From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewsAggregator/Src/Authentication.cpp | 12 ++--- plugins/NewsAggregator/Src/CheckFeed.cpp | 16 +++--- plugins/NewsAggregator/Src/ExportImport.cpp | 12 ++--- plugins/NewsAggregator/Src/Icons.cpp | 6 +-- plugins/NewsAggregator/Src/Options.cpp | 72 +++++++++++++-------------- plugins/NewsAggregator/Src/Services.cpp | 2 +- 6 files changed, 60 insertions(+), 60 deletions(-) (limited to 'plugins/NewsAggregator') diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index 1cfe612b5a..5824d075a0 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -28,9 +28,9 @@ void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg) } else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) { TCHAR buf[MAX_PATH] = {0}; - GetDlgItemText(hwndDlg, IDC_LOGIN, buf, SIZEOF(buf)); + GetDlgItemText(hwndDlg, IDC_LOGIN, buf, _countof(buf)); tlogin = mir_tstrdup(buf); - GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf)); + GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, _countof(buf)); tpass = mir_tstrdup(buf); } char *user = mir_t2a(tlogin), *pass = mir_t2a(tpass); @@ -56,10 +56,10 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (SelItem.hwndList) { TCHAR str[MAX_PATH]; - if (GetDlgItemText(SelItem.hwndList, IDC_FEEDTITLE, str, SIZEOF(str))) + if (GetDlgItemText(SelItem.hwndList, IDC_FEEDTITLE, str, _countof(str))) SetDlgItemText(hwndDlg, IDC_FEEDNAME, str); else { - GetDlgItemText(SelItem.hwndList, IDC_FEEDURL, str, SIZEOF(str)); + GetDlgItemText(SelItem.hwndList, IDC_FEEDURL, str, _countof(str)); SetDlgItemText(hwndDlg, IDC_FEEDNAME, str); } } @@ -87,11 +87,11 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ItemInfo &SelItem = *(ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); TCHAR username[MAX_PATH]; char passw[MAX_PATH]; - if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, SIZEOF(username))) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, _countof(username))) { MessageBox(hwndDlg, TranslateT("Enter your username"), TranslateT("Error"), MB_OK | MB_ICONERROR); break; } - if (!GetDlgItemTextA(hwndDlg, IDC_FEEDPASSWORD, passw, SIZEOF(passw))) { + if (!GetDlgItemTextA(hwndDlg, IDC_FEEDPASSWORD, passw, _countof(passw))) { MessageBox(hwndDlg, TranslateT("Enter your password"), TranslateT("Error"), MB_OK | MB_ICONERROR); break; } diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 68736cebdb..9e156a3162 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -47,7 +47,7 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg) HXML child = xi.getChild(chan, j); if (!mir_tstrcmpi(xi.getName(child), _T("title"))) { TCHAR mes[MAX_PATH]; - mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL); + mir_sntprintf(mes, _countof(mes), TranslateT("%s\nis a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); TCHAR *tszTitle = (TCHAR *)xi.getText(child); return tszTitle; @@ -59,7 +59,7 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg) HXML child = xi.getChild(node, j); if (!mir_tstrcmpi(xi.getName(child), _T("title"))) { TCHAR mes[MAX_PATH]; - mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL); + mir_sntprintf(mes, _countof(mes), TranslateT("%s\nis a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); TCHAR *tszTitle = (TCHAR *)xi.getText(child); return tszTitle; @@ -73,7 +73,7 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg) } Netlib_LogfT(hNetlibUser, _T("%s is not a valid feed's address."), tszURL); TCHAR mes[MAX_PATH]; - mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis not a valid feed's address."), tszURL); + mir_sntprintf(mes, _countof(mes), TranslateT("%s\nis not a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR); return NULL; } @@ -199,7 +199,7 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR szAttrName = xi.getAttrName(node, i); if (!mir_tstrcmpi(szAttrName, _T("version"))) { TCHAR ver[MAX_PATH]; - mir_sntprintf(ver, SIZEOF(ver), _T("RSS %s"), xi.getAttrValue(node, szAttrName)); + mir_sntprintf(ver, _countof(ver), _T("RSS %s"), xi.getAttrValue(node, szAttrName)); db_set_ts(hContact, MODULE, "MirVer", ver); break; } @@ -267,7 +267,7 @@ void CheckCurrentFeed(MCONTACT hContact) CMString filename = szNick; filename.Replace(_T("/"), _T("_")); - mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext); + mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext); CreateDirectoryTreeT(tszRoot); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); @@ -393,7 +393,7 @@ void CheckCurrentFeed(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext); TCHAR *filename = szNick; - mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext); + mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL); @@ -538,7 +538,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext); TCHAR *filename = szNick; - mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext); + mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL); @@ -571,7 +571,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext); TCHAR *filename = szNick; - mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext); + mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL); diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 3b2ef7fd8c..fe6e512c29 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDOK: { TCHAR FileName[MAX_PATH]; - GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, SIZEOF(FileName)); + GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, _countof(FileName)); int bytesParsed = 0; HXML hXml = xi.parseFile(FileName, &bytesParsed, NULL); if(hXml != NULL) { @@ -130,7 +130,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( !group) group = (TCHAR *)xi.getAttrValue(parent, xi.getAttrName(parent, i)); else { - mir_sntprintf(tmpgroup, SIZEOF(tmpgroup), _T("%s\\%s"), xi.getAttrValue(parent, xi.getAttrName(parent, i)), group); + mir_sntprintf(tmpgroup, _countof(tmpgroup), _T("%s\\%s"), xi.getAttrValue(parent, xi.getAttrName(parent, i)), group); group = tmpgroup; } break; @@ -209,9 +209,9 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } TCHAR mes[MAX_PATH]; if (DUPES) - mir_sntprintf(mes, SIZEOF(mes), TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES); + mir_sntprintf(mes, _countof(mes), TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES); else - mir_sntprintf(mes, SIZEOF(mes), TranslateT("Imported %d feed(s)."), count); + mir_sntprintf(mes, _countof(mes), TranslateT("Imported %d feed(s)."), count); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); } } @@ -228,7 +228,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); TCHAR tmp[MAX_PATH]; - mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.opml, *.xml)%c*.opml;*.xml%c%c"), TranslateT("OPML files"), 0, 0, 0); + mir_sntprintf(tmp, _countof(tmp), _T("%s (*.opml, *.xml)%c*.opml;*.xml%c%c"), TranslateT("OPML files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; ofn.lpstrFile = FileName; @@ -491,7 +491,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); TCHAR tmp[MAX_PATH]; - mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.opml)%c*.opml%c%c"), TranslateT("OPML files"), 0, 0, 0); + mir_sntprintf(tmp, _countof(tmp), _T("%s (*.opml)%c*.opml%c%c"), TranslateT("OPML files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; ofn.lpstrFile = FileName; diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp index 9b100c8b06..05828449ff 100644 --- a/plugins/NewsAggregator/Src/Icons.cpp +++ b/plugins/NewsAggregator/Src/Icons.cpp @@ -33,19 +33,19 @@ static IconItem iconList[] = void InitIcons() { - Icon_Register(hInst, LPGEN("News Aggregator"), iconList, SIZEOF(iconList), MODULE); + Icon_Register(hInst, LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE); } HICON LoadIconEx(const char *name, bool big) { char szSettingName[100]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, name); + mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODULE, name); return IcoLib_GetIcon(szSettingName, big); } HANDLE GetIconHandle(const char *name) { - for (int i=0; i < SIZEOF(iconList); i++) + for (int i=0; i < _countof(iconList); i++) if ( !mir_strcmp(iconList[i].szName, name)) return iconList[i].hIcolib; diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index b8849fc775..66006753ff 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -40,37 +40,37 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR str[MAX_PATH]; char passw[MAX_PATH]; { - if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) { MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)) || mir_tstrcmp(str, _T("http://")) == 0) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) { MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str))) { + if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) { MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK); break; } MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); Proto_AddToContact(hContact, MODULE); - GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str)); db_set_ts(hContact, MODULE, "Nick", str); HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)); db_set_ts(hContact, MODULE, "URL", str); db_set_b(hContact, MODULE, "CheckState", 1); db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false)); - GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str)); db_set_ts(hContact, MODULE, "MsgFormat", str); db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0)); if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) { db_set_b(hContact, MODULE, "UseAuth", 1); - GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str)); db_set_ts(hContact, MODULE, "Login", str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, SIZEOF(passw)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw)); db_set_s(hContact, MODULE, "Password", passw); } DeleteAllItems(hwndList); @@ -95,7 +95,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_TAGHELP: TCHAR tszTagHelp[1024]; - mir_sntprintf(tszTagHelp, SIZEOF(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), + mir_sntprintf(tszTagHelp, _countof(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), _T("##"), TranslateT("The title of the item."), _T("#<description>#"), TranslateT("The item synopsis."), _T("#<link>#"), TranslateT("The URL of the item."), @@ -115,7 +115,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); TCHAR tszURL[MAX_PATH] = { 0 }, *tszTitle = NULL; - if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, SIZEOF(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) + if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) tszTitle = CheckFeed(tszURL, hwndDlg); else MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); @@ -204,33 +204,33 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { ItemInfo *SelItem = (ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char passw[MAX_PATH]; - if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) { MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)) || mir_tstrcmp(str, _T("http://")) == 0) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) { MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str))) { + if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) { MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK); break; } - GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)); db_set_ts(SelItem->hContact, MODULE, "URL", str); - GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str)); db_set_ts(SelItem->hContact, MODULE, "Nick", str); db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false)); - GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str)); db_set_ts(SelItem->hContact, MODULE, "MsgFormat", str); if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) { db_set_b(SelItem->hContact, MODULE, "UseAuth", 1); - GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str)); db_set_ts(SelItem->hContact, MODULE, "Login", str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, SIZEOF(passw)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw)); db_set_s(SelItem->hContact, MODULE, "Password", passw); } else { @@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAGHELP: TCHAR tszTagHelp[1024]; - mir_sntprintf(tszTagHelp, SIZEOF(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), + mir_sntprintf(tszTagHelp, _countof(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), _T("#<title>#"), TranslateT("The title of the item."), _T("#<description>#"), TranslateT("The item synopsis."), _T("#<link>#"), TranslateT("The URL of the item."), @@ -278,7 +278,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DISCOVERY: TCHAR tszURL[MAX_PATH] = { 0 }; - if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, SIZEOF(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) { + if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); TCHAR *tszTitle = CheckFeed(tszURL, hwndDlg); @@ -361,33 +361,33 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP { MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char passw[MAX_PATH]; - if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) { MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)) || mir_tstrcmp(str, _T("http://")) == 0) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) { MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str))) { + if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) { MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK); break; } - GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)); db_set_ts(hContact, MODULE, "URL", str); - GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str)); db_set_ts(hContact, MODULE, "Nick", str); db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false)); - GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str)); db_set_ts(hContact, MODULE, "MsgFormat", str); if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) { db_set_b(hContact, MODULE, "UseAuth", 1); - GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str)); db_set_ts(hContact, MODULE, "Login", str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, SIZEOF(passw)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw)); db_set_s(hContact, MODULE, "Password", passw); } else { @@ -415,7 +415,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAGHELP: TCHAR tszTagHelp[1024]; - mir_sntprintf(tszTagHelp, SIZEOF(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), + mir_sntprintf(tszTagHelp, _countof(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), _T("#<title>#"), TranslateT("The title of the item."), _T("#<description>#"), TranslateT("The item synopsis."), _T("#<link>#"), TranslateT("The URL of the item."), @@ -433,7 +433,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DISCOVERY: TCHAR tszURL[MAX_PATH] = { 0 }; - if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, SIZEOF(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) { + if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); TCHAR *tszTitle = CheckFeed(tszURL, hwndDlg); @@ -485,8 +485,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA sel = ListView_GetSelectionMark(hwndList); { ItemInfo SelItem = { 0 }; - ListView_GetItemText(hwndList, sel, 0, SelItem.nick, SIZEOF(SelItem.nick)); - ListView_GetItemText(hwndList, sel, 1, SelItem.url, SIZEOF(SelItem.url)); + ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick)); + ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url)); SelItem.hwndList = hwndList; SelItem.SelNumber = sel; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcChangeFeedOpts, (LPARAM)&SelItem); @@ -497,8 +497,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Contact deleting"), MB_YESNO | MB_ICONWARNING) == IDYES) { TCHAR nick[MAX_PATH], url[MAX_PATH]; int sel = ListView_GetSelectionMark(hwndList); - ListView_GetItemText(hwndList, sel, 0, nick, SIZEOF(nick)); - ListView_GetItemText(hwndList, sel, 1, url, SIZEOF(url)); + ListView_GetItemText(hwndList, sel, 0, nick, _countof(nick)); + ListView_GetItemText(hwndList, sel, 1, url, _countof(url)); for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { ptrT dbNick(db_get_tsa(hContact, MODULE, "Nick")); @@ -556,8 +556,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA sel = ListView_GetHotItem(hwndList); if (sel != -1) { ItemInfo SelItem = { 0 }; - ListView_GetItemText(hwndList, sel, 0, SelItem.nick, SIZEOF(SelItem.nick)); - ListView_GetItemText(hwndList, sel, 1, SelItem.url, SIZEOF(SelItem.url)); + ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick)); + ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url)); SelItem.hwndList = hwndList; SelItem.SelNumber = sel; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcChangeFeedOpts, (LPARAM)&SelItem); diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index eb88bf1f1c..fa81455bb7 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -40,7 +40,7 @@ int NewsAggrInit(WPARAM, LPARAM) if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER))) FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T("")); else - mir_tstrncpy(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot)); + mir_tstrncpy(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), _countof(tszRoot)); for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1)) -- cgit v1.2.3