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/TipperYM/src/options.cpp | 38 +++++++++++++++---------------- plugins/TipperYM/src/popwin.cpp | 10 ++++----- plugins/TipperYM/src/skin_parser.cpp | 4 ++-- plugins/TipperYM/src/tipper.cpp | 4 ++-- plugins/TipperYM/src/translations.cpp | 42 +++++++++++++++++------------------ 5 files changed, 49 insertions(+), 49 deletions(-) (limited to 'plugins/TipperYM') diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 47a814109c..ddf1333b7b 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -100,8 +100,8 @@ bool LoadDS(DISPLAYSUBST *ds, int index) if (db_get_ts(0, MODULE_ITEMS, setting, &dbv)) return false; - _tcsncpy(ds->swzName, dbv.ptszVal, SIZEOF(ds->swzName)); - ds->swzName[SIZEOF(ds->swzName) - 1] = 0; + _tcsncpy(ds->swzName, dbv.ptszVal, _countof(ds->swzName)); + ds->swzName[_countof(ds->swzName) - 1] = 0; db_free(&dbv); mir_snprintf(setting, "Type%d", index); @@ -161,15 +161,15 @@ bool LoadDI(DISPLAYITEM *di, int index) if (db_get_ts(0, MODULE_ITEMS, setting, &dbv)) return false; - _tcsncpy(di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel)); - di->swzLabel[SIZEOF(di->swzLabel) - 1] = 0; + _tcsncpy(di->swzLabel, dbv.ptszVal, _countof(di->swzLabel)); + di->swzLabel[_countof(di->swzLabel) - 1] = 0; db_free(&dbv); mir_snprintf(setting, "DIValue%d", index); di->swzValue[0] = 0; if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv)) { - _tcsncpy(di->swzValue, dbv.ptszVal, SIZEOF(di->swzValue)); - di->swzValue[SIZEOF(di->swzValue) - 1] = 0; + _tcsncpy(di->swzValue, dbv.ptszVal, _countof(di->swzValue)); + di->swzValue[_countof(di->swzValue) - 1] = 0; db_free(&dbv); } @@ -516,7 +516,7 @@ void LoadOptions() } else if (opt.skinMode == SM_IMAGE) { if (!db_get_ts(NULL, MODULE, "SkinName", &dbv)) { - _tcsncpy(opt.szSkinName, dbv.ptszVal, SIZEOF(opt.szSkinName) - 1); + _tcsncpy(opt.szSkinName, dbv.ptszVal, _countof(opt.szSkinName) - 1); db_free(&dbv); } } @@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel); SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue); - for (int i = 0; i < SIZEOF(displayItemTypes); i++) { + for (int i = 0; i < _countof(displayItemTypes); i++) { int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(displayItemTypes[i].title)); SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)displayItemTypes[i].type); if (displayItemTypes[i].type == di->type) @@ -573,7 +573,7 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0); int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0); - for (int i = 0; i < SIZEOF(displayItemTypes); i++) { + for (int i = 0; i < _countof(displayItemTypes); i++) { if (displayItemTypes[i].type == type) di->type = displayItemTypes[i].type; } @@ -709,10 +709,10 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ds->type = DVT_PROTODB; else { ds->type = DVT_DB; - GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, SIZEOF(ds->szModuleName)); + GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, _countof(ds->szModuleName)); } - GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, SIZEOF(ds->szSettingName)); + GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, _countof(ds->szSettingName)); int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETCURSEL, 0, 0); ds->iTranslateFuncId = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, sel, 0); @@ -767,7 +767,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - for (int i = 0; i < SIZEOF(btns); i++) { + for (int i = 0; i < _countof(btns); i++) { SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(btns[i].swzTooltip), BATF_TCHAR); if (btns[i].uintCoreIconId) @@ -994,7 +994,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.stateMask = TVIS_STATEIMAGEMASK; item.hItem = hItem; item.pszText = buff; - item.cchTextMax = SIZEOF(buff); + item.cchTextMax = _countof(buff); if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) { tmpParam = item.lParam; tmpState = item.state; @@ -1461,7 +1461,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; tvi.item.stateMask = TVIS_STATEIMAGEMASK; - for (int i = 0; i < SIZEOF(extraIconName); i++) { + for (int i = 0; i < _countof(extraIconName); i++) { tvi.item.lParam = (LPARAM)&exIcons[i]; tvi.item.pszText = TranslateTS(extraIconName[exIcons[i].order]); tvi.item.state = INDEXTOSTATEIMAGEMASK(exIcons[i].vis ? 2 : 1); @@ -1517,8 +1517,8 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), item.hItem); i++; } - db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, SIZEOF(opt.exIconsOrder)); - db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, SIZEOF(opt.exIconsVis)); + db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, _countof(opt.exIconsOrder)); + db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, _countof(opt.exIconsVis)); opt.iSmileyAddFlags = 0; opt.iSmileyAddFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS) ? SMILEYADD_ENABLE : 0) @@ -1647,7 +1647,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE; tvis.item.stateMask = TVIS_STATEIMAGEMASK; tvis.item.pszText = swzName; - tvis.item.cchTextMax = SIZEOF(swzName); + tvis.item.cchTextMax = _countof(swzName); tvis.item.hItem = dat->hDragItem; tvis.item.state = INDEXTOSTATEIMAGEMASK(((ICONSTATE *)item.lParam)->vis ? 2 : 1); TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis.item); @@ -1979,7 +1979,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } } - for (i = 0; i < SIZEOF(trayTipItems); i++) { + for (i = 0; i < _countof(trayTipItems); i++) { tvi.item.pszText = TranslateTS(trayTipItems[i]); tvi.item.state = INDEXTOSTATEIMAGEMASK(opt.iFirstItems & (1 << i) ? 2 : 1); TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi); @@ -2036,7 +2036,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM item; item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS)); item.pszText = buff; - item.cchTextMax = SIZEOF(buff); + item.cchTextMax = _countof(buff); item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; item.stateMask = TVIS_STATEIMAGEMASK; while (item.hItem != NULL) { diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 0423e7e0ee..1f63f93768 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -78,7 +78,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); if (Proto_IsAccountLocked(pa)) - mir_sntprintf(pwd->swzTitle, SIZEOF(pwd->swzTitle), TranslateT("%s (locked)"), pwd->swzTitle); + mir_sntprintf(pwd->swzTitle, _countof(pwd->swzTitle), TranslateT("%s (locked)"), pwd->swzTitle); // protocol status WORD wStatus = (WORD)CallProtoService(pwd->clcit.szProto, PS_GETSTATUS, 0, 0); @@ -106,7 +106,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa TCHAR swzLogon[64]; if (TimestampToTimeDifference(NULL, pwd->clcit.szProto, "LogonTS", swzLogon, 59)) { TCHAR ago[96]; - mir_sntprintf(ago, SIZEOF(ago), TranslateT("%s ago"), swzLogon); + mir_sntprintf(ago, _countof(ago), TranslateT("%s ago"), swzLogon); AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false); } @@ -1500,7 +1500,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa mir_tstrcpy(swzProto, pa->tszAccountName); if (dwItems & TRAYTIP_LOCKSTATUS) if (Proto_IsAccountLocked(pa)) - mir_sntprintf(swzProto, SIZEOF(swzProto), TranslateT("%s (locked)"), pa->tszAccountName); + mir_sntprintf(swzProto, _countof(swzProto), TranslateT("%s (locked)"), pa->tszAccountName); AddRow(pwd, swzProto, buff, NULL, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, wStatus)); bFirstItem = false; @@ -1508,7 +1508,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_LOGON) { if (TimestampToTimeDifference(NULL, pa->szModuleName, "LogonTS", buff, 59)) { TCHAR ago[96]; - mir_sntprintf(ago, SIZEOF(ago), TranslateT("%s ago"), buff); + mir_sntprintf(ago, _countof(ago), TranslateT("%s ago"), buff); AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false); } } @@ -1629,7 +1629,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR); if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) { TCHAR *swzProto = a2t(proto); - mir_sntprintf(swzName, SIZEOF(swzName), _T("%s (%s)"), swzNick, swzProto); + mir_sntprintf(swzName, _countof(swzName), _T("%s (%s)"), swzNick, swzProto); mir_free(swzProto); } else mir_tstrcpy(swzName, swzNick); diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index d4335c6cfb..fc93fe0b79 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -88,7 +88,7 @@ void ParseAboutPart(FILE *fp, TCHAR *buff, TCHAR *szSkinName) else if (_tcsstr(buff, _T("preview"))) { TCHAR szImgPath[1024]; - mir_sntprintf(szImgPath, SIZEOF(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, szSkinName, pch); + mir_sntprintf(szImgPath, _countof(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, szSkinName, pch); if (FileExists(szImgPath)) mir_tstrcpy(opt.szPreviewFile, szImgPath); } @@ -126,7 +126,7 @@ void ParseImagePart(FILE *fp, TCHAR *buff, int iPart) if (_tcsstr(buff, _T("image"))) { TCHAR szImgPath[1024]; - mir_sntprintf(szImgPath, SIZEOF(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, opt.szSkinName, pch); + mir_sntprintf(szImgPath, _countof(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, opt.szSkinName, pch); opt.szImgFile[iPart] = mir_tstrdup(szImgPath); } else if (_tcsstr(buff, _T("tm"))) diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index bc94a4a38c..4a60c6bc94 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -117,7 +117,7 @@ int EventDeleted(WPARAM wParam, LPARAM lParam) int ReloadSkinFolder(WPARAM wParam, LPARAM lParam) { - FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); + FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); return 0; } @@ -255,7 +255,7 @@ int ModulesLoaded(WPARAM, LPARAM) hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder); hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Tipper"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER)); - FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); + FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); InitTipperSmileys(); LoadOptions(); diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index e492d4bbf8..d888abc7a0 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -233,21 +233,21 @@ TCHAR *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const cha { DBVARIANT dbv; char szSettingName[256]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", prefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", prefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int day = 0; if (GetInt(dbv, &day)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", prefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", prefix); int month = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { if (GetInt(dbv, &month)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", prefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sYear", prefix); int year = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -281,21 +281,21 @@ TCHAR *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char { DBVARIANT dbv; char szSettingName[256]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", szPrefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int day = 0; if (GetInt(dbv, &day)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", szPrefix); int month = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { if (GetInt(dbv, &month)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sYear", szPrefix); int year = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -330,21 +330,21 @@ TCHAR *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, co { DBVARIANT dbv; char szSettingName[256]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sHours", szPrefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int hours = 0; if (GetInt(dbv, &hours)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMinutes", szPrefix); int minutes = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { if (GetInt(dbv, &minutes)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sSeconds", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sSeconds", szPrefix); int seconds = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -374,14 +374,14 @@ TCHAR *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const cha { DBVARIANT dbv; char szSettingName[256]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sHours", szPrefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int hours = 0; if (GetInt(dbv, &hours)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMinutes", szPrefix); int minutes = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -410,42 +410,42 @@ TCHAR *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const ch { DBVARIANT dbv; char szSettingName[256]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", szPrefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int day = 0; if (GetInt(dbv, &day)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", szPrefix); int month = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { if (GetInt(dbv, &month)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sYear", szPrefix); int year = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { if (GetInt(dbv, &year)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sHours", szPrefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int hours = 0; if (GetInt(dbv, &hours)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMinutes", szPrefix); int minutes = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { if (GetInt(dbv, &minutes)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sSeconds", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sSeconds", szPrefix); int seconds = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -512,14 +512,14 @@ TCHAR *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName, { DBVARIANT dbv; char szSettingName[256]; - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", szPrefix); if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { int day = 0; if (GetInt(dbv, &day)) { db_free(&dbv); - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix); + mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", szPrefix); int month = 0; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -657,7 +657,7 @@ TCHAR *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *s int iLang = db_get_b(hContact, szModuleName, szSettingName, 0); if (iLang) { - for (int i = 0; i < SIZEOF(languages); i++) + for (int i = 0; i < _countof(languages); i++) { if (iLang == languages[i].id) { @@ -711,7 +711,7 @@ static DBVTranslation internalTranslations[] = void InitTranslations() { dwNextFuncId = db_get_dw(0, MODULE_ITEMS, "NextFuncId", 1); - for (int i = 0; i < SIZEOF(internalTranslations); i++) + for (int i = 0; i < _countof(internalTranslations); i++) AddTranslation(&internalTranslations[i]); hServiceAdd = CreateServiceFunction(MS_TIPPER_ADDTRANSLATION, ServiceAddTranslation); -- cgit v1.2.3