From 01de930753fd7a5d47c0350a4361949d770b93cf Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 22 Jul 2013 13:38:03 +0000 Subject: replace sprintf to mir_snprintf (part 1) git-svn-id: http://svn.miranda-ng.org/main/trunk@5446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/clist.cpp | 2 +- plugins/TabSRMM/src/chat/log.cpp | 10 +++++----- plugins/TabSRMM/src/chat/options.cpp | 10 +++++----- plugins/TabSRMM/src/chat/services.cpp | 2 +- plugins/TabSRMM/src/chat/tools.cpp | 2 +- plugins/TabSRMM/src/chat/window.cpp | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'plugins/TabSRMM/src/chat') diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index 2c0db1e44c..363e815947 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -267,7 +267,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, const T return FALSE; va_start(marker, fmt); - _vstprintf(szBuf, fmt, marker); + mir_vsntprintf(szBuf, _tcslen(szBuf), fmt, marker); va_end(marker); cle.cbSize = sizeof(cle); diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 551bacb1ca..6b02b68d5d 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -522,7 +522,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff char* d; va_start(va, fmt); - lineLen = _vsntprintf(line, 8000, fmt, va); + lineLen = mir_vsntprintf(line, 8000, fmt, va); if (lineLen < 0) lineLen = 8000; line[lineLen] = 0; va_end(va); @@ -621,7 +621,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff } else if (*line > 0 && *line < 128) { *d++ = (char) * line; } - else d += sprintf(d, "\\u%u ?", (WORD) * line); + else d += mir_snprintf(d, strlen(d), "\\u%u ?", (WORD) * line); } *cbBufferEnd = (int)(d - *buffer); @@ -1284,7 +1284,7 @@ void LoadMsgLogBitmaps(void) for (i=0; i < SIZEOF(pLogIconBmpBits); i++) { hIcon = hIcons[i]; pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2); - rtfHeaderSize = sprintf((char *)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight); + rtfHeaderSize = mir_snprintf((char *)pLogIconBmpBits[i], strlen((char *)pLogIconBmpBits[i]), "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight); hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp); FillRect(hdcMem, &rc, hBkgBrush); DrawIconEx(hdcMem, 0, 1, hIcon, iIconSize, iIconSize, 0, NULL, DI_NORMAL); @@ -1294,9 +1294,9 @@ void LoadMsgLogBitmaps(void) { int n; for (n = 0; n < sizeof(BITMAPINFOHEADER); n++) - sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]); + sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]); //!!!!!!!!!!! for (n = 0; n < widthBytes * bih.biHeight; n += 4) - sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]); + sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]); //!!!!!!!!!!!!! } logIconBmpSize[i] = rtfHeaderSize + (bih.biSize + widthBytes * bih.biHeight) * 2 + 1; pLogIconBmpBits[i][logIconBmpSize[i] - 1] = '}'; diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index e905eef4a0..6ab2614586 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -230,16 +230,16 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM } if (colour) { - wsprintfA(str, "Font%dCol", i); + mir_snprintf(str, SIZEOF(str), "Font%dCol", i); *colour = M.GetDword(szMod, str, fol[j].defColour); } if (lf) { - wsprintfA(str, "Font%dSize", i); + mir_snprintf(str, SIZEOF(str), "Font%dSize", i); lf->lfHeight = (char) M.GetByte(szMod, str, fol[j].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; - wsprintfA(str, "Font%dSty", i); + mir_snprintf(str, SIZEOF(str), "Font%dSty", i); style = M.GetByte(szMod, str, fol[j].defStyle); if (i == MSGFONTID_MESSAGEAREA && section == FONTSECTION_IM && M.GetByte("inputFontFix", 1) == 1) { lf->lfWeight = FW_NORMAL; @@ -253,13 +253,13 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0; lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0; } - wsprintfA(str, "Font%dSet", i); + mir_snprintf(str, SIZEOF(str), "Font%dSet", i); lf->lfCharSet = M.GetByte(szMod, str, fol[j].defCharset); lf->lfOutPrecision = OUT_DEFAULT_PRECIS; lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - wsprintfA(str, "Font%d", i); + mir_snprintf(str, SIZEOF(str), "Font%d", i); if ((i == 17 && !strcmp(szMod, CHAT_FONTMODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) { lf->lfCharSet = SYMBOL_CHARSET; lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName)); diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 231f466da9..a29ad7e27a 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -417,7 +417,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT if ((pContainer = FindMatchingContainer(_T("default"), hContact)) == NULL) { TCHAR szName[CONTAINER_NAMELEN + 1]; - _sntprintf(szName, CONTAINER_NAMELEN, _T("default")); + mir_sntprintf(szName, CONTAINER_NAMELEN, _T("default")); pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact); } } diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index dcb335c157..22aaf0611f 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -198,7 +198,7 @@ static int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszP return 0; va_start(marker, fmt); - _vstprintf(szBuf, fmt, marker); + mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker); va_end(marker); pd.lchContact = hContact; diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 32e796d74e..5e47773b02 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2979,7 +2979,7 @@ LABEL_SHOWWINDOW: } else /* in the beginning of the message window */ - _stprintf(tszAppeal, tszAplTmpl, tr.lpstrText); + mir_sntprintf(tszAppeal, SIZEOF(tszAppeal), tszAplTmpl, tr.lpstrText); st = lstrlen(tszAppeal); if (chr.cpMax != -1) { tr2.chrg.cpMin = chr.cpMax; @@ -3444,7 +3444,7 @@ LABEL_SHOWWINDOW: DBVARIANT dbv = {0}; char szIndex[10]; char *szKey = "TAB_ContainersW"; - _snprintf(szIndex, 8, "%d", iSelection - IDM_CONTAINERMENU); + mir_snprintf(szIndex, SIZEOF(szIndex), "%d", iSelection - IDM_CONTAINERMENU); if (iSelection - IDM_CONTAINERMENU >= 0) { if (!db_get_ts(NULL, szKey, szIndex, &dbv)) { SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal); -- cgit v1.2.3