From 664200e644b45e52c70affa1c036d7366474ae9d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 19 Aug 2013 19:04:33 +0000 Subject: core *printf patch git-svn-id: http://svn.miranda-ng.org/main/trunk@5750 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdchat/src/clist.cpp | 2 +- src/core/stdchat/src/log.cpp | 13 +++++++------ src/core/stdchat/src/main.cpp | 2 +- src/core/stdchat/src/options.cpp | 12 ++++++------ src/core/stdchat/src/tools.cpp | 2 +- src/core/stdchat/src/window.cpp | 8 ++++---- src/core/stdclist/src/clcfonts.cpp | 2 +- src/core/stdclist/src/cluiopts.cpp | 4 ++-- src/core/stdfile/filexferdlg.cpp | 5 +++-- src/core/stdmsg/src/msglog.cpp | 17 +++++++++-------- src/core/stdmsg/src/msgs.cpp | 2 +- src/mir_core/json/JSONOptions.h | 2 -- src/mir_core/json/NumberToString.h | 4 ++-- src/modules/netlib/netliblog.cpp | 6 +++--- src/modules/utils/openurl.cpp | 9 +++++---- src/modules/xml/xmlParser.cpp | 2 +- 16 files changed, 47 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index a4fac02a9d..8ddc8c40d8 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -259,7 +259,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR return FALSE; va_start(marker, fmt); - _vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker); + mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker); va_end(marker); cle.cbSize = sizeof(cle); diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 85b52d5262..0a465fa7dd 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -114,7 +114,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); @@ -216,7 +216,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 += sprintf(d, "\\u%u ?", (WORD)*line); //!!!!!!!!!!! } *cbBufferEnd = (int) (d - *buffer); @@ -681,8 +681,9 @@ void LoadMsgLogBitmaps(void) pBmpBits = (PBYTE) mir_alloc(widthBytes * bih.biHeight); 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); + size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2; + pLogIconBmpBits[i] = (PBYTE) mir_alloc(size); + rtfHeaderSize = mir_snprintf((char *)pLogIconBmpBits[i], size, "{\\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, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL); @@ -691,9 +692,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/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index b2985d4098..edb254145a 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -258,7 +258,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg) { WCHAR szwName[64]; char szName[64]; - wsprintfA(szName, "s%u", nextStgId++); + mir_snprintf(szName, SIZEOF(szName), "s%u", nextStgId++); MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, SIZEOF(szwName)); if (pictStg == NULL) return STG_E_MEDIUMFULL; diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index b49684e9a5..96dc9f1cf3 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -326,28 +326,28 @@ void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour) DBVARIANT dbv; if (colour) { - wsprintfA(str, "Font%dCol", i); + mir_snprintf(str, SIZEOF(str), "Font%dCol", i); *colour = db_get_dw(NULL, "ChatFonts", str, fontOptionsList[i].defColour); } if (lf) { - wsprintfA(str, "Font%dSize", i); + mir_snprintf(str, SIZEOF(str), "Font%dSize", i); lf->lfHeight = (char) db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; - wsprintfA(str, "Font%dSty", i); + mir_snprintf(str, SIZEOF(str), "Font%dSty", i); style = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defStyle); lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & FONTF_ITALIC ? 1 : 0; lf->lfUnderline = 0; lf->lfStrikeOut = 0; - wsprintfA(str, "Font%dSet", i); + mir_snprintf(str, SIZEOF(str), "Font%dSet", i); lf->lfCharSet = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].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 (db_get_ts(NULL, "ChatFonts", str, &dbv)) lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); else { @@ -368,7 +368,7 @@ void RegisterFonts( void ) strncpy(fontid.dbSettingsGroup, "ChatFonts", sizeof(fontid.dbSettingsGroup)); _tcsncpy(fontid.group, _T("Chat Module"), SIZEOF(fontid.group)); _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); - sprintf(idstr, "Font%d", index); + mir_snprintf(idstr, SIZEOF(idstr), "Font%d", index); strncpy(fontid.prefix, idstr, sizeof(fontid.prefix)); fontid.order = index; diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index b72ee32fac..ce06d7e015 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -133,7 +133,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* psz return 0; va_start(marker, fmt); - _vsntprintf(szBuf, 4096, fmt, marker); + mir_vsntprintf(szBuf, 4096, fmt, marker); va_end(marker); pd.lchContact = hContact; diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index c56f80b6c7..3308ceb167 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1111,13 +1111,13 @@ static int RestoreWindowPosition(HWND hwnd, HANDLE hContact, char * szModule, ch wp.length=sizeof(wp); GetWindowPlacement(hwnd,&wp); - wsprintfA(szSettingName,"%sx",szNamePrefix); + mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix); x=db_get_dw(hContact,szModule,szSettingName,-1); - wsprintfA(szSettingName,"%sy",szNamePrefix); + mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix); y=(int)db_get_dw(hContact,szModule,szSettingName,-1); - wsprintfA(szSettingName,"%swidth",szNamePrefix); + mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix); width=db_get_dw(hContact,szModule,szSettingName,-1); - wsprintfA(szSettingName,"%sheight",szNamePrefix); + mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", szNamePrefix); height=db_get_dw(hContact,szModule,szSettingName,-1); if (x==-1) diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index 1996b7b895..dcb4e658cf 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -97,7 +97,7 @@ void RegisterCListFonts() strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); _tcsncpy(fontid.group, _T("Contact List"), SIZEOF(fontid.group)); _tcsncpy(fontid.name, szClistFontIdDescr[fontListOrder[i]], SIZEOF(fontid.name)); - sprintf(idstr, "Font%d", fontListOrder[i]); + mir_snprintf(idstr, SIZEOF(idstr), "Font%d", fontListOrder[i]); strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); fontid.order = fontListOrder[i]; diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index d3e248056e..efd9c9fb92 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -148,9 +148,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_HSCROLL: { char str[10]; - wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255); + mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255); SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str); - wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255); + mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255); SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str); } if (wParam != 0x12345678) diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index 593008551e..bb69fdd495 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -493,9 +493,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; if ((pszExtension = _tcsrchr(pszFilename+1, '.')) == NULL) pszExtension = pszFilename+lstrlen(pszFilename); if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename); - pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*((pszExtension-szOriginalFilename)+21+lstrlen(pszExtension))); + size_t size = (pszExtension-szOriginalFilename)+21+lstrlen(pszExtension); + pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); for (i = 1;;i++) { - _stprintf((TCHAR*)pfr->szFilename, _T("%.*s (%u)%s"), pszExtension-szOriginalFilename, szOriginalFilename, i, pszExtension); + mir_sntprintf((TCHAR*)pfr->szFilename, size, _T("%.*s (%u)%s"), pszExtension-szOriginalFilename, szOriginalFilename, i, pszExtension); if (_taccess(pfr->szFilename, 0) != 0) break; } diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index f2c82f8a9f..53f1ef7582 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -143,7 +143,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA { *tag = 0; *tage = 0; - d += sprintf(d, "{\\field{\\*\\fldinst HYPERLINK \"%s\"}{\\fldrslt %s}}", mir_t2a(tagu), mir_t2a(tag + 1)); + d += sprintf(d, "{\\field{\\*\\fldinst HYPERLINK \"%s\"}{\\fldrslt %s}}", mir_t2a(tagu), mir_t2a(tag + 1)); //!!!!!!!!!! line = tage + 5; found = 1; } @@ -167,11 +167,11 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA if (!found) { if (*line < 128) *d++ = (char) *line; - else d += sprintf(d, "\\u%d ?", *line); + else d += sprintf(d, "\\u%d ?", *line); //!!!!!!!!!! } } else if (*line < 128) *d++ = (char) *line; - else d += sprintf(d, "\\u%d ?", *line); + else d += sprintf(d, "\\u%d ?", *line); //!!!!!!!!!! } *(d++) = '}'; @@ -239,7 +239,7 @@ static char *SetToStyle(int style) LOGFONT lf; LoadMsgDlgFont(style, &lf, NULL); - wsprintfA(szStyle, "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); + mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); return szStyle; } @@ -606,9 +606,10 @@ void LoadMsgLogIcons(void) for (i = 0; i < SIZEOF(pLogIconBmpBits); i++) { hIcon = Skin_GetIconByHandle(iconList[i].hIcolib); - pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2); + size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2; + pLogIconBmpBits[i] = (PBYTE) mir_alloc(size); //I can't seem to get binary mode working. No matter. - 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], size, "{\\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, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL); @@ -619,9 +620,9 @@ void LoadMsgLogIcons(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/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 016dcdc765..b8c1298ad8 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -516,7 +516,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg) { WCHAR szwName[64]; char szName[64]; - wsprintfA(szName, "s%u", nextStgId++); + mir_snprintf(szName, SIZEOF(szName), "s%u", nextStgId++); MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, SIZEOF(szwName)); if (pictStg == NULL) return STG_E_MEDIUMFULL; diff --git a/src/mir_core/json/JSONOptions.h b/src/mir_core/json/JSONOptions.h index 29d588113a..d4bd343677 100644 --- a/src/mir_core/json/JSONOptions.h +++ b/src/mir_core/json/JSONOptions.h @@ -1,8 +1,6 @@ #ifndef JSON_OPTIONS_H #define JSON_OPTIONS_H -#define snprintf _snprintf - /** * This file holds all of the compiling options for easy access and so * that you don't have to remember them, or look them up all the time diff --git a/src/mir_core/json/NumberToString.h b/src/mir_core/json/NumberToString.h index a260f1cb5c..a706372f92 100644 --- a/src/mir_core/json/NumberToString.h +++ b/src/mir_core/json/NumberToString.h @@ -78,9 +78,9 @@ public: static json_string _ftoa(T value){ json_char result[64]; #ifdef JSON_UNICODE - swprintf(result, 63, L"%f", value); + mir_snwprintf(result, 63, L"%f", value); #else - snprintf(result, 63, "%f", value); + mir_snprintf(result, 63, "%f", value); #endif //strip the trailing zeros for(json_char * pos = &result[0]; *pos; ++pos){ diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 4f0aecff29..857f5c75d0 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -491,13 +491,13 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla PBYTE p = buf + line; pszBuf += wsprintfA( pszBuf, "%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ", - line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); + line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); //!!!!!!!!!! } else { - pszBuf += wsprintfA(pszBuf, "%08X: ", line); + pszBuf += wsprintfA(pszBuf, "%08X: ", line); //!!!!!!!!!! // Dump data as hex for (col = 0; col < colsInLine; col++) - pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col&3) == 3 && col != 15)?'-':' '); + pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col&3) == 3 && col != 15)?'-':' '); //!!!!!!!!!! // Fill out last line with blanks for (; col<16; col++) { lstrcpyA(pszBuf, " "); diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 70590c8ebf..b451421441 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -37,9 +37,10 @@ static void OpenURLThread(void *arg) return; //wack a protocol on it - TCHAR *szResult = (TCHAR*)mir_alloc(sizeof(TCHAR)*(lstrlen(hUrlInfo->szUrl)+9)); + size_t size = lstrlen(hUrlInfo->szUrl)+9; + TCHAR *szResult = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\') { - wsprintf(szResult, _T("file:///%s"), hUrlInfo->szUrl); + mir_sntprintf(szResult, size, _T("file:///%s"), hUrlInfo->szUrl); } else { int i; @@ -48,9 +49,9 @@ static void OpenURLThread(void *arg) szResult = mir_tstrdup(hUrlInfo->szUrl); else { if ( !_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4)) - wsprintf(szResult, _T("ftp://%s"), hUrlInfo->szUrl); + mir_sntprintf(szResult, size, _T("ftp://%s"), hUrlInfo->szUrl); else - wsprintf(szResult, _T("http://%s"), hUrlInfo->szUrl); + mir_sntprintf(szResult, size, _T("http://%s"), hUrlInfo->szUrl); } } diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index af3f7d92e1..7407fa908c 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -402,7 +402,7 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) // create message char message[2000], *s1 = (char*)"", *s3 = (char*)""; XMLCSTR s2 = _CXML(""); if (pResults.error == eXMLErrorFirstTagNotFound) { s1 = (char*)"First Tag should be '"; s2 = tag; s3 = (char*)"'.\n"; } - sprintf(message, + mir_snprintf(message, SIZEOF(message), #ifdef _XMLWIDECHAR "XML Parsing error inside file '%S'.\n%S\nAt line %i, column %i.\n%s%S%s" #else -- cgit v1.2.3