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/NotesAndReminders/src/main.cpp | 2 +- plugins/NotesAndReminders/src/notes.cpp | 26 ++++++------ plugins/NotesAndReminders/src/options.cpp | 52 +++++++++++------------ plugins/NotesAndReminders/src/reminders.cpp | 64 ++++++++++++++--------------- 4 files changed, 72 insertions(+), 72 deletions(-) (limited to 'plugins/NotesAndReminders/src') diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index a19ad4f3da..42ed98f0fb 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -110,7 +110,7 @@ IconItem iconList[] = void InitIcons(void) { - Icon_Register(hinstance, LPGEN("Sticky Notes"), iconList, SIZEOF(iconList), MODULENAME); + Icon_Register(hinstance, LPGEN("Sticky Notes"), iconList, _countof(iconList), MODULENAME); } int OnOptInitialise(WPARAM w, LPARAM L) diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index e3cfb87c52..3f553dee1e 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -381,7 +381,7 @@ void LoadNotes(BOOL bIsStartup) { char *DelPos; - mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", I); + mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", I); if (Value) { @@ -694,7 +694,7 @@ void PurgeNotes(void) NotesCount = db_get_dw(0,MODULENAME,"NotesData",0); for(I = 0; I < NotesCount; I++) { - mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", I); + mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", I); db_unset(0,MODULENAME,ValueName); } } @@ -940,7 +940,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified) Value[0xffff] = 0; } - mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", NotesCount - I - 1); // we do not reverse notes in DB + mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", NotesCount - I - 1); // we do not reverse notes in DB db_set_blob(0, MODULENAME, ValueName, Value, n+1); @@ -956,7 +956,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified) // delete any left over DB note entries for(; I < OldNotesCount; I++) { - mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", I); + mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", I); db_unset(0,MODULENAME,ValueName); } @@ -1024,10 +1024,10 @@ static BOOL DoContextMenu(HWND AhWnd,WPARAM wParam,LPARAM lParam) HMENU hBg = GetSubMenu(hSub, FindMenuItem(hSub, _T("Background Color"))); HMENU hFg = GetSubMenu(hSub, FindMenuItem(hSub, _T("Text Color"))); - for (i=0; iCtlType != ODT_MENU) break; - if (lpMeasureItem->itemID >= IDM_COLORPRESET_BG && lpMeasureItem->itemID <= IDM_COLORPRESET_BG+SIZEOF(clrPresets)) + if (lpMeasureItem->itemID >= IDM_COLORPRESET_BG && lpMeasureItem->itemID <= IDM_COLORPRESET_BG+_countof(clrPresets)) { MeasureColorPresetMenuItem(hdlg, lpMeasureItem, clrPresets + (lpMeasureItem->itemID - IDM_COLORPRESET_BG)); return TRUE; } - else if (lpMeasureItem->itemID >= IDM_COLORPRESET_FG && lpMeasureItem->itemID <= IDM_COLORPRESET_FG+SIZEOF(clrPresets)) + else if (lpMeasureItem->itemID >= IDM_COLORPRESET_FG && lpMeasureItem->itemID <= IDM_COLORPRESET_FG+_countof(clrPresets)) { MeasureColorPresetMenuItem(hdlg, lpMeasureItem, clrPresets + (lpMeasureItem->itemID - IDM_COLORPRESET_FG)); return TRUE; @@ -1424,12 +1424,12 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l if (lpDrawItem->CtlType != ODT_MENU) break; - if (lpDrawItem->itemID >= IDM_COLORPRESET_BG && lpDrawItem->itemID <= IDM_COLORPRESET_BG+SIZEOF(clrPresets)) + if (lpDrawItem->itemID >= IDM_COLORPRESET_BG && lpDrawItem->itemID <= IDM_COLORPRESET_BG+_countof(clrPresets)) { PaintColorPresetMenuItem(lpDrawItem, clrPresets + (lpDrawItem->itemID - IDM_COLORPRESET_BG)); return TRUE; } - else if (lpDrawItem->itemID >= IDM_COLORPRESET_FG && lpDrawItem->itemID <= IDM_COLORPRESET_FG+SIZEOF(clrPresets)) + else if (lpDrawItem->itemID >= IDM_COLORPRESET_FG && lpDrawItem->itemID <= IDM_COLORPRESET_FG+_countof(clrPresets)) { PaintColorPresetMenuItem(lpDrawItem, clrPresets + (lpDrawItem->itemID - IDM_COLORPRESET_FG)); return TRUE; @@ -1459,7 +1459,7 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l H = SN->REHwnd; - if (id >= IDM_COLORPRESET_BG && id <= IDM_COLORPRESET_BG+SIZEOF(clrPresets)) + if (id >= IDM_COLORPRESET_BG && id <= IDM_COLORPRESET_BG+_countof(clrPresets)) { SN->BgColor = clrPresets[id-IDM_COLORPRESET_BG].color | 0xff000000; SendMessage(H, EM_SETBKGNDCOLOR, 0, SN->BgColor & 0xffffff); @@ -1467,7 +1467,7 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l JustSaveNotes(); return FALSE; } - else if (id >= IDM_COLORPRESET_FG && id <= IDM_COLORPRESET_FG+SIZEOF(clrPresets)) + else if (id >= IDM_COLORPRESET_FG && id <= IDM_COLORPRESET_FG+_countof(clrPresets)) { CHARFORMAT CF = {0}; SN->FgColor = clrPresets[id-IDM_COLORPRESET_FG].color | 0xff000000; @@ -2025,7 +2025,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM switch (NM->hdr.code) { case HDN_ENDTRACK: - UpdateGeomFromWnd(Dialog, NULL, g_notesListColGeom, SIZEOF(g_notesListColGeom)); + UpdateGeomFromWnd(Dialog, NULL, g_notesListColGeom, _countof(g_notesListColGeom)); break; } } diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 71c6e76902..fe5590f7a3 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -230,21 +230,21 @@ void RegisterFontServiceFonts() FontIDT fontid = {0}; fontid.cbSize = sizeof(FontIDT); - _tcsncpy(fontid.group, _T(SECTIONNAME), SIZEOF(fontid.group)); - _tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), SIZEOF(fontid.backgroundGroup) ); - strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); + _tcsncpy(fontid.group, _T(SECTIONNAME), _countof(fontid.group)); + _tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), _countof(fontid.backgroundGroup) ); + strncpy(fontid.dbSettingsGroup, MODULENAME, _countof(fontid.dbSettingsGroup)); fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE; HDC hDC = GetDC(NULL); int nFontScale = GetDeviceCaps(hDC, LOGPIXELSY); ReleaseDC(NULL, hDC); - for (int i = 0; i < SIZEOF(fontOptionsList); i++) + for (int i = 0; i < _countof(fontOptionsList); i++) { fontid.order = i; mir_snprintf(szTemp, "Font%d", i); - strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix)); - _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); + strncpy(fontid.prefix, szTemp, _countof(fontid.prefix)); + _tcsncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name)); fontid.deffontsettings.colour = fontOptionsList[i].defColour; fontid.deffontsettings.size = (char)-MulDiv(fontOptionsList[i].defSize, nFontScale, 72); @@ -252,8 +252,8 @@ void RegisterFontServiceFonts() fontid.deffontsettings.style = fontOptionsList[i].defStyle; fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); - _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace)); - _tcsncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fontid.backgroundName)); + _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace)); + _tcsncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, _countof(fontid.backgroundName)); FontRegisterT(&fontid); } @@ -261,16 +261,16 @@ void RegisterFontServiceFonts() ColourIDT colorid = {0}; colorid.cbSize = sizeof(ColourIDT); - _tcsncpy(colorid.group, _T(SECTIONNAME), SIZEOF(colorid.group)); - strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); + _tcsncpy(colorid.group, _T(SECTIONNAME), _countof(colorid.group)); + strncpy(colorid.dbSettingsGroup, MODULENAME, _countof(fontid.dbSettingsGroup)); colorid.flags = 0; - for (int i = 0; i < SIZEOF(colourOptionsList); i++) + for (int i = 0; i < _countof(colourOptionsList); i++) { colorid.order = i; - _tcsncpy(colorid.name, colourOptionsList[i].szName, SIZEOF(colorid.name)); + _tcsncpy(colorid.name, colourOptionsList[i].szName, _countof(colorid.name)); colorid.defcolour = colourOptionsList[i].defColour; - strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting)); + strncpy(colorid.setting, colourOptionsList[i].szSettingName, _countof(colorid.setting)); ColourRegisterT(&colorid); } @@ -284,8 +284,8 @@ void LoadNRFont(int i, LOGFONT *lf, COLORREF *colour) FontIDT fontid = {0}; fontid.cbSize = sizeof(fontid); - _tcsncpy(fontid.group, LPGENT(SECTIONNAME), SIZEOF(fontid.group)); - _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); + _tcsncpy(fontid.group, LPGENT(SECTIONNAME), _countof(fontid.group)); + _tcsncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name)); COLORREF col = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)lf); @@ -360,9 +360,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar SendDlgItemMessage(hdlg,IDC_COMBODATE,CB_RESETCONTENT,0,0); SendDlgItemMessage(hdlg,IDC_COMBOTIME,CB_RESETCONTENT,0,0); - for (i=0; i 0 && g_reminderListGeom[3] > 0) { - WriteSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,SIZEOF(g_reminderListGeom)); - WriteSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,SIZEOF(g_reminderListColGeom)); + WriteSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,_countof(g_reminderListGeom)); + WriteSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,_countof(g_reminderListColGeom)); } if (g_notesListGeom[2] > 0 && g_notesListGeom[3] > 0) { - WriteSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,SIZEOF(g_notesListGeom)); - WriteSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,SIZEOF(g_notesListColGeom)); + WriteSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,_countof(g_notesListGeom)); + WriteSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,_countof(g_notesListColGeom)); } if (g_lpszAltBrowser) diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index be97aea7cb..192ea34e5c 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -215,7 +215,7 @@ void PurgeReminders(void) ReminderCount = db_get_dw(0,MODULENAME,"RemindersData",0); for(I = 0;I < ReminderCount;I++) { - mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", I); + mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", I); db_unset(0, MODULENAME, ValueName); } } @@ -287,7 +287,7 @@ void JustSaveReminders(void) Value[0xffff] = 0; } - mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", ReminderCount - I - 1); // do not want to reverse in DB + mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", ReminderCount - I - 1); // do not want to reverse in DB db_set_blob(0, MODULENAME, ValueName, Value, n+1); @@ -297,7 +297,7 @@ void JustSaveReminders(void) // delete any left over DB reminder entries for(; I < OldReminderCount; I++) { - mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", I); + mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", I); db_unset(0, MODULENAME, ValueName); } } @@ -317,7 +317,7 @@ void LoadReminders(void) { Size = 65535; Value = NULL; - mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", I); + mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", I); ReadSettingBlob(0, MODULENAME, ValueName, &Size, (void**)&Value); @@ -607,7 +607,7 @@ INT_PTR OpenTriggeredReminder(WPARAM w, LPARAM l) pReminder->handle = H = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_NOTIFYREMINDER), 0, DlgProcNotifyReminder); - mir_snprintf(S, SIZEOF(S), "%s! - %s", Translate("Reminder"), S1); + mir_snprintf(S, _countof(S), "%s! - %s", Translate("Reminder"), S1); SetWindowText(H, S); if (pReminder->Reminder) @@ -642,7 +642,7 @@ static void SkinPlaySoundPoly(LPCSTR pszSoundName) char szShort[MAX_PATH]; char s[512]; GetShortPathNameA(szFull, szShort, sizeof(szShort)); - mir_snprintf(s, SIZEOF(s), "play \"%s\"", szShort); + mir_snprintf(s, _countof(s), "play \"%s\"", szShort); mciSendStringA(s, NULL, 0, NULL); } @@ -1055,7 +1055,7 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S const int m = (i&1) ? 30 : 0; FileTimeToTzLocalST((FILETIME*)&li, &tm2); - mir_snprintf(s, SIZEOF(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute); + mir_snprintf(s, _countof(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); // item data contains time offset from midnight in seconds (bit 31 is set to flag that // combo box items are absolute times and not relative times like below @@ -1086,35 +1086,35 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S FileTimeToTzLocalST((FILETIME*)&li, &tm2); wCurHour = tm2.wHour; wCurMinute = tm2.wMinute; - mir_snprintf(s, SIZEOF(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute); + mir_snprintf(s, _countof(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC)); // 5 minutes li.QuadPart += (ULONGLONG)5 * MinutesToFileTime; FileTimeToTzLocalST((FILETIME*)&li, &tm2); - mir_snprintf(s, SIZEOF(s), "%02d:%02d (5 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); + mir_snprintf(s, _countof(s), "%02d:%02d (5 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC)); // 10 minutes li.QuadPart += (ULONGLONG)5 * MinutesToFileTime; FileTimeToTzLocalST((FILETIME*)&li, &tm2); - mir_snprintf(s, SIZEOF(s), "%02d:%02d (10 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); + mir_snprintf(s, _countof(s), "%02d:%02d (10 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC)); // 15 minutes li.QuadPart += (ULONGLONG)5 * MinutesToFileTime; FileTimeToTzLocalST((FILETIME*)&li, &tm2); - mir_snprintf(s, SIZEOF(s), "%02d:%02d (15 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); + mir_snprintf(s, _countof(s), "%02d:%02d (15 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC)); // 30 minutes li.QuadPart += (ULONGLONG)15 * MinutesToFileTime; FileTimeToTzLocalST((FILETIME*)&li, &tm2); - mir_snprintf(s, SIZEOF(s), "%02d:%02d (30 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); + mir_snprintf(s, _countof(s), "%02d:%02d (30 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC)); @@ -1142,13 +1142,13 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S } // icq-style display 1.0, 1.5 etc. hours even though that isn't accurate due to rounding - //mir_snprintf(s, SIZEOF(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, 1+(i>>1), (i&1) ? 5 : 0, lpszHours); + //mir_snprintf(s, _countof(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, 1+(i>>1), (i&1) ? 5 : 0, lpszHours); // display delta time more accurately to match reformatting (that icq doesn't do) dt = (UINT)((li.QuadPart/MinutesToFileTime) - (ref/MinutesToFileTime)); if (dt < 60) - mir_snprintf(s, SIZEOF(s), "%02d:%02d (%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt, lpszMinutes); + mir_snprintf(s, _countof(s), "%02d:%02d (%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt, lpszMinutes); else - mir_snprintf(s, SIZEOF(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt/60, ((dt%60)*10)/60, lpszHours); + mir_snprintf(s, _countof(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt/60, ((dt%60)*10)/60, lpszHours); n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDTime,CB_SETITEMDATA,n, dt*60); @@ -1179,39 +1179,39 @@ static void PopulateTimeOffsetCombo(HWND Dialog, UINT nIDCombo) // 5 - 55 minutes (in 5 minute steps) for (i = 1; i < 12; i++) { - mir_snprintf(s, SIZEOF(s), "%d %s", i*5, lpszMinutes); + mir_snprintf(s, _countof(s), "%d %s", i*5, lpszMinutes); n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA,n, i*5); } // 1 hour - mir_snprintf(s, SIZEOF(s), "1 %s", lpszHour); + mir_snprintf(s, _countof(s), "1 %s", lpszHour); n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, 60); // 2, 4, 8 hours for (i = 2; i <= 8; i+=2) { - mir_snprintf(s, SIZEOF(s), "%d %s", i, lpszHours); + mir_snprintf(s, _countof(s), "%d %s", i, lpszHours); n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, i*60); } // 1 day - mir_snprintf(s, SIZEOF(s), "1 %s", lpszDay); + mir_snprintf(s, _countof(s), "1 %s", lpszDay); n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, 24*60); // 2-4 days for (i = 2; i <= 4; i++) { - mir_snprintf(s, SIZEOF(s), "%d %s", i, lpszDays); + mir_snprintf(s, _countof(s), "%d %s", i, lpszDays); n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, i*24*60); } // 1 week - mir_snprintf(s, SIZEOF(s), "1 %s", lpszWeek); + mir_snprintf(s, _countof(s), "1 %s", lpszWeek); n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s); SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, 7*24*60); } @@ -1570,7 +1570,7 @@ INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog,UINT Message,WPARAM wParam,LP // which could potentially mess up things otherwise) { char s[32]; - mir_snprintf(s, SIZEOF(s), "%I64x", li.QuadPart); + mir_snprintf(s, _countof(s), "%I64x", li.QuadPart); SetDlgItemText(Dialog, IDC_REFTIME, s); } @@ -1915,7 +1915,7 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA // which could potentially mess up things otherwise) { char s[32]; - mir_snprintf(s, SIZEOF(s), "%I64x", li.QuadPart); + mir_snprintf(s, _countof(s), "%I64x", li.QuadPart); SetDlgItemText(Dialog, IDC_REFTIME, s); } @@ -1938,7 +1938,7 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA { int n; char s[32]; - mir_snprintf(s, SIZEOF(s), "%02d:%02d", (UINT)tm.wHour, (UINT)tm.wMinute); + mir_snprintf(s, _countof(s), "%02d:%02d", (UINT)tm.wHour, (UINT)tm.wMinute); // search for preset first n = SendDlgItemMessage(Dialog, IDC_TIME, CB_FINDSTRING, (WPARAM)-1, (LPARAM)s); @@ -1966,33 +1966,33 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA n = SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_ADDSTRING, 0, (LPARAM)Translate("Never")); SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_SETITEMDATA, n, 0); - mir_snprintf(s, SIZEOF(s), "%s 5 %s", lpszEvery, lpszSeconds); + mir_snprintf(s, _countof(s), "%s 5 %s", lpszEvery, lpszSeconds); n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND, CB_ADDSTRING, 0, (LPARAM)s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)5); - mir_snprintf(s, SIZEOF(s), "%s 10 %s", lpszEvery, lpszSeconds); + mir_snprintf(s, _countof(s), "%s 10 %s", lpszEvery, lpszSeconds); n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)10); - mir_snprintf(s, SIZEOF(s), "%s 15 %s", lpszEvery, lpszSeconds); + mir_snprintf(s, _countof(s), "%s 15 %s", lpszEvery, lpszSeconds); n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)15); - mir_snprintf(s, SIZEOF(s), "%s 20 %s", lpszEvery, lpszSeconds); + mir_snprintf(s, _countof(s), "%s 20 %s", lpszEvery, lpszSeconds); n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)20); - mir_snprintf(s, SIZEOF(s), "%s 30 %s", lpszEvery, lpszSeconds); + mir_snprintf(s, _countof(s), "%s 30 %s", lpszEvery, lpszSeconds); n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)30); - mir_snprintf(s, SIZEOF(s), "%s 60 %s", lpszEvery, lpszSeconds); + mir_snprintf(s, _countof(s), "%s 60 %s", lpszEvery, lpszSeconds); n = SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_ADDSTRING, 0, (LPARAM)s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)60); if (NewReminderVisible == 2 && pEditReminder->RepeatSound) { - mir_snprintf(s, SIZEOF(s), "%s %d %s", lpszEvery, pEditReminder->RepeatSound, lpszSeconds); + mir_snprintf(s, _countof(s), "%s %d %s", lpszEvery, pEditReminder->RepeatSound, lpszSeconds); SetDlgItemText(Dialog, IDC_COMBO_REPEATSND, s); SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETCURSEL, SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)s), 0); } @@ -2489,7 +2489,7 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA switch (NM->hdr.code) { case HDN_ENDTRACK: - UpdateGeomFromWnd(Dialog, NULL, g_reminderListColGeom, SIZEOF(g_reminderListColGeom)); + UpdateGeomFromWnd(Dialog, NULL, g_reminderListColGeom, _countof(g_reminderListColGeom)); break; } } -- cgit v1.2.3