From c49014bbfa57191cd4c52be5d01690a6eef778ac Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 16 May 2015 19:04:12 +0000 Subject: fix for strncat use git-svn-id: http://svn.miranda-ng.org/main/trunk@13650 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Weather/src/weather_contacts.cpp | 4 +- plugins/Weather/src/weather_info.cpp | 82 ++++++++++++++++---------------- plugins/Weather/src/weather_ini.cpp | 6 +-- plugins/Weather/src/weather_popup.cpp | 6 +-- plugins/Weather/src/weather_update.cpp | 4 +- 5 files changed, 51 insertions(+), 51 deletions(-) (limited to 'plugins') diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 58fb62a540..17d2c70e31 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -294,12 +294,12 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa ofn.nMaxFile = SIZEOF(str); // set filters _tcsncpy(filter, TranslateT("Text Files"), SIZEOF(filter) - 1); - _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - 1); + _tcsncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); pfilter = filter + _tcslen(filter)+1; _tcsncpy(pfilter, _T("*.txt"), SIZEOF(filter) - 1); pfilter = pfilter + _tcslen(pfilter)+1; _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - 1); - _tcsncat(pfilter, _T(" (*.*)"), SIZEOF(filter) - 1); + _tcsncat(pfilter, _T(" (*.*)"), SIZEOF(filter) - mir_tstrlen(filter)); pfilter = pfilter + _tcslen(pfilter)+1; _tcsncpy(pfilter, _T("*.*"), SIZEOF(filter) - 1); pfilter = pfilter + _tcslen(pfilter)+1; diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp index 7eb6e420d5..21eb577854 100644 --- a/plugins/Weather/src/weather_info.cpp +++ b/plugins/Weather/src/weather_info.cpp @@ -159,48 +159,48 @@ void GetINIInfo(TCHAR *pszSvc) else { mir_sntprintf(str2, SIZEOF(str2), TranslateT("Weather INI information for \"%s\":"), pszSvc); - _tcsncat(str2,_T("\n\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("Name:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\t\t"), SIZEOF(str2) - 1); - _tcsncat(str2, sData->DisplayName, SIZEOF(str2) - 1); - _tcsncat(str2,_T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("Internal Name:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\t"), SIZEOF(str2) - 1); - _tcsncat(str2, sData->InternalName, SIZEOF(str2) - 1); - _tcsncat(str2,_T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("Author:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\t\t"), SIZEOF(str2) - 1); - _tcsncat(str2, sData->Author, SIZEOF(str2) - 1); - _tcsncat(str2,_T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("Version:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\t\t"), SIZEOF(str2) - 1); - _tcsncat(str2, sData->Version, SIZEOF(str2) - 1); - _tcsncat(str2,_T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("INI Version:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\t"), SIZEOF(str2) - 1); + _tcsncat(str2, _T("\n\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("Name:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\t\t"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, sData->DisplayName, SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("Internal Name:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\t"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, sData->InternalName, SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("Author:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\t\t"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, sData->Author, SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("Version:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\t\t"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, sData->Version, SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("INI Version:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\t"), SIZEOF(str2) - mir_tstrlen(str2)); switch (sData->InternalVer) { - case 1: _tcsncat(str2,_T("1.0"), SIZEOF(str2) - 1); break; - case 2: _tcsncat(str2,_T("1.1"), SIZEOF(str2) - 1); break; - case 3: _tcsncat(str2,_T("1.1a"), SIZEOF(str2) - 1); break; - case 4: _tcsncat(str2,_T("1.2"), SIZEOF(str2) - 1); break; - case 5: _tcsncat(str2,_T("1.3"), SIZEOF(str2) - 1); break; - case 6: _tcsncat(str2,_T("1.4"), SIZEOF(str2) - 1); break; - case 7: _tcsncat(str2,_T("1.5"), SIZEOF(str2) - 1); break; + case 1: _tcsncat(str2, _T("1.0"), SIZEOF(str2) - mir_tstrlen(str2)); break; + case 2: _tcsncat(str2, _T("1.1"), SIZEOF(str2) - mir_tstrlen(str2)); break; + case 3: _tcsncat(str2, _T("1.1a"), SIZEOF(str2) - mir_tstrlen(str2)); break; + case 4: _tcsncat(str2, _T("1.2"), SIZEOF(str2) - mir_tstrlen(str2)); break; + case 5: _tcsncat(str2, _T("1.3"), SIZEOF(str2) - mir_tstrlen(str2)); break; + case 6: _tcsncat(str2, _T("1.4"), SIZEOF(str2) - mir_tstrlen(str2)); break; + case 7: _tcsncat(str2, _T("1.5"), SIZEOF(str2) - mir_tstrlen(str2)); break; } - _tcsncat(str2,_T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("File Name:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\t"), SIZEOF(str2) - 1); - _tcsncat(str2, sData->ShortFileName, SIZEOF(str2) - 1); - _tcsncat(str2, _T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("Item Count:"), SIZEOF(str2) - 1); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("File Name:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\t"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, sData->ShortFileName, SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("Item Count:"), SIZEOF(str2) - mir_tstrlen(str2)); mir_sntprintf(str2, SIZEOF(str2), _T("%s\t%i\n"), str2, sData->UpdateDataCount); - _tcsncat(str2, TranslateT("Memory Used:"), SIZEOF(str2) - 1); + _tcsncat(str2, TranslateT("Memory Used:"), SIZEOF(str2) - mir_tstrlen(str2)); mir_sntprintf(str2, SIZEOF(str2), _T("%s\t%i "), str2, sData->MemUsed); - _tcsncat(str2, TranslateT("bytes"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\n\n"), SIZEOF(str2) - 1); - _tcsncat(str2, TranslateT("Description:"), SIZEOF(str2) - 1); - _tcsncat(str2,_T("\n"), SIZEOF(str2) - 1); - _tcsncat(str2, sData->Description, SIZEOF(str2) - 1); + _tcsncat(str2, TranslateT("bytes"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, TranslateT("Description:"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2)); + _tcsncat(str2, sData->Description, SIZEOF(str2) - mir_tstrlen(str2)); // display the message box and quit MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK|MB_ICONINFORMATION); @@ -217,7 +217,7 @@ void MoreVarList(void) // heading _tcsncpy(str, VARS_LIST, SIZEOF(str) - 1); - _tcsncat(str, _T("\n\n"), SIZEOF(str) - 1); + _tcsncat(str, _T("\n\n"), SIZEOF(str) - mir_tstrlen(str)); // loop through all weather services to find custom variables for (WIDATALIST *Item = WIHead;Item != NULL;Item = Item->next) { @@ -231,8 +231,8 @@ void MoreVarList(void) TCHAR* find = _tcsstr(str, tempstr); // if the custom variable does not exist in the list, add it to the list if (find == NULL) { - _tcsncat(str, tempstr, SIZEOF(str) - 1); - _tcsncat(str, _T(", "), SIZEOF(str) - 1); + _tcsncat(str, tempstr, SIZEOF(str) - mir_tstrlen(str)); + _tcsncat(str, _T(", "), SIZEOF(str) - mir_tstrlen(str)); } } } diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 0f81268766..930d2ea828 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -183,7 +183,7 @@ bool LoadWIData(bool dial) if (chop == NULL) return false; *chop = '\0'; - _tcsncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"),MAX_PATH - 1); + _tcsncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"), SIZEOF(szSearchPath) - mir_tstrlen(szSearchPath)); _tcsncpy(FileName, szSearchPath, MAX_PATH - 1); WIN32_FIND_DATA fd; @@ -195,7 +195,7 @@ bool LoadWIData(bool dial) do { chop = _tcsrchr(FileName, '\\'); chop[1] = '\0'; - _tcsncat(FileName, fd.cFileName, SIZEOF(FileName) - 1); + _tcsncat(FileName, fd.cFileName, SIZEOF(FileName) - mir_tstrlen(FileName)); if ( _tcsicmp(fd.cFileName, _T("SAMPLE_INI.INI"))) { WIDATA Data; LoadStationData(FileName, fd.cFileName, &Data); @@ -567,7 +567,7 @@ INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TCHAR *chop = _tcsrchr(szPath, '\\'); if (chop) { *chop = '\0'; - _tcsncat(szPath, _T("\\Plugins\\weather\\"),SIZEOF(szPath) - 1); + _tcsncat(szPath, _T("\\Plugins\\weather\\"), SIZEOF(szPath) - mir_tstrlen(szPath)); _tmkdir(szPath); ShellExecute((HWND)lParam, _T("open"), szPath, _T(""), _T(""), SW_SHOW); } diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index b8b6a326f8..050f0e01c4 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -397,9 +397,9 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_VAR3: // display variable list _tcsncpy(str, _T(" \n"),SIZEOF(str) - 1); // to make the message box wider - _tcsncat(str, VAR_LIST_POPUP, SIZEOF(str) - 1); - _tcsncat(str, _T("\n"),SIZEOF(str) - 1); - _tcsncat(str, CUSTOM_VARS,SIZEOF(str) - 1); + _tcsncat(str, VAR_LIST_POPUP, SIZEOF(str) - mir_tstrlen(str)); + _tcsncat(str, _T("\n"), SIZEOF(str) - mir_tstrlen(str)); + _tcsncat(str, CUSTOM_VARS, SIZEOF(str) - mir_tstrlen(str)); MessageBox(NULL, str, TranslateT("Variable List"), MB_OK|MB_ICONASTERISK|MB_TOPMOST); break; diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 290303d372..b202fcd56b 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -60,9 +60,9 @@ int UpdateWeather(MCONTACT hContact) // show warnings by popup mir_sntprintf(str, SIZEOF(str) - 105, TranslateT("Unable to retrieve weather information for %s"), dbv.ptszVal); - _tcsncat(str, _T("\n"), SIZEOF(str) - 1); + _tcsncat(str, _T("\n"), SIZEOF(str) - mir_tstrlen(str)); TCHAR *tszError = GetError(code); - _tcsncat(str, tszError, SIZEOF(str) - 1); + _tcsncat(str, tszError, SIZEOF(str) - mir_tstrlen(str)); WPShowMessage(str, SM_WARNING); mir_free(tszError); } -- cgit v1.2.3