summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AutoShutdown/src')
-rw-r--r--plugins/AutoShutdown/src/frame.cpp16
-rw-r--r--plugins/AutoShutdown/src/main.cpp2
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp6
-rw-r--r--plugins/AutoShutdown/src/shutdownsvc.cpp2
-rw-r--r--plugins/AutoShutdown/src/utils.cpp10
5 files changed, 18 insertions, 18 deletions
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index c01bf11b54..e66b12998e 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -358,8 +358,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
else {
TCHAR szOutput[256];
if (dat->fTimeFlags&SDWTF_ST_TIME)
- GetFormatedDateTime(szOutput,SIZEOF(szOutput),dat->settingLastTime,TRUE);
- else GetFormatedCountdown(szOutput,SIZEOF(szOutput),dat->countdown);
+ GetFormatedDateTime(szOutput,_countof(szOutput),dat->settingLastTime,TRUE);
+ else GetFormatedCountdown(szOutput,_countof(szOutput),dat->countdown);
SetWindowText(dat->hwndTime,szOutput);
PostMessage(hwndFrame,M_CHECK_CLIPPED,0,0);
/* update tooltip text (if shown) */
@@ -443,7 +443,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
HFONT hFontPrev=NULL;
TCHAR szOutput[256];
dat->flags&=~FWPDF_TIMEISCLIPPED;
- if (GetWindowText(dat->hwndTime,szOutput,SIZEOF(szOutput)))
+ if (GetWindowText(dat->hwndTime,szOutput,_countof(szOutput)))
if (GetClientRect(dat->hwndTime,&rc)) {
hdc=GetDC(dat->hwndTime);
if (hdc != NULL) {
@@ -484,17 +484,17 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
case TTN_NEEDTEXT:
{ NMTTDISPINFO *ttdi=(NMTTDISPINFO*)lParam;
if (dat->flags&FWPDF_TIMEISCLIPPED && (HWND)wParam==dat->hwndTime) {
- if (GetWindowText(dat->hwndTime,ttdi->szText,SIZEOF(ttdi->szText)))
+ if (GetWindowText(dat->hwndTime,ttdi->szText,_countof(ttdi->szText)))
ttdi->lpszText=ttdi->szText;
}
else if ((HWND)wParam==dat->hwndIcon)
ttdi->lpszText=TranslateT("Automatic Shutdown");
else {
- TCHAR szTime[SIZEOF(ttdi->szText)];
+ TCHAR szTime[_countof(ttdi->szText)];
if (dat->fTimeFlags&SDWTF_ST_TIME)
- GetFormatedDateTime(szTime,SIZEOF(szTime),dat->settingLastTime,FALSE);
- else GetFormatedCountdown(szTime,SIZEOF(szTime),dat->countdown);
- mir_sntprintf(ttdi->szText,SIZEOF(ttdi->szText),_T("%s %s"),(dat->fTimeFlags&SDWTF_ST_TIME)?TranslateT("Shutdown at:"):TranslateT("Time left:"),szTime);
+ GetFormatedDateTime(szTime,_countof(szTime),dat->settingLastTime,FALSE);
+ else GetFormatedCountdown(szTime,_countof(szTime),dat->countdown);
+ mir_sntprintf(ttdi->szText,_countof(ttdi->szText),_T("%s %s"),(dat->fTimeFlags&SDWTF_ST_TIME)?TranslateT("Shutdown at:"):TranslateT("Time left:"),szTime);
ttdi->lpszText=ttdi->szText;
}
return 0;
diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp
index 7962e5fe6b..e7cdf5ac2d 100644
--- a/plugins/AutoShutdown/src/main.cpp
+++ b/plugins/AutoShutdown/src/main.cpp
@@ -76,7 +76,7 @@ extern "C" __declspec(dllexport) int Load(void)
if (InitFrame()) return 1; /* before icons */
/* shared */
- Icon_Register(hInst, "Automatic Shutdown", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Automatic Shutdown", iconList, _countof(iconList));
InitShutdownSvc();
InitWatcher(); /* before InitSettingsDlg() */
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index 207cdbaad2..89cdb08aed 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -45,7 +45,7 @@ static BOOL CALLBACK DisplayCpuUsageProc(BYTE nCpuUsage,LPARAM lParam)
/* dialog closed? */
if (!IsWindow((HWND)lParam)) return FALSE; /* stop poll thread */
TCHAR str[64];
- mir_sntprintf(str,SIZEOF(str),TranslateT("(current: %u%%)"),nCpuUsage);
+ mir_sntprintf(str,_countof(str),TranslateT("(current: %u%%)"),nCpuUsage);
SetWindowText((HWND)lParam,str);
return TRUE;
}
@@ -116,8 +116,8 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
DWORD lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
- SendMessage(hwndCombo,CB_INITSTORAGE,SIZEOF(unitNames),SIZEOF(unitNames)*16); /* approx. */
- for(int i=0;i<SIZEOF(unitNames);++i) {
+ SendMessage(hwndCombo,CB_INITSTORAGE,_countof(unitNames),_countof(unitNames)*16); /* approx. */
+ for(int i=0;i<_countof(unitNames);++i) {
int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)TranslateTS(unitNames[i]));
if (index != LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)unitValues[i]);
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp
index 2a69f1b9cd..a19adbb2fa 100644
--- a/plugins/AutoShutdown/src/shutdownsvc.cpp
+++ b/plugins/AutoShutdown/src/shutdownsvc.cpp
@@ -379,7 +379,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
case M_UPDATE_COUNTDOWN: /* lParam=(WORD)countdown */
{
TCHAR szText[256];
- mir_sntprintf(szText,SIZEOF(szText),TranslateTS(desc[shutdownType-1]),lParam);
+ mir_sntprintf(szText,_countof(szText),TranslateTS(desc[shutdownType-1]),lParam);
SetDlgItemText(hwndDlg,IDC_TEXT_HEADER,szText);
/* countdown finished */
if (!lParam)
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp
index 489605c69e..7fc7c6720a 100644
--- a/plugins/AutoShutdown/src/utils.cpp
+++ b/plugins/AutoShutdown/src/utils.cpp
@@ -49,7 +49,7 @@ void TrimString(TCHAR *pszStr)
{
int i;
TCHAR *psz,szChars[]=_T(" \r\n\t");
- for(i=0;i<SIZEOF(szChars);++i) {
+ for(i=0;i<_countof(szChars);++i) {
/* trim end */
psz=&pszStr[mir_tstrlen(pszStr)-1];
while(pszStr[0] && *psz==szChars[i]) {
@@ -80,7 +80,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...)
va_list va;
va_start(va,pszTextFmt);
- mir_vsnprintf(szText,SIZEOF(szText),pszTextFmt,va);
+ mir_vsnprintf(szText,_countof(szText),pszTextFmt,va);
va_end(va);
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
@@ -193,9 +193,9 @@ BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDate
return GetTimeFormat(locale,((st.wSecond==0)?TIME_NOSECONDS:0)|TIME_FORCE24HOURFORMAT,&st,NULL,pszOut,nSize) != 0;
/* show both date and time */
{ TCHAR szDate[128],szTime[128];
- if (!GetTimeFormat(locale,((st.wSecond==0)?TIME_NOSECONDS:0)|TIME_FORCE24HOURFORMAT,&st,NULL,szTime,SIZEOF(szTime)))
+ if (!GetTimeFormat(locale,((st.wSecond==0)?TIME_NOSECONDS:0)|TIME_FORCE24HOURFORMAT,&st,NULL,szTime,_countof(szTime)))
return FALSE;
- if (!GetDateFormat(locale,DATE_SHORTDATE,&st,NULL,szDate,SIZEOF(szDate)))
+ if (!GetDateFormat(locale,DATE_SHORTDATE,&st,NULL,szDate,_countof(szDate)))
return FALSE;
mir_sntprintf(pszOut,nSize,_T("%s %s"),szTime,szDate);
return TRUE;
@@ -207,7 +207,7 @@ BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDate
HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDesc,HINSTANCE hInst,WORD idRes,BOOL fLarge)
{
TCHAR szFileName[MAX_PATH];
- GetModuleFileName(hInst,szFileName,SIZEOF(szFileName));
+ GetModuleFileName(hInst,szFileName,_countof(szFileName));
SKINICONDESC sid = { 0 };
sid.pszName = (char*)pszDbName;