summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-16 13:43:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-16 13:43:06 +0000
commiteefe0f0d556fbf3d77602d0a99b9134505050756 (patch)
tree41eef7b1ea9fca98c8e22be29ba0eb07fffb19e1 /plugins
parent9d8530d69c5896d91e8e9468e769a4eafb9cc53b (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')
-rw-r--r--plugins/AVS/src/cache.cpp16
-rw-r--r--plugins/AVS/src/utils.cpp2
-rw-r--r--plugins/BasicHistory/src/EventList.cpp8
-rw-r--r--plugins/BasicHistory/src/Options.cpp26
-rw-r--r--plugins/Clist_modern/src/modern_tbbutton.cpp2
-rw-r--r--plugins/Clist_mw/src/clcfonts.cpp2
-rw-r--r--plugins/Clist_nicer/src/CLCButton.cpp2
-rw-r--r--plugins/Clist_nicer/src/clui.cpp2
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp4
-rw-r--r--plugins/Exchange/src/emails.cpp2
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_fct.cpp48
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp69
-rw-r--r--plugins/MyDetails/src/data.cpp4
-rw-r--r--plugins/PackUpdater/Src/Notifications.cpp2
-rw-r--r--plugins/Popup/src/bitmap_funcs.cpp25
-rw-r--r--plugins/Scriver/src/chat/window.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp8
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp6
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp2
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp2
-rw-r--r--plugins/Weather/src/weather_opt.cpp4
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp2
-rw-r--r--plugins/WebView/src/webview_opts.cpp6
-rw-r--r--plugins/WebView/src/webview_services.cpp2
-rw-r--r--plugins/YARelay/src/main.cpp2
26 files changed, 120 insertions, 132 deletions
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index 4e7c28bdab..999d9cba53 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -172,13 +172,13 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY
// Get hash
char *szProto = GetContactProto(hContact);
if (szProto != NULL) {
- DBVARIANT dbv = {0};
- if ( !db_get_s(hContact, szProto, "AvatarHash", &dbv)) {
+ DBVARIANT dbv = { 0 };
+ if (!db_get_s(hContact, szProto, "AvatarHash", &dbv)) {
if (dbv.type == DBVT_TCHAR)
- _tcsncpy_s(cacn.hash, SIZEOF(cacn.hash), dbv.ptszVal, _TRUNCATE);
+ _tcsncpy_s(cacn.hash, dbv.ptszVal, _TRUNCATE);
else if (dbv.type == DBVT_BLOB) {
- ptrA szHash( mir_base64_encode(dbv.pbVal, dbv.cpbVal));
- _tcsncpy_s(cacn.hash, SIZEOF(cacn.hash), _A2T(szHash), _TRUNCATE);
+ ptrA szHash(mir_base64_encode(dbv.pbVal, dbv.cpbVal));
+ _tcsncpy_s(cacn.hash, _A2T(szHash), _TRUNCATE);
}
db_free(&dbv);
}
@@ -206,7 +206,7 @@ void DeleteAvatarFromCache(MCONTACT hContact, BOOL forever)
hContact = GetContactThatHaveTheAvatar(hContact);
CacheNode *node = FindAvatarInCache(hContact, FALSE);
if (node == NULL) {
- struct CacheNode temp_node = {0};
+ struct CacheNode temp_node = { 0 };
temp_node.dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0);
NotifyMetaAware(hContact, &temp_node, (AVATARCACHEENTRY *)GetProtoDefaultAvatar(hContact));
return;
@@ -252,10 +252,10 @@ void PicLoader(LPVOID param)
else if (dwDelay > 100)
dwDelay = 100;
- while(!g_shutDown) {
+ while (!g_shutDown) {
CacheNode *node = g_Cache;
- while(!g_shutDown && node) {
+ while (!g_shutDown && node) {
if (node->mustLoad > 0 && node->ace.hContact) {
node->mustLoad = 0;
AVATARCACHEENTRY ace_temp;
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp
index 244282cc25..e4ab45e2ff 100644
--- a/plugins/AVS/src/utils.cpp
+++ b/plugins/AVS/src/utils.cpp
@@ -244,7 +244,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
if ( lstrlen(tszFilename) < 4)
return -1;
- _tcsncpy_s(tszFilename, SIZEOF(tszFilename), VARST(tszFilename), _TRUNCATE);
+ _tcsncpy_s(tszFilename, VARST(tszFilename), _TRUNCATE);
if ((hFile = CreateFile(tszFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE)
return -2;
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);
}
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp
index 2825a8259d..4274347583 100644
--- a/plugins/Clist_modern/src/modern_tbbutton.cpp
+++ b/plugins/Clist_modern/src/modern_tbbutton.cpp
@@ -240,7 +240,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_SETTEXT:
- _tcsncpy_s(bct->szText, SIZEOF(bct->szText), (TCHAR*)lParam, _TRUNCATE);
+ _tcsncpy_s(bct->szText, (TCHAR*)lParam, _TRUNCATE);
break;
case WM_SETFONT:
diff --git a/plugins/Clist_mw/src/clcfonts.cpp b/plugins/Clist_mw/src/clcfonts.cpp
index 7794139d37..de73ee3600 100644
--- a/plugins/Clist_mw/src/clcfonts.cpp
+++ b/plugins/Clist_mw/src/clcfonts.cpp
@@ -66,7 +66,7 @@ void RegisterCListFonts()
pcli->pfnGetFontSetting(i, &lf, &fontid.deffontsettings.colour);
lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- _tcsncpy_s(fontid.deffontsettings.szFace, SIZEOF(fontid.deffontsettings.szFace), lf.lfFaceName, _TRUNCATE);
+ _tcsncpy_s(fontid.deffontsettings.szFace, lf.lfFaceName, _TRUNCATE);
fontid.deffontsettings.charset = lf.lfCharSet;
fontid.deffontsettings.size = (char)lf.lfHeight;
fontid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0);
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp
index 5cbf3fd6d6..a01c7b45bd 100644
--- a/plugins/Clist_nicer/src/CLCButton.cpp
+++ b/plugins/Clist_nicer/src/CLCButton.cpp
@@ -390,7 +390,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
break;
case WM_SETTEXT:
- _tcsncpy_s(bct->szText, SIZEOF(bct->szText), (TCHAR*)lParam, _TRUNCATE);
+ _tcsncpy_s(bct->szText, (TCHAR*)lParam, _TRUNCATE);
break;
case BM_GETIMAGE:
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 9b8263034c..20c8e4a103 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -2061,7 +2061,7 @@ void FS_RegisterFonts()
pcli->pfnGetFontSetting(i, &lf, &fid.deffontsettings.colour);
lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- _tcsncpy_s(fid.deffontsettings.szFace, SIZEOF(fid.deffontsettings.szFace), lf.lfFaceName, _TRUNCATE);
+ _tcsncpy_s(fid.deffontsettings.szFace, lf.lfFaceName, _TRUNCATE);
fid.deffontsettings.charset = lf.lfCharSet;
fid.deffontsettings.size = (char)lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0);
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 91be0a6a42..7c2ffab9e5 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -72,11 +72,11 @@ BOOL strrep(TCHAR *src,TCHAR *needle,TCHAR *newstring)
return FALSE;
pos=(int)(found-src);
- _tcsncpy_s(begining,_countof(begining),src,pos);
+ _tcsncpy_s(begining, src, pos);
begining[pos]='\0';
pos=pos+(int)_tcslen(needle);
- _tcsncpy_s(tail,_countof(tail),src+pos,sizeof(tail));
+ _tcsncpy_s(tail, src+pos, _TRUNCATE);
begining[pos]='\0';
pos=mir_sntprintf(src,_tcslen(src),_T("%s%s%s"),begining,newstring,tail);
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp
index 696c595b02..d6dd60bc79 100644
--- a/plugins/Exchange/src/emails.cpp
+++ b/plugins/Exchange/src/emails.cpp
@@ -61,7 +61,7 @@ int CExchangeServer::Connect(int bForceConnect)
GetStringFromDatabase("Username", _T(""), user, _countof(user));
if (ServiceExists(MS_UTILS_REPLACEVARS))
- _tcsncpy_s(user, _countof(user), VARST(user), _TRUNCATE);
+ _tcsncpy_s(user, VARST(user), _TRUNCATE);
GetStringFromDatabase("Password", _T(""), password, _countof(password));
GetStringFromDatabase("Server", _T(""), server, _countof(server));
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
index 40d45560fa..81dc82af75 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
@@ -150,7 +150,7 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart)
if ( (_tcsstr(wordsearch, _T("www.")) != NULL) && (_tcsstr(wordsearch, _T("http://")) == NULL))
{
- _tcsncpy_s(link, _countof(link), _T("http://"), _mstrlen(_T("http://")));
+ _tcsncpy_s(link, _T("http://"), _mstrlen(_T("http://")));
// Link longer than defined max -> cut link to max
if ( (i-wordStart+1) > (int)(LINK_MAX-_mstrlen(_T("http://"))))
_tcsncpy_s(link + _mstrlen(_T("http://")), _countof(link), word, LINK_MAX - _mstrlen(_T("http://")));
@@ -164,7 +164,7 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart)
link_size = LINK_MAX;
else
link_size = i-wordStart+1;
- _tcsncpy_s(link, _countof(link), word, link_size);
+ _tcsncpy_s(link, word, link_size);
}
dbtimestring.szFormat = _T("d-t");
@@ -173,8 +173,8 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart)
CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT,(WPARAM)dbei->timestamp, (LPARAM)&dbtimestring);
date_ptr = _tcstok_s(dbdate, _T("-"), &tok_ctx);
time_ptr = _tcstok_s(NULL, _T("-"), &tok_ctx);
- _tcsncpy_s(date, _countof(date), date_ptr, DATE_SIZE);
- _tcsncpy_s(time, _countof(time), time_ptr, TIME_SIZE);
+ _tcsncpy_s(date, date_ptr, _TRUNCATE);
+ _tcsncpy_s(time, time_ptr, _TRUNCATE);
// Prevent overflow
date[DATE_SIZE] = _T('\0');
time[TIME_SIZE] = _T('\0');
@@ -187,9 +187,9 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart)
if ( type == LINK_MAIL && _tcsstr(link, _T("mailto:")) == NULL )
{
- _tcsncpy_s(templink, _countof(templink), link, LINK_MAX-1);
- _tcsncpy_s(link, _countof(link), _T("mailto:"), LINK_MAX-1);
- _tcsncpy_s(link + _mstrlen(_T("mailto:")), _countof(link), templink, LINK_MAX-_mstrlen(_T("mailto:"))-1);
+ _tcsncpy_s(templink, link, _TRUNCATE);
+ _tcsncpy_s(link, _T("mailto:"), _TRUNCATE);
+ _tcsncpy_s(link + _mstrlen(_T("mailto:")), _countof(link), templink, _TRUNCATE);
}
// Add new Element to list:
@@ -200,9 +200,9 @@ int ExtractURI(DBEVENTINFO *dbei, HANDLE hEvent, LISTELEMENT *listStart)
ZeroMemory(newElement, sizeof(LISTELEMENT));
newElement->direction = direction;
newElement->type = type;
- _tcsncpy_s(newElement->date, _countof(newElement->date), date, DATE_SIZE-1);
- _tcsncpy_s(newElement->time, _countof(newElement->time), time, TIME_SIZE-1);
- _tcsncpy_s(newElement->link, _countof(newElement->link), link, LINK_MAX-1);
+ _tcsncpy_s(newElement->date, date, _TRUNCATE);
+ _tcsncpy_s(newElement->time, time, _TRUNCATE);
+ _tcsncpy_s(newElement->link, link, _TRUNCATE);
newElement->hEvent = hEvent;
actualElement = listStart;
@@ -334,7 +334,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_FACE | CFM_COLOR;
cf.dwEffects = CFE_BOLD;
cf.crTextColor = colourSet.text;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Arial"));
+ _tcscpy_s(cf.szFaceName, _T("Arial"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
ZeroMemory(searchText, _countof(searchText)*sizeof(TCHAR));
@@ -346,7 +346,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
ZeroMemory(&cf, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_BOLD;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Courier"));
+ _tcscpy_s(cf.szFaceName, _T("Courier"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf);
}
@@ -357,13 +357,13 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
linePos = GetLastLinePos(listStart);
if ((realListCount - append) == 1)
- _tcscpy_s(lastDate, _countof(lastDate), actualElement->date);
+ _tcscpy_s(lastDate, actualElement->date);
for(appCount = 1; appCount <= (realListCount - append); appCount++)
{
actualElement = actualElement->nextElement;
if(appCount == (realListCount - append - 1))
- _tcscpy_s(lastDate, _countof(lastDate), actualElement->date);
+ _tcscpy_s(lastDate, actualElement->date);
}
gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
@@ -447,7 +447,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_FACE;
cf.dwEffects = CFE_BOLD;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Arial"));
+ _tcscpy_s(cf.szFaceName, _T("Arial"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
if ( options.showDate != 0 )
{
@@ -455,11 +455,11 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM) _T("\n\n"));
linePos += 3;
}
- _tcscpy_s(lastDate, _countof(lastDate), actualElement->date);
+ _tcscpy_s(lastDate, actualElement->date);
ZeroMemory( &cf, sizeof(cf));
cf.cbSize = sizeof cf;
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_UNDERLINE | CFM_FACE;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Courier"));
+ _tcscpy_s(cf.szFaceName, _T("Courier"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
}
ZeroMemory( &cf, sizeof(cf));
@@ -517,7 +517,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_FACE;
cf.dwEffects = CFE_BOLD;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Arial"));
+ _tcscpy_s(cf.szFaceName, _T("Arial"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)TranslateT("No messages found!\nPlease change current filter options."));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)_T("\n"));
@@ -557,7 +557,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B
ZeroMemory(&cf, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_BOLD | CFM_ITALIC | CFM_COLOR;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Courier"));
+ _tcscpy_s(cf.szFaceName, _T("Courier"));
cf.crTextColor = TxtColourSel;
SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
if ( options->showLine == 1 )
@@ -569,7 +569,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_BOLD | CFM_FACE | CFM_COLOR;
cf.dwEffects = CFE_BOLD;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Arial"));
+ _tcscpy_s(cf.szFaceName, _T("Arial"));
cf.crTextColor = TxtColourSel;
SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
@@ -581,7 +581,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B
ZeroMemory(&cf, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_UNDERLINE | CFM_FACE;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Courier"));
+ _tcscpy_s(cf.szFaceName, _T("Courier"));
SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM) &cf);
// incoming
@@ -589,7 +589,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR | CFM_FACE;
cf.crTextColor = InColourSel;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Courier"));
+ _tcscpy_s(cf.szFaceName, _T("Courier"));
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf );
if ( options->showDirection == 1 )
@@ -612,7 +612,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR | CFM_FACE;
cf.crTextColor = OutColourSel;
- _tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), _T("Courier"));
+ _tcscpy_s(cf.szFaceName, _T("Courier"));
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf);
@@ -1274,7 +1274,7 @@ BOOL SaveEditAsStream( HWND hDlg )
TCHAR szFilename[MAX_PATH];
// Initialize filename field
- _tcscpy_s(szFilename, _countof(szFilename), _T("*.rtf"));
+ _tcscpy_s(szFilename, _T("*.rtf"));
// Fill in OPENFILENAME struct
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index 7b7dbd1e23..fd18559cf1 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -286,16 +286,15 @@ BOOL checkFilters(TCHAR* str, int field)
{
TCHAR buff[512] = _T("");
TCHAR *strptr = NULL;
- switch(field)
- {
+ switch(field) {
case 0:
- _tcsncpy_s(buff, SIZEOF(buff), settingFilterSender, SIZEOF(buff));
+ _tcsncpy_s(buff, settingFilterSender, _TRUNCATE);
break;
case 1:
- _tcsncpy_s(buff, SIZEOF(buff), settingFilterSubject, SIZEOF(buff));
+ _tcsncpy_s(buff, settingFilterSubject, _TRUNCATE);
break;
case 2:
- _tcsncpy_s(buff, SIZEOF(buff), settingFilterTo, SIZEOF(buff));
+ _tcsncpy_s(buff, settingFilterTo, _TRUNCATE);
break;
}
@@ -303,8 +302,8 @@ BOOL checkFilters(TCHAR* str, int field)
while(strptr = _tcschr(buff, ';'))
{
TCHAR tmp[512] = TEXT(""), *ptr;
- _tcsncpy_s(tmp, SIZEOF(tmp), buff, (strptr-buff));
- _tcsncpy_s(buff, SIZEOF(buff), strptr + 1, SIZEOF(buff));
+ _tcsncpy_s(tmp, buff, (strptr-buff));
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
if(_tcsstr(_tcslwr(ptr=_tcsdup(str)),_tcslwr(tmp)))
{
@@ -512,8 +511,8 @@ void ErMsgT(TCHAR* msg)
log_p(L"Error: %S", msg);
if(settingShowError && !isPopupWaiting) {
TCHAR buffer[256+14];
- _tcsncpy_s(buffer, _countof(buffer), _T("LotusNotify: "), SIZEOF(buffer));
- _tcscat_s(buffer, _countof(buffer), msg);
+ _tcsncpy_s(buffer, _T("LotusNotify: "), _TRUNCATE);
+ _tcscat_s(buffer, msg);
isPopupWaiting = TRUE;
PUShowMessageT(buffer, SM_WARNING);
isPopupWaiting = FALSE;
@@ -761,15 +760,13 @@ void checkthread(void*)
ZeroMemory(msgFrom,512);
ZeroMemory(msgSubject,512);
- if(wcslen(field_from_UNICODE) < 512 && wcslen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE){
- _tcsncpy_s(msgFrom, SIZEOF(msgFrom), &(field_from_UNICODE[3]), wcscspn(field_from_UNICODE, L"/")-3 );
- } else {
- _tcsncpy_s(msgFrom, SIZEOF(msgFrom), field_from_UNICODE, _TRUNCATE);
- }
+ if(wcslen(field_from_UNICODE) < 512 && wcslen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE)
+ _tcsncpy_s(msgFrom, &(field_from_UNICODE[3]), wcscspn(field_from_UNICODE, L"/")-3 );
+ else
+ _tcsncpy_s(msgFrom, field_from_UNICODE, _TRUNCATE);
- for (Att = 0; (MailGetMessageAttachmentInfo1)(note_handle, Att,&bhAttachment, NULL, &cSize, NULL, NULL, NULL, NULL); Att++) {
+ for (Att = 0; (MailGetMessageAttachmentInfo1)(note_handle, Att,&bhAttachment, NULL, &cSize, NULL, NULL, NULL, NULL); Att++)
attSize += cSize;
- }
#ifdef _DEBUG
log_p(L"checkthread: MAIL INFO: date=[%S], from=[%s], to=[%s], cc=[%s], sub=[%s], attSize=[%d]"
@@ -998,13 +995,13 @@ void LoadSettings()
db_free(&dbv);
if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSender",&dbv))
- _tcsncpy_s(settingFilterSender, SIZEOF(settingFilterSender), dbv.ptszVal, SIZEOF(settingFilterSender));
+ _tcsncpy_s(settingFilterSender, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSubject",&dbv))
- _tcsncpy_s(settingFilterSubject, SIZEOF(settingFilterSubject), dbv.ptszVal, SIZEOF(settingFilterSubject));
+ _tcsncpy_s(settingFilterSubject, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
if(!db_get_ts(NULL, PLUGINNAME, "LNFilterTo",&dbv))
- _tcsncpy_s(settingFilterTo ,SIZEOF(settingFilterTo), dbv.ptszVal, SIZEOF(settingFilterTo));
+ _tcsncpy_s(settingFilterTo, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
settingOnceOnly = db_get_b (NULL, PLUGINNAME, "LNOnceOnly",0);
@@ -1105,28 +1102,28 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
TCHAR buff[512];
TCHAR* strptr;
- _tcsncpy_s(buff, SIZEOF(buff), settingFilterSender, SIZEOF(buff));
+ _tcsncpy_s(buff, settingFilterSender, _TRUNCATE);
while(strptr = _tcschr(buff, TEXT(';'))) {
TCHAR tmp[512] = TEXT("");
- _tcsncpy_s(tmp, SIZEOF(tmp), buff, (strptr-buff));
+ _tcsncpy_s(tmp, buff, (strptr-buff));
SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER , CB_ADDSTRING, 0, (LPARAM)tmp);
- _tcsncpy_s(buff, SIZEOF(buff), strptr + 1, SIZEOF(buff));
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
}
- _tcsncpy_s(buff, SIZEOF(buff), settingFilterSubject, SIZEOF(buff) );
+ _tcsncpy_s(buff, settingFilterSubject, _TRUNCATE);
while(strptr = _tcschr(buff, TEXT(';'))) {
TCHAR tmp[512] = TEXT("");
- _tcsncpy_s(tmp, SIZEOF(tmp), buff, (strptr-buff));
+ _tcsncpy_s(tmp, buff, (strptr-buff));
SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT , CB_ADDSTRING, 0, (LPARAM)tmp);
- _tcsncpy_s(buff, SIZEOF(buff), strptr + 1, SIZEOF(buff));
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
}
- _tcsncpy_s(buff, SIZEOF(buff), settingFilterTo, SIZEOF(buff) );
+ _tcsncpy_s(buff, settingFilterTo, _TRUNCATE);
while(strptr = _tcschr(buff, TEXT(';'))) {
TCHAR tmp[512] = TEXT("");
- _tcsncpy_s(tmp, SIZEOF(tmp), buff, (strptr-buff));
+ _tcsncpy_s(tmp, buff, (strptr-buff));
SendDlgItemMessage(hwndDlg, IDC_FILTER_TO , CB_ADDSTRING, 0, (LPARAM)tmp);
- _tcsncpy_s(buff, SIZEOF(buff), strptr + 1, SIZEOF(buff));
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
}
break;
@@ -1292,7 +1289,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0);
}
- _tcsncpy_s(settingFilterSender, SIZEOF(settingFilterSender), TEXT(""), SIZEOF(settingFilterSender));
+ settingFilterSender[0] = 0;
for(i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_GETCOUNT, 0, (LONG)0); i++){
TCHAR text[512] = TEXT("");
SendDlgItemMessage(hwndDlg,IDC_FILTER_SENDER ,CB_GETLBTEXT,(WPARAM)i,(LONG) (LPSTR)text);
@@ -1301,7 +1298,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
db_set_ts(NULL, PLUGINNAME, "LNFilterSender", settingFilterSender);
- _tcsncpy_s(settingFilterSubject, SIZEOF(settingFilterSubject), TEXT(""),SIZEOF(settingFilterSubject));
+ settingFilterSubject[0] = 0;
for(i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCOUNT, 0, (LONG)0); i++){
TCHAR text[512] = TEXT("");
SendDlgItemMessage(hwndDlg,IDC_FILTER_SUBJECT ,CB_GETLBTEXT,(WPARAM)i,(LONG) (LPSTR)text);
@@ -1310,7 +1307,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
db_set_ts(NULL, PLUGINNAME, "LNFilterSubject", settingFilterSubject);
- _tcsncpy_s(settingFilterTo, SIZEOF(settingFilterTo), TEXT(""),SIZEOF(settingFilterTo));
+ settingFilterTo[0] = 0;
for(i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCOUNT, 0, (LONG)0); i++){
TCHAR text[512] = TEXT("");
SendDlgItemMessage(hwndDlg,IDC_FILTER_TO ,CB_GETLBTEXT,(WPARAM)i,(LONG) (LPSTR)text);
@@ -1483,12 +1480,12 @@ void checkEnvPath(TCHAR *path)
}
assert(_tcslen(path) + _tcslen(cur) + 1 < SIZEOF(nowy));
- _tcsncpy_s(nowy, _countof(nowy), _T("PATH="), SIZEOF(nowy));
- _tcscat_s(nowy, _countof(nowy), cur);
+ _tcsncpy_s(nowy, _T("PATH="), _TRUNCATE);
+ _tcscat_s(nowy, cur);
if(cur[_tcslen(cur)-1]!=';')
- _tcscat_s(nowy, _countof(nowy), _T(";"));
- _tcscat_s(nowy, _countof(nowy), path);
- _tcscat_s(nowy, _countof(nowy), _T(";"));
+ _tcscat_s(nowy, _T(";"));
+ _tcscat_s(nowy, path);
+ _tcscat_s(nowy, _T(";"));
_tputenv(nowy);
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index 66f91b9e93..bb2dd807ae 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -532,7 +532,7 @@ void ProtocolArray::GetDefaultNick()
{
ptrT tszNick(db_get_tsa(0, MODULE_NAME, SETTING_DEFAULT_NICK));
if (tszNick)
- _tcsncpy_s(default_nick, SIZEOF(default_nick), tszNick, _TRUNCATE);
+ _tcsncpy_s(default_nick, tszNick, _TRUNCATE);
else
default_nick[0] = '\0';
}
@@ -541,7 +541,7 @@ void ProtocolArray::GetDefaultAvatar()
{
ptrT tszFile(db_get_tsa(0, "ContactPhoto", "File"));
if (tszFile)
- _tcsncpy_s(default_avatar_file, SIZEOF(default_avatar_file), tszFile, _TRUNCATE);
+ _tcsncpy_s(default_avatar_file, tszFile, _TRUNCATE);
else
default_avatar_file[0] = '\0';
}
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp
index 8b41c0eee3..4944abfeb8 100644
--- a/plugins/PackUpdater/Src/Notifications.cpp
+++ b/plugins/PackUpdater/Src/Notifications.cpp
@@ -441,7 +441,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
{
- _tcsncpy_s(tszCurrentDir, SIZEOF(tszCurrentDir), arFilePath[i].c_str(), _TRUNCATE);
+ _tcsncpy_s(tszCurrentDir, arFilePath[i].c_str(), _TRUNCATE);
TCHAR *p = _tcsrchr(tszCurrentDir, '\\');
if (p) *p = 0;
}
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp
index 4385def2d1..4c9f42514c 100644
--- a/plugins/Popup/src/bitmap_funcs.cpp
+++ b/plugins/Popup/src/bitmap_funcs.cpp
@@ -912,26 +912,17 @@ bool MyBitmap::loadFromFile(const TCHAR *fn, const TCHAR *fnAlpha)
if (bits) freemem();
if (!_tcsncmp(fn, _T("pixel:"), lstrlen(_T("pixel:"))))
- {
return loadFromFile_pixel(fn, fnAlpha);
- } else
+
if (!_tcsncmp(fn, _T("gradient:"), lstrlen(_T("gradient:"))))
- {
return loadFromFile_gradient(fn, fnAlpha);
- } else
- {
- TCHAR ext[5];
- _tcsncpy_s(ext, SIZEOF(ext), fn + (_tcslen(fn) - 4), _TRUNCATE);
- if (!lstrcmpi(ext, _T(".png")))
- {
- return loadFromFile_png(fn, fnAlpha);
- } else
- {
- return loadFromFile_default(fn, fnAlpha);
- }
- }
- // unreachable place
- return false;
+
+ TCHAR ext[5];
+ _tcsncpy_s(ext, fn + (_tcslen(fn) - 4), _TRUNCATE);
+ if (!lstrcmpi(ext, _T(".png")))
+ return loadFromFile_png(fn, fnAlpha);
+
+ return loadFromFile_default(fn, fnAlpha);
}
void MyBitmap::allocate(int w, int h)
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 13a8dc3505..9f4b27a16b 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -803,7 +803,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui->pszUID);
if (p != NULL) {
- _tcsncpy_s(tszBuf, SIZEOF(tszBuf), p, _TRUNCATE);
+ _tcsncpy_s(tszBuf, p, _TRUNCATE);
mir_free(p);
}
}
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index 0040e69b2f..ce4dbe34da 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -690,14 +690,14 @@ void RegisterFontServiceFonts() {
ColourRegisterT(&cid);
}
cid.order++;
- _tcsncpy_s(cid.name, SIZEOF(cid.name), LPGENT("Nick list background"), _TRUNCATE);
- strncpy_s(cid.setting, SIZEOF(cid.setting), "ColorNicklistBG", _TRUNCATE);
+ _tcsncpy_s(cid.name, LPGENT("Nick list background"), _TRUNCATE);
+ strncpy_s(cid.setting, "ColorNicklistBG", _TRUNCATE);
cid.defcolour = SRMSGDEFSET_BKGCOLOUR;
ColourRegisterT(&cid);
cid.order++;
- _tcsncpy_s(cid.name, SIZEOF(cid.name), LPGENT("Group chat log background"), _TRUNCATE);
- strncpy_s(cid.setting, SIZEOF(cid.setting), "ColorLogBG", _TRUNCATE);
+ _tcsncpy_s(cid.name, LPGENT("Group chat log background"), _TRUNCATE);
+ strncpy_s(cid.setting, "ColorLogBG", _TRUNCATE);
ColourRegisterT(&cid);
// static colors (info panel, tool bar background etc...)
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 5386ad7423..8cb081d5aa 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1397,7 +1397,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
if (p != NULL) {
- _tcsncpy_s(tszBuf, SIZEOF(tszBuf), p, _TRUNCATE);
+ _tcsncpy_s(tszBuf, p, _TRUNCATE);
mir_free(p);
}
}
@@ -1761,7 +1761,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
if (p) {
- _tcsncpy_s(tszBuf, SIZEOF(tszBuf), p, _TRUNCATE);
+ _tcsncpy_s(tszBuf, p, _TRUNCATE);
mir_free(p);
}
}
@@ -2039,7 +2039,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
dat->hTabIcon = dat->hTabStatusIcon;
if (dat->cache->getStatus() != dat->cache->getOldStatus()) {
- _tcsncpy_s(dat->szStatus, SIZEOF(dat->szStatus), pcli->pfnGetStatusModeDescription(dat->wStatus, 0), _TRUNCATE);
+ _tcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->wStatus, 0), _TRUNCATE);
TCITEM item = { 0 };
item.mask = TCIF_TEXT;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index cd98a09016..7af5e2671e 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -684,7 +684,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, HANDLE hEve
if (hContact)
mir_sntprintf(pud.lptzContactName, MAX_CONTACTNAME, _T("%s"), pcli->pfnGetContactDisplayName(hContact, 0));
else
- _tcsncpy_s(pud.lptzContactName, MAX_CONTACTNAME, _A2T(dbe.szModule), _TRUNCATE);
+ _tcsncpy_s(pud.lptzContactName, _A2T(dbe.szModule), _TRUNCATE);
TCHAR *szPreview = GetPreviewT((WORD)eventType, &dbe);
if (szPreview) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index a45931b803..3a08715d5d 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1760,7 +1760,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
dat->dwFlagsEx = dat->idle ? dat->dwFlagsEx | MWF_SHOW_ISIDLE : dat->dwFlagsEx & ~MWF_SHOW_ISIDLE;
dat->wStatus = dat->cache->getStatus();
- _tcsncpy_s(dat->szStatus, SIZEOF(dat->szStatus), pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
+ _tcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
if (lParam != 0) {
if (PluginConfig.m_CutContactNameOnTabs)
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index d3f1859f50..ee8677a731 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1251,7 +1251,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);
- _tcsncpy_s(dat->szStatus, SIZEOF(dat->szStatus), pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
+ _tcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
}
else dat->wStatus = ID_STATUS_OFFLINE;
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index f16c4d888e..1b4573da80 100644
--- a/plugins/Weather/src/weather_opt.cpp
+++ b/plugins/Weather/src/weather_opt.cpp
@@ -115,7 +115,7 @@ void LoadOptions(void)
opt.eUnit = db_get_w(NULL, WEATHERPROTONAME, "eUnit", 2);
ptrT szValue(db_get_tsa(NULL, WEATHERPROTONAME, "DegreeSign"));
- _tcsncpy_s(opt.DegreeSign, SIZEOF(opt.DegreeSign), (szValue == NULL) ? _T("") : szValue, _TRUNCATE);
+ _tcsncpy_s(opt.DegreeSign, (szValue == NULL) ? _T("") : szValue, _TRUNCATE);
opt.DoNotAppendUnit = db_get_b(NULL, WEATHERPROTONAME, "DoNotAppendUnit", 0);
opt.NoFrac = db_get_b(NULL, WEATHERPROTONAME, "NoFractions", 0);
@@ -191,7 +191,7 @@ void LoadOptions(void)
// misc
if (szValue = db_get_tsa(NULL, WEATHERPROTONAME, "Default"))
- _tcsncpy_s(opt.Default, SIZEOF(opt.Default), szValue, _TRUNCATE);
+ _tcsncpy_s(opt.Default, szValue, _TRUNCATE);
else
opt.Default[0] = 0;
}
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index 084215923a..a7dee35823 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -162,7 +162,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
url[0] = '\0';
if (!db_get_ts(hContact2, MODULENAME, URL_KEY, &dbv)) {
- _tcsncpy_s(url, SIZEOF(url), dbv.ptszVal, _TRUNCATE);
+ _tcsncpy_s(url, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
SetDlgItemText(hwndDlg, IDC_OPEN_URL, FixButtonText(url, SIZEOF(url)));
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index 9e7149908e..347ccd2bdb 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -49,15 +49,15 @@ void strdel(TCHAR *parBuffer, int len )
TCHAR* FixButtonText(TCHAR *url, size_t len)
{
TCHAR buttontext[256], stringbefore[256], newbuttontext[256];
- _tcsncpy_s(buttontext, SIZEOF(buttontext), url, _TRUNCATE);
- _tcsncpy_s(newbuttontext, SIZEOF(newbuttontext), url, _TRUNCATE);
+ _tcsncpy_s(buttontext, url, _TRUNCATE);
+ _tcsncpy_s(newbuttontext, url, _TRUNCATE);
if ( _tcschr(newbuttontext, '&') != 0) {
while (true) {
if ( _tcschr(newbuttontext, '&') == 0)
break;
- _tcsncpy_s(buttontext, SIZEOF(buttontext), newbuttontext, _TRUNCATE);
+ _tcsncpy_s(buttontext, newbuttontext, _TRUNCATE);
TCHAR *stringafter = _tcschr(buttontext, '&');
int pos = (stringafter - buttontext);
int posbefore = (stringafter - buttontext) - 1;
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 0289f0a096..b8fdf9aaa2 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -53,7 +53,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
TCHAR nick[100];
ptrT oldnick( db_get_tsa(hContact, "CList", "MyHandle"));
if (oldnick != NULL)
- _tcsncpy_s(nick, SIZEOF(nick), oldnick, _TRUNCATE);
+ _tcsncpy_s(nick, oldnick, _TRUNCATE);
else
nick[0] = 0;
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp
index 6cacf14429..e41a97859c 100644
--- a/plugins/YARelay/src/main.cpp
+++ b/plugins/YARelay/src/main.cpp
@@ -158,7 +158,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam)
ci.dwFlag = CNF_UNIQUEID;
if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (long)&ci) == 0){
if (ci.type == CNFT_ASCIIZ)
- _tcsncpy_s(buf, ci.pszVal, SIZEOF(buf));
+ _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
else if (ci.type == CNFT_BYTE)
mir_sntprintf(buf, SIZEOF(buf), _T("%u"), ci.bVal);
else if (ci.type == CNFT_WORD)