diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-23 19:23:02 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-23 19:23:02 +0000 |
commit | 90e458dac28dc98d60ab00b35ddcfd09fb46811a (patch) | |
tree | dc598dd8f32d8ecf14989d54d325ae11502bb8d8 | |
parent | 3b05e84e27e50e8b44cb86cbc0a8eb1b639d7223 (diff) |
replace sprintf to mir_snprintf (part 3)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5461 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
26 files changed, 134 insertions, 134 deletions
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 2bfe65a20a..b8faea47a1 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -190,38 +190,38 @@ void LoadAlarms() { for(int i = 0; i < num_alarms; i++) {
memset(&alarm, 0, sizeof(ALARM));
- sprintf(buff, "Title%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Title%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szTitle = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
- sprintf(buff, "Desc%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Desc%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szDesc = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
- sprintf(buff, "Occ%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Occ%d", i);
alarm.occurrence = (Occurrence)db_get_w(0, MODULE, buff, 0);
- sprintf(buff, "STHour%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STHour%d", i);
alarm.time.wHour = db_get_w(0, MODULE, buff, 0);
- sprintf(buff, "STMinute%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STMinute%d", i);
alarm.time.wMinute = db_get_w(0, MODULE, buff, 0);
- sprintf(buff, "STSecond%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STSecond%d", i);
alarm.time.wSecond = db_get_w(0, MODULE, buff, 0);
switch(alarm.occurrence) {
case OC_ONCE:
- sprintf(buff, "STYear%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STYear%d", i);
alarm.time.wYear = db_get_w(0, MODULE, buff, 0);
- sprintf(buff, "STMonth%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STMonth%d", i);
alarm.time.wMonth = db_get_w(0, MODULE, buff, 0);
- sprintf(buff, "STDay%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STDay%d", i);
alarm.time.wDay = db_get_w(0, MODULE, buff, 0);
break;
case OC_WEEKLY:
- sprintf(buff, "STDayOfWeek%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STDayOfWeek%d", i);
alarm.time.wDayOfWeek = db_get_w(0, MODULE, buff, 0);
break;
case OC_WEEKDAYS:
@@ -229,26 +229,26 @@ void LoadAlarms() { case OC_DAILY:
break;
case OC_MONTHLY:
- sprintf(buff, "STDay%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STDay%d", i);
alarm.time.wDay = db_get_w(0, MODULE, buff, 0);
break;
case OC_YEARLY:
- sprintf(buff, "STMonth%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STMonth%d", i);
alarm.time.wMonth = db_get_w(0, MODULE, buff, 0);
- sprintf(buff, "STDay%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "STDay%d", i);
alarm.time.wDay = db_get_w(0, MODULE, buff, 0);
break;
}
if (UpdateAlarm(alarm.time, alarm.occurrence)) {
- sprintf(buff, "ActionFlags%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "ActionFlags%d", i);
alarm.action = (unsigned short)db_get_dw(0, MODULE, buff, AAF_POPUP | AAF_SOUND);
if (alarm.action & AAF_COMMAND) {
- sprintf(buff, "ActionCommand%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "ActionCommand%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szCommand = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
- sprintf(buff, "ActionParams%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "ActionParams%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
alarm.szCommandParams = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
@@ -256,22 +256,22 @@ void LoadAlarms() { }
}
- sprintf(buff, "SoundNum%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "SoundNum%d", i);
alarm.sound_num = (int)db_get_b(0, MODULE, buff, 1);
- sprintf(buff, "Snoozer%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Snoozer%d", i);
alarm.snoozer = db_get_b(0, MODULE, buff, 0) == 1;
- sprintf(buff, "Hidden%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Hidden%d", i);
alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_HIDDEN : 0);
- sprintf(buff, "Suspended%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Suspended%d", i);
alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_SUSPENDED : 0);
- sprintf(buff, "NoStartup%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "NoStartup%d", i);
alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_NOSTARTUP : 0);
- sprintf(buff, "Flags%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "Flags%d", i);
alarm.flags = db_get_dw(0, MODULE, buff, alarm.flags);
alarm.id = next_alarm_id++;
@@ -290,18 +290,18 @@ void SaveAlarms() { ALARM *i;
for(alarms.reset(); i = alarms.current(); alarms.next(), index++) {
- sprintf(buff, "Title%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "Title%d", index);
db_set_ts(0, MODULE, buff, i->szTitle);
- sprintf(buff, "Desc%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "Desc%d", index);
db_set_ts(0, MODULE, buff, i->szDesc);
- sprintf(buff, "Occ%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "Occ%d", index);
db_set_w(0, MODULE, buff, i->occurrence);
- sprintf(buff, "STHour%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STHour%d", index);
db_set_w(0, MODULE, buff, i->time.wHour);
- sprintf(buff, "STMinute%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STMinute%d", index);
db_set_w(0, MODULE, buff, i->time.wMinute);
- sprintf(buff, "STSecond%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STSecond%d", index);
db_set_w(0, MODULE, buff, i->time.wSecond);
switch(i->occurrence) {
@@ -310,41 +310,41 @@ void SaveAlarms() { case OC_WEEKDAYS:
break;
case OC_WEEKLY:
- sprintf(buff, "STDayOfWeek%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STDayOfWeek%d", index);
db_set_w(0, MODULE, buff, i->time.wDayOfWeek);
break;
case OC_ONCE:
- sprintf(buff, "STYear%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STYear%d", index);
db_set_w(0, MODULE, buff, i->time.wYear);
case OC_YEARLY:
- sprintf(buff, "STMonth%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STMonth%d", index);
db_set_w(0, MODULE, buff, i->time.wMonth);
case OC_MONTHLY:
- sprintf(buff, "STDay%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "STDay%d", index);
db_set_w(0, MODULE, buff, i->time.wDay);
break;
}
- sprintf(buff, "ActionFlags%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "ActionFlags%d", index);
db_set_dw(0, MODULE, buff, i->action);
if (i->action & AAF_COMMAND) {
if (_tcslen(i->szCommand)) {
- sprintf(buff, "ActionCommand%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "ActionCommand%d", index);
db_set_ts(0, MODULE, buff, i->szCommand);
if (_tcslen(i->szCommandParams)) {
- sprintf(buff, "ActionParams%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "ActionParams%d", index);
db_set_ts(0, MODULE, buff, i->szCommandParams);
}
}
}
- sprintf(buff, "SoundNum%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "SoundNum%d", index);
db_set_b(0, MODULE, buff, i->sound_num);
- sprintf(buff, "Snoozer%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "Snoozer%d", index);
db_set_b(0, MODULE, buff, i->snoozer ? 1 : 0);
- sprintf(buff, "Flags%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "Flags%d", index);
db_set_dw(0, MODULE, buff, i->flags);
}
db_set_w(0, MODULE, "Count", index);
@@ -536,7 +536,7 @@ void DoAlarm(ALARM *alarm) if (alarm->action & AAF_SOUND) {
if (alarm->sound_num > 0 && alarm->sound_num <= 3) {
char buff[128];
- sprintf(buff, "Triggered%d", alarm->sound_num);
+ mir_snprintf(buff, SIZEOF(buff), "Triggered%d", alarm->sound_num);
SkinPlaySound(buff);
} else if (alarm->sound_num == 4) {
if (alarm->szTitle != NULL && alarm->szTitle[0] != '\0') {
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 8866f1f071..92184f0c75 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -146,7 +146,7 @@ void RegisterCLUIFonts( void ) _tcsncpy(fontid.group, fontOptionsList[i].szGroup, SIZEOF(fontid.group));
_tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
- sprintf(idstr, "Font%d", fontOptionsList[i].fontID);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%d", fontOptionsList[i].fontID);
strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
fontid.order = i+1;
@@ -160,7 +160,7 @@ void RegisterCLUIFonts( void ) _tcsncpy(effectid.group, fontOptionsList[i].szGroup, SIZEOF(effectid.group));
_tcsncpy(effectid.name, fontOptionsList[i].szDescr, SIZEOF(effectid.name));
- sprintf(idstr, "Font%d", fontOptionsList[i].fontID);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%d", fontOptionsList[i].fontID);
strncpy(effectid.setting, idstr, SIZEOF(effectid.setting));
effectid.order = i + 1;
@@ -1220,7 +1220,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING, 0, (LPARAM)MIRANDANAME);
char szUin[20];
- sprintf(szUin,"%u",db_get_dw(NULL,"ICQ","UIN",0));
+ mir_snprintf(szUin, SIZEOF(szUin), "%u", db_get_dw(NULL, "ICQ", "UIN", 0));
SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING, 0, (LPARAM)szUin);
if ( !db_get_s(NULL,"ICQ","Nick",&dbv)) {
@@ -1326,9 +1326,9 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP case WM_HSCROLL:
{ char str[10];
- sprintf(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);
- sprintf(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) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
@@ -1937,9 +1937,9 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar case WM_HSCROLL:
{
char str[10];
- sprintf(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);
- sprintf(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)
if ( !bInit) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 32823204d1..7376a2a363 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1712,7 +1712,7 @@ LRESULT CLUI::PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bH char szFilePath[MAX_PATH], szProfile[MAX_PATH];
CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)&szFilePath );
CallService(MS_DB_GETPROFILENAME,MAX_PATH,(LPARAM)&szProfile );
- _snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile );
+ mir_snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile );
UnmapViewOfFile( hView );
rc = 1;
}
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index e287b491b0..23a53c5ae8 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -2309,10 +2309,10 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (pos != -1) {
int oldflags;
- wsprintfA(TBcapt,"%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
- Frames[pos].name,Frames[pos].height,Frames[pos].visible,Frames[pos].floating,
- Frames[pos].FloatingPos.x,Frames[pos].FloatingPos.y,
- Frames[pos].FloatingSize.x,Frames[pos].FloatingSize.y,
+ mir_snprintf(TBcapt, SIZEOF(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
+ Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating,
+ Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y,
+ Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y,
Frames[pos].order);
oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,Frames[pos].id),0);
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index edaf193de0..1a572f808e 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -2725,7 +2725,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (pos != -1) {
int oldflags;
- wsprintfA(TBcapt, "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
+ mir_snprintf(TBcapt, SIZEOF(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating,
Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y,
Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y,
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 95ef2c10ef..580aa254f8 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -107,7 +107,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) tmi.ownerdata=mmep;
char buf[1024];
- sprintf(buf,"%s/%s",mi->pszService,mi->pszName);
+ mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName);
OptParam op;
op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi);
@@ -482,7 +482,7 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) tmi.ownerdata = mmep;
char buf[1024];
- sprintf(buf,"%s/%s",mi->pszService,mi->pszName);
+ mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName);
OptParam op;
op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi);
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index a313c90e1d..ee76cbb8a7 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -284,7 +284,7 @@ struct CListEvent* AddEvent(CLISTEVENT *cle) TCHAR szwProto[64];
MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
szwProto[63] = 0;
- _snwprintf(szBuffer, SIZEOF(szBuffer), L"%s: %s (%s)", szwProto, szName, szStatus);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s: %s (%s)"), szwProto, szName, szStatus);
szBuffer[127] = 0;
AppendMenu(cfg::dat.hMenuNotify, MF_BYCOMMAND | MF_STRING, cfg::dat.wNextMenuID, szBuffer);
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 99dcd3cd86..7707923fbd 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -366,13 +366,13 @@ INT_PTR CALLBACK API::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 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",
exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine,
exCtx.Rax,exCtx.Rbx, exCtx.Rcx, exCtx.Rdx,
exCtx.Rsi, exCtx.Rdi, exCtx.Rbp, exCtx.Rsp, 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",
exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine,
exCtx.Eax,exCtx.Ebx, exCtx.Ecx, exCtx.Edx,
@@ -417,7 +417,7 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, TCH memcpy(&exRecord, ep->ExceptionRecord, sizeof(EXCEPTION_RECORD));
memcpy(&exCtx, ep->ContextRecord, sizeof(CONTEXT));
- _snprintf(exSzFile, MAX_PATH, "%s%s", szName, szExt);
+ mir_snprintf(exSzFile, MAX_PATH, "%s%s", szName, szExt);
mir_sntprintf(exReason, 256, _T("An application error has occured: %s"), szReason);
exLine = line;
exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0);
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index be3233c174..c5638b8b0e 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -201,7 +201,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) { string sCreateLink(const char * pszSrvPath) {
char szTemp[30];
string sLink = DBGetString(NULL, MODULE, "ExternalSrvName", szDefaultExternalSrvName);
- _snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwLocalIpAddress));
+ mir_snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwLocalIpAddress));
ReplaceAll(sLink, "%LocalIP%", szTemp);
if (sLink.find("%ExternalIP%") != sLink.npos) {
@@ -214,11 +214,11 @@ string sCreateLink(const char * pszSrvPath) { dwExternalIpAddressGenerated = GetTickCount();
}
- _snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwExternalIpAddress));
+ mir_snprintf(szTemp, sizeof(szTemp), "%d.%d.%d.%d", SplitIpAddress(dwExternalIpAddress));
ReplaceAll(sLink, "%ExternalIP%", szTemp);
}
- _snprintf(szTemp, sizeof(szTemp), "%d", dwLocalPortUsed, szTemp);
+ mir_snprintf(szTemp, sizeof(szTemp), "%d", dwLocalPortUsed, szTemp);
ReplaceAll(sLink, "%Port%", szTemp);
string sSrvPath = pszSrvPath;
@@ -463,7 +463,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { DWORD dwError = CommDlgExtendedError();
if (dwError) {
char szTemp[200];
- _snprintf(szTemp, sizeof(szTemp), "Failed to create File Open dialog the error returned was %d", dwError);
+ mir_snprintf(szTemp, sizeof(szTemp), "Failed to create File Open dialog the error returned was %d", dwError);
MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
}
return false;
@@ -560,7 +560,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { ListView_InsertItem(hShareList, &sItem);
- _snprintf(szTmp, sizeof(szTmp), "%d", pclCur->st.nMaxDownloads);
+ mir_snprintf(szTmp, sizeof(szTmp), "%d", pclCur->st.nMaxDownloads);
sItem.iSubItem = 1;
sItem.pszText = szTmp;
ListView_SetItem(hShareList, &sItem);
@@ -600,7 +600,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { ListView_SetItem(hUserList, &sItem);
if (pclCurUser->dwTotalSize) {
- _snprintf(szTmp, sizeof(szTmp), "%d %%", (pclCurUser->dwCurrentDL * 100) / pclCurUser->dwTotalSize);
+ mir_snprintf(szTmp, sizeof(szTmp), "%d %%", (pclCurUser->dwCurrentDL * 100) / pclCurUser->dwTotalSize);
} else {
strcpy(szTmp, "? %%");
}
@@ -612,9 +612,9 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { if (dwSpeed > 10000) {
dwSpeed += 512; // make sure we round ot down correctly.
dwSpeed /= 1024;
- _snprintf(szTmp, sizeof(szTmp), "%d KB/Sec", dwSpeed);
+ mir_snprintf(szTmp, sizeof(szTmp), "%d KB/Sec", dwSpeed);
} else {
- _snprintf(szTmp, sizeof(szTmp), "%d B/Sec", dwSpeed);
+ mir_snprintf(szTmp, sizeof(szTmp), "%d B/Sec", dwSpeed);
}
sItem.iSubItem = 4;
sItem.pszText = szTmp;
@@ -1220,7 +1220,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szKeyWord, sizeof(szKeyWord));
DWORD dwExternalIP = GetExternIP(szUrl, szKeyWord);
- _snprintf(szKeyWord, sizeof(szKeyWord), Translate("You external ip was detected as %d.%d.%d.%d\r\nby: %s") ,
+ mir_snprintf(szKeyWord, sizeof(szKeyWord), Translate("You external ip was detected as %d.%d.%d.%d\r\nby: %s") ,
SplitIpAddress(dwExternalIP) ,
szUrl);
MessageBox(hwndDlg, szKeyWord, MSG_BOX_TITEL, MB_OK);
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index a565289ba7..e64656d93e 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -231,7 +231,7 @@ void CLHttpUser::SendError(int iErrorCode, const char * pszError, const char * p pszDescription = pszError;
char szBuf[1000];
- DWORD dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf) ,
+ DWORD dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf) ,
"HTTP/1.1 %i %s\r\n"
"Date: %s\r\n"
"Server: MirandaWeb/%s\r\n"
@@ -281,7 +281,7 @@ void CLHttpUser::SendRedir(int iErrorCode, const char * pszError, const char * p pszDescription = pszError;
char szBuff[1000];
- DWORD dwBytesToWrite = _snprintf(szBuff, sizeof(szBuff) ,
+ DWORD dwBytesToWrite = mir_snprintf(szBuff, sizeof(szBuff) ,
"HTTP/1.1 %i %s\r\n"
"Date: %s\r\n"
"Server: MirandaWeb/%s\r\n"
@@ -546,7 +546,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { char szETag[ 50 ];
{
- int nETagLen = _snprintf(szETag, sizeof(szETag), "\"%x-%x-%x\"",
+ int nETagLen = mir_snprintf(szETag, sizeof(szETag), "\"%x-%x-%x\"",
nDataSize, stFileTime.dwHighDateTime, stFileTime.dwLowDateTime);
if (!apszParam[eIfRange] || (strncmp(szETag, apszParam[eIfRange], nETagLen) == 0)) {
@@ -616,7 +616,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { "Last-Modified: %s\r\n"
"\r\n";
- dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf), szHttpPartial ,
+ dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpPartial ,
szCurTime ,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
szETag ,
@@ -638,7 +638,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { "Last-Modified: %s\r\n"
"\r\n";
- dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf), szHttpOk ,
+ dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpOk ,
szCurTime ,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
szETag ,
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index f449cc0c4c..9610db95f0 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -48,29 +48,29 @@ void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) { int style;
DBVARIANT dbv;
if (colour) {
- wsprintfA(str, "Font%dCol", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
*colour = db_get_dw(NULL, CHATFONTMOD, str, 0x000000);
}
if (lf) {
- wsprintfA(str, "Font%dSize", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dSize", i);
lf->lfHeight = (char) db_get_b(NULL, CHATFONTMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
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, CHATFONTMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
- wsprintfA(str, "Font%dSet", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dSet", i);
lf->lfCharSet = db_get_b(NULL, CHATFONTMOD, str, DEFAULT_CHARSET);
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(NULL, CHATFONTMOD, str, &dbv))
lstrcpyA(lf->lfFaceName, "Verdana");
else {
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index a9c4473b4f..52b00640c3 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -566,7 +566,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) {
if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) {
char szSetting[12];
- wsprintfA(szSetting, "p%d", wParam);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "p%d", wParam);
BYTE hlpDisablePopup = db_get_b(0, MODULE, szSetting, 0);
if (hlpDisablePopup != opt.PopupAutoDisabled) {
@@ -590,7 +590,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) if (opt.DisableSoundGlobally) {
char szSetting[12];
- wsprintfA(szSetting, "s%d", wParam);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "s%d", wParam);
BYTE hlpDisableSound = db_get_b(0, MODULE, szSetting, 0);
if (hlpDisableSound != opt.SoundAutoDisabled) {
@@ -650,7 +650,7 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD if (opt.ShowPreviousStatus) {
TCHAR buff[MAX_STATUSTEXT];
- wsprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText);
+ mir_sntprintf(buff, SIZEOF(buff), TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText);
_tcscat(_tcscat(stzStatusText, _T(" ")), buff);
}
}
@@ -807,7 +807,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) if (!opt.FromOffline || oldStatus != ID_STATUS_OFFLINE) { // Either it wasn't a change from Offline or we didn't enable that.
char buff[8];
- wsprintfA(buff, "%d", newStatus);
+ mir_snprintf(buff, SIZEOF(buff), "%d", newStatus);
if (db_get_b(0, MODULE, buff, 1) == 0)
return 0; // "Notify when a contact changes to one of..." is unchecked
}
@@ -822,8 +822,8 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) // check if that proto from which we received statuschange notification, isn't in autodisable list
if (opt.AutoDisable) {
char statusIDs[12], statusIDp[12];
- wsprintfA(statusIDs, "s%d", myStatus);
- wsprintfA(statusIDp, "p%d", myStatus);
+ mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
+ mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
}
@@ -847,7 +847,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) _tcsncpy(stzOldStatus, StatusList[Index(oldStatus)].lpzStandardText, MAX_STATUSTEXT);
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("HH':'mm"), stzTime, SIZEOF(stzTime));
GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
- wsprintf(stzText, TranslateT("%s, %s. %s changed to: %s (was: %s).\r\n"), stzDate, stzTime, stzName, stzStatus, stzOldStatus);
+ mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s changed to: %s (was: %s).\r\n"), stzDate, stzTime, stzName, stzStatus, stzOldStatus);
LogToFile(stzText);
}
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 7486715434..ae9b897bed 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char status[8];
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++)
{
- wsprintfA(status, "%d", i);
+ mir_snprintf(status, SIZEOF(status), "%d", i);
CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, status, 1));
}
CheckDlgButton(hwndDlg, IDC_CHK_FROMOFFLINE, opt.FromOffline);
@@ -266,7 +266,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char status[8];
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++)
{
- wsprintfA(status, "%d", i);
+ mir_snprintf(status, SIZEOF(status), "%d", i);
db_set_b(NULL, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
}
opt.FromOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_FROMOFFLINE);
@@ -442,12 +442,12 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
ctlColour = SendDlgItemMessage(hwndDlg, (i+2000), CPM_GETCOLOUR, 0, 0);
StatusList[Index(i)].colorBack = SendDlgItemMessage(hwndDlg, (i+2000), CPM_GETCOLOUR, 0, 0);
- wsprintfA(str, "%ibg", i);
+ mir_snprintf(str, SIZEOF(str), "%ibg", i);
db_set_dw(0, MODULE, str, ctlColour);
ctlColour = SendDlgItemMessage(hwndDlg, (i+1000), CPM_GETCOLOUR, 0, 0);
StatusList[Index(i)].colorText = ctlColour;
- wsprintfA(str, "%itx", i);
+ mir_snprintf(str, SIZEOF(str), "%itx", i);
db_set_dw(0, MODULE, str, ctlColour);
}
@@ -493,13 +493,13 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L char str[8];
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
{
- wsprintfA(str, "p%d", i);
+ mir_snprintf(str, SIZEOF(str), "p%d", i);
CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, str, 0));
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
{
- wsprintfA(str, "s%d", i);
+ mir_snprintf(str, SIZEOF(str), "s%d", i);
CheckDlgButton(hwndDlg, (i+2000),db_get_b(NULL, MODULE, str, 0));
}
@@ -517,12 +517,12 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
{
- wsprintfA(str, "p%d", i);
+ mir_snprintf(str, SIZEOF(str), "p%d", i);
db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
{
- wsprintfA(str, "s%d", i);
+ mir_snprintf(str, SIZEOF(str), "s%d", i);
db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i+2000));
}
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 6632802340..60d215cdf3 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -307,7 +307,7 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) BOOL bEnablePopup = true, bEnableSound = true;
char buff[12] = {0};
- wsprintfA(buff, "%d", ID_STATUS_EXTRASTATUS);
+ mir_snprintf(buff, SIZEOF(buff), "%d", ID_STATUS_EXTRASTATUS);
if (( db_get_b(0, MODULE, buff, 1) == 0)
|| (db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
@@ -321,8 +321,8 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) char statusIDs[12], statusIDp[12];
if (opt.AutoDisable) {
WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0);
- wsprintfA(statusIDs, "s%d", myStatus);
- wsprintfA(statusIDp, "p%d", myStatus);
+ mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
+ mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
}
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 757a55f0b9..5643a03849 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -3,7 +3,7 @@ int readFileIntoArray(int fileNumber, char *FileContents[])
{
char dbSetting[20], temp[MAX_STRING_LENGTH];
- wsprintfA(dbSetting, "fn%d", fileNumber);
+ mir_snprintf(dbSetting, SIZEOF(dbSetting), "fn%d", fileNumber);
DBVARIANT dbv;
char tszFileName[MAX_PATH];
@@ -390,7 +390,7 @@ BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString) // Build a string showing the date and time.
wsprintfA(lpszString, "%02d/%02d/%d %02d:%02d",
stLocal.wDay, stLocal.wMonth, stLocal.wYear,
- stLocal.wHour, stLocal.wMinute);
+ stLocal.wHour, stLocal.wMinute); //!!!!!!!!!!!!!!!
return TRUE;
}
@@ -422,7 +422,7 @@ int lastChecked(char *newStr, const char *str) if (GetLastWriteTime(hFile, tszFileName)) {
CloseHandle(hFile);
strcat(newStr, tszFileName);
- _snprintf(tszFileName, MAX_PATH, "%s%d))", szPattern, file);
+ mir_snprintf(tszFileName, MAX_PATH, "%s%d))", szPattern, file);
return (int)strlen(tszFileName);
}
CloseHandle(hFile);
@@ -555,7 +555,7 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) }
else
{
- wsprintfA(tempString, "fn%d", tempInt);
+ mir_snprintf(tempString, SIZEOF(tempString), "fn%d", tempInt);
if (db_get_static(NULL, MODNAME,tempString, tempString))
strcat(newString, tempString);
else return ERROR_NO_FILE;
@@ -609,15 +609,15 @@ void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module2 if (db_get_static(hContact, module1, setting1, text)) {
switch (stringReplacer(text, newString, hContact)) {
case ERROR_NO_LINE_AFTER_VAR_F:
- wsprintfA(newString, Translate("%s - ERROR: no line specified or line not found (in %s)"),text, setting1);
+ mir_snprintf(newString, SIZEOF(newString), Translate("%s - ERROR: no line specified or line not found (in %s)"),text, setting1);
error = 1;
break;
case ERROR_LINE_NOT_READ:
- wsprintfA(newString, Translate("%s - ERROR: file couldnt be opened (in %s)"), text, setting1);
+ mir_snprintf(newString, SIZEOF(newString), Translate("%s - ERROR: file couldnt be opened (in %s)"), text, setting1);
error = 1;
break;
case ERROR_NO_FILE:
- wsprintfA(newString, Translate("%s - ERROR: no file specified in settings (in %s)"), text, setting1);
+ mir_snprintf(newString, SIZEOF(newString), Translate("%s - ERROR: no file specified in settings (in %s)"), text, setting1);
error = 1;
break;
default:
@@ -650,7 +650,7 @@ void replaceAllStrings(HANDLE hContact) /* tooltips*/
WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
if (db_get_static(hContact, MODNAME, "Program", tmp1) && db_get_static(hContact, MODNAME, "ProgramParams", tmp2)) {
- wsprintfA(tmp3, "%s %s", tmp1, tmp2);
+ mir_snprintf(tmp3, SIZEOF(tmp3), "%s %s", tmp1, tmp2);
db_set_s(hContact, "UserInfo", "FirstName", tmp3);
}
else if (db_get_static(hContact, MODNAME, "Program", tmp1))
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 19d1daf1ac..16d7220d19 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -179,18 +179,18 @@ TCHAR *ParseString(TCHAR *szstring, HANDLE hcontact, BYTE isfile) switch(*++p) {
case 'Y':
if (!st.wYear) goto LBL_noData;
- d += _stprintf(d, _T("%04i"), st.wYear);
+ d += _stprintf(d, _T("%04i"), st.wYear); //!!!!!!!!!!!!
break;
case 'y':
if (!st.wYear) goto LBL_noData;
- d += _stprintf(d, _T("%02i"), st.wYear % 100);
+ d += _stprintf(d, _T("%02i"), st.wYear % 100); //!!!!!!!!!!!!
break;
case 'm':
if (!(isetting=st.wMonth)) goto LBL_noData;
LBL_2DigNum:
- d += _stprintf(d, _T("%02i"), isetting);
+ d += _stprintf(d, _T("%02i"), isetting); //!!!!!!!!!!!!
break;
case 'd':
@@ -478,7 +478,7 @@ void ShowPopup(HANDLE hcontact, const char * lpzProto, int newStatus) DBVARIANT dbv;
char szSetting[10];
- sprintf(szSetting, "Col_%d",newStatus-ID_STATUS_OFFLINE);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Col_%d", newStatus - ID_STATUS_OFFLINE);
DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[newStatus-ID_STATUS_OFFLINE]);
POPUPDATAT ppd = {0};
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);
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index f86520019a..2c2c761d9b 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -48,7 +48,7 @@ int Log(char *format, ...) fputs(str, fout);
va_start(vararg, format);
- tBytes = _vsnprintf(str, sizeof(str), format, vararg);
+ tBytes = mir_vsnprintf(str, sizeof(str), format, vararg);
if (tBytes > 0)
{
str[tBytes] = 0;
@@ -71,7 +71,7 @@ int Info(char *title, char *format, ...) va_list vararg;
int tBytes;
va_start(vararg, format);
- tBytes = _vsnprintf(str, sizeof(str), format, vararg);
+ tBytes = mir_vsnprintf(str, sizeof(str), format, vararg);
if (tBytes > 0)
{
str[tBytes] = 0;
@@ -102,12 +102,12 @@ char *BinToHex(int size, PBYTE data) int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[ maxSize ];
memset(szresult, 0, maxSize);
- sprintf(buffer, "%0*X", HEX_SIZE, size);
+ mir_snprintf(buffer, SIZEOF(buffer), "%0*X", HEX_SIZE, size);
strcpy(szresult, buffer);
int i;
for (i = 0; i < size; i++)
{
- sprintf(buffer, "%02X", data[i]);
+ mir_snprintf(buffer, SIZEOF(buffer), "%02X", data[i]);
strcpy(szresult + (HEX_SIZE + i * 2), buffer);
}
return szresult;
|