diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-16 13:43:06 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-16 13:43:06 +0000 |
commit | eefe0f0d556fbf3d77602d0a99b9134505050756 (patch) | |
tree | 41eef7b1ea9fca98c8e22be29ba0eb07fffb19e1 /src/modules | |
parent | 9d8530d69c5896d91e8e9468e769a4eafb9cc53b (diff) |
in _tcsncpy_s / _tcsncat_s / strncpy_s / strncat_s the second parameter to be omitted if the size of first one is fixed (not to contaminate sources with the excessive code)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9829 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/chat/chat_opts.cpp | 18 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/clist.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/tools.cpp | 2 | ||||
-rw-r--r-- | src/modules/database/database.cpp | 4 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_edit.cpp | 2 | ||||
-rw-r--r-- | src/modules/utils/path.cpp | 8 |
7 files changed, 19 insertions, 19 deletions
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index ffcd82d6d9..428d1e72f8 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -124,7 +124,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (tszFace == NULL)
lstrcpy(lf->lfFaceName, FO.szDefFace);
else
- _tcsncpy_s(lf->lfFaceName, SIZEOF(lf->lfFaceName), tszFace, _TRUNCATE);
+ _tcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
}
}
@@ -136,13 +136,13 @@ void RegisterFonts(void) FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART;
- _tcsncpy_s(fontid.backgroundGroup, SIZEOF(fontid.backgroundGroup), g_szFontGroup, _TRUNCATE);
- _tcsncpy_s(fontid.group, SIZEOF(fontid.group), g_szFontGroup, _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundGroup, g_szFontGroup, _TRUNCATE);
+ _tcsncpy_s(fontid.group, g_szFontGroup, _TRUNCATE);
for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) {
FontOptionsList &FO = fontOptionsList[i];
strncpy(fontid.dbSettingsGroup, CHATFONT_MODULE, sizeof(fontid.dbSettingsGroup));
- _tcsncpy_s(fontid.name, SIZEOF(fontid.name), FO.szDescr, _TRUNCATE);
+ _tcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE);
char idstr[10];
mir_snprintf(idstr, SIZEOF(idstr), "Font%d", index);
@@ -152,25 +152,25 @@ void RegisterFonts(void) switch (i) {
case 18:
case 19:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Nick list background"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, LPGENT("Nick list background"), _TRUNCATE);
break;
case 17:
if (g_iFontMode == FONTMODE_SKIP)
continue;
if (g_iFontMode == FONTMODE_USE) {
- _tcsncpy_s(fontid.name, SIZEOF(fontid.name), LPGENT("Message typing area"), _TRUNCATE);
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Message background"), _TRUNCATE);
+ _tcsncpy_s(fontid.name, LPGENT("Message typing area"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, LPGENT("Message background"), _TRUNCATE);
FO.defColour = RGB(0, 0, 40);
break;
}
- _tcsncpy_s(fontid.name, SIZEOF(fontid.name), LPGENT("Chat log symbols (Webdings)"), _TRUNCATE);
+ _tcsncpy_s(fontid.name, LPGENT("Chat log symbols (Webdings)"), _TRUNCATE);
FO.szDefFace = _T("Webdings");
FO.defColour = RGB(170, 170, 170);
FO.defCharset = SYMBOL_CHARSET;
// fall through
default:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Group chat log background"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, LPGENT("Group chat log background"), _TRUNCATE);
break;
}
_tcsncpy(fontid.deffontsettings.szFace, FO.szDefFace, SIZEOF(fontid.deffontsettings.szFace));
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 211e913d83..7363c4b36f 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -232,7 +232,7 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam) if (si->iType == GCW_SERVER)
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("Server: %s"), si->ptszName);
else
- _tcsncpy_s(szTemp, SIZEOF(szTemp), si->ptszName, _TRUNCATE);
+ _tcsncpy_s(szTemp, si->ptszName, _TRUNCATE);
si->hContact = ci.AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
db_set_s(si->hContact, si->pszModule, "Topic", "");
db_unset(si->hContact, "CList", "StatusMsg");
diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index a9e55d5fa6..d4de18e515 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -27,7 +27,7 @@ MCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDi TCHAR pszGroup[50]; *pszGroup = '\0';
ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
if (groupName)
- _tcsncpy_s(pszGroup, SIZEOF(pszGroup), groupName, _TRUNCATE);
+ _tcsncpy_s(pszGroup, groupName, _TRUNCATE);
else
_tcscpy(pszGroup, _T("Chat rooms"));
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index dd74d42f1a..284753c0b4 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -744,7 +744,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) // we have to reparse the filename
TCHAR *tszNow = ci.MakeTimeStamp(_T("%a%d%m%Y"), tTime); // once a day
if (_tcscmp(tszOldTimeStamp, tszNow)) {
- _tcsncpy_s(tszOldTimeStamp, 30, tszNow, _TRUNCATE);
+ _tcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
*si->pszLogFileName = 0;
}
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 58112c2ac4..9ede9ce6e9 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -52,9 +52,9 @@ static void fillProfileName(const TCHAR* ptszFileName) else
p++;
- _tcsncpy_s(g_profileName, SIZEOF(g_profileName), p, _TRUNCATE);
+ _tcsncpy_s(g_profileName, p, _TRUNCATE);
- _tcsncpy_s(g_shortProfileName, SIZEOF(g_shortProfileName), p, _TRUNCATE);
+ _tcsncpy_s(g_shortProfileName, p, _TRUNCATE);
TCHAR *pos = _tcsrchr(g_shortProfileName, '.');
if (lstrcmpi(pos, _T(".dat")) == 0)
*pos = 0;
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index 51a8a4f3e9..20bbf3680d 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -97,7 +97,7 @@ static void FillContactList(HWND hList) SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem); // Enter text to SubItems
LvItem.iSubItem = 2; // protocol
- _tcsncpy_s(buff, SIZEOF(buff), (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
+ _tcsncpy_s(buff, (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
ListView_SetItem(hList, &LvItem);
}
else {
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 2a4bcaa530..0bd1e79383 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -178,7 +178,7 @@ static __forceinline char *GetPathVarX(char *, int code) switch(code) {
case 1:
if (hAvatarFolder != NULL)
- _tcsncpy_s(szFullPath, SIZEOF(szFullPath), tszAvatarRoot, _TRUNCATE);
+ _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
break;
@@ -262,7 +262,7 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code) switch(code) {
case 1:
if (hAvatarFolder != NULL)
- _tcsncpy_s(szFullPath, SIZEOF(szFullPath), tszAvatarRoot, _TRUNCATE);
+ _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
break;
@@ -434,7 +434,7 @@ static int OnFoldersChanged(WPARAM, LPARAM) TCHAR tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot))
- _tcsncpy_s(tszAvatarRoot, SIZEOF(tszAvatarRoot), tmpVar, SIZEOF(tmpVar));
+ _tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
return 0;
}
@@ -444,7 +444,7 @@ void InitPathVar() if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
TCHAR tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot))
- _tcsncpy_s(tszAvatarRoot, SIZEOF(tszAvatarRoot), tmpVar, SIZEOF(tmpVar));
+ _tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
}
}
|