summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/WhenWasIt/src')
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp44
-rw-r--r--plugins/WhenWasIt/src/icons.cpp6
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp8
-rw-r--r--plugins/WhenWasIt/src/services.cpp16
-rw-r--r--plugins/WhenWasIt/src/utils.cpp6
5 files changed, 40 insertions, 40 deletions
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 8e9f057066..caa196e5d8 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -123,7 +123,7 @@ SIZE GetControlTextSize(HWND hCtrl)
const size_t maxSize = 2048;
TCHAR buffer[maxSize];
SIZE size;
- GetWindowText(hCtrl, buffer, SIZEOF(buffer));
+ GetWindowText(hCtrl, buffer, _countof(buffer));
GetTextExtentPoint32(hDC, buffer, (int)mir_tstrlen(buffer), &size);
SelectObject(hDC, oldFont);
ReleaseDC(hCtrl, hDC);
@@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
SetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer);
_itot(commonData.checkInterval, buffer, 10);
SetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
SetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer);
_itot(commonData.cSoundNearDays, buffer, 10);
SetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer);
@@ -306,22 +306,22 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
const int maxSize = 1024;
TCHAR buffer[maxSize];
- GetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer, _countof(buffer));
TCHAR *stop = NULL;
commonData.daysInAdvance = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
- GetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer, _countof(buffer));
commonData.daysAfter = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.daysAfter = DAYS_TO_NOTIFY_AFTER; }
- GetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer, _countof(buffer));
commonData.checkInterval = _ttol(buffer);
if (!commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
- GetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer, _countof(buffer));
TCHAR *pos;
pos = _tcschr(buffer, _T('|'));
if (pos) {
@@ -338,12 +338,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
}
else commonData.popupTimeout = commonData.popupTimeoutToday = _ttol(buffer);
- GetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer, _countof(buffer));
//cSoundNearDays = _ttol(buffer);
commonData.cSoundNearDays = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.cSoundNearDays = BIRTHDAY_NEAR_DEFAULT_DAYS; }
- GetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer, _countof(buffer));
commonData.cDlgTimeout = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
@@ -419,7 +419,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
char *szProto = GetContactProto(hContact);
TCHAR buffer[2048];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hWnd, buffer);
HWND hDate = GetDlgItem(hWnd, IDC_DATE);
@@ -443,7 +443,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case DOB_PROTOCOL:
DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_PROTOCOL);
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%S protocol"), szProto);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("%S protocol"), szProto);
szCurrentModuleTooltip = buffer;
break;
@@ -544,8 +544,8 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam
TCHAR text1[maxSize];
TCHAR text2[maxSize];
long value1, value2;
- ListView_GetItemText(params.hList, (int)lParam1, params.column, text1, SIZEOF(text1));
- ListView_GetItemText(params.hList, (int)lParam2, params.column, text2, SIZEOF(text2));
+ ListView_GetItemText(params.hList, (int)lParam1, params.column, text1, _countof(text1));
+ ListView_GetItemText(params.hList, (int)lParam2, params.column, text2, _countof(text2));
int res = 0;
@@ -609,22 +609,22 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll,
TCHAR buffer[2048];
if ((dtb <= 366) && (dtb >= 0))
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), dtb);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), dtb);
else
- mir_sntprintf(buffer, SIZEOF(buffer), NA);
+ mir_sntprintf(buffer, _countof(buffer), NA);
ListView_SetItemText(hList, entry, 2, buffer);
if ((month != 0) && (day != 0))
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%04d-%02d-%02d"), year, month, day);
+ mir_sntprintf(buffer, _countof(buffer), _T("%04d-%02d-%02d"), year, month, day);
else
- mir_sntprintf(buffer, SIZEOF(buffer), NA);
+ mir_sntprintf(buffer, _countof(buffer), NA);
ListView_SetItemText(hList, entry, 3, buffer);
if (age < 400 && age > 0) //hopefully noone lives longer than this :)
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), age);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), age);
else
- mir_sntprintf(buffer, SIZEOF(buffer), NA);
+ mir_sntprintf(buffer, _countof(buffer), NA);
ListView_SetItemText(hList, entry, 4, buffer);
ListView_SetItemText(hList, entry, 5, GetBirthdayModule(module, hContact));
@@ -694,7 +694,7 @@ void SetBirthdaysCount(HWND hWnd)
{
int count = ListView_GetItemCount((GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST)));
TCHAR title[512];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Birthday list (%d)"), count);
+ mir_sntprintf(title, _countof(title), TranslateT("Birthday list (%d)"), count);
SetWindowText(hWnd, title);
}
@@ -881,7 +881,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
const int MAX_SIZE = 512;
TCHAR buffer[MAX_SIZE];
timeout--;
- mir_sntprintf(buffer, SIZEOF(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
+ mir_sntprintf(buffer, _countof(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
SetDlgItemText(hWnd, IDC_CLOSE, buffer);
if (timeout <= 0)
@@ -914,9 +914,9 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
ListView_InsertItem(hList, &item);
TCHAR buffer[512];
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->age);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), data->age);
ListView_SetItemText(hList, index, 1, buffer);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->dtb);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), data->dtb);
ListView_SetItemText(hList, index, 2, buffer);
BirthdaysSortParams params = { 0 };
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp
index 6dd5157fb3..b9a7d9db7d 100644
--- a/plugins/WhenWasIt/src/icons.cpp
+++ b/plugins/WhenWasIt/src/icons.cpp
@@ -45,7 +45,7 @@ static HANDLE AddIcon(char *name, char *description, TCHAR *tszPath, int iDefaul
int AddIcons()
{
TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hInstance, tszPath, SIZEOF(tszPath));
+ GetModuleFileName(hInstance, tszPath, _countof(tszPath));
hCheckMenu = AddIcon("MenuCheck", LPGEN("Check birthdays menu item"), tszPath, IDI_CHECK);
hListMenu = AddIcon("MenuList", LPGEN("List birthdays menu item"), tszPath, IDI_LIST);
@@ -61,10 +61,10 @@ int AddIcons()
hDTB[1] = AddIcon("DTB1", LPGEN("1 day to birthday"), tszPath, IDI_DTB1);
for (int i = 2; i < cDTB; i++) {
mir_snprintf(name, "DTB%d", i);
- mir_snprintf(description, SIZEOF(description), Translate("%d days to birthday"), i);
+ mir_snprintf(description, _countof(description), Translate("%d days to birthday"), i);
hDTB[i] = AddIcon(name, description, tszPath, IDI_DTB0 + i);
}
- mir_snprintf(description, SIZEOF(description), Translate("More than %d days to birthday"), cDTB - 1);
+ mir_snprintf(description, _countof(description), Translate("More than %d days to birthday"), cDTB - 1);
hDTBMore = AddIcon("DTBMore", description, tszPath, IDI_DTBMORE);
hWWIExtraIcons = ExtraIcon_Register("WhenWasIt", LPGEN("WhenWasIt birthday reminder"), "MenuCheck");
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index 79c518246d..4f2412143d 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -72,7 +72,7 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDTBText(dtb, name, text, SIZEOF(text));
+ BuildDTBText(dtb, name, text, _countof(text));
int gender = GetContactGender(hContact);
POPUPDATAT pd = { 0 };
@@ -116,7 +116,7 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDABText(dab, name, text, SIZEOF(text));
+ BuildDABText(dab, name, text, _countof(text));
int gender = GetContactGender(hContact);
POPUPDATAT pd = { 0 };
@@ -156,7 +156,7 @@ int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDTBText(dtb, name, text, SIZEOF(text));
+ BuildDTBText(dtb, name, text, _countof(text));
if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
@@ -178,7 +178,7 @@ int DialogNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDABText(dab, name, text, SIZEOF(text));
+ BuildDABText(dab, name, text, _countof(text));
if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 3e392520c9..2130782dec 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -220,16 +220,16 @@ INT_PTR ImportBirthdaysService(WPARAM wParam, LPARAM lParam)
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c"), TranslateT("Birthdays files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c"), TranslateT("Birthdays files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
- of.nMaxFile = SIZEOF(fileName);
+ of.nMaxFile = _countof(fileName);
of.lpstrTitle = TranslateT("Please select a file to import birthdays from...");
of.Flags = OFN_FILEMUSTEXIST;
if (GetOpenFileName(&of)) {
TCHAR buffer[2048];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Importing birthdays from file: %s"), fileName);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Importing birthdays from file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hImportBirthdays);
DoImport(fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done importing birthdays"), hImportBirthdays);
@@ -245,10 +245,10 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c%s (*.*)%c*.*%c"), TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c%s (*.*)%c*.*%c"), TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
- of.nMaxFile = SIZEOF(fileName);
+ of.nMaxFile = _countof(fileName);
of.lpstrTitle = TranslateT("Please select a file to export birthdays to...");
if (GetSaveFileName(&of)) {
@@ -257,7 +257,7 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
if (!_tcschr(fn, _T('.')))
mir_tstrcat(fileName, _T(BIRTHDAY_EXTENSION));
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Exporting birthdays to file: %s"), fileName);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Exporting birthdays to file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hExportBirthdays);
DoExport(fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done exporting birthdays"), hExportBirthdays);
@@ -278,7 +278,7 @@ int DoImport(TCHAR *fileName)
while (!feof(fin)) {
TCHAR buffer[4096];
- _fgetts(buffer, SIZEOF(buffer), fin);
+ _fgetts(buffer, _countof(buffer), fin);
if (buffer[0] == _T(COMMENT_CHAR))
continue;
@@ -304,7 +304,7 @@ int DoImport(TCHAR *fileName)
}
else {
TCHAR tmp[2048];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
ShowPopupMessage(TranslateT("Warning"), tmp, hImportBirthdays);
}
}
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index f8da4effb5..8c396b757f 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -155,17 +155,17 @@ TCHAR* GetContactID(MCONTACT hContact, char *szProto)
TCHAR tmp[16];
switch (ctInfo.type) {
case CNFT_BYTE:
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), ctInfo.bVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%d"), ctInfo.bVal);
buffer = _tcsdup(tmp);
break;
case CNFT_WORD:
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), ctInfo.wVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%d"), ctInfo.wVal);
buffer = _tcsdup(tmp);
break;
case CNFT_DWORD:
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%ld"), ctInfo.dVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%ld"), ctInfo.dVal);
buffer = _tcsdup(tmp);
break;