summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-12-26 16:39:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-12-26 16:39:04 +0300
commit62a186697df33c96dc1a6dac0f4dfc38652fb96f (patch)
tree1437d0906218fae8827aed384026f2b7e656f4ac /plugins/AutoShutdown/src
parentfcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (diff)
BYTE -> uint8_t
Diffstat (limited to 'plugins/AutoShutdown/src')
-rw-r--r--plugins/AutoShutdown/src/cpuusage.cpp38
-rw-r--r--plugins/AutoShutdown/src/cpuusage.h2
-rw-r--r--plugins/AutoShutdown/src/frame.cpp4
-rw-r--r--plugins/AutoShutdown/src/options.cpp8
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp14
-rw-r--r--plugins/AutoShutdown/src/shutdownsvc.cpp16
-rw-r--r--plugins/AutoShutdown/src/utils.cpp2
-rw-r--r--plugins/AutoShutdown/src/utils.h2
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp6
9 files changed, 46 insertions, 46 deletions
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp
index 1e5c3e6231..de331986d1 100644
--- a/plugins/AutoShutdown/src/cpuusage.cpp
+++ b/plugins/AutoShutdown/src/cpuusage.cpp
@@ -35,9 +35,9 @@ static BOOL WinNT_PerfStatsSwitch(wchar_t *pszServiceName, BOOL fDisable)
if (!RegOpenKeyEx(hKeyServices, pszServiceName, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyService)) {
if (!RegOpenKeyEx(hKeyService, L"Performance", 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyPerf)) {
dwDataSize = sizeof(DWORD);
- if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", nullptr, nullptr, (BYTE*)&dwData, &dwDataSize))
+ if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", nullptr, nullptr, (uint8_t*)&dwData, &dwDataSize))
if ((dwData != 0) != fDisable)
- fSwitched = !RegSetValueEx(hKeyPerf, L"Disable Performance Counters", 0, REG_DWORD, (BYTE*)&fDisable, dwDataSize);
+ fSwitched = !RegSetValueEx(hKeyPerf, L"Disable Performance Counters", 0, REG_DWORD, (uint8_t*)&fDisable, dwDataSize);
RegCloseKey(hKeyPerf);
}
RegCloseKey(hKeyService);
@@ -57,7 +57,7 @@ struct CpuUsageThreadParams
DWORD *pidThread;
};
-static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage)
+static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, uint8_t nCpuUsage)
{
if (param->hFirstEvent != nullptr) {
/* return value for PollCpuUsage() */
@@ -75,7 +75,7 @@ static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage)
static void WinNT_PollThread(CpuUsageThreadParams *param)
{
DWORD dwBufferSize = 0, dwCount;
- BYTE *pBuffer = nullptr;
+ uint8_t *pBuffer = nullptr;
PERF_DATA_BLOCK *pPerfData = nullptr;
LONG res, lCount;
PERF_OBJECT_TYPE *pPerfObj;
@@ -84,7 +84,7 @@ static void WinNT_PollThread(CpuUsageThreadParams *param)
PERF_COUNTER_BLOCK *pPerfCounterBlock;
DWORD dwObjectId, dwCounterId;
wchar_t wszValueName[11], *pwszInstanceName;
- BYTE nCpuUsage;
+ uint8_t nCpuUsage;
BOOL fSwitched, fFound, fIsFirst = FALSE;
LARGE_INTEGER liPrevCounterValue = { 0 }, liCurrentCounterValue = { 0 }, liPrevPerfTime100nSec = { 0 };
@@ -98,9 +98,9 @@ static void WinNT_PollThread(CpuUsageThreadParams *param)
/* poll */
for (;;) {
/* retrieve data for given object */
- res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, (BYTE*)pPerfData, &dwBufferSize);
+ res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, (uint8_t*)pPerfData, &dwBufferSize);
while (!pBuffer || res == ERROR_MORE_DATA) {
- pBuffer = (BYTE*)mir_realloc(pPerfData, dwBufferSize += 256);
+ pBuffer = (uint8_t*)mir_realloc(pPerfData, dwBufferSize += 256);
if (!pBuffer) break;
pPerfData = (PERF_DATA_BLOCK*)pBuffer;
res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, pBuffer, &dwBufferSize);
@@ -110,43 +110,43 @@ static void WinNT_PollThread(CpuUsageThreadParams *param)
/* find object in data */
fFound = FALSE;
/* first object */
- pPerfObj = (PERF_OBJECT_TYPE*)((BYTE*)pPerfData + pPerfData->HeaderLength);
+ pPerfObj = (PERF_OBJECT_TYPE*)((uint8_t*)pPerfData + pPerfData->HeaderLength);
for (dwCount = 0; dwCount < pPerfData->NumObjectTypes; ++dwCount) {
if (pPerfObj->ObjectNameTitleIndex == dwObjectId) {
/* find counter in object data */
/* first counter */
- pPerfCounter = (PERF_COUNTER_DEFINITION*)((BYTE*)pPerfObj + pPerfObj->HeaderLength);
+ pPerfCounter = (PERF_COUNTER_DEFINITION*)((uint8_t*)pPerfObj + pPerfObj->HeaderLength);
for (dwCount = 0; dwCount < (pPerfObj->NumCounters); ++dwCount) {
if (pPerfCounter->CounterNameTitleIndex == dwCounterId) {
/* find instance in counter data */
if (pPerfObj->NumInstances == PERF_NO_INSTANCES) {
- pPerfCounterBlock = (PERF_COUNTER_BLOCK*)((BYTE*)pPerfObj + pPerfObj->DefinitionLength);
- liCurrentCounterValue = *(LARGE_INTEGER*)((BYTE*)pPerfCounterBlock + pPerfCounter->CounterOffset);
+ pPerfCounterBlock = (PERF_COUNTER_BLOCK*)((uint8_t*)pPerfObj + pPerfObj->DefinitionLength);
+ liCurrentCounterValue = *(LARGE_INTEGER*)((uint8_t*)pPerfCounterBlock + pPerfCounter->CounterOffset);
fFound = TRUE;
}
else {
/* first instance */
- pPerfInstance = (PERF_INSTANCE_DEFINITION*)((BYTE*)pPerfObj + pPerfObj->DefinitionLength);
+ pPerfInstance = (PERF_INSTANCE_DEFINITION*)((uint8_t*)pPerfObj + pPerfObj->DefinitionLength);
for (lCount = 0; lCount < (pPerfObj->NumInstances); ++lCount) {
- pPerfCounterBlock = (PERF_COUNTER_BLOCK*)((BYTE*)pPerfInstance + pPerfInstance->ByteLength);
- if (!mir_wstrcmpi(pwszInstanceName, (wchar_t*)((BYTE*)pPerfInstance + pPerfInstance->NameOffset))) {
- liCurrentCounterValue = *(LARGE_INTEGER*)((BYTE*)pPerfCounterBlock + pPerfCounter->CounterOffset);
+ pPerfCounterBlock = (PERF_COUNTER_BLOCK*)((uint8_t*)pPerfInstance + pPerfInstance->ByteLength);
+ if (!mir_wstrcmpi(pwszInstanceName, (wchar_t*)((uint8_t*)pPerfInstance + pPerfInstance->NameOffset))) {
+ liCurrentCounterValue = *(LARGE_INTEGER*)((uint8_t*)pPerfCounterBlock + pPerfCounter->CounterOffset);
fFound = TRUE;
break;
}
/* next instance */
- pPerfInstance = (PPERF_INSTANCE_DEFINITION)((BYTE*)pPerfCounterBlock + pPerfCounterBlock->ByteLength);
+ pPerfInstance = (PPERF_INSTANCE_DEFINITION)((uint8_t*)pPerfCounterBlock + pPerfCounterBlock->ByteLength);
}
}
break;
}
/* next counter */
- pPerfCounter = (PERF_COUNTER_DEFINITION*)((BYTE*)pPerfCounter + pPerfCounter->ByteLength);
+ pPerfCounter = (PERF_COUNTER_DEFINITION*)((uint8_t*)pPerfCounter + pPerfCounter->ByteLength);
}
break;
}
/* next object */
- pPerfObj = (PERF_OBJECT_TYPE*)((BYTE*)pPerfObj + pPerfObj->TotalByteLength);
+ pPerfObj = (PERF_OBJECT_TYPE*)((uint8_t*)pPerfObj + pPerfObj->TotalByteLength);
}
if (!fFound)
break;
@@ -155,7 +155,7 @@ static void WinNT_PollThread(CpuUsageThreadParams *param)
* counter type: PERF_100NSEC_TIMER_INV
* calc: time base=100Ns, value=100*(1-(data_diff)/(100NsTime_diff)) */
if (!fIsFirst) {
- nCpuUsage = (BYTE)((1.0 - (Li2Double(liCurrentCounterValue) - Li2Double(liPrevCounterValue)) / (Li2Double(pPerfData->PerfTime100nSec) - Li2Double(liPrevPerfTime100nSec)))*100.0 + 0.5);
+ nCpuUsage = (uint8_t)((1.0 - (Li2Double(liCurrentCounterValue) - Li2Double(liPrevCounterValue)) / (Li2Double(pPerfData->PerfTime100nSec) - Li2Double(liPrevPerfTime100nSec)))*100.0 + 0.5);
if (!CallBackAndWait(param, nCpuUsage))
break;
}
diff --git a/plugins/AutoShutdown/src/cpuusage.h b/plugins/AutoShutdown/src/cpuusage.h
index f10ead7d9e..391832e059 100644
--- a/plugins/AutoShutdown/src/cpuusage.h
+++ b/plugins/AutoShutdown/src/cpuusage.h
@@ -22,5 +22,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma once
/* Start Thread */
-typedef BOOL (CALLBACK* CPUUSAGEAVAILPROC)(BYTE nCpuUsage,LPARAM lParam);
+typedef BOOL (CALLBACK* CPUUSAGEAVAILPROC)(uint8_t nCpuUsage,LPARAM lParam);
DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc,LPARAM lParam,DWORD dwDelayMillis);
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index ccae0afbd2..6ff377a99a 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -33,7 +33,7 @@ static HANDLE hHookModulesLoaded;
#define FRAMEELEMENT_BKGRND 2
#define FRAMEELEMENT_TEXT 3
-static COLORREF GetDefaultColor(BYTE id)
+static COLORREF GetDefaultColor(uint8_t id)
{
switch (id) {
case FRAMEELEMENT_BAR:
@@ -84,7 +84,7 @@ struct CountdownFrameWndData
COLORREF clrBackground, clrText;
HFONT hFont;
WORD fTimeFlags;
- BYTE flags;
+ uint8_t flags;
};
/* Flags */
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp
index 3c79c94384..06756a5407 100644
--- a/plugins/AutoShutdown/src/options.cpp
+++ b/plugins/AutoShutdown/src/options.cpp
@@ -85,12 +85,12 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_NOTIFY:
switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
- g_plugin.setByte("ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
+ g_plugin.setByte("ShowConfirmDlg", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
g_plugin.setWord("ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE));
- g_plugin.setByte("RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
- g_plugin.setByte("SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
+ g_plugin.setByte("RememberOnRestart", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
+ g_plugin.setByte("SmartOfflineCheck", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER)))
- g_plugin.setByte("WeatherShutdown", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_WEATHER) != 0));
+ g_plugin.setByte("WeatherShutdown", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_WEATHER) != 0));
return TRUE;
}
break;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index 999eeb0d98..8e1e9642ef 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -36,7 +36,7 @@ static void EnableDlgItem(HWND hwndDlg, int idCtrl, BOOL fEnable)
EnableWindow(hwndDlg, fEnable);
}
-static BOOL CALLBACK DisplayCpuUsageProc(BYTE nCpuUsage, LPARAM lParam)
+static BOOL CALLBACK DisplayCpuUsageProc(uint8_t nCpuUsage, LPARAM lParam)
{
/* dialog closed? */
if (!IsWindow((HWND)lParam))
@@ -129,7 +129,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
/* cpuusage threshold */
{
- BYTE setting = DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
+ uint8_t setting = DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETRANGE, 0, MAKELPARAM(100, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_CPUUSAGE, EM_SETLIMITTEXT, (WPARAM)3, 0);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
@@ -138,11 +138,11 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
/* shutdown types */
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_SHUTDOWNTYPE);
- BYTE lastShutdownType = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
+ uint8_t lastShutdownType = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
SendMessage(hwndCombo, CB_INITSTORAGE, SDSDT_MAX, SDSDT_MAX * 32);
- for (BYTE shutdownType = 1; shutdownType <= SDSDT_MAX; ++shutdownType)
+ for (uint8_t shutdownType = 1; shutdownType <= SDSDT_MAX; ++shutdownType)
if (ServiceIsTypeEnabled(shutdownType, 0)) {
wchar_t *pszText = (wchar_t*)ServiceGetTypeDescription(shutdownType, GSTDF_TCHAR); /* never fails */
int index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)pszText);
@@ -232,7 +232,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
case M_UPDATE_SHUTDOWNDESC: /* lParam=(LPARAM)(HWND)hwndCombo */
{
- BYTE shutdownType = (BYTE)SendMessage((HWND)lParam, CB_GETITEMDATA, SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+ uint8_t shutdownType = (uint8_t)SendMessage((HWND)lParam, CB_GETITEMDATA, SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
SetDlgItemText(hwndDlg, IDC_TEXT_SHUTDOWNTYPE, (wchar_t*)ServiceGetTypeDescription(shutdownType, GSTDF_LONGDESC | GSTDF_TCHAR));
}
return TRUE;
@@ -357,12 +357,12 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
{
int index = SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- g_plugin.setByte("ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setByte("ShutdownType", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
g_plugin.setDword("CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
g_plugin.setDword("Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
- g_plugin.setByte("CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
+ g_plugin.setByte("CpuUsageThreshold", (uint8_t)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
}
/* watcher type */
{
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp
index c225d63e17..064c1fd843 100644
--- a/plugins/AutoShutdown/src/shutdownsvc.cpp
+++ b/plugins/AutoShutdown/src/shutdownsvc.cpp
@@ -67,7 +67,7 @@ static void BroadcastEndSession(DWORD dwRecipients, LPARAM lParam)
}
/************************* Workers ************************************/
-static BOOL IsShutdownTypeEnabled(BYTE shutdownType)
+static BOOL IsShutdownTypeEnabled(uint8_t shutdownType)
{
BOOL bReturn = FALSE;
switch (shutdownType) {
@@ -128,7 +128,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType)
return bReturn;
}
-static DWORD ShutdownNow(BYTE shutdownType)
+static DWORD ShutdownNow(uint8_t shutdownType)
{
DWORD dwErrCode = ERROR_SUCCESS;
switch (shutdownType) {
@@ -297,7 +297,7 @@ static DWORD ShutdownNow(BYTE shutdownType)
#define M_UPDATE_COUNTDOWN (WM_APP+112)
static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- BYTE shutdownType = (BYTE)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ uint8_t shutdownType = (uint8_t)GetWindowLongPtr(hwndDlg, DWLP_USER);
WORD countdown = (WORD)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA);
switch (msg) {
@@ -417,7 +417,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam)
{
/* passing 0 as wParam is only to be used internally, undocumented */
if (!wParam) wParam = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
- if (!IsShutdownTypeEnabled((BYTE)wParam)) return 1; /* does shutdownType range check */
+ if (!IsShutdownTypeEnabled((uint8_t)wParam)) return 1; /* does shutdownType range check */
if ((BOOL)lParam && hwndShutdownDlg != nullptr) return 2;
/* ask others if allowed */
@@ -429,11 +429,11 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam)
NotifyEventHooks(hEventShutdown, wParam, lParam);
/* show dialog */
if (lParam && g_plugin.getByte("ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT))
- if (CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SHUTDOWNNOW), nullptr, ShutdownDlgProc, (BYTE)wParam) != nullptr)
+ if (CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SHUTDOWNNOW), nullptr, ShutdownDlgProc, (uint8_t)wParam) != nullptr)
return 0;
/* show error */
- DWORD dwErrCode = ShutdownNow((BYTE)wParam);
+ DWORD dwErrCode = ShutdownNow((uint8_t)wParam);
if (dwErrCode != ERROR_SUCCESS) {
char *pszErr = GetWinErrorDescription(dwErrCode);
ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("Initiating the shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
@@ -447,7 +447,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam)
INT_PTR ServiceIsTypeEnabled(WPARAM wParam, LPARAM)
{
- return IsShutdownTypeEnabled((BYTE)wParam); /* does shutdownType range check */
+ return IsShutdownTypeEnabled((uint8_t)wParam); /* does shutdownType range check */
}
const wchar_t *apszShort[] = {
@@ -473,7 +473,7 @@ const wchar_t *apszLong[] = {
INT_PTR ServiceGetTypeDescription(WPARAM wParam, LPARAM lParam)
{
/* shutdownType range check */
- if (!wParam || (BYTE)wParam > SDSDT_MAX) return 0;
+ if (!wParam || (uint8_t)wParam > SDSDT_MAX) return 0;
/* select description */
wchar_t *pszDesc = (wchar_t*)((lParam & GSTDF_LONGDESC) ? apszLong : apszShort)[wParam - 1];
if (!(lParam & GSTDF_UNTRANSLATED))
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp
index 35e1bb0755..cd2b247703 100644
--- a/plugins/AutoShutdown/src/utils.cpp
+++ b/plugins/AutoShutdown/src/utils.cpp
@@ -31,7 +31,7 @@ static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
mir_free(mbp);
}
-void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, ...)
+void ShowInfoMessage(uint8_t flags, const char *pszTitle, const char *pszTextFmt, ...)
{
char szText[256]; /* max for systray */
diff --git a/plugins/AutoShutdown/src/utils.h b/plugins/AutoShutdown/src/utils.h
index e64dc87086..e3c05f51f9 100644
--- a/plugins/AutoShutdown/src/utils.h
+++ b/plugins/AutoShutdown/src/utils.h
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma once
/* Error Output */
-void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...);
+void ShowInfoMessage(uint8_t flags,const char *pszTitle,const char *pszTextFmt,...);
char* GetWinErrorDescription(DWORD dwLastError);
/* Time */
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp
index f3a3f76578..0d53d9deed 100644
--- a/plugins/AutoShutdown/src/watcher.cpp
+++ b/plugins/AutoShutdown/src/watcher.cpp
@@ -182,16 +182,16 @@ static int StatusSettingChanged(WPARAM wParam, LPARAM lParam)
static DWORD idCpuUsageThread;
-static BOOL CALLBACK CpuUsageWatcherProc(BYTE nCpuUsage, LPARAM lParam)
+static BOOL CALLBACK CpuUsageWatcherProc(uint8_t nCpuUsage, LPARAM lParam)
{
- static BYTE nTimesBelow = 0; /* only one watcher thread */
+ static uint8_t nTimesBelow = 0; /* only one watcher thread */
/* terminated? */
if (idCpuUsageThread != GetCurrentThreadId()) {
nTimesBelow = 0;
return FALSE; /* stop poll thread */
}
/* ignore random peaks */
- if (nCpuUsage < (BYTE)lParam) ++nTimesBelow;
+ if (nCpuUsage < (uint8_t)lParam) ++nTimesBelow;
else nTimesBelow = 0;
if (nTimesBelow == 3) {
nTimesBelow = 0;