From 90e458dac28dc98d60ab00b35ddcfd09fb46811a Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 23 Jul 2013 19:23:02 +0000 Subject: replace sprintf to mir_snprintf (part 3) git-svn-id: http://svn.miranda-ng.org/main/trunk@5461 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/globals.cpp | 6 +++--- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/modplus.cpp | 4 ++-- plugins/TabSRMM/src/msglog.cpp | 18 +++++++++--------- plugins/TabSRMM/src/msgoptions.cpp | 2 +- plugins/TabSRMM/src/msgs.cpp | 2 +- plugins/TabSRMM/src/selectcontainer.cpp | 2 +- plugins/TabSRMM/src/themes.cpp | 4 ++-- plugins/TabSRMM/src/utils.cpp | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 160c3104d0..aefc6f1bef 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -789,13 +789,13 @@ INT_PTR CALLBACK CGlobals::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case WM_INITDIALOG: { char szBuffer[2048]; #ifdef _WIN64 - sprintf(szBuffer, + mir_snprintf(szBuffer, SIZEOF(szBuffer), "Exception %16.16X at address %16.16X occured in %s at line %d.\r\n\r\nEAX=%16.16X EBX=%16.16X ECX=%16.16X\r\nEDX=%16.16X ESI=%16.16X EDI=%16.16X\r\nEBP=%16.16X ESP=%16.16X EIP=%16.16X", m_exRecord.ExceptionCode, m_exRecord.ExceptionAddress, m_exSzFile, m_exLine, m_exCtx.Rax,m_exCtx.Rbx, m_exCtx.Rcx, m_exCtx.Rdx, m_exCtx.Rsi, m_exCtx.Rdi, m_exCtx.Rbp, m_exCtx.Rsp, m_exCtx.Rip); #else - sprintf(szBuffer, + mir_snprintf(szBuffer, SIZEOF(szBuffer), "Exception %8.8X at address %8.8X occured in %s at line %d.\r\n\r\nEAX=%8.8X EBX=%8.8X ECX=%8.8X\r\nEDX=%8.8X ESI=%8.8X EDI=%8.8X\r\nEBP=%8.8X ESP=%8.8X EIP=%8.8X", m_exRecord.ExceptionCode, m_exRecord.ExceptionAddress, m_exSzFile, m_exLine, m_exCtx.Eax,m_exCtx.Ebx, m_exCtx.Ecx, m_exCtx.Edx, @@ -840,7 +840,7 @@ int CGlobals::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line memcpy(&m_exRecord, ep->ExceptionRecord, sizeof(EXCEPTION_RECORD)); memcpy(&m_exCtx, ep->ContextRecord, sizeof(CONTEXT)); - _snprintf(m_exSzFile, MAX_PATH, "%s%s", szName, szExt); + mir_snprintf(m_exSzFile, MAX_PATH, "%s%s", szName, szExt); mir_sntprintf(m_exReason, 256, L"An application error has occured: %s", szReason); m_exLine = line; m_exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, CGlobals::Ex_DlgProc, 0); diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index b401080e22..177eae7ba1 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -470,7 +470,7 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) if (lParam) { TCHAR szTip[256]; - _sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message."), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR)); + mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message."), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR)); if (fShowOnClist && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) { MIRANDASYSTRAYNOTIFY tn; tn.szProto = NULL; diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index ef2ba6b72d..3165d1bb53 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -164,7 +164,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) pszFormatedText = (TCHAR *)mir_alloc(6*sizeof(TCHAR)); ZeroMemory(pszFormatedText,6*sizeof(TCHAR)); - _sntprintf(pszFormatedText,6*sizeof(TCHAR),_T("%s"),_T("[img]")); + mir_sntprintf(pszFormatedText,6*sizeof(TCHAR),_T("%s"),_T("[img]")); bbd.ptszTooltip = TranslateT("Insert [img] tag / surround selected text with [img][/img]"); CallService(MS_BB_SETBUTTONSTATE, wParam, (LPARAM)&bbd); @@ -175,7 +175,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) pszFormatedText = (TCHAR *)mir_alloc(7*sizeof(TCHAR)); ZeroMemory(pszFormatedText,7*sizeof(TCHAR)); - _sntprintf(pszFormatedText,7*sizeof(TCHAR),_T("%s"),_T("[/img]")); + mir_sntprintf(pszFormatedText,7*sizeof(TCHAR),_T("%s"),_T("[/img]")); bbd.ptszTooltip = TranslateT("Insert [img] tag / surround selected text with [img][/img]"); CallService(MS_BB_SETBUTTONSTATE, wParam, (LPARAM)&bbd); diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 119f632355..7f5427354b 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -137,9 +137,9 @@ void TSAPI CacheLogFonts() ZeroMemory((void*)logfonts, sizeof(LOGFONTA) * MSGDLGFONTCOUNT + 2); for (i=0; i < MSGDLGFONTCOUNT; i++) { LoadLogfont(i, &logfonts[i], &fontcolors[i], FONTMODULE); - wsprintfA(rtfFontsGlobal[i], "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic,logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY); + mir_snprintf(rtfFontsGlobal[i], SIZEOF(rtfFontsGlobal[i]), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic,logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY); } - wsprintfA(rtfFontsGlobal[MSGDLGFONTCOUNT], "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0); + mir_snprintf(rtfFontsGlobal[MSGDLGFONTCOUNT], SIZEOF(rtfFontsGlobal[MSGDLGFONTCOUNT]), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0); _tcsncpy(szToday, TranslateT("Today"), 20); _tcsncpy(szYesterday, TranslateT("Yesterday"), 20); @@ -284,7 +284,7 @@ static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferA } else { char szTemp[10]; int colindex = GetColorIndex(GetRTFFont(LOWORD(mode) ? (MSGFONTID_MYMSG + (HIWORD(mode) ? 8 : 0)) : (MSGFONTID_YOURMSG + (HIWORD(mode) ? 8 : 0)))); - _snprintf(szTemp, 4, "%02d", colindex); + mir_snprintf(szTemp, 4, "%02d", colindex); d[3] = szTemp[0]; d[4] = szTemp[1]; d[5] = ' '; @@ -312,7 +312,7 @@ static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferA } else if (*line < 128) { *d++ = (char) * line; } else - d += sprintf(d, "\\u%d ?", *line); + d += sprintf(d, "\\u%d ?", *line); //!!!!!!!!!!!!! } strcpy(d, "}"); @@ -381,7 +381,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int } else { char szTemp[10]; int colindex = GetColorIndex(GetRTFFont(LOWORD(mode) ? (MSGFONTID_MYMSG + (HIWORD(mode) ? 8 : 0)) : (MSGFONTID_YOURMSG + (HIWORD(mode) ? 8 : 0)))); - _snprintf(szTemp, 4, "%02d", colindex); + mir_snprintf(szTemp, 4, "%02d", colindex); (*buffer)[i + 3] = szTemp[0]; (*buffer)[i + 4] = szTemp[1]; } @@ -476,7 +476,7 @@ static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced, // custom template colors... for (i = 1; i <= 5; i++) { - _snprintf(szTemp, 10, "cc%d", i); + mir_snprintf(szTemp, 10, "cc%d", i); colour = theme->custom_colors[i - 1]; if (colour == 0) colour = RGB(1, 1, 1); @@ -1018,9 +1018,9 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont if ( *szDescr != 0 ) { TCHAR* tszDescr = DbGetEventStringT( &dbei, szDescr ); TCHAR buf[1000]; - mir_sntprintf( buf, SIZEOF(buf), _T("%s (%s)"), tszFileName, tszDescr ); + mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), tszFileName, tszDescr); AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, buf, 0 ); - mir_free( tszDescr ); + mir_free(tszDescr); } else { AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszFileName, 0 ); @@ -1532,7 +1532,7 @@ static void ReplaceIcons(HWND hwndDlg, struct TWindowData *dat, LONG startAt, in char szPattern[50]; FINDTEXTEXA fi; - _snprintf(szPattern, 40, "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]); + mir_snprintf(szPattern, 40, "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]); fi.lpstrText = szPattern; fi.chrg.cpMin = 0; fi.chrg.cpMax = -1; diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 1ce7e66d1f..ae84126625 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -86,7 +86,7 @@ void TSAPI LoadLogfont(int i, LOGFONTA * lf, COLORREF * colour, char *szModule) lf->lfClipPrecision = lfResult.lfClipPrecision; lf->lfQuality = lfResult.lfQuality; lf->lfPitchAndFamily = lfResult.lfPitchAndFamily; - wsprintfA(lf->lfFaceName, "%S", lfResult.lfFaceName); + mir_snprintf(lf->lfFaceName, SIZEOF(lf->lfFaceName), "%S", lfResult.lfFaceName); } } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 60c932de1c..d3c1613a3e 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -701,7 +701,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, i 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/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index 884dea27e8..49bf0971f5 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -183,7 +183,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L char szValue[10]; TContainerData *pContainer = 0; do { - _snprintf(szValue, 8, "%d", iCounter); + mir_snprintf(szValue, 8, "%d", iCounter); if (db_get_ts(NULL, szKey, szValue, &dbv)) break; // end of list if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) { diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index e628e00525..8cef2ee767 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1269,12 +1269,12 @@ void CSkin::ReadItem(const int id, const TCHAR *szItem) this_item->ALPHA = min(this_item->ALPHA, 100); clr = RGB(GetBValue(defaults->COLOR), GetGValue(defaults->COLOR), GetRValue(defaults->COLOR)); - _sntprintf(def_color, 15, _T("%6.6x"), clr); + mir_sntprintf(def_color, 15, _T("%6.6x"), clr); GetPrivateProfileString(szItem, _T("Color1"), def_color, buffer, 400, m_tszFileName); this_item->COLOR = HexStringToLong(buffer); clr = RGB(GetBValue(defaults->COLOR2), GetGValue(defaults->COLOR2), GetRValue(defaults->COLOR2)); - _sntprintf(def_color, 15, _T("%6.6x"), clr); + mir_sntprintf(def_color, 15, _T("%6.6x"), clr); GetPrivateProfileString(szItem, _T("Color2"), def_color, buffer, 400, m_tszFileName); this_item->COLOR2 = HexStringToLong(buffer); diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 07aafdf478..3a9884dd52 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -205,13 +205,13 @@ search_again: } message.erase(beginmark, (closing - beginmark)); message.insert(beginmark, _T("cxxx ")); - _sntprintf(szTemp, 4, _T("%02d"), MSGDLGFONTCOUNT + 13 + ii); + mir_sntprintf(szTemp, 4, _T("%02d"), MSGDLGFONTCOUNT + 13 + ii); message[beginmark + 3] = szTemp[0]; message[beginmark + 4] = szTemp[1]; clr_found = true; if (was_added) { TCHAR wszTemp[100]; - _sntprintf(wszTemp, 100, _T("##col##%06u:%04u"), endmark - closing, ii); + mir_sntprintf(wszTemp, 100, _T("##col##%06u:%04u"), endmark - closing, ii); wszTemp[99] = 0; message.insert(beginmark, wszTemp); } @@ -790,7 +790,7 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED); if (pContainer->settings->fPrivate) { - _snprintf(szCName, 40, "%s%d_Blob", szSetting, pContainer->iContainerIndex); + mir_snprintf(szCName, 40, "%s%d_Blob", szSetting, pContainer->iContainerIndex); WriteContainerSettingsToDB(0, pContainer->settings, szCName); } mir_snprintf(szCName, 40, "%s%d_theme", szSetting, pContainer->iContainerIndex); -- cgit v1.2.3