diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-02 05:19:23 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-02 05:19:23 +0000 |
commit | 114f83d5d8a73b3f1435e09b1d91aff843e4ce15 (patch) | |
tree | 0805188bf6bcf5749d1e76d5d1e73ccb6cf41cc4 /plugins | |
parent | 6e2b6b31bae6d69bff5271451e73eb08637b8118 (diff) |
mir_snprintf(..., "%s", ...) -> strncpy_s(...)
build fix to prevous commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@11212 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Clist_nicer/src/clcutils.cpp | 1 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/extBackg.cpp | 14 | ||||
-rw-r--r-- | plugins/CrashDumper/src/upload.cpp | 10 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_folders.h | 4 | ||||
-rw-r--r-- | plugins/FileAsMessage/src/dialog.cpp | 2 | ||||
-rw-r--r-- | plugins/IEView/src/HTMLBuilder.cpp | 4 | ||||
-rw-r--r-- | plugins/RecentContacts/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/Spamotron/src/bayes.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp | 2 | ||||
-rw-r--r-- | plugins/YahooGroups/src/services.cpp | 7 |
12 files changed, 27 insertions, 25 deletions
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index c700c5607c..f8026b4d2e 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -90,6 +90,7 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) memcpy(pOut, pSrc, (dwSrcLen * sizeof(TCHAR)));
pOut[dwSrcLen] = 0;
return dwSrcLen;
+ }
if (pSrc[0] == '.')
return (mir_sntprintf(pOut, MAX_PATH, _T("%s\\%s"), cfg::dat.tszProfilePath, pSrc));
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index d124c0cedc..74e848468d 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -973,7 +973,7 @@ static void BTN_ReadItem(char *itemName, char *file) ImageItem *imgItem = g_ImageItems;
memset(&tmpItem, 0, sizeof(tmpItem));
- mir_snprintf(tmpItem.szName, SIZEOF(tmpItem.szName), "%s", &itemName[1]);
+ strncpy_s(tmpItem.szName, &itemName[1], _TRUNCATE);
tmpItem.width = GetPrivateProfileIntA(itemName, "Width", 16, file);
tmpItem.height = GetPrivateProfileIntA(itemName, "Height", 16, file);
tmpItem.xOff = GetPrivateProfileIntA(itemName, "xoff", 0, file);
@@ -1048,7 +1048,7 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.szService[0] = 0;
GetPrivateProfileStringA(itemName, "Service", "None", szBuffer, 1000, file);
if (_stricmp(szBuffer, "None")) {
- mir_snprintf(tmpItem.szService, 256, "%s", szBuffer);
+ strncpy_s(tmpItem.szService, szBuffer, _TRUNCATE);
tmpItem.dwFlags |= BUTTON_ISSERVICE;
tmpItem.uId = nextButtonID++;
}
@@ -1057,7 +1057,7 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.szService[0] = 0;
GetPrivateProfileStringA(itemName, "Service", "None", szBuffer, 1000, file);
if (_stricmp(szBuffer, "None")) {
- mir_snprintf(tmpItem.szService, 256, "%s", szBuffer);
+ strncpy_s(tmpItem.szService, szBuffer, _TRUNCATE);
tmpItem.dwFlags |= BUTTON_ISPROTOSERVICE;
tmpItem.uId = nextButtonID++;
}
@@ -1067,10 +1067,10 @@ static void BTN_ReadItem(char *itemName, char *file) GetPrivateProfileStringA(itemName, "Module", "None", szBuffer, 1000, file);
if (_stricmp(szBuffer, "None"))
- mir_snprintf(tmpItem.szModule, 256, "%s", szBuffer);
+ strncpy_s(tmpItem.szModule, szBuffer, _TRUNCATE);
GetPrivateProfileStringA(itemName, "Setting", "None", szBuffer, 1000, file);
if (_stricmp(szBuffer, "None"))
- mir_snprintf(tmpItem.szSetting, 256, "%s", szBuffer);
+ strncpy_s(tmpItem.szSetting, szBuffer, _TRUNCATE);
if (GetPrivateProfileIntA(itemName, "contact", 0, file) != 0)
tmpItem.dwFlags |= BUTTON_DBACTIONONCONTACT;
@@ -1286,10 +1286,10 @@ void LoadPerContactSkins(TCHAR *tszFileName) char UIN[40];
switch (dbv.type) {
case DBVT_DWORD:
- mir_snprintf(UIN, 40, "%d", dbv.dVal);
+ mir_snprintf(UIN, SIZEOF(UIN), "%d", dbv.dVal);
break;
case DBVT_ASCIIZ:
- mir_snprintf(UIN, 40, "%s", dbv.pszVal);
+ strncpy_s(UIN, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
break;
default:
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 7b1d2350aa..fccdc858ce 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -40,10 +40,10 @@ void GetLoginStr(char* user, size_t szuser, char* pass) DBVARIANT dbv;
if (db_get_s(NULL, PluginName, "Username", &dbv) == 0) {
- mir_snprintf(user, szuser, "%s", dbv.pszVal);
+ strncpy_s(user, szuser, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
- }
- else user[0] = 0;
+ } else
+ user[0] = 0;
if (db_get_s(NULL, PluginName, "Password", &dbv) == 0) {
BYTE hash[16];
@@ -56,8 +56,8 @@ void GetLoginStr(char* user, size_t szuser, char* pass) arrayToHex(hash, sizeof(hash), pass);
db_free(&dbv);
- }
- else pass[0] = 0;
+ } else
+ pass[0] = 0;
}
void OpenAuthUrl(const char* url)
diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h index c54f7c3d18..4256e02355 100644 --- a/plugins/ExternalAPI/m_folders.h +++ b/plugins/ExternalAPI/m_folders.h @@ -172,7 +172,7 @@ __inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, co if (res) {
char buffer[MAX_PATH];
PathToAbsolute(notFound, buffer);
- mir_snprintf(path, size, "%s", buffer);
+ strncpy_s(path, size, buffer, _TRUNCATE);
}
return res;
@@ -205,7 +205,7 @@ __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, if (res) {
char buffer[MAX_PATH];
PathToAbsolute(notFound, buffer);
- mir_snprintf(path, size, "%s", buffer);
+ strncpy_s(path, size, buffer, _TRUNCATE);
}
if (path[0] != '\0')
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 21aa2775ba..9cc63c3929 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -1191,7 +1191,7 @@ INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam if(size != -1)
mir_snprintf(str, SIZEOF(str), Translate("Size: %d bytes"), size);
else
- mir_snprintf(str, SIZEOF(str), "%s", Translate("Can't get a file size"));
+ strncpy_s(str, Translate("Can't get a file size"), _TRUNCATE);
SetDlgItemText(hDlg, IDC_FILESIZE, str);
break;
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 3bc97efae4..08d7f0ac50 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -219,7 +219,7 @@ void HTMLBuilder::getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_snprintf(buf, SIZEOF(buf), "%s", ci.pszVal);
+ strncpy_s(buf, (char*)ci.pszVal, _TRUNCATE);
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
@@ -233,7 +233,7 @@ void HTMLBuilder::getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_snprintf(buf, SIZEOF(buf), "%s", ci.pszVal);
+ strncpy_s(buf, (char*)ci.pszVal, _TRUNCATE);
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp index e5c587613d..31462b55db 100644 --- a/plugins/RecentContacts/src/options.cpp +++ b/plugins/RecentContacts/src/options.cpp @@ -17,7 +17,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mir_snprintf(str, SIZEOF(str), "%d", LastUCOpt.MaxShownContacts);
SetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str);
- mir_snprintf(str, SIZEOF(str), "%s", LastUCOpt.DateTimeFormat.c_str());
+ strncpy_s(str, LastUCOpt.DateTimeFormat.c_str(), _TRUNCATE);
SetDlgItemTextA(hwndDlg, IDC_DATETIME, str);
SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lParam);
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 96d8e1a2ad..c3b663bd3f 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -441,7 +441,7 @@ void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_snprintf(buf, maxlen, "%s", ci.pszVal);
+ strncpy_s(buf, maxlen, (char*)ci.pszVal, _TRUNCATE);
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index d444e12411..d7b7518182 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -28,7 +28,7 @@ int CheckBayes() if (hBayesFolder)
FoldersGetCustomPath(hBayesFolder, bayesdb_fullpath, MAX_PATH, bayesdb_tmp);
else
- mir_snprintf(bayesdb_fullpath, SIZEOF(bayesdb_fullpath), "%s", bayesdb_tmp);
+ strncpy_s(bayesdb_fullpath, bayesdb_tmp, _TRUNCATE);
strcat(bayesdb_fullpath, "\\"BAYESDB_FILENAME);
if (_access(bayesdb_fullpath,0) == 0)
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index e0b8ef4229..e0aa1f7e61 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1197,7 +1197,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG static void SetupLogFormatting(TWindowData *dat)
{
if (dat->hHistoryEvents)
- mir_snprintf(dat->szMicroLf, SIZEOF(dat->szMicroLf), "%s", "\\v\\cf%d \\ ~-+%d+-~\\v0 ");
+ strncpy_s(dat->szMicroLf, "\\v\\cf%d \\ ~-+%d+-~\\v0 ", _TRUNCATE);
else
mir_snprintf(dat->szMicroLf, SIZEOF(dat->szMicroLf), "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT));
}
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 12201aea07..d0f2a7e6f7 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -297,7 +297,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) mir_snprintf(name, SIZEOF(name),"(UNKNOWN) (%s)", _pszProto); } else - mir_snprintf(name, SIZEOF(name),"%s", "(UNKNOWN)"); + strncpy_s(name, "(UNKNOWN)", _TRUNCATE); } else { // Proto loadet - GetContactName(hContact,pszProto,0) diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index d0de915c21..645bae1282 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -93,8 +93,9 @@ void AddNewGroup(char *newGroup) char tmp[128];
char group[1024];
+
*group = 1;
- mir_snprintf((group + 1), (SIZEOF(group) - 1), "%s", newGroup);
+ strncpy_s((group + 1), (SIZEOF(group) - 1), newGroup, _TRUNCATE);
mir_snprintf(tmp, SIZEOF(tmp), "%d", index);
const int MAX_SIZE = 1024;
@@ -129,7 +130,7 @@ void CreateGroup(char *group) strncat(buffer, sub, sizeof(buffer));
}
else{
- mir_snprintf(buffer, SIZEOF(buffer), "%s", sub);
+ strncpy_s(buffer, sub, _TRUNCATE);
}
if (!availableGroups.Contains(buffer))
@@ -149,7 +150,7 @@ void CreateGroup(char *group) strncat(buffer, sub, sizeof(buffer));
}
else{
- mir_snprintf(buffer, SIZEOF(buffer), "%s", sub);
+ strncpy_s(buffer, sub, _TRUNCATE);
}
if (!availableGroups.Contains(buffer))
|