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 /plugins/BasicHistory | |
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 'plugins/BasicHistory')
-rw-r--r-- | plugins/BasicHistory/src/EventList.cpp | 8 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Options.cpp | 26 |
2 files changed, 17 insertions, 17 deletions
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 6a822b8312..d114f3eae6 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -492,10 +492,10 @@ std::wstring EventList::GetContactId() static void GetMessageDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
{
- TCHAR* msg = DbGetEventTextT( dbei, CP_ACP );
- _tcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid Message"), cbBuf - 1 );
- buf[ cbBuf-1 ] = 0;
- mir_free( msg );
+ TCHAR *msg = DbGetEventTextT(dbei, CP_ACP);
+ _tcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid Message"), _TRUNCATE);
+ buf[cbBuf - 1] = 0;
+ mir_free(msg);
}
void EventList::GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr )
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 0d0e56198c..bed9f30bdb 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -244,27 +244,27 @@ void Options::Load(void) fid.cbSize = sizeof(FontIDT);
cid.cbSize = sizeof(ColourIDT);
hid.cbSize = sizeof(HOTKEYDESC);
- strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", SIZEOF(fid.dbSettingsGroup));
- _tcsncpy_s(fid.backgroundGroup, _T("History"), SIZEOF(fid.backgroundGroup));
- _tcsncpy_s(fid.group, LPGENT("History"), SIZEOF(fid.group));
+ strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE);
+ _tcsncpy_s(fid.backgroundGroup, _T("History"), _TRUNCATE);
+ _tcsncpy_s(fid.group, LPGENT("History"), _TRUNCATE);
for (int i = 0; i < g_fontsSize; ++i) {
fid.order = i;
- _tcsncpy_s(fid.deffontsettings.szFace, g_FontOptionsList[i].szDefFace, LF_FACESIZE);
+ _tcsncpy_s(fid.deffontsettings.szFace, g_FontOptionsList[i].szDefFace, _TRUNCATE);
fid.deffontsettings.size = g_FontOptionsList[i].defSize;
fid.deffontsettings.colour = g_FontOptionsList[i].defColour;
fid.deffontsettings.style = g_FontOptionsList[i].defStyle;
fid.deffontsettings.charset = DEFAULT_CHARSET;
mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "Font%d", i);
- _tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, SIZEOF(fid.name));
- _tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, SIZEOF(fid.name));
+ _tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, _TRUNCATE);
+ _tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, _TRUNCATE);
fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags;
FontRegisterT(&fid);
}
- strncpy_s(cid.dbSettingsGroup, "BasicHistory_Fonts", SIZEOF(fid.dbSettingsGroup));
- _tcsncpy_s(cid.group, LPGENT("History"), SIZEOF(fid.group));
+ strncpy_s(cid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE);
+ _tcsncpy_s(cid.group, LPGENT("History"), _TRUNCATE);
for (int i = 0; i < g_colorsSize; ++i) {
- _tcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, SIZEOF(cid.name));
+ _tcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, _TRUNCATE);
mir_snprintf(cid.setting, SIZEOF(cid.setting), "Color%d", i);
cid.order = i;
cid.defcolour = g_ColorOptionsList[i].def;
@@ -417,8 +417,8 @@ COLORREF Options::GetFont(Fonts fontId, PLOGFONT font) {
FontIDT fid = {0};
fid.cbSize = sizeof(FontIDT);
- _tcsncpy_s(fid.group, LPGENT("History"), SIZEOF(fid.group));
- _tcsncpy_s(fid.name, g_FontOptionsList[fontId].szDescr, SIZEOF(fid.name));
+ _tcsncpy_s(fid.group, LPGENT("History"), _TRUNCATE);
+ _tcsncpy_s(fid.name, g_FontOptionsList[fontId].szDescr, _TRUNCATE);
return (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)font);
}
@@ -426,8 +426,8 @@ COLORREF Options::GetColor(Colors colorId) {
ColourIDT cid = {0};
cid.cbSize = sizeof(ColourIDT);
- _tcsncpy_s(cid.group, LPGENT("History"), SIZEOF(cid.group));
- _tcsncpy_s(cid.name, g_ColorOptionsList[colorId].tszName, SIZEOF(cid.name));
+ _tcsncpy_s(cid.group, LPGENT("History"), _TRUNCATE);
+ _tcsncpy_s(cid.name, g_ColorOptionsList[colorId].tszName, _TRUNCATE);
return (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, NULL);
}
|