From c370af60855db957c5b200914bf0bde743845528 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Aug 2015 16:22:41 +0000 Subject: mir_sntprintf / mir_snprintf: obsoleted second parameter removed wherever possible git-svn-id: http://svn.miranda-ng.org/main/trunk@15064 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Weather/src/weather.cpp | 2 +- plugins/Weather/src/weather_addstn.cpp | 18 +++++++++--------- plugins/Weather/src/weather_contacts.cpp | 8 ++++---- plugins/Weather/src/weather_conv.cpp | 8 ++++---- plugins/Weather/src/weather_data.cpp | 4 ++-- plugins/Weather/src/weather_icons.cpp | 2 +- plugins/Weather/src/weather_info.cpp | 10 +++++----- plugins/Weather/src/weather_ini.cpp | 2 +- plugins/Weather/src/weather_mwin.cpp | 2 +- plugins/Weather/src/weather_svcs.cpp | 4 ++-- plugins/Weather/src/weather_update.cpp | 10 +++++----- 11 files changed, 35 insertions(+), 35 deletions(-) (limited to 'plugins/Weather') diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index fdd4596d19..0e52a477e0 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -231,7 +231,7 @@ extern "C" int __declspec(dllexport) Load(void) // window needed for popup commands TCHAR SvcFunc[100]; - mir_sntprintf(SvcFunc, _countof(SvcFunc), _T("%s__PopupWindow"), _T(WEATHERPROTONAME)); + mir_sntprintf(SvcFunc, _T("%s__PopupWindow"), _T(WEATHERPROTONAME)); hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL); SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc); diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index bda1bd95b7..2e2eeca1a7 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -90,7 +90,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) AvatarDownloaded(hContact); TCHAR str[256]; - mir_sntprintf(str, _countof(str), TranslateT("Current weather information for %s."), psr->nick.t); + mir_sntprintf(str, TranslateT("Current weather information for %s."), psr->nick.t); db_set_ts(hContact, WEATHERPROTONAME, "About", str); // make the last update tags to something invalid @@ -109,7 +109,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) opt.DefStn = hContact; if (!db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) { // notification message box - mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal); + mir_sntprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal); db_free(&dbv); MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION); } @@ -234,7 +234,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, TCHAR *szData = NULL; // load the page - mir_snprintf(loc, _countof(loc), sData->SearchURL, sID); + mir_snprintf(loc, sData->SearchURL, sID); BOOL bFound = (InternetDownloadFile(loc, NULL, NULL, &szData) == 0); if (bFound) { TCHAR* szInfo = szData; @@ -251,7 +251,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, // give no station name but only ID if the search is unavailable else _tcsncpy(str, TranslateT(""), MAX_DATA_LEN - 1); - mir_sntprintf(newID, _countof(newID), _T("%s/%s"), svc, sID); + mir_sntprintf(newID, _T("%s/%s"), svc, sID); // set the search result and broadcast it PROTOSEARCHRESULT psr = { sizeof(psr) }; @@ -311,7 +311,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // replace spaces with %20 char loc[256]; T2Utf szSearchName(name); - mir_snprintf(loc, _countof(loc), sData->SearchURL, ptrA(mir_urlEncode(szSearchName))); + mir_snprintf(loc, sData->SearchURL, ptrA(mir_urlEncode(szSearchName))); if (InternetDownloadFile(loc, NULL, NULL, &szData) == 0) { TCHAR* szInfo = szData; search = _tcsstr(szInfo, sData->NotFoundStr); // determine if data is available @@ -324,14 +324,14 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // if station ID appears first in the downloaded data if (!mir_tstrcmpi(sData->Single.First, _T("ID"))) { GetDataValue(&sData->Single.ID, str, &szInfo); - mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str); + mir_sntprintf(sID, _T("%s/%s"), svc, str); GetDataValue(&sData->Single.Name, Name, &szInfo); } // if station name appears first in the downloaded data else if (!mir_tstrcmpi(sData->Single.First, _T("NAME"))) { GetDataValue(&sData->Single.Name, Name, &szInfo); GetDataValue(&sData->Single.ID, str, &szInfo); - mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str); + mir_sntprintf(sID, _T("%s/%s"), svc, str); } else str[0] = 0; @@ -365,14 +365,14 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // if station ID appears first in the downloaded data if (!mir_tstrcmpi(sData->Multiple.First, _T("ID"))) { GetDataValue(&sData->Multiple.ID, str, &szInfo); - mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str); + mir_sntprintf(sID, _T("%s/%s"), svc, str); GetDataValue(&sData->Multiple.Name, Name, &szInfo); } // if station name appears first in the downloaded data else if (!mir_tstrcmpi(sData->Multiple.First, _T("NAME"))) { GetDataValue(&sData->Multiple.Name, Name, &szInfo); GetDataValue(&sData->Multiple.ID, str, &szInfo); - mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str); + mir_sntprintf(sID, _T("%s/%s"), svc, str); } else break; diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 3ce506d66a..ae74ad7973 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -29,7 +29,7 @@ static void OpenUrl(TCHAR* format, TCHAR* id) { TCHAR loc[512]; GetID(id); - mir_sntprintf(loc, _countof(loc), format, id); + mir_sntprintf(loc, format, id); Utils_OpenUrlT(loc); } @@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa // if ID search is available, do it if (sData->IDSearch.Available) { // load the page - mir_snprintf(loc, _countof(loc), sData->IDSearch.SearchURL, str); + mir_snprintf(loc, sData->IDSearch.SearchURL, str); str[0] = 0; TCHAR *pData = NULL; if (InternetDownloadFile(loc, NULL, sData->UserAgent, &pData) == 0) { @@ -371,7 +371,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa } GetDlgItemText(hwndDlg, IDC_NAME, city, _countof(city)); db_set_ts(hContact, WEATHERPROTONAME, "Nick", city); - mir_sntprintf(str2, _countof(str2), TranslateT("Current weather information for %s."), city); + mir_sntprintf(str2, TranslateT("Current weather information for %s."), city); if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)) { GetDlgItemText(hwndDlg, IDC_LOG, str, _countof(str)); db_set_ts(hContact, WEATHERPROTONAME, "Log", str); @@ -458,7 +458,7 @@ int ContactDeleted(WPARAM wParam, LPARAM) ptrT tszNick(db_get_tsa(hContact, WEATHERPROTONAME, "Nick")); if (tszNick != NULL) { TCHAR str[255]; - mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), (TCHAR*)tszNick); + mir_sntprintf(str, TranslateT("%s is now the default weather station"), (TCHAR*)tszNick); MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION); } db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default); diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index b77cb46500..e889d63e2d 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -390,7 +390,7 @@ WORD GetIcon(const TCHAR* cond, WIDATA *Data) do { j++; // using the format _T("# Weather #" - mir_sntprintf(LangPackStr, _countof(LangPackStr), _T("# Weather %s %i #"), statusStr[i], j); + mir_sntprintf(LangPackStr, _T("# Weather %s %i #"), statusStr[i], j); _tcsncpy_s(LangPackStr1, TranslateTS(LangPackStr), _TRUNCATE); CharLowerBuff(LangPackStr1, (DWORD)mir_tstrlen(LangPackStr1)); if (_tcsstr(cond, LangPackStr1) != NULL) @@ -545,7 +545,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) name[0] = 0; // read the entire variable name while (dis[i] != ']' && i < mir_tstrlen(dis)) { - mir_snprintf(temp, _countof(temp), "%c", dis[i++]); + mir_snprintf(temp, "%c", dis[i++]); mir_strcat(name, temp); } // access the database to get its value @@ -559,7 +559,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) } // if the character is not a variable, write the original character to the new string else { - mir_sntprintf(lpzDate, _countof(lpzDate), _T("%c"), dis[i]); + mir_sntprintf(lpzDate, _T("%c"), dis[i]); mir_tstrcat(str, lpzDate); } } @@ -632,7 +632,7 @@ TCHAR *GetError(int code) case 503: str = E503; break; case 504: str = E504; break; default: - mir_sntprintf(str2, _countof(str2), TranslateT("HTTP Error %i"), code); + mir_sntprintf(str2, TranslateT("HTTP Error %i"), code); str = str2; break; } diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index c1c5a53168..c9303092ad 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -154,7 +154,7 @@ void EraseAllInfo() opt.DefStn = hContact; if (!db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) { - mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal); + mir_sntprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal); db_free(&dbv); MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION); } @@ -181,7 +181,7 @@ void EraseAllInfo() } opt.DefStn = LastContact; if (!db_get_ts(LastContact, WEATHERPROTONAME, "Nick", &dbv)) { - mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal); + mir_sntprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal); db_free(&dbv); MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION); } diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp index 8b69cffcd0..68d162e8fc 100644 --- a/plugins/Weather/src/weather_icons.cpp +++ b/plugins/Weather/src/weather_icons.cpp @@ -45,7 +45,7 @@ void InitIcons(void) HICON LoadIconEx(const char* name, bool big) { char szSettingName[100]; - mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", WEATHERPROTONAME, name); + mir_snprintf(szSettingName, "%s_%s", WEATHERPROTONAME, name); return IcoLib_GetIcon(szSettingName, big); } diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp index 590150dc36..b1eba54fea 100644 --- a/plugins/Weather/src/weather_info.cpp +++ b/plugins/Weather/src/weather_info.cpp @@ -147,12 +147,12 @@ void GetINIInfo(TCHAR *pszSvc) WIDATA *sData = GetWIData(pszSvc); // if the service does not exist among the loaded INI's if (sData == NULL) { - mir_sntprintf(str2, _countof(str2), TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc); + mir_sntprintf(str2, TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc); MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION); } // if exist, get the information else { - mir_sntprintf(str2, _countof(str2), TranslateT("Weather INI information for \"%s\":"), pszSvc); + mir_sntprintf(str2, TranslateT("Weather INI information for \"%s\":"), pszSvc); mir_tstrncat(str2, _T("\n\n"), _countof(str2) - mir_tstrlen(str2)); mir_tstrncat(str2, TranslateT("Name:"), _countof(str2) - mir_tstrlen(str2)); mir_tstrncat(str2, _T("\t\t"), _countof(str2) - mir_tstrlen(str2)); @@ -187,9 +187,9 @@ void GetINIInfo(TCHAR *pszSvc) mir_tstrncat(str2, sData->ShortFileName, _countof(str2) - mir_tstrlen(str2)); mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2)); mir_tstrncat(str2, TranslateT("Item Count:"), _countof(str2) - mir_tstrlen(str2)); - mir_sntprintf(str2, _countof(str2), _T("%s\t%i\n"), str2, sData->UpdateDataCount); + mir_sntprintf(str2, _T("%s\t%i\n"), str2, sData->UpdateDataCount); mir_tstrncat(str2, TranslateT("Memory Used:"), _countof(str2) - mir_tstrlen(str2)); - mir_sntprintf(str2, _countof(str2), _T("%s\t%i "), str2, sData->MemUsed); + mir_sntprintf(str2, _T("%s\t%i "), str2, sData->MemUsed); mir_tstrncat(str2, TranslateT("bytes"), _countof(str2) - mir_tstrlen(str2)); mir_tstrncat(str2, _T("\n\n"), _countof(str2) - mir_tstrlen(str2)); mir_tstrncat(str2, TranslateT("Description:"), _countof(str2) - mir_tstrlen(str2)); @@ -219,7 +219,7 @@ void MoreVarList(void) // the custom variable is defined as "%[]" // ignore the "hi" item and hidden items if (mir_tstrcmp(WItem->Item.Name, _T("Ignore")) && WItem->Item.Name[0] != '#') { - mir_sntprintf(tempstr, _countof(tempstr), _T("%c[%s]"), '%', WItem->Item.Name); + mir_sntprintf(tempstr, _T("%c[%s]"), '%', WItem->Item.Name); TCHAR *find = _tcsstr(str, tempstr); // if the custom variable does not exist in the list, add it to the list if (find == NULL) { diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index e69bc56fda..0775fff823 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -268,7 +268,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) Data->InternalVer = 7; else { TCHAR str[4096]; - mir_sntprintf(str, _countof(str), TranslateT("Invalid ini format for: %s"), pszFile); + mir_sntprintf(str, TranslateT("Invalid ini format for: %s"), pszFile); MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR); fclose(pfile); return; diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index b92291fa17..2dc78a8975 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -243,7 +243,7 @@ static void addWindow(MCONTACT hContact) db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv); TCHAR winname[512]; - mir_sntprintf(winname, _countof(winname), _T("Weather: %s"), dbv.ptszVal); + mir_sntprintf(winname, _T("Weather: %s"), dbv.ptszVal); db_free(&dbv); HWND hWnd = CreateWindow(_T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE, diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index f1a027ae19..d8dd8ccf8e 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -147,12 +147,12 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR; pai->format = PA_FORMAT_PNG; - mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]); + mir_sntprintf(pai->filename, _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]); if (_taccess(pai->filename, 4) == 0) return GAIR_SUCCESS; pai->format = PA_FORMAT_GIF; - mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]); + mir_sntprintf(pai->filename, _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]); if (_taccess(pai->filename, 4) == 0) return GAIR_SUCCESS; diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index a213106160..a01a2d19fe 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -106,7 +106,7 @@ int UpdateWeather(MCONTACT hContact) if (!dbres && dbv.ptszVal[0] != 0) { if (opt.AlertPopup && !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0) && Ch) { // display alert popup - mir_sntprintf(str, _countof(str), _T("Alert for %s%c%s"), winfo.city, 255, dbv.ptszVal); + mir_sntprintf(str, _T("Alert for %s%c%s"), winfo.city, 255, dbv.ptszVal); WPShowMessage(str, SM_WEATHERALERT); } // alert issued, set display to italic @@ -410,19 +410,19 @@ int GetWeatherData(MCONTACT hContact) // generate update URL switch (i) { case 0: - mir_snprintf(loc, _countof(loc), Data->UpdateURL, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL, _T2A(id)); break; case 1: - mir_snprintf(loc, _countof(loc), Data->UpdateURL2, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL2, _T2A(id)); break; case 2: - mir_snprintf(loc, _countof(loc), Data->UpdateURL3, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL3, _T2A(id)); break; case 3: - mir_snprintf(loc, _countof(loc), Data->UpdateURL4, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL4, _T2A(id)); break; default: -- cgit v1.2.3