diff options
28 files changed, 193 insertions, 204 deletions
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 7a54b884ef..6d99c5243e 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -129,7 +129,7 @@ int _DebugTrace(const char *fmt, ...) mir_snprintf(debug, SIZEOF(debug) - 10, " ***** AVS [%08d] [ID:%04x]: ", GetTickCount(), GetCurrentThreadId());
OutputDebugStringA(debug);
- _vsnprintf(debug, ibsize, fmt, va);
+ mir_vsnprintf(debug, ibsize, fmt, va);
OutputDebugStringA(debug);
OutputDebugStringA(" ***** \n");
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index fc5803d7e1..539f2392f9 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -102,7 +102,7 @@ char *MakeFileClassName(const char *pszFileExt) pszClass=(char*)mir_alloc((lstrlenA(pszFileExt)+12)*sizeof(TCHAR));
if (pszClass!=NULL)
/* using correctly formated PROGID */
- wsprintfA(pszClass,"miranda%sfile",pszFileExt); /* includes dot, buffer safe */
+ mir_snprintf(pszClass, strlen(pszClass), "miranda%sfile", pszFileExt); /* includes dot, buffer safe */
return pszClass;
}
@@ -204,7 +204,7 @@ TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID) if ((cch=GetModuleFileName(hModule,szModule,SIZEOF(szModule)))!=0) {
pszIconLoc=(TCHAR*)mir_alloc((cch+=8)*sizeof(TCHAR));
if (pszIconLoc!=NULL)
- wsprintf(pszIconLoc,_T("%s,%i"),szModule,-(int)nIconResID); /* id may be 0, buffer safe */
+ mir_sntprintf(pszIconLoc, _tcslen(pszIconLoc), _T("%s,%i"), szModule, -(int)nIconResID); /* id may be 0, buffer safe */
}
return pszIconLoc;
}
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index b0e47e2d3e..1f701e9a59 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -3111,10 +3111,10 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam int oldflags;
- sprintf(TBcapt,"%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
- g_pfwFrames[pos].szName,g_pfwFrames[pos].height,g_pfwFrames[pos].visible,g_pfwFrames[pos].floating,
- g_pfwFrames[pos].FloatingPos.x,g_pfwFrames[pos].FloatingPos.y,
- g_pfwFrames[pos].FloatingSize.x,g_pfwFrames[pos].FloatingSize.y,
+ mir_snprintf(TBcapt, SIZEOF(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
+ g_pfwFrames[pos].szName, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating,
+ g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y,
+ g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y,
g_pfwFrames[pos].order
);
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 6385e65344..3d45aaca75 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -233,7 +233,7 @@ int IniParser::GetSkinFolder( IN const TCHAR * szFileName, OUT TCHAR * pszFolder GetPrivateProfileString(_T("Skin_Description_Section"),_T("SkinFolder"),_T(""),cus,SIZEOF(custom_folder),szFileName);
if ( cus && _tcslen(cus)>0)
- _sntprintf(pszFolderName,MAX_PATH,_T("%s\\%s"),custom_folder,cus);
+ mir_sntprintf(pszFolderName, MAX_PATH, _T("%s\\%s"), custom_folder, cus);
mir_free(szBuff);
PathToRelativeT(pszFolderName, pszFolderName);
@@ -3575,13 +3575,13 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) BitBlt(g_pCachedWindow->hImageDC,rLine.left,rLine.top,rLine.right-rLine.left,rLine.bottom-rLine.top,g_pCachedWindow->hBackDC,rLine.left,rLine.top,SRCCOPY);
{
char req[255];
- _snprintf(req,sizeof(req),"Main,ID=ScrollBar,Frame=%s,Part=Back",Frame->szName);
+ mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=Back", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC,&rLine,&rLine,req);
- _snprintf(req,sizeof(req),"Main,ID=ScrollBar,Frame=%s,Part=Thumb",Frame->szName);
+ mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=Thumb", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC,&rThumb,&rThumb,req);
- _snprintf(req,sizeof(req),"Main,ID=ScrollBar,Frame=%s,Part=UpLineButton",Frame->szName);
+ mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar, Frame=%s,Part=UpLineButton", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC,&rUpBtn,&rUpBtn,req);
- _snprintf(req,sizeof(req),"Main,ID=ScrollBar,Frame=%s,Part=DownLineButton",Frame->szName);
+ mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=DownLineButton", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC,&rDnBtn,&rDnBtn,req);
}
}
@@ -3924,11 +3924,11 @@ static DWORD ske_HexToARGB(char * Hex) char * st;
BYTE alpha;
DWORD AARRGGBB = 0;
- _snprintf(buf,10, "%s\n",Hex);
+ mir_snprintf(buf, SIZEOF(buf), "%s\n", Hex);
if (buf[1] == 'x' || buf[1] == 'X')
- _snprintf(buf2,11,"0x%s\n",buf+2);
+ mir_snprintf(buf2, SIZEOF(buf2), "0x%s\n", buf+2);
else
- _snprintf(buf2,11,"0x%s\n",buf);
+ mir_snprintf(buf2, SIZEOF(buf2), "0x%s\n", buf);
buf2[10] = '\0';
AARRGGBB = strtoul(buf2,&st,16);
alpha = (BYTE)((AARRGGBB&0xFF000000)>>24);
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 556f8bad1e..d11aa60518 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -69,7 +69,7 @@ STATUSBARDATA g_StatusBarData = {0}; char* ApendSubSetting(char * buf, int size, char *first, char *second)
{
- _snprintf(buf,size,"%sFont%s",first,second);
+ mir_snprintf(buf, size, "%sFont%s", first, second);
return buf;
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 75166d6429..726a081f88 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -297,7 +297,7 @@ static void InitIcoLib() continue;
TCHAR szDescr[128];
- mir_sntprintf(szDescr, 128, TranslateT("%s Connecting"), accs[k]->tszAccountName );
+ mir_sntprintf(szDescr, SIZEOF(szDescr), TranslateT("%s Connecting"), accs[k]->tszAccountName );
IconItemT icon = { szDescr, "conn", IDI_PROTOCONNECTING };
Icon_RegisterT(g_hInst, LPGENT("CList - Nicer/Connecting Icons"), &icon, 1, accs[k]->szModuleName);
}
@@ -1444,7 +1444,7 @@ skipbg: if (serviceFailure) {
char szError[512];
- mir_snprintf(szError, 512, Translate("The service %s specified by the %s button definition was not found. You may need to install additional plugins"), item->szService, item->szName);
+ mir_snprintf(szError, SIZEOF(szError), Translate("The service %s specified by the %s button definition was not found. You may need to install additional plugins"), item->szService, item->szName);
MessageBoxA(0, szError, Translate("Service failure"), MB_OK);
}
break;
@@ -1701,7 +1701,7 @@ buttons_done: if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE) {
char szBuffer[128];
- mir_snprintf(szBuffer, 128, "%s_conn", pd->RealName);
+ mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_conn", pd->RealName);
hIcon = Skin_GetIcon(szBuffer);
}
else if (cfg::dat.bShowXStatusOnSbar && status > ID_STATUS_OFFLINE) {
@@ -2039,7 +2039,7 @@ void FS_RegisterFonts() strncpy(fid.dbSettingsGroup, "CLC", 5);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE;
while (_tagFSINFO[j].name != 0) {
- _snprintf(szTemp, sizeof(szTemp), "Font%d", _tagFSINFO[j].id);
+ mir_snprintf(szTemp, sizeof(szTemp), "Font%d", _tagFSINFO[j].id);
strncpy(fid.prefix, szTemp, sizeof(fid.prefix));
fid.order = _tagFSINFO[j].id;
_tcsncpy(fid.backgroundGroup, LPGENT("Contact List"), SIZEOF(fid.backgroundGroup));
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 831407e081..29a816f5e5 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -525,7 +525,7 @@ void UpdateFilters() for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- _sntprintf(szMask, 256, _T("%s|"), szTemp);
+ mir_sntprintf(szMask, SIZEOF(szMask), _T("%s|"), szTemp);
if (dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index e8bf749c18..c570d2c404 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -8,7 +8,6 @@ #define _CRT_NONSTDC_NO_DEPRECATE
#define _WIN32_WINNT 0x0501
-#define MIRANDA_VER 0x0A00
#include <tchar.h>
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index eb76c67fea..b5404945d3 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -260,9 +260,9 @@ void FILEECHO::updateTitle() contactName=(char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0);
if(iState == STATE_OPERATE && chunkCount != 0)
- _snprintf(newtitle,sizeof(newtitle),"%d%% - %s: %s",chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName);
+ mir_snprintf(newtitle, sizeof(newtitle), "%d%% - %s: %s", chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName);
else
- _snprintf(newtitle,sizeof(newtitle),"%s: %s",Translate(szFEMode[inSend]), contactName);
+ mir_snprintf(newtitle, sizeof(newtitle), "%s: %s", Translate(szFEMode[inSend]), contactName);
SetWindowText(hDlg, newtitle);
}
@@ -429,9 +429,9 @@ void FILEECHO::sendReq() if(*p == '\\')
strcpy(filename,p+1);
- _snprintf(sendbuf, sizeof(sendbuf), Translate("Size: %d bytes"), fileSize);
+ mir_snprintf(sendbuf, sizeof(sendbuf), Translate("Size: %d bytes"), fileSize);
SetDlgItemText(hDlg, IDC_FILESIZE, sendbuf);
- _snprintf(sendbuf, sizeof(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary+'0', codeSymb, chunkCount, fileSize);
+ mir_snprintf(sendbuf, sizeof(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary+'0', codeSymb, chunkCount, fileSize);
sendCmd(0, CMD_REQ, sendbuf, filename);
SetDlgItemText(hDlg, IDC_STATUS, Translate("Request sent. Awaiting of acceptance.."));
@@ -460,7 +460,7 @@ void FILEECHO::incomeRequest(char *param) chunkCountx = atoi(p);
fileSize = atoi(param);
- _snprintf(buf, sizeof(buf), Translate("Size: %d bytes"), fileSize);
+ mir_snprintf(buf, sizeof(buf), Translate("Size: %d bytes"), fileSize);
SetDlgItemText(hDlg, IDC_FILENAME, filename);
SetDlgItemText(hDlg, IDC_FILESIZE, buf);
@@ -635,7 +635,7 @@ void FILEECHO::onSendTimer() }
char prefix[128];
- _snprintf(prefix, sizeof(prefix), "%X,%X,%X>", chunkIndx+1, chunkPos[chunkIndx], chksum);
+ mir_snprintf(prefix, sizeof(prefix), "%X,%X,%X>", chunkIndx+1, chunkPos[chunkIndx], chksum);
#ifdef DEBUG
overhead += lstrlen((char*)buffer);
#endif
@@ -735,15 +735,9 @@ void FILEECHO::cmdDACK(char *param) // All chunks has been received successfully
//
{
-#ifdef DEBUG
- char msg[100];
-
- _snprintf(msg, sizeof(msg), "overhead: %d", overhead);
- SetDlgItemText(hDlg, IDC_STATUS, msg);
-#else
char *msg = Translate("Sent successfully");
SetDlgItemText(hDlg, IDC_STATUS, msg);
-#endif
+
SkinPlaySound("FileDone");
destroyTransfer();
MakePopupMsg(hDlg, hContact, msg);
@@ -877,9 +871,9 @@ int FILEECHO::sendCmd(int id, int cmd, char *szParam, char *szPrefix) buf = (char*)malloc(buflen);
if(szPrefix == NULL)
- _snprintf(buf,buflen,"%s%c%s", szServicePrefix, cCmdList[cmd], szParam);
+ mir_snprintf(buf, buflen, "%s%c%s", szServicePrefix, cCmdList[cmd], szParam);
else
- _snprintf(buf,buflen,"%s%c%s%s", szServicePrefix, cCmdList[cmd], szPrefix, szParam);
+ mir_snprintf(buf, buflen, "%s%c%s%s", szServicePrefix, cCmdList[cmd], szPrefix, szParam);
retval = CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)buf);
free(buf);
updateProgress();
@@ -1194,9 +1188,9 @@ INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam int size = RetrieveFileSize(str);
if(size != -1)
- _snprintf(str, sizeof(str), Translate("Size: %d bytes"), size);
+ mir_snprintf(str, sizeof(str), Translate("Size: %d bytes"), size);
else
- _snprintf(str, sizeof(str), Translate("Can't get a file size"), size);
+ mir_snprintf(str, sizeof(str), Translate("Can't get a file size"), size);
SetDlgItemText(hDlg, IDC_FILESIZE, str);
break;
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 0297a1f038..f05efe472a 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -122,7 +122,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, // Write dirname
ReplaceSign(szFileName, MAX_PATH, '&', "&");
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <dirname>%s</dirname>\r\n", szFileName);
WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL);
@@ -137,7 +137,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, ReplaceSign(szFileName, MAX_PATH, '&', "&");
if (fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" isdir=\"true\"/>\r\n", szFileName);
} else {
pszExt = strrchr(szFileName, '.');
@@ -147,24 +147,24 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, pszExt++;
}
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
szFileName, (pszExt == NULL) ? "" : pszExt, fdFindFileData.nFileSizeLow);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&fdFindFileData.ftCreationTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"created=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
FileTimeToSystemTime(&fdFindFileData.ftLastWriteTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"modified=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"/>\r\n");
}
@@ -191,7 +191,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, if (pclCur->bIsDirectory()) {
szFileName[strlen(szFileName)-1] = '\0';
if (!strchr(szFileName, '/')) { // only one level deeper
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" isdir=\"true\"/>\r\n", szFileName);
if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
@@ -219,24 +219,24 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, CloseHandle(hFileS);
}
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
szFileName, (pszExt == NULL) ? "" : pszExt, dwFileSize);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&ftFileCreateTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"created=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
FileTimeToSystemTime(&ftFileModifyTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"modified=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"/>\r\n");
if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index b59587737e..f71fe47ac0 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -345,7 +345,7 @@ bool bWriteConfigurationFile() { } else {
CLFileShareNode * pclCur = pclFirstNode;
while (pclCur) {
- DWORD dwBytesToWrite = _snprintf(szBuf, sizeof(szBuf), szXmlData ,
+ DWORD dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szXmlData ,
pclCur->st.pszSrvPath,
pclCur->pszOrigRealPath,
pclCur->st.nMaxDownloads,
@@ -646,8 +646,8 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { }
hDirectBoundPort = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) hNetlibUser, (LPARAM) & nlb);
if (!hDirectBoundPort) {
- char szTemp[200];
- _snprintf(szTemp, sizeof(szTemp), TranslateT("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port") ,
+ TCHAR szTemp[200];
+ mir_snprintf(szTemp, SIZEOF(szTemp), TranslateT("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port") ,
nlb.wPort == 80 ? "80" : nus.szIncomingPorts);
MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
return 1001;
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 73f8ff7815..2f8adeb013 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -1503,13 +1503,13 @@ void Options::init() continue;
}
/* SRMM settings */
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
proto->setSRMMEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
proto->setSRMMMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
proto->setSRMMFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
@@ -1518,7 +1518,7 @@ void Options::init() proto->setSRMMBackgroundFilename(tmpPath);
db_free(&dbv);
}
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
@@ -1527,7 +1527,7 @@ void Options::init() proto->setSRMMCssFilename(tmpPath);
db_free(&dbv);
}
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
@@ -1536,13 +1536,13 @@ void Options::init() }
/* Group chat settings */
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
proto->setChatEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
proto->setChatMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
proto->setChatFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
@@ -1551,7 +1551,7 @@ void Options::init() proto->setChatBackgroundFilename(tmpPath);
db_free(&dbv);
}
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
@@ -1560,7 +1560,7 @@ void Options::init() proto->setChatCssFilename(tmpPath);
db_free(&dbv);
}
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
@@ -1569,13 +1569,13 @@ void Options::init() }
/* History settings */
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
proto->setHistoryEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
proto->setHistoryMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
proto->setHistoryFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
@@ -1584,7 +1584,7 @@ void Options::init() proto->setHistoryBackgroundFilename(tmpPath);
db_free(&dbv);
}
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
if ( strncmp(tmpPath, "http://", 7))
@@ -1593,7 +1593,7 @@ void Options::init() proto->setHistoryCssFilename(tmpPath);
db_free(&dbv);
}
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
@@ -1693,67 +1693,67 @@ void Options::saveProtocolSettings() char tmpPath[MAX_PATH];
proto->copyFromTemp();
/* SRMM settings */
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->isSRMMEnable());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->getSRMMMode());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
db_set_dw(NULL, ieviewModuleName, dbsName, proto->getSRMMFlags());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
strcpy(tmpPath, proto->getSRMMBackgroundFilename());
PathToRelative(proto->getSRMMBackgroundFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
strcpy (tmpPath, proto->getSRMMCssFilename());
PathToRelative(proto->getSRMMCssFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
strcpy (tmpPath, proto->getSRMMTemplateFilename());
PathToRelative(proto->getSRMMTemplateFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
/* Group Chat settings */
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->isChatEnable());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->getChatMode());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
db_set_dw(NULL, ieviewModuleName, dbsName, proto->getChatFlags());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
strcpy (tmpPath, proto->getChatBackgroundFilename());
PathToRelative(proto->getChatBackgroundFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
strcpy (tmpPath, proto->getChatCssFilename());
PathToRelative(proto->getChatCssFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
strcpy (tmpPath, proto->getChatTemplateFilename());
PathToRelative(proto->getChatTemplateFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
/* History settings */
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->isHistoryEnable());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->getHistoryMode());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
db_set_dw(NULL, ieviewModuleName, dbsName, proto->getHistoryFlags());
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
strcpy (tmpPath, proto->getHistoryBackgroundFilename());
PathToRelative(proto->getHistoryBackgroundFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
strcpy (tmpPath, proto->getHistoryCssFilename());
PathToRelative(proto->getHistoryCssFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- sprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
+ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
strcpy (tmpPath, proto->getHistoryTemplateFilename());
PathToRelative(proto->getHistoryTemplateFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index 7d3c2d703d..4503fc7ef9 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -57,24 +57,21 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
{
+ TranslateDialogDefault(hwndDlg);
ItemInfo &SelItem = *(ItemInfo*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)&SelItem);
- if (SelItem.hwndList)
- {
+ if (SelItem.hwndList) {
TCHAR str[MAX_PATH];
if (GetDlgItemText(SelItem.hwndList, IDC_FEEDTITLE, str, SIZEOF(str)))
SetDlgItemText(hwndDlg, IDC_FEEDNAME, str);
- else
- {
+ else {
GetDlgItemText(SelItem.hwndList, IDC_FEEDURL, str, SIZEOF(str));
SetDlgItemText(hwndDlg, IDC_FEEDNAME, str);
}
}
- else if (SelItem.hContact)
- {
+ else if (SelItem.hContact) {
DBVARIANT dbv;
if (!db_get_ts(SelItem.hContact, MODULE, "Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FEEDNAME, dbv.ptszVal);
@@ -96,23 +93,21 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR username[MAX_PATH];
char passw[MAX_PATH];
if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, SIZEOF(username))) {
- MessageBox(hwndDlg, TranslateT("Enter your username"), TranslateT("Error"), MB_OK);
+ MessageBox(hwndDlg, TranslateT("Enter your username"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
}
if (!GetDlgItemTextA(hwndDlg, IDC_FEEDPASSWORD, passw, SIZEOF(passw))) {
- MessageBox(hwndDlg, TranslateT("Enter your password"), TranslateT("Error"), MB_OK);
+ MessageBox(hwndDlg, TranslateT("Enter your password"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
}
- if (SelItem.hwndList)
- {
+ if (SelItem.hwndList) {
CheckDlgButton(SelItem.hwndList, IDC_USEAUTH, BST_CHECKED);
EnableWindow(GetDlgItem(SelItem.hwndList, IDC_LOGIN), TRUE);
EnableWindow(GetDlgItem(SelItem.hwndList, IDC_PASSWORD), TRUE);
SetDlgItemText(SelItem.hwndList, IDC_LOGIN, username);
SetDlgItemTextA(SelItem.hwndList, IDC_PASSWORD, passw);
}
- else if (SelItem.hContact)
- {
+ else if (SelItem.hContact) {
db_set_b(SelItem.hContact, MODULE, "UseAuth", 1);
db_set_ts(SelItem.hContact, MODULE, "Login", username);
CallService(MS_DB_CRYPT_ENCODESTRING, strlen(passw), (LPARAM)&passw);
@@ -130,6 +125,5 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
break;
}
-
return FALSE;
}
\ No newline at end of file diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index dbabbb1217..5652e8dc0c 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -578,7 +578,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM void ErrorMSG(int minValue, int maxValue)
{
TCHAR str[128];
- wsprintf(str, TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
+ mir_sntprintf(str, SIZEOF(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
MSGERROR(str);
}
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);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index b40276d6fa..366f68534f 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -155,13 +155,13 @@ TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hCont if (!M.GetByte("singlewinmode", 0)) {
do {
char szCounter[10];
- _snprintf(szCounter, 8, "%d", i);
+ mir_snprintf(szCounter, 8, "%d", i);
DBVARIANT dbv;
if (db_get_ts(NULL, szKey, szCounter, &dbv)) {
if (iFirstFree != -1) {
pContainer->iContainerIndex = iFirstFree;
- _snprintf(szCounter, 8, "%d", iFirstFree);
+ mir_snprintf(szCounter, 8, "%d", iFirstFree);
}
else pContainer->iContainerIndex = i;
@@ -2004,13 +2004,13 @@ panel_found: }
}
else {
- _snprintf(szCName, 40, "%s%dx", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, 40, "%s%dx", szSetting, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
- _snprintf(szCName, 40, "%s%dy", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, 40, "%s%dy", szSetting, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
- _snprintf(szCName, 40, "%s%dwidth", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, 40, "%s%dwidth", szSetting, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- _snprintf(szCName, 40, "%s%dheight", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, 40, "%s%dheight", szSetting, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
db_set_b(0, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
@@ -2193,8 +2193,8 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size }
else {
TCHAR fmt[20];
- _sntprintf(fmt, 18, _T("%%%d.%ds..."), cutMax, cutMax);
- _sntprintf(newname, size, fmt, oldname);
+ mir_sntprintf(fmt, 18, _T("%%%d.%ds..."), cutMax, cutMax);
+ mir_sntprintf(newname, size, fmt, oldname);
newname[size - 1] = 0;
}
return 0;
@@ -2373,7 +2373,7 @@ void TSAPI DeleteContainer(int iIndex) char *szKey = "TAB_ContainersW";
char *szSettingP = "CNTW_";
char *szSubKey = "containerW";
- _snprintf(szIndex, 8, "%d", iIndex);
+ mir_snprintf(szIndex, 8, "%d", iIndex);
DBVARIANT dbv;
if (!db_get_ts(NULL, szKey, szIndex, &dbv)) {
@@ -2390,17 +2390,17 @@ void TSAPI DeleteContainer(int iIndex) db_free(&dbv_c);
}
}
- _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Flags", szSettingP, iIndex);
+ mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Flags", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Trans", szSettingP, iIndex);
+ mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Trans", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dwidth", szSettingP, iIndex);
+ mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dwidth", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dheight", szSettingP, iIndex);
+ mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dheight", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dx", szSettingP, iIndex);
+ mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dx", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
- _snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dy", szSettingP, iIndex);
+ mir_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dy", szSettingP, iIndex);
db_unset(NULL, SRMSGMOD_T, szSetting);
}
db_free(&dbv);
@@ -2415,7 +2415,7 @@ void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) char *szSubKey = "containerW";
char szIndex[10];
- _snprintf(szIndex, 8, "%d", iIndex);
+ mir_snprintf(szIndex, 8, "%d", iIndex);
if (!db_get_ts(NULL, szKey, szIndex, &dbv)) {
if (szNew != NULL)
if (lstrlen(szNew) != 0)
@@ -2459,7 +2459,7 @@ HMENU TSAPI BuildContainerMenu() hMenu = CreateMenu();
do {
- _snprintf(szCounter, 8, "%d", i);
+ mir_snprintf(szCounter, 8, "%d", i);
if (db_get_ts(NULL, szKey, szCounter, &dbv))
break;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 9eaa6cec47..53d9445103 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -687,9 +687,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (lstrlenA((char *)hClip) > mwdat->nMax) {
TCHAR szBuffer[512];
if (M.GetByte("autosplit", 0))
- _sntprintf(szBuffer, 512, TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10);
else
- _sntprintf(szBuffer, 512, TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), mwdat->nMax);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), mwdat->nMax);
SendMessage(hwndParent, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
}
}
@@ -1320,7 +1320,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->hContact && dat->szProto != NULL) {
dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- mir_sntprintf(dat->szStatus, SIZEOF(dat->szStatus), _T("%s"), (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, GSMDF_TCHAR));
+ mir_sntprintf(dat->szStatus, SIZEOF(dat->szStatus), _T("%s"), (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, GSMDF_TCHAR));
} else
dat->wStatus = ID_STATUS_OFFLINE;
@@ -2882,7 +2882,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP 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);
@@ -3477,7 +3477,7 @@ quote_from_last: if (!(pcaps & PF4_OFFLINEFILES)) {
TCHAR szBuffer[256];
- _sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
break;
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index bab958ae85..2dac49be97 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -153,11 +153,11 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic) struct tm *lt = localtime(&t);
DWORD setView = 1;
- mir_sntprintf(szTimestamp, 100, _T("%04u %02u %02u_%02u%02u"), lt->tm_year + 1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min);
+ mir_sntprintf(szTimestamp, SIZEOF(szTimestamp), _T("%04u %02u %02u_%02u%02u"), lt->tm_year + 1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min);
TCHAR *szProto = mir_a2t(dat->cache->getActiveProto());
- mir_sntprintf(szFinalPath, MAX_PATH, _T("%s\\%s"), M.getSavedAvatarPath(), szProto);
+ mir_sntprintf(szFinalPath, SIZEOF(szFinalPath), _T("%s\\%s"), M.getSavedAvatarPath(), szProto);
mir_free(szProto);
if (CreateDirectory(szFinalPath, 0) == 0) {
@@ -1015,7 +1015,7 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) p1 = pszText;
// iterate through all characters, if rtf control character found then take action
while (*p1 != (TCHAR) '\0') {
- _sntprintf(InsertThis, 50, _T(""));
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T(""));
iRemoveChars = 0;
switch (*p1) {
@@ -1026,17 +1026,17 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) int iInd = Utils::RTFColorToIndex(iCol);
bJustRemovedRTF = TRUE;
- _sntprintf(szTemp, 20, _T("%d"), iCol);
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), iCol);
iRemoveChars = 3 + lstrlen(szTemp);
if (bTextHasStarted || iCol)
- _sntprintf(InsertThis, sizeof(InsertThis) / sizeof(TCHAR), (iInd > 0) ? (inColor ? _T("[/color][color=%s]") : _T("[color=%s]")) : (inColor ? _T("[/color]") : _T("")), Utils::rtf_ctable[iInd - 1].szName);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), (iInd > 0) ? (inColor ? _T("[/color][color=%s]") : _T("[color=%s]")) : (inColor ? _T("[/color]") : _T("")), Utils::rtf_ctable[iInd - 1].szName);
inColor = iInd > 0 ? 1 : 0;
} else if (p1 == _tcsstr(p1, _T("\\highlight"))) { //background color
TCHAR szTemp[20];
int iCol = _ttoi(p1 + 10);
bJustRemovedRTF = TRUE;
- _sntprintf(szTemp, 20, _T("%d"), iCol);
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), iCol);
iRemoveChars = 10 + lstrlen(szTemp);
} else if (p1 == _tcsstr(p1, _T("\\par"))) { // newline
bTextHasStarted = TRUE;
@@ -1046,48 +1046,48 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 5;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("\n"));
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\n"));
} else if (p1 == _tcsstr(p1, _T("\\endash"))) {
bTextHasStarted = bJustRemovedRTF = TRUE;
iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2013);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2013);
} else if (p1 == _tcsstr(p1, _T("\\emdash"))) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2014);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2014);
} else if (p1 == _tcsstr(p1, _T("\\bullet"))) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2022);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2022);
} else if (p1 == _tcsstr(p1, _T("\\ldblquote"))) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201C);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201C);
} else if (p1 == _tcsstr(p1, _T("\\rdblquote"))) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201D);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x201D);
} else if (p1 == _tcsstr(p1, _T("\\lquote"))) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2018);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2018);
} else if (p1 == _tcsstr(p1, _T("\\rquote"))) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2019);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x2019);
} else if (p1 == _tcsstr(p1, _T("\\b"))) { //bold
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = (p1[2] != (TCHAR) '0') ? 2 : 3;
if (!(lf.lfWeight == FW_BOLD)) { // only allow bold if the font itself isn't a bold one, otherwise just strip it..
if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[b]") : _T("[/b]"));
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[b]") : _T("[/b]"));
}
} else if (p1 == _tcsstr(p1, _T("\\i"))) { // italics
@@ -1096,7 +1096,7 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) iRemoveChars = (p1[2] != (TCHAR) '0') ? 2 : 3;
if (!lf.lfItalic) { // same as for bold
if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[i]") : _T("[/i]"));
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[2] != (TCHAR) '0') ? _T("[i]") : _T("[/i]"));
}
} else if (p1 == _tcsstr(p1, _T("\\strike"))) { // strike-out
@@ -1105,7 +1105,7 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) iRemoveChars = (p1[7] != (TCHAR) '0') ? 7 : 8;
if (!lf.lfStrikeOut) { // same as for bold
if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[7] != (TCHAR) '0') ? _T("[s]") : _T("[/s]"));
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[7] != (TCHAR) '0') ? _T("[s]") : _T("[/s]"));
}
} else if (p1 == _tcsstr(p1, _T("\\ul"))) { // underlined
@@ -1119,19 +1119,19 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) iRemoveChars = 3;
if (!lf.lfUnderline) { // same as for bold
if (dat->SendFormat)
- _sntprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != (TCHAR) '0' && p1[3] != (TCHAR) 'n') ? _T("[u]") : _T("[/u]"));
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != (TCHAR) '0' && p1[3] != (TCHAR) 'n') ? _T("[u]") : _T("[/u]"));
}
} else if (p1 == _tcsstr(p1, _T("\\tab"))) { // tab
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 4;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x09);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), 0x09);
} else if (p1[1] == (TCHAR) '\\' || p1[1] == (TCHAR) '{' || p1[1] == (TCHAR) '}') { // escaped characters
bTextHasStarted = TRUE;
//bJustRemovedRTF = TRUE;
iRemoveChars = 2;
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), p1[1]);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), p1[1]);
} else if (p1[1] == (TCHAR) '\'') { // special character
bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
@@ -1152,7 +1152,7 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) // convert string containing char in hex format to int.
p3 = InsertThis;
iLame = _tcstol(p3, &stoppedHere, 16);
- _sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), (TCHAR) iLame);
+ mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("%c"), (TCHAR) iLame);
} else
iRemoveChars = 2;
@@ -2074,7 +2074,7 @@ void TSAPI LoadThemeDefaults(TContainerData *pContainer) pContainer->theme.inputbg = M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
for (i = 1; i <= 5; i++) {
- _snprintf(szTemp, 10, "cc%d", i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i);
colour = M.GetDword(szTemp, RGB(224, 224, 224));
if (colour == 0)
colour = RGB(1, 1, 1);
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index d52c9543ca..b1b87cce68 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -125,7 +125,7 @@ int _DebugTraceW(const wchar_t *fmt, ...) mir_snprintf(tszTime, 50, "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
- _vsnwprintf(debug, ibsize - 10, fmt, va);
+ mir_vsntprintf(debug, ibsize - 10, fmt, va);
//#ifdef _DEBUG
OutputDebugStringW(debug);
//#else
@@ -158,7 +158,7 @@ int _DebugTraceA(const char *fmt, ...) va_start(va, fmt);
lstrcpyA(debug, "TABSRMM: ");
- _vsnprintf(&debug[9], ibsize - 10, fmt, va);
+ mir_vsnprintf(&debug[9], ibsize - 10, fmt, va);
#ifdef _DEBUG
OutputDebugStringA(debug);
#else
@@ -195,7 +195,7 @@ int _DebugPopup(HANDLE hContact, const TCHAR *fmt, ...) int ibsize = 1023;
va_start(va, fmt);
- _vsntprintf(debug, ibsize, fmt, va);
+ mir_vsntprintf(debug, ibsize, fmt, va);
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
MIRANDASYSTRAYNOTIFY tn;
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index e03e09a5df..da61c3bea8 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -192,19 +192,19 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, struct TWindowData *dat) char *szModule = fontBlocks[n].szModule;
WritePrivateProfileStringA(fontBlocks[n].szBLockname, "Valid", "1", szIniFilename);
for (i=0; i < fontBlocks[n].iCount; i++) {
- sprintf(szTemp, "Font%d", firstIndex + i);
- sprintf(szAppname, fontBlocks[n].szIniTemp, firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", firstIndex + i);
+ mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (!db_get_s(NULL, szModule, szTemp, &dbv)) {
WritePrivateProfileStringA(szAppname, "Face", dbv.pszVal, szIniFilename);
db_free(&dbv);
}
- sprintf(szTemp, "Font%dCol", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dCol", firstIndex + i);
WritePrivateProfileStringA(szAppname, "Color", _itoa(M.GetDword(szModule, szTemp, 0), szBuf, 10), szIniFilename);
- sprintf(szTemp, "Font%dSty", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dSty", firstIndex + i);
WritePrivateProfileStringA(szAppname, "Style", _itoa(M.GetByte(szModule, szTemp, 0), szBuf, 10), szIniFilename);
- sprintf(szTemp, "Font%dSize", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dSize", firstIndex + i);
WritePrivateProfileStringA(szAppname, "Size", _itoa(M.GetByte(szModule, szTemp, 0), szBuf, 10), szIniFilename);
- sprintf(szTemp, "Font%dSet", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dSet", firstIndex + i);
WritePrivateProfileStringA(szAppname, "Set", _itoa(M.GetByte(szModule, szTemp, 0), szBuf, 10), szIniFilename);
}
n++;
@@ -240,7 +240,7 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, struct TWindowData *dat) mir_free(encoded);
}
for (i=0; i < CUSTOM_COLORS; i++) {
- sprintf(szTemp, "cc%d", i + 1);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i + 1);
if (dat == 0)
WritePrivateProfileStringA("Custom Colors", szTemp, _itoa(M.GetDword(szTemp, 0), szBuf, 10), szIniFilename);
else
@@ -283,27 +283,27 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in continue;
}
for (i=0; i < fontBlocks[n].iCount; i++) {
- sprintf(szTemp, "Font%d", firstIndex + i);
- sprintf(szAppname, fontBlocks[n].szIniTemp, firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", firstIndex + i);
+ mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (GetPrivateProfileStringA(szAppname, "Face", "Verdana", szBuf, sizeof(szBuf), szIniFilename) != 0) {
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT)
lstrcpynA(szBuf, "Arial", sizeof(szBuf));
db_set_s(NULL, szModule, szTemp, szBuf);
}
- sprintf(szTemp, "Font%dCol", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dCol", firstIndex + i);
db_set_dw(0, szModule, szTemp, GetPrivateProfileIntA(szAppname, "Color", GetSysColor(COLOR_WINDOWTEXT), szIniFilename));
- sprintf(szTemp, "Font%dSty", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dSty", firstIndex + i);
db_set_b(0, szModule, szTemp, (BYTE)(GetPrivateProfileIntA(szAppname, "Style", 0, szIniFilename)));
- sprintf(szTemp, "Font%dSize", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dSize", firstIndex + i);
bSize = (char)GetPrivateProfileIntA(szAppname, "Size", -10, szIniFilename);
if (bSize > 0)
bSize = -MulDiv(bSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
db_set_b(0, szModule, szTemp, bSize);
- sprintf(szTemp, "Font%dSet", firstIndex + i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%dSet", firstIndex + i);
charset = GetPrivateProfileIntA(szAppname, "Set", 0, szIniFilename);
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT)
charset = 0;
@@ -333,7 +333,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in db_set_b(0, SRMSGMOD_T, "extramicrolf", (BYTE)(GetPrivateProfileIntA("Message Log", "ExtraMicroLF", 0, szIniFilename)));
for (i=0; i < CUSTOM_COLORS; i++) {
- sprintf(szTemp, "cc%d", i + 1);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i + 1);
if (dat == 0)
db_set_dw(0, SRMSGMOD_T, szTemp, GetPrivateProfileIntA("Custom Colors", szTemp, RGB(224, 224, 224), szIniFilename));
else
@@ -347,7 +347,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in else
defclr = g_Settings.UserListColors[CHAT_STATUS_NORMAL];
g_Settings.nickColors[i] = GetPrivateProfileIntA("Nick Colors", _itoa(i, szTemp, 10), defclr, szIniFilename);
- sprintf(szTemp, "NickColor%d", i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i);
db_set_dw(0, "Chat", szTemp, g_Settings.nickColors[i]);
}
}
@@ -357,11 +357,11 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in ReleaseDC(NULL, hdc);
if (!noAdvanced) {
for (i=0; i < MSGDLGFONTCOUNT; i++) {
- _snprintf(szTemp, 20, "Font%d", i);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
LoadLogfontFromINI(i, szTemp, &dat->theme.logFonts[i], &dat->theme.fontColors[i], szIniFilename);
- wsprintfA(dat->theme.rtfFonts + (i * RTFCACHELINESIZE), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, dat->theme.logFonts[i].lfWeight >= FW_BOLD ? 1 : 0, dat->theme.logFonts[i].lfItalic, dat->theme.logFonts[i].lfUnderline, 2 * abs(dat->theme.logFonts[i].lfHeight) * 74 / SY);
+ wsprintfA(dat->theme.rtfFonts + (i * RTFCACHELINESIZE), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, dat->theme.logFonts[i].lfWeight >= FW_BOLD ? 1 : 0, dat->theme.logFonts[i].lfItalic, dat->theme.logFonts[i].lfUnderline, 2 * abs(dat->theme.logFonts[i].lfHeight) * 74 / SY); //!!!!!!!!
}
- wsprintfA(dat->theme.rtfFonts + (MSGDLGFONTCOUNT * RTFCACHELINESIZE), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0, 0);
+ wsprintfA(dat->theme.rtfFonts + (MSGDLGFONTCOUNT * RTFCACHELINESIZE), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0, 0); //!!!!!!!!!
}
dat->theme.bg = GetPrivateProfileIntA("Message Log", "BackgroundColor", RGB(224, 224, 224), szIniFilename);
dat->theme.inbg = GetPrivateProfileIntA("Message Log", "IncomingBG", RGB(224, 224, 224), szIniFilename);
@@ -381,7 +381,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in dat->theme.right_indent = GetPrivateProfileIntA("Message Log", "RightIndent", 0, szIniFilename);
for (i=0; i < CUSTOM_COLORS; i++) {
- sprintf(szTemp, "cc%d", i + 1);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i + 1);
if (dat == 0)
db_set_dw(0, SRMSGMOD_T, szTemp, GetPrivateProfileIntA("Custom Colors", szTemp, RGB(224, 224, 224), szIniFilename));
else
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 7882420073..b64987ceae 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -608,7 +608,7 @@ static int OnModulesLoad(WPARAM wParam, LPARAM lParam) if ( HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnBGChange)) {
char buf[256];
- sprintf(buf, "TopToolBar Background/%s", TTB_OPTDIR);
+ mir_snprintf(buf, SIZEOF(buf), "TopToolBar Background/%s", TTB_OPTDIR);
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)buf, 0);
}
return 0;
diff --git a/plugins/VersionInfo/src/CVersionInfo.cpp b/plugins/VersionInfo/src/CVersionInfo.cpp index ed8e839e4d..4d668a1591 100644 --- a/plugins/VersionInfo/src/CVersionInfo.cpp +++ b/plugins/VersionInfo/src/CVersionInfo.cpp @@ -364,7 +364,7 @@ bool CVersionInfo::GetProfileSettings() WIN32_FIND_DATA fd;
if ( FindFirstFile(tszProfileName, &fd) != INVALID_HANDLE_VALUE ) {
TCHAR number[40];
- mir_sntprintf( number, SIZEOF(number), _T("%.2f KBytes"), double(fd.nFileSizeLow) / 1024 );
+ mir_sntprintf(number, SIZEOF(number), _T("%.2f KBytes"), double(fd.nFileSizeLow) / 1024);
lpzProfileSize = number;
FILETIME ftLocal;
@@ -378,7 +378,7 @@ bool CVersionInfo::GetProfileSettings() else {
DWORD error = GetLastError();
TCHAR tmp[1024];
- wsprintf(tmp, _T("%d"), error);
+ mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), error);
lpzProfileCreationDate = _T("<error ") + std::tstring(tmp) + _T(" at FileOpen>") + std::tstring(tszProfileName);
lpzProfileSize = _T("<error ") + std::tstring(tmp) + _T(" at FileOpen>") + std::tstring(tszProfileName);
}
@@ -769,7 +769,7 @@ bool CVersionInfo::GetPluginLists() TCHAR error[2048];
//DWORD_PTR arguments[2] = {loadError, 0};
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, loadError, 0, error, SIZEOF(error), NULL);
- wsprintf(buffer, _T(" Error %ld - %s"), loadError, error);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T(" Error %ld - %s"), loadError, error);
CPlugin thePlugin( fd.cFileName, _T("<unknown>"), UUID_NULL, _T(""), 0, time.c_str(), buffer);
AddPlugin(thePlugin, listUnloadablePlugins);
}
@@ -830,7 +830,7 @@ bool CVersionInfo::GetPluginLists() #ifdef _DEBUG
if (verbose) {
TCHAR szMsg[4096] = { 0 };
- wsprintf(szMsg, _T("Done with: %s"), fd.cFileName);
+ mir_sntprintf(szMsg, SIZEOF(szMsg), _T("Done with: %s"), fd.cFileName);
PUShowMessageT(szMsg, SM_NOTIFY);
}
#endif
@@ -905,15 +905,15 @@ bool CVersionInfo::GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedM TCHAR szError[20];
char* szModuleName = mir_t2a(moduleName);
if (MapAndLoad(szModuleName, NULL, &image, TRUE, TRUE) == FALSE) {
- wsprintf(szError, _T("%d"), GetLastError());
- mir_free( szModuleName );
+ mir_sntprintf(szError, SIZEOF(szError), _T("%d"), GetLastError());
+ mir_free(szModuleName);
linkedModules = _T("<error ") + std::tstring(szError) + _T(" at MapAndLoad()>\r\n");
return result;
}
- mir_free( szModuleName );
+ mir_free(szModuleName);
importData = (IMAGE_IMPORT_DESCRIPTOR *) ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &importTableSize);
if (!importData) {
- wsprintf(szError, _T("%d"), GetLastError());
+ mir_sntprintf(szError, SIZEOF(szError), _T("%d"), GetLastError());
linkedModules = _T("<error ") + std::tstring(szError) + _T(" at ImageDirectoryEntryToDataEx()>\r\n");
}
else {
@@ -1003,13 +1003,14 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif if (luiProcessors > 1) {
TCHAR noProcs[128];
- wsprintf(noProcs, _T(" [%d CPUs]"), luiProcessors);
+ mir_sntprintf(noProcs, SIZEOF(noProcs), _T(" [%d CPUs]"), luiProcessors);
out.append(noProcs);
}
out.append( _T("\r\n"));
//RAM
- TCHAR szRAM[64]; wsprintf(szRAM, _T("%d"), luiRAM);
+ TCHAR szRAM[64];
+ mir_sntprintf(szRAM, SIZEOF(szRAM), _T("%d"), luiRAM);
out.append( _T("Installed RAM: ") + std::tstring(szRAM) + _T(" MBytes\r\n"));
//operating system
@@ -1025,7 +1026,8 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif //FreeDiskSpace
if (luiFreeDiskSpace) {
- TCHAR szDiskSpace[64]; wsprintf(szDiskSpace, _T("%d"), luiFreeDiskSpace);
+ TCHAR szDiskSpace[64];
+ mir_sntprintf(szDiskSpace, SIZEOF(szDiskSpace), _T("%d"), luiFreeDiskSpace);
out.append( _T("Free disk space on Miranda partition: ") + std::tstring(szDiskSpace) + _T(" MBytes\r\n\r\n"));
}
@@ -1081,9 +1083,9 @@ void CVersionInfo::AddInfoFooter(int suppressFooter, int forumStyle, int beautif static void AddSectionAndCount(std::list<CPlugin> list, LPCTSTR listText, std::tstring &out)
{
TCHAR tmp[64];
- wsprintf(tmp, _T(" (%u)"), list.size());
+ mir_sntprintf(tmp, SIZEOF(tmp), _T(" (%u)"), list.size());
out.append(listText);
- out.append( tmp );
+ out.append(tmp);
out.append( _T(":"));
}
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp index 7b95614088..da31eabb5b 100644 --- a/plugins/Weather/src/weather_info.cpp +++ b/plugins/Weather/src/weather_info.cpp @@ -152,13 +152,13 @@ void GetINIInfo(TCHAR *pszSvc) // if the service does not exist among the loaded INI's
if (sData == NULL)
{
- wsprintf(str2, TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
+ mir_sntprintf(str2, SIZEOF(str2), TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK|MB_ICONINFORMATION);
}
// if exist, get the information
else
{
- wsprintf(str2, TranslateT("Weather INI information for \"%s\":"), pszSvc);
+ mir_sntprintf(str2, SIZEOF(str2), TranslateT("Weather INI information for \"%s\":"), pszSvc);
_tcscat(str2,_T("\n\n"));
_tcscat(str2, TranslateT("Name:"));
_tcscat(str2,_T("\t\t"));
@@ -192,9 +192,9 @@ void GetINIInfo(TCHAR *pszSvc) _tcscat(str2, sData->ShortFileName);
_tcscat(str2, _T("\n"));
_tcscat(str2, TranslateT("Item Count:"));
- wsprintf(str2, _T("%s\t%i\n"), str2, sData->UpdateDataCount);
+ mir_sntprintf(str2, SIZEOF(str2), _T("%s\t%i\n"), str2, sData->UpdateDataCount);
_tcscat(str2, TranslateT("Memory Used:"));
- wsprintf(str2, _T("%s\t%i "), str2, sData->MemUsed);
+ mir_sntprintf(str2, SIZEOF(str2), _T("%s\t%i "), str2, sData->MemUsed);
_tcscat(str2, TranslateT("bytes"));
_tcscat(str2,_T("\n\n"));
_tcscat(str2, TranslateT("Description:"));
@@ -228,7 +228,7 @@ void MoreVarList(void) // the custom variable is defined as "%[<variable name>]"
// ignore the "hi" item and hidden items
if ( _tcscmp(WItem->Item.Name, _T("Ignore")) && WItem->Item.Name[0] != '#') {
- wsprintf(tempstr, _T("%c[%s]"), '%', WItem->Item.Name);
+ mir_sntprintf(tempstr, SIZEOF(tempstr), _T("%c[%s]"), '%', WItem->Item.Name);
TCHAR* find = _tcsstr(str, tempstr);
// if the custom variable does not exist in the list, add it to the list
if (find == NULL) {
|