diff options
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r-- | plugins/DbEditorPP/src/copymodule.cpp | 4 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/deletemodule.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/exportimport.cpp | 34 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/findwindow.cpp | 10 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/icons.cpp | 16 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main.cpp | 34 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main_window.cpp | 10 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/modsettingenum.cpp | 10 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/moduletree.cpp | 22 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/renamemodule.cpp | 4 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/settinglist.cpp | 14 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/settingsdlg.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/watchedvars.cpp | 14 |
13 files changed, 88 insertions, 88 deletions
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 12e68246c5..8e13789c0a 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -35,13 +35,13 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (ApplyProtoFilter(hContact))
continue;
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact);
}
- GetContactName(NULL, NULL, name, SIZEOF(name));
+ GetContactName(NULL, NULL, name, _countof(name));
int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0);
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index aba293adc1..4905fedd10 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -92,7 +92,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) case IDOK:
{
char module[FLD_SIZE];
- GetDlgItemTextA(hwnd, IDC_CONTACTS, module, SIZEOF(module));
+ GetDlgItemTextA(hwnd, IDC_CONTACTS, module, _countof(module));
SetCursor(LoadCursor(NULL, IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
deleteModule(hContact, module, 0);
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 37fc728f24..281fd6d10c 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -16,7 +16,7 @@ int Openfile(TCHAR *outputFile, const char *module, int maxlen) if (module) {
int n = 0;
- mir_tstrncpy(filename, _A2T(module), SIZEOF(filename));
+ mir_tstrncpy(filename, _A2T(module), _countof(filename));
while (filename[n]) {
switch (filename[n]) {
@@ -121,27 +121,27 @@ char* NickFromHContact(MCONTACT hContact) int loaded = 0;
szProto[0] = 0;
- if (!db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
loaded = Proto_IsProtocolLoaded(szProto) ? 1 : 0;
- if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, SIZEOF(name)))
- mir_strncpy(name, "(UNKNOWN)", SIZEOF(name));
+ if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, _countof(name)))
+ mir_strncpy(name, "(UNKNOWN)", _countof(name));
if (!loaded) {
if (szProto[0])
- mir_snprintf(nick, SIZEOF(nick), "%s (%s)", name, szProto);
+ mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto);
else
- mir_strncpy(nick, name, SIZEOF(nick));
+ mir_strncpy(nick, name, _countof(nick));
}
else {
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
char szUID[FLD_SIZE];
- GetValueA(hContact, szProto, uid, szUID, SIZEOF(szUID));
- mir_snprintf(nick, SIZEOF(nick), "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID);
+ GetValueA(hContact, szProto, uid, szUID, _countof(szUID));
+ mir_snprintf(nick, _countof(nick), "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID);
}
else
- mir_snprintf(nick, SIZEOF(nick), "%s (%s)", name, szProto);
+ mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto);
}
}
@@ -269,9 +269,9 @@ MCONTACT CheckNewContact(const char *myProto, const char *uid, const char *myNam char szProto[FLD_SIZE], szName[NAME_SIZE];
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (!db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
if (!mir_strcmp(szProto, myProto))
- if (GetValueA(hContact, szProto, uid, szName, SIZEOF(szName)) && !mir_strcmp(szName, myName))
+ if (GetValueA(hContact, szProto, uid, szName, _countof(szName)) && !mir_strcmp(szName, myName))
return hContact;
return INVALID_CONTACT_ID;
@@ -314,19 +314,19 @@ void importSettings(MCONTACT hContact, char *utf8) char *p1 = strrchr(&importstring[i], '>*{');
char *p2 = strrchr(&importstring[i], '}*');
- if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szUID)) {
+ if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(szUID)) {
strncpy(szUID, p1 + 1, p2 - p1 - 2);
p1 = strrchr(&importstring[i], ')*<');
p2 = strrchr(&importstring[i], '>*{');
- if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(uid)) {
+ if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(uid)) {
strncpy(uid, p1 + 1, p2 - p1 - 3);
p1 = strrchr(&importstring[i], ' *(');
p2 = strrchr(&importstring[i], ')*<');
- if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szProto)) {
+ if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(szProto)) {
strncpy(szProto, p1 + 1, p2 - p1 - 3);
char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -446,7 +446,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam TCHAR name[NAME_SIZE], msg[MSG_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, SIZEOF(name));
+ GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
mir_sntprintf(msg, TranslateT("Import to \"%s\""), name);
SetWindowText(hwnd, msg);
@@ -516,11 +516,11 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) mir_tstrcpy(szFileNames, _T(""));
if (!FilePath)
- offset = Openfile2Import(szFileNames, SIZEOF(szFileNames));
+ offset = Openfile2Import(szFileNames, _countof(szFileNames));
else {
_A2T tmp(FilePath);
if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES)
- mir_tstrncpy(szFileNames, tmp, SIZEOF(szFileNames));
+ mir_tstrncpy(szFileNames, tmp, _countof(szFileNames));
}
int index = 0;
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index 6481fcf027..496d78fe81 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -98,11 +98,11 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP TCHAR text[FLD_SIZE];
TCHAR replace[FLD_SIZE] = {0};
- if (!GetDlgItemText(hwnd, IDC_TEXT, text, SIZEOF(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break;
+ if (!GetDlgItemText(hwnd, IDC_TEXT, text, _countof(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break;
// empty replace is done only for exact match or entire replace
if (LOWORD(wParam) == IDOK &&
- !GetDlgItemText(hwnd, IDC_REPLACE, replace, SIZEOF(replace)) &&
+ !GetDlgItemText(hwnd, IDC_REPLACE, replace, _countof(replace)) &&
(!IsDlgButtonChecked(hwnd, IDC_ENTIRELY) && !IsDlgButtonChecked(hwnd, IDC_EXACT)))
break;
@@ -192,8 +192,8 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP {
ItemInfo ii = {0};
ii.hContact = (MCONTACT)lvi.lParam;
- ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, SIZEOF(ii.module));
- ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, SIZEOF(ii.setting));
+ ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, _countof(ii.module));
+ ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, _countof(ii.setting));
if (ii.setting[0])
ii.type = FW_SETTINGNAME;
else if (ii.module[0])
@@ -245,7 +245,7 @@ void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *set else
mode = TranslateT("Found");
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
LVITEM lvi = {0};
lvi.mask = LVIF_PARAM;
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index 4bcd1cfc90..1e3d755ff0 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -42,7 +42,7 @@ IconItem iconList[] = { HANDLE GetIcoLibHandle(int icon)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == icon)
return iconList[i].hIcolib;
return INVALID_HANDLE_VALUE;
@@ -50,12 +50,12 @@ HANDLE GetIcoLibHandle(int icon) void IcoLibRegister(void)
{
- Icon_Register(hInst, modFullname, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, modFullname, iconList, _countof(iconList));
}
HICON LoadSkinnedDBEIcon(int icon)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == icon)
return IcoLib_GetIconByHandle(iconList[i].hIcolib);
@@ -68,11 +68,11 @@ static int protoCount = 0; HIMAGELIST LoadIcons()
{
HICON hIcon;
- HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, SIZEOF(dbeIcons), 5);
+ HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, _countof(dbeIcons), 5);
if (!hil) return NULL;
- for(int i = 0; i < SIZEOF(dbeIcons); i++)
+ for(int i = 0; i < _countof(dbeIcons); i++)
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i]));
Proto_EnumAccounts(&protoCount, &protocols);
@@ -97,11 +97,11 @@ int GetProtoIconIndex(const char *szProto) if (protoCount && protocols) {
for (int i = 0; i < protoCount; i++) {
if (!mir_strcmp(protocols[i]->szModuleName, szProto))
- return i + SIZEOF(dbeIcons);
+ return i + _countof(dbeIcons);
}
if (Proto_IsProtocolLoaded(szProto))
- return SIZEOF(dbeIcons) - 2; // ICO_ONLINE;
+ return _countof(dbeIcons) - 2; // ICO_ONLINE;
}
}
- return SIZEOF(dbeIcons) - 1; // ICO_OFFLINE;
+ return _countof(dbeIcons) - 1; // ICO_OFFLINE;
}
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 0ddb715f5d..b132390c45 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -230,7 +230,7 @@ char *StringFromBlob(BYTE *blob, WORD len) for (j = 0; j < len; j++)
{
- mir_snprintf(tmp, SIZEOF(tmp), "%02X ", blob[j]);
+ mir_snprintf(tmp, _countof(tmp), "%02X ", blob[j]);
mir_strcat(data, tmp);
}
return data;
@@ -451,33 +451,33 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle name[0] = 0;
if (hContact && (!proto || !proto[0])) {
- if (!db_get_static(hContact, "Protocol", "p", tmp, SIZEOF(tmp)))
+ if (!db_get_static(hContact, "Protocol", "p", tmp, _countof(tmp)))
szProto = tmp;
}
for (int i = 0; i < NAMEORDERCOUNT - 1; i++) {
switch (nameOrder[i]) {
case 0: // custom name
- GetValue(hContact, "CList", "MyHandle", name, SIZEOF(name));
+ GetValue(hContact, "CList", "MyHandle", name, _countof(name));
break;
case 1: // nick
if (!szProto) break;
- GetValue(hContact, szProto, "Nick", name, SIZEOF(name));
+ GetValue(hContact, szProto, "Nick", name, _countof(name));
break;
/*
case 2: // First Name
if (!szProto) break;
- GetValue(hContact, szProto, "FirstName", name, SIZEOF(name));
+ GetValue(hContact, szProto, "FirstName", name, _countof(name));
break;
*/
case 3: // E-mail
if (!szProto) break;
- GetValue(hContact, szProto, "e-mail", name, SIZEOF(name));
+ GetValue(hContact, szProto, "e-mail", name, _countof(name));
break;
/*
case 4: // Last Name
- GetValue(hContact, szProto, "LastName", name, SIZEOF(name));
+ GetValue(hContact, szProto, "LastName", name, _countof(name));
break;
*/
case 5: // Unique id
@@ -486,21 +486,21 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle // protocol must define a PFLAG_UNIQUEIDSETTING
char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
- GetValue(hContact, szProto, uid, name, SIZEOF(name));
+ GetValue(hContact, szProto, uid, name, _countof(name));
}
break;
case 6: // first + last name
{
if (!szProto) break;
- GetValue(hContact, szProto, "FirstName", name, SIZEOF(name));
+ GetValue(hContact, szProto, "FirstName", name, _countof(name));
int len = (int)mir_tstrlen(name);
- if (len + 2 < SIZEOF(name)) {
+ if (len + 2 < _countof(name)) {
if (len)
- mir_tstrncat(name, _T(" "), SIZEOF(name));
+ mir_tstrncat(name, _T(" "), _countof(name));
len++;
- GetValue(hContact, szProto, "LastName", &name[len], SIZEOF(name) - len);
+ GetValue(hContact, szProto, "LastName", &name[len], _countof(name) - len);
}
}
break;
@@ -511,7 +511,7 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle }
if (!name[0])
- mir_tstrncpy(name, TranslateT("<UNKNOWN>"), SIZEOF(name));
+ mir_tstrncpy(name, TranslateT("<UNKNOWN>"), _countof(name));
if (szProto && szProto[0]) {
if (g_Order)
@@ -538,7 +538,7 @@ int ApplyProtoFilter(MCONTACT hContact) int loaded = 0;
char szProto[FLD_SIZE];
- if (!db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
loaded = Proto_IsProtocolLoaded(szProto) ? 1 : 0;
if ((loaded && g_Mode == MODE_UNLOADED) || (!loaded && g_Mode == MODE_LOADED))
@@ -571,7 +571,7 @@ void saveListSettings(HWND hwnd, ColumnsSettings *cs) int i = 0;
while (cs[i].name) {
if (ListView_GetColumn(hwnd, cs[i].index, &sLC)) {
- mir_snprintf(tmp, SIZEOF(tmp), cs[i].dbname, i);
+ mir_snprintf(tmp, _countof(tmp), cs[i].dbname, i);
db_set_w(NULL, modname, tmp, (WORD)sLC.cx);
}
i++;
@@ -585,8 +585,8 @@ INT_PTR CALLBACK ColumnsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam) const int maxSize = 1024;
TCHAR text1[maxSize];
TCHAR text2[maxSize];
- ListView_GetItemText(params.hList, lParam1, params.column, text1, SIZEOF(text1));
- ListView_GetItemText(params.hList, lParam2, params.column, text2, SIZEOF(text2));
+ ListView_GetItemText(params.hList, lParam1, params.column, text1, _countof(text1));
+ ListView_GetItemText(params.hList, lParam2, params.column, text2, _countof(text2));
int res = mir_tstrcmpi(text1, text2);
return (params.column == params.last) ? -res : res;
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 87482e939d..74723eb983 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -116,7 +116,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = TreeView_GetSelection(hwnd);
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
if (TreeView_GetItem(hwnd, &tvi) && tvi.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
MCONTACT hContact = mtis->hContact;
@@ -177,7 +177,7 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd, UINT msg, WPARAM wPar char setting[FLD_SIZE];
int idx = ListView_GetSelectionMark(hwnd);
if (idx == -1 ) return 0;
- ListView_GetItemTextA(hwnd, idx, 0, setting, SIZEOF(setting));
+ ListView_GetItemTextA(hwnd, idx, 0, setting, _countof(setting));
if (wParam == VK_F2)
editSetting(info.hContact, info.module, setting);
@@ -322,7 +322,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
tvi.hItem = item;
if (TreeView_GetItem(hwnd2Tree, &tvi)) {
MCONTACT hContact = 0;
@@ -348,7 +348,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (pos != -1) {
char data[FLD_SIZE];
- ListView_GetItemTextA(hwnd2List, pos, 0, data, SIZEOF(data));
+ ListView_GetItemTextA(hwnd2List, pos, 0, data, _countof(data));
db_set_s(NULL, modname, "LastSetting", data);
}
else
@@ -409,7 +409,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = TreeView_GetSelection(hwnd2Tree);
tvi.pszText = text; // modulename
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
if (!TreeView_GetItem(hwnd2Tree, &tvi)) break;
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
if (mtis && (mtis->type == MODULE))
diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp index b6d90ff1b1..dc30d2f473 100644 --- a/plugins/DbEditorPP/src/modsettingenum.cpp +++ b/plugins/DbEditorPP/src/modsettingenum.cpp @@ -113,7 +113,7 @@ int enumResidentProc(const char *setting, DWORD, LPARAM) char str[FLD_SIZE];
const char *end = strstr(setting, "/");
- if (end && (end - setting) < SIZEOF(str)) {
+ if (end && (end - setting) < _countof(str)) {
mir_strncpy(str, setting, end - setting + 1);
if (m_lResidentModules.getIndex(str) == -1)
m_lResidentModules.insert(mir_strdup(str));
@@ -152,9 +152,9 @@ int IsResidentSetting(const char *module, const char *setting) if (!setting) return 1;
char str[2*FLD_SIZE];
- mir_strncpy(str, module, SIZEOF(str)-1);
+ mir_strncpy(str, module, _countof(str)-1);
mir_strcat(str, "/");
- mir_strncat(str, setting, SIZEOF(str));
+ mir_strncat(str, setting, _countof(str));
return m_lResidentSettings.getIndex(str) != -1;
}
@@ -244,9 +244,9 @@ int fixResidentSettings() for (setting = SettingList.first; setting; setting = setting->next) {
- mir_strncpy(str, module->name, SIZEOF(str)-1);
+ mir_strncpy(str, module->name, _countof(str)-1);
mir_strcat(str, "/");
- mir_strncat(str, setting->name, SIZEOF(str));
+ mir_strncat(str, setting->name, _countof(str));
int idx = m_lResidentSettings.getIndex(str);
if (idx == -1)
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 1611cd0c71..04963061d0 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -63,12 +63,12 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec if (hSelectedContact != hContact)
lParam->type |= EMPTY;
- if (db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
szProto[0] = 0;
icon = GetProtoIconIndex(szProto);
- GetContactName(hContact, szProto, name, SIZEOF(name));
+ GetContactName(hContact, szProto, name, _countof(name));
tvi.item.pszText = name;
tvi.item.iImage = icon;
@@ -162,7 +162,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
- item.cchTextMax = SIZEOF(text);
+ item.cchTextMax = _countof(text);
do {
do {
lastItem = item.hItem;
@@ -241,7 +241,7 @@ http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?t item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
- item.cchTextMax = SIZEOF(text);
+ item.cchTextMax = _countof(text);
prelastItem = item.hItem;
do {
@@ -330,7 +330,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
tvi.hItem = item;
TreeView_GetItem(hwnd2Tree, &tvi);
@@ -340,18 +340,18 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) if (mtis->type == CONTACT)
SelectedModule[0] = 0;
else
- mir_strncpy(SelectedModule, _T2A(text), SIZEOF(SelectedModule));
+ mir_strncpy(SelectedModule, _T2A(text), _countof(SelectedModule));
Select = 1;
}
}
break;
case 2: // restore saved
- if (GetValueA(NULL, modname, "LastModule", SelectedModule, SIZEOF(SelectedModule))) {
+ if (GetValueA(NULL, modname, "LastModule", SelectedModule, _countof(SelectedModule))) {
hSelectedContact = db_get_dw(NULL, modname, "LastContact", INVALID_CONTACT_ID);
if (hSelectedContact != INVALID_CONTACT_ID)
Select = 1;
- GetValueA(NULL, modname, "LastSetting", SelectedSetting, SIZEOF(SelectedSetting));
+ GetValueA(NULL, modname, "LastSetting", SelectedSetting, _countof(SelectedSetting));
}
break;
@@ -508,7 +508,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = pnmtv->itemNew.hItem;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
TreeView_GetItem(pnmtv->hdr.hwndFrom, &tvi);
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
@@ -589,7 +589,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_PARAM;
tvi.hItem = ptvdi->item.hItem;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
mtis = (ModuleTreeInfoStruct *)ptvdi->item.lParam;
@@ -631,7 +631,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti.hItem;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
if (!tvi.lParam) return;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 000f283c3a..42a4bc69a1 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -31,7 +31,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam TranslateDialogDefault(hwnd);
TCHAR msg[MSG_SIZE], name[NAME_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, SIZEOF(name));
+ GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
mir_sntprintf(msg, TranslateT("Add module to \"%s\""), name);
SetWindowText(hwnd, msg);
@@ -42,7 +42,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case IDOK:
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) {
char modulename[FLD_SIZE];
- GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, SIZEOF(modulename));
+ GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, _countof(modulename));
if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
// null contact
db_set_b(NULL, modulename, "(Default)", 0);
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 49445328c1..cc1ebbebab 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -144,7 +144,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s while (i < items) {
if (ListView_GetItemState(hwnd2List, i, LVIS_SELECTED)) {
- if (ListView_GetItemTextA(hwnd2List, i, 0, text, SIZEOF(text)))
+ if (ListView_GetItemTextA(hwnd2List, i, 0, text, _countof(text)))
db_unset(hContact, module, text);
items--;
}
@@ -289,7 +289,7 @@ void addListHandle(MCONTACT hContact) lvi.lParam = hContact;
lvi.iImage = IMAGE_HANDLE;
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
lvi.pszText = name;
int index = ListView_InsertItem(hwnd2List, &lvi);
@@ -337,13 +337,13 @@ void PopulateSettings(MCONTACT hContact, const char *module) {
// save module as it can be erased by ClearListView()
char tmp[FLD_SIZE];
- mir_strncpy(tmp, module, SIZEOF(tmp));
+ mir_strncpy(tmp, module, _countof(tmp));
// clear any settings that may be there...
ClearListView();
info.hContact = hContact;
- mir_strncpy(info.module, tmp, SIZEOF(info.module));
+ mir_strncpy(info.module, tmp, _countof(info.module));
ModuleSettingLL setlist;
@@ -609,7 +609,7 @@ void EditLabel(int item, int subitem) info.hwnd2Edit = NULL;
}
- if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, SIZEOF(setting))) return;
+ if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, _countof(setting))) return;
if (!setting[0] || !ListView_GetSubItemRect(hwnd2List, item, subitem, LVIR_LABEL, &rc))
return;
@@ -712,7 +712,7 @@ void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam) if (!g_Inline || hti.iSubItem > 1 || hti.flags == LVHT_ONITEMICON) {
char setting[FLD_SIZE];
EditFinish(hti.iItem);
- if (ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, SIZEOF(setting)))
+ if (ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, _countof(setting)))
editSetting(info.hContact, info.module, setting);
}
else
@@ -853,7 +853,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to }
char setting[FLD_SIZE];
- if (!ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, SIZEOF(setting))) return;
+ if (!ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, _countof(setting))) return;
// check if the setting is being watched and if it is then check the menu item
int watchIdx = WatchedArrayIndex(info.hContact, info.module, setting, 1);
diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp index 246678306d..876ac8262b 100644 --- a/plugins/DbEditorPP/src/settingsdlg.cpp +++ b/plugins/DbEditorPP/src/settingsdlg.cpp @@ -189,7 +189,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l struct DBsetting *dbsetting = (struct DBsetting*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
TCHAR settingname[FLD_SIZE];
- GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, SIZEOF(settingname));
+ GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, _countof(settingname));
if (settingname[0])
{
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index b9bc71cefd..a43c1e46c3 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -116,7 +116,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) TCHAR data[32], tmp[16], name[NAME_SIZE];
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
lvItem.pszText = name;
index = ListView_InsertItem(hwnd, &lvItem);
@@ -321,8 +321,8 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
ItemInfo ii;
ii.hContact = (MCONTACT)lvi.lParam;
- ListView_GetItemTextA(hwndVars, hti.iItem, 1, ii.module, SIZEOF(ii.module));
- ListView_GetItemTextA(hwndVars, hti.iItem, 2, ii.setting, SIZEOF(ii.setting));
+ ListView_GetItemTextA(hwndVars, hti.iItem, 1, ii.module, _countof(ii.module));
+ ListView_GetItemTextA(hwndVars, hti.iItem, 2, ii.setting, _countof(ii.setting));
ii.type = FW_SETTINGNAME;
SendMessage(hwnd2mainWindow, WM_FINDITEM, (WPARAM)&ii, 0);
}
@@ -372,17 +372,17 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) int timeout = db_get_b(NULL, modname, "PopupDelay", 3);
TCHAR name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE];
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
// 2nd line
- int type = GetValue(hContact, module, setting, value, SIZEOF(value));
+ int type = GetValue(hContact, module, setting, value, _countof(value));
mir_sntprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""), _A2T(module), _A2T(setting), DBVType(type), value);
POPUPDATAT ppd = { 0 };
ppd.lchContact = (MCONTACT)hContact;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
- mir_tstrncpy(ppd.lptzContactName, name, SIZEOF(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, text, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, name, _countof(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, text, _countof(ppd.lptzText));
ppd.colorBack = colorBack;
ppd.colorText = colorText;
ppd.iSeconds = timeout ? timeout : -1;
|