From 62a186697df33c96dc1a6dac0f4dfc38652fb96f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Dec 2021 16:39:04 +0300 Subject: BYTE -> uint8_t --- src/core/stdautoaway/src/stdafx.h | 6 ++-- src/core/stdaway/src/options.cpp | 6 ++-- src/core/stdaway/src/stdafx.h | 2 +- src/core/stdclist/src/clcopts.cpp | 16 +++++------ src/core/stdclist/src/clcpaint.cpp | 2 +- src/core/stdclist/src/cluiopts.cpp | 54 ++++++++++++++++++------------------ src/core/stdcrypt/src/Rijndael.cpp | 4 +-- src/core/stdcrypt/src/Rijndael.h | 2 +- src/core/stdcrypt/src/encrypt.cpp | 24 ++++++++-------- src/core/stdcrypt/src/stdafx.h | 4 +-- src/core/stdcrypt/src/stdcrypt.h | 18 ++++++------ src/core/stdcrypt/src/utils.cpp | 4 +-- src/core/stdfile/src/file.cpp | 4 +-- src/core/stdfile/src/fileopts.cpp | 4 +-- src/core/stdmsg/src/chat_options.cpp | 8 +++--- src/core/stdmsg/src/globals.h | 4 +-- src/core/stdmsg/src/msgoptions.cpp | 6 ++-- src/core/stdpopup/src/options.cpp | 10 +++---- src/core/stdpopup/src/services.cpp | 2 +- 19 files changed, 90 insertions(+), 90 deletions(-) (limited to 'src/core') diff --git a/src/core/stdautoaway/src/stdafx.h b/src/core/stdautoaway/src/stdafx.h index 841c4d50b9..1e820ab127 100644 --- a/src/core/stdautoaway/src/stdafx.h +++ b/src/core/stdautoaway/src/stdafx.h @@ -76,9 +76,9 @@ struct CMPlugin : public PLUGIN int Load() override; int Unload() override; - CMOption bIdleCheck, bIdleMethod, bIdleOnSaver, bIdleOnFullScr, bIdleOnLock; - CMOption bIdlePrivate, bIdleSoundsOff, bIdleOnTerminal, bIdleStatusLock; - CMOption bAAEnable; + CMOption bIdleCheck, bIdleMethod, bIdleOnSaver, bIdleOnFullScr, bIdleOnLock; + CMOption bIdlePrivate, bIdleSoundsOff, bIdleOnTerminal, bIdleStatusLock; + CMOption bAAEnable; CMOption bAAStatus; CMOption iIdleTime1st; }; diff --git a/src/core/stdaway/src/options.cpp b/src/core/stdaway/src/options.cpp index 900e10cdc7..74cfac21ce 100644 --- a/src/core/stdaway/src/options.cpp +++ b/src/core/stdaway/src/options.cpp @@ -91,9 +91,9 @@ public: for (int i = cmbStatus.GetCount() - 1; i >= 0; i--) { int status = cmbStatus.GetItemData(i); - g_plugin.SetStatusModeByte(status, "Ignore", (BYTE)m_info[i].ignore); - g_plugin.SetStatusModeByte(status, "NoDlg", (BYTE)m_info[i].noDialog); - g_plugin.SetStatusModeByte(status, "UsePrev", (BYTE)m_info[i].usePrevious); + g_plugin.SetStatusModeByte(status, "Ignore", (uint8_t)m_info[i].ignore); + g_plugin.SetStatusModeByte(status, "NoDlg", (uint8_t)m_info[i].noDialog); + g_plugin.SetStatusModeByte(status, "UsePrev", (uint8_t)m_info[i].usePrevious); g_plugin.setWString(StatusModeToDbSetting(status, "Default"), m_info[i].msg); } return true; diff --git a/src/core/stdaway/src/stdafx.h b/src/core/stdaway/src/stdafx.h index f7863b348b..1e9dc9a08f 100644 --- a/src/core/stdaway/src/stdafx.h +++ b/src/core/stdaway/src/stdafx.h @@ -86,7 +86,7 @@ struct CMPlugin : public PLUGIN return getByte(StatusModeToDbSetting(status, suffix), bDefault) != 0; } - void SetStatusModeByte(int status, const char *suffix, BYTE value) + void SetStatusModeByte(int status, const char *suffix, uint8_t value) { setByte(StatusModeToDbSetting(status, suffix), value); } diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 860c8bc0e6..49c9d76abd 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -231,13 +231,13 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam else db_set_dw(0, "CLC", "GreyoutFlags", 0); } - db_set_b(0, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); - db_set_b(0, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "ShowIdle", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); + db_set_b(0, "CLC", "LeftMargin", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); db_set_w(0, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0)); - db_set_b(0, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); - db_set_b(0, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); - db_set_b(0, "CLC", "RowHeight", (BYTE)SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0)); - db_set_b(0, "CLC", "GammaCorrect", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); + db_set_b(0, "CLC", "GroupIndent", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "NoVScrollBar", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); + db_set_b(0, "CLC", "RowHeight", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "GammaCorrect", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); Clist_ClcOptionsChanged(); return TRUE; } @@ -347,7 +347,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(0, "CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + db_set_b(0, "CLC", "UseBitmap", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); { COLORREF col; col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); @@ -360,7 +360,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_unset(0, "CLC", "SelBkColour"); else db_set_dw(0, "CLC", "SelBkColour", col); - db_set_b(0, "CLC", "UseWinColours", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR))); + db_set_b(0, "CLC", "UseWinColours", (uint8_t)(IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR))); } { char str[MAX_PATH], strrel[MAX_PATH]; diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 8a493e0649..f967443e37 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" extern HIMAGELIST himlCListClc; -static BYTE divide3[765] = { 255 }; +static uint8_t divide3[765] = { 255 }; static void ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight) { diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 47a925c238..536fa29a97 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -145,25 +145,25 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - g_plugin.setByte("OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); - g_plugin.setByte("ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); - g_plugin.setByte("BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); - db_set_b(0, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); - db_set_b(0, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); - db_set_b(0, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE)); - db_set_b(0, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); - g_plugin.setByte("AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + g_plugin.setByte("OnTop", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); + g_plugin.setByte("ToolWindow", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); + g_plugin.setByte("BringToFront", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); + db_set_b(0, "CLUI", "FadeInOut", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); + db_set_b(0, "CLUI", "AutoSize", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + db_set_b(0, "CLUI", "MaxSizeHeight", (uint8_t)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE)); + db_set_b(0, "CLUI", "AutoSizeUpward", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); + g_plugin.setByte("AutoHide", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); g_plugin.setWord("HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); - g_plugin.setByte("Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); - g_plugin.setByte("Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); - g_plugin.setByte("AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); - g_plugin.setByte("WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); - g_plugin.setByte("OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); - db_set_b(0, "CLUI", "DockToSides", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING)); - db_set_b(0, "CLUI", "ShowCaption", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); - db_set_b(0, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); - db_set_b(0, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); - g_plugin.setByte("Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); + g_plugin.setByte("Transparent", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + g_plugin.setByte("Alpha", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); + g_plugin.setByte("AutoAlpha", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); + g_plugin.setByte("WindowShadow", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); + g_plugin.setByte("OnDesktop", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); + db_set_b(0, "CLUI", "DockToSides", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING)); + db_set_b(0, "CLUI", "ShowCaption", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + db_set_b(0, "CLUI", "ShowMainMenu", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); + db_set_b(0, "CLUI", "ClientAreaDrag", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); + g_plugin.setByte("Min2Tray", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); { wchar_t title[256]; GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title)); @@ -218,7 +218,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ShowWindow(g_clistApi.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - SetLayeredWindowAttributes(g_clistApi.hwndContactList, RGB(0, 0, 0), (BYTE)g_plugin.getByte("AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); + SetLayeredWindowAttributes(g_clistApi.hwndContactList, RGB(0, 0, 0), (uint8_t)g_plugin.getByte("AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } else SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); @@ -239,7 +239,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(0, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED); { - BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1); + uint8_t showOpts = db_get_b(0, "CLUI", "SBarShow", 1); CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED); @@ -275,19 +275,19 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + db_set_b(0, "CLUI", "ShowSBar", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); db_set_b(0, "CLUI", "SBarShow", - (BYTE)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | + (uint8_t)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0))); - db_set_b(0, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); - db_set_b(0, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); - db_set_b(0, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); + db_set_b(0, "CLUI", "SBarRightClk", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); + db_set_b(0, "CLUI", "EqualSections", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); + db_set_b(0, "CLUI", "SBarBevel", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); g_clistApi.pfnLoadCluiGlobalOpts(); - if (db_get_b(0, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { + if (db_get_b(0, "CLUI", "ShowGrip", 1) != (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { HWND parent = GetParent(g_clistApi.hwndStatus); int flags = WS_CHILD | CCS_BOTTOM; - db_set_b(0, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); + db_set_b(0, "CLUI", "ShowGrip", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); ShowWindow(g_clistApi.hwndStatus, SW_HIDE); DestroyWindow(g_clistApi.hwndStatus); flags |= db_get_b(0, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; diff --git a/src/core/stdcrypt/src/Rijndael.cpp b/src/core/stdcrypt/src/Rijndael.cpp index 510af48871..a97b9c1d1c 100644 --- a/src/core/stdcrypt/src/Rijndael.cpp +++ b/src/core/stdcrypt/src/Rijndael.cpp @@ -931,7 +931,7 @@ CRijndael::~CRijndael() // chain - initial chain block // keylength - 16, 24 or 32 bytes // blockSize - The block size in bytes of this Rijndael (16, 24 or 32 bytes). -int CRijndael::MakeKey(BYTE const* key, char const* chain, int keylength, int blockSize) +int CRijndael::MakeKey(uint8_t const* key, char const* chain, int keylength, int blockSize) { if (nullptr == key) return 1; @@ -978,7 +978,7 @@ int CRijndael::MakeKey(BYTE const* key, char const* chain, int keylength, int bl int KC = m_keylength / 4; //Copy user material bytes into temporary ints int* pi = tk; - BYTE const* pc = key; + uint8_t const* pc = key; for (i = 0; i < KC; i++) { *pi = *(pc++) << 24; *pi |= *(pc++) << 16; diff --git a/src/core/stdcrypt/src/Rijndael.h b/src/core/stdcrypt/src/Rijndael.h index a69409b929..f1fc02905f 100644 --- a/src/core/stdcrypt/src/Rijndael.h +++ b/src/core/stdcrypt/src/Rijndael.h @@ -33,7 +33,7 @@ public: // chain - initial chain block // keylength - 16, 24 or 32 bytes // blockSize - The block size in bytes of this Rijndael (16, 24 or 32 bytes). - int MakeKey(BYTE const* key, char const* chain, int keylength, int blockSize); + int MakeKey(uint8_t const* key, char const* chain, int keylength, int blockSize); private: //Auxiliary Function diff --git a/src/core/stdcrypt/src/encrypt.cpp b/src/core/stdcrypt/src/encrypt.cpp index 27a6500f5e..3b8d173229 100644 --- a/src/core/stdcrypt/src/encrypt.cpp +++ b/src/core/stdcrypt/src/encrypt.cpp @@ -49,7 +49,7 @@ void CStdCrypt::key2ext(const char *pszPassword, ExternalKey &key) tmp.m_crc32 = crc32(0xAbbaDead, (LPCBYTE)pszPassword, (int)strlen(pszPassword)); getRandomBytes(tmp.slack, sizeof(tmp.slack)); - BYTE tmpHash[32]; + uint8_t tmpHash[32]; slow_hash(pszPassword, strlen(pszPassword), tmpHash); CRijndael tmpAes; @@ -57,7 +57,7 @@ void CStdCrypt::key2ext(const char *pszPassword, ExternalKey &key) tmpAes.Encrypt(&tmp, &key, sizeof(ExternalKey)); } -bool CStdCrypt::getKey(BYTE *pKey, size_t cbKeyLen) +bool CStdCrypt::getKey(uint8_t *pKey, size_t cbKeyLen) { if (!m_valid || cbKeyLen < sizeof(m_extKey)) return false; @@ -71,7 +71,7 @@ bool CStdCrypt::checkKey(const char *pszPassword, const ExternalKey *pPublic, Ex if (mir_strlen(pszPassword) == 0) pszPassword = "Miranda"; - BYTE tmpHash[32]; + uint8_t tmpHash[32]; slow_hash(pszPassword, strlen(pszPassword), tmpHash); CRijndael tmpAes; @@ -81,7 +81,7 @@ bool CStdCrypt::checkKey(const char *pszPassword, const ExternalKey *pPublic, Ex return (tmp.m_crc32 == crc32(0xAbbaDead, (LPCBYTE)pszPassword, (int)strlen(pszPassword))); } -bool CStdCrypt::setKey(const char *pszPassword, const BYTE *pPublic, size_t cbKeyLen) +bool CStdCrypt::setKey(const char *pszPassword, const uint8_t *pPublic, size_t cbKeyLen) { // full external key. decode & check password if (cbKeyLen != sizeof(m_extKey)) @@ -99,7 +99,7 @@ bool CStdCrypt::setKey(const char *pszPassword, const BYTE *pPublic, size_t cbKe bool CStdCrypt::generateKey(void) { - BYTE tmp[KEY_LENGTH]; + uint8_t tmp[KEY_LENGTH]; if (!getRandomBytes(tmp, sizeof(tmp))) return false; @@ -127,8 +127,8 @@ void CStdCrypt::setPassword(const char *pszPassword) key2ext(pszPassword, m_extKey); } -// result must be freed using mir_free or assigned to mir_ptr -BYTE* CStdCrypt::encodeString(const char *src, size_t *cbResultLen) +// result must be freed using mir_free or assigned to mir_ptr +uint8_t* CStdCrypt::encodeString(const char *src, size_t *cbResultLen) { if (!m_valid || src == nullptr) { if (cbResultLen) @@ -139,7 +139,7 @@ BYTE* CStdCrypt::encodeString(const char *src, size_t *cbResultLen) return encodeBuffer(src, mir_strlen(src)+1, cbResultLen); } -BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen) +uint8_t* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen) { if (cbResultLen) *cbResultLen = 0; @@ -147,7 +147,7 @@ BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen if (!m_valid || src == nullptr || cbLen >= 0xFFFE) return nullptr; - BYTE *tmpBuf = (BYTE*)_alloca(cbLen + 2); + uint8_t *tmpBuf = (uint8_t*)_alloca(cbLen + 2); *(PWORD)tmpBuf = (WORD)cbLen; memcpy(tmpBuf + 2, src, cbLen); cbLen += 2; @@ -155,7 +155,7 @@ BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen if (rest) cbLen += BLOCK_SIZE - rest; - BYTE *result = (BYTE*)mir_alloc(cbLen); + uint8_t *result = (uint8_t*)mir_alloc(cbLen); m_aes.ResetChain(); if (m_aes.Encrypt(tmpBuf, LPSTR(result), cbLen)) { mir_free(result); @@ -167,7 +167,7 @@ BYTE* CStdCrypt::encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen return result; } -char* CStdCrypt::decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen) +char* CStdCrypt::decodeString(const uint8_t *pBuf, size_t bufLen, size_t *cbResultLen) { size_t resLen; char *result = (char*)decodeBuffer(pBuf, bufLen, &resLen); @@ -183,7 +183,7 @@ char* CStdCrypt::decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultL return result; } -void* CStdCrypt::decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen) +void* CStdCrypt::decodeBuffer(const uint8_t *pBuf, size_t bufLen, size_t *cbResultLen) { if (cbResultLen) *cbResultLen = 0; diff --git a/src/core/stdcrypt/src/stdafx.h b/src/core/stdcrypt/src/stdafx.h index e97567258a..3064acc296 100644 --- a/src/core/stdcrypt/src/stdafx.h +++ b/src/core/stdcrypt/src/stdafx.h @@ -72,5 +72,5 @@ struct CMPlugin : public PLUGIN int Load() override; }; -bool getRandomBytes(BYTE *buf, size_t bufLen); -void slow_hash(const void *buf, size_t bufLen, BYTE *tmpHash); +bool getRandomBytes(uint8_t *buf, size_t bufLen); +void slow_hash(const void *buf, size_t bufLen, uint8_t *tmpHash); diff --git a/src/core/stdcrypt/src/stdcrypt.h b/src/core/stdcrypt/src/stdcrypt.h index ce003bd27b..03a10bcd83 100644 --- a/src/core/stdcrypt/src/stdcrypt.h +++ b/src/core/stdcrypt/src/stdcrypt.h @@ -28,9 +28,9 @@ with this program; if not, write to the Free Software Foundation, Inc., struct ExternalKey { - BYTE m_key[KEY_LENGTH]; + uint8_t m_key[KEY_LENGTH]; DWORD m_crc32; - BYTE slack[BLOCK_SIZE - sizeof(DWORD)]; + uint8_t slack[BLOCK_SIZE - sizeof(DWORD)]; }; struct CStdCrypt : public MICryptoEngine, public MZeroedObject @@ -49,8 +49,8 @@ struct CStdCrypt : public MICryptoEngine, public MZeroedObject // get/set the instance key STDMETHODIMP_(size_t) getKeyLength(void) override; - STDMETHODIMP_(bool) getKey(BYTE *pKey, size_t cbKeyLen) override; - STDMETHODIMP_(bool) setKey(const char *pszPassword, const BYTE *pKey, size_t cbKeyLen) override; + STDMETHODIMP_(bool) getKey(uint8_t *pKey, size_t cbKeyLen) override; + STDMETHODIMP_(bool) setKey(const char *pszPassword, const uint8_t *pKey, size_t cbKeyLen) override; STDMETHODIMP_(bool) generateKey(void) override; // creates a new key inside STDMETHODIMP_(void) purgeKey(void) override; // purges a key from memory @@ -59,11 +59,11 @@ struct CStdCrypt : public MICryptoEngine, public MZeroedObject STDMETHODIMP_(void) setPassword(const char *pszPassword); STDMETHODIMP_(bool) checkPassword(const char *pszPassword) override; - // result must be freed using mir_free or assigned to mir_ptr - STDMETHODIMP_(BYTE*) encodeString(const char *src, size_t *cbResultLen) override; - STDMETHODIMP_(BYTE*) encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen) override; + // result must be freed using mir_free or assigned to mir_ptr + STDMETHODIMP_(uint8_t*) encodeString(const char *src, size_t *cbResultLen) override; + STDMETHODIMP_(uint8_t*) encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen) override; // result must be freed using mir_free or assigned to ptrA/ptrW - STDMETHODIMP_(char*) decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen) override; - STDMETHODIMP_(void*) decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen) override; + STDMETHODIMP_(char*) decodeString(const uint8_t *pBuf, size_t bufLen, size_t *cbResultLen) override; + STDMETHODIMP_(void*) decodeBuffer(const uint8_t *pBuf, size_t bufLen, size_t *cbResultLen) override; }; diff --git a/src/core/stdcrypt/src/utils.cpp b/src/core/stdcrypt/src/utils.cpp index d799f0bb0e..bb334edbdb 100644 --- a/src/core/stdcrypt/src/utils.cpp +++ b/src/core/stdcrypt/src/utils.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -bool getRandomBytes(BYTE *buf, size_t bufLen) +bool getRandomBytes(uint8_t *buf, size_t bufLen) { // try to use Intel hardware randomizer first HCRYPTPROV hProvider = NULL; @@ -46,7 +46,7 @@ bool getRandomBytes(BYTE *buf, size_t bufLen) return true; } -void slow_hash(const void *buf, size_t bufLen, BYTE* tmpHash) +void slow_hash(const void *buf, size_t bufLen, uint8_t* tmpHash) { mir_sha256_hash(buf, bufLen, tmpHash); diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index f83af57ab7..2a57485eb0 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -388,11 +388,11 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) dbei.cbBlob += (int)mir_strlen(szDescr) + 1; - if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == nullptr) + if ((dbei.pBlob = (uint8_t*)mir_alloc(dbei.cbBlob)) == nullptr) return 0; *(DWORD*)dbei.pBlob = 0; - BYTE* p = dbei.pBlob + sizeof(DWORD); + uint8_t* p = dbei.pBlob + sizeof(DWORD); for (int i = 0; i < pre->fileCount; i++) { mir_strcpy((char*)p, pszFiles[i]); p += mir_strlen(pszFiles[i]) + 1; diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 006273dfd1..279db00135 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -146,8 +146,8 @@ public: g_plugin.setWString("ScanCmdLine", str); g_plugin.setByte("UseScanner", chkScanAfterDl.GetState() ? VIRUSSCAN_AFTERDL : (chkScanDuringDl.GetState() ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE)); - g_plugin.setByte("WarnBeforeOpening", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_WARNBEFOREOPENING)); - g_plugin.setByte("IfExists", (BYTE)(IsDlgButtonChecked(m_hwnd, IDC_ASK) ? FILERESUME_ASK : + g_plugin.setByte("WarnBeforeOpening", (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_WARNBEFOREOPENING)); + g_plugin.setByte("IfExists", (uint8_t)(IsDlgButtonChecked(m_hwnd, IDC_ASK) ? FILERESUME_ASK : (IsDlgButtonChecked(m_hwnd, IDC_RESUME) ? FILERESUME_RESUMEALL : (IsDlgButtonChecked(m_hwnd, IDC_OVERWRITE) ? FILERESUME_OVERWRITEALL : FILERESUME_RENAMEALL)))); return TRUE; diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index 17f73d4a7a..d94f9133fc 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -229,7 +229,7 @@ class COptMainDlg : public CDlgBase for (int i = 0; i < nValues; i++, branch++) { tvi.hItem = branch->hItem; checkBoxes.GetItem(&tvi); - BYTE bChecked = (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 1) ? 0 : 1; + uint8_t bChecked = (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 1) ? 0 : 1; if (branch->iMode) { if (bChecked) iState |= branch->iMode; @@ -285,7 +285,7 @@ public: void OnDestroy() override { - BYTE b = checkBoxes.GetItemState(hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; + uint8_t b = checkBoxes.GetItemState(hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; db_set_b(0, CHAT_MODULE, "Branch1Exp", b); b = checkBoxes.GetItemState(hListHeading2, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; db_set_b(0, CHAT_MODULE, "Branch2Exp", b); @@ -432,7 +432,7 @@ public: int iLen = spin4.GetPosition(); if (iLen > 0) - db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); + db_set_b(0, CHAT_MODULE, "NicklistRowDist", (uint8_t)iLen); else db_unset(0, CHAT_MODULE, "NicklistRowDist"); @@ -525,7 +525,7 @@ public: else iLen = 1; g_Settings.iPopupStyle = iLen; - db_set_b(0, CHAT_MODULE, "PopupStyle", (BYTE)iLen); + db_set_b(0, CHAT_MODULE, "PopupStyle", (uint8_t)iLen); iLen = SendDlgItemMessage(m_hwnd, IDC_SPIN1, UDM_GETPOS, 0, 0); g_Settings.iPopupTimeout = iLen; diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index e156b001bc..7207ccb9c3 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -60,9 +60,9 @@ struct GlobalMessageData CMOption popupFlags; CMOption msgTimeout; CMOption nFlashMax; - CMOption iGap; + CMOption iGap; - CMOption iLoadHistory; + CMOption iLoadHistory; CMOption nLoadCount, nLoadTime; bool bSmileyInstalled = false; diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 49aeb6873b..6bf23d43fa 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -30,7 +30,7 @@ struct FontOptionsList const wchar_t* szDescr; COLORREF defColour; const wchar_t* szDefFace; - BYTE defStyle; + uint8_t defStyle; char defSize; } static const fontOptionsList[] = @@ -437,7 +437,7 @@ public: void RebuildList(CCtrlClc::TEventInfo* = nullptr) { - BYTE defType = g_dat.bTypingNew; + uint8_t defType = g_dat.bTypingNew; if (hItemNew && defType) clist.SetCheck(hItemNew, 1); @@ -541,7 +541,7 @@ public: bool OnApply() override { - BYTE bOldValue = db_get_b(0, CHAT_MODULE, "Tabs", 1); + uint8_t bOldValue = db_get_b(0, CHAT_MODULE, "Tabs", 1); db_set_b(0, CHAT_MODULE, "Tabs", m_chkTabs.GetState()); db_set_b(0, CHAT_MODULE, "TabBottom", m_chkTabsBottom.GetState()); diff --git a/src/core/stdpopup/src/options.cpp b/src/core/stdpopup/src/options.cpp index 103d6c9711..adc8283b4e 100644 --- a/src/core/stdpopup/src/options.cpp +++ b/src/core/stdpopup/src/options.cpp @@ -21,7 +21,7 @@ void LoadOptions() options.default_timeout = g_plugin.getDword("DefaultTimeout", 7); options.win_width = g_plugin.getDword("WinWidth", 220); options.win_max_height = g_plugin.getDword("WinMaxHeight", 400); - options.location = (PopupLocation)g_plugin.getByte("Location", (BYTE)PL_BOTTOMRIGHT); + options.location = (PopupLocation)g_plugin.getByte("Location", (uint8_t)PL_BOTTOMRIGHT); options.opacity = g_plugin.getByte("Opacity", 75); options.border = g_plugin.getByte("Border", 1) == 1; options.round = g_plugin.getByte("RoundCorners", 1) == 1; @@ -54,8 +54,8 @@ void SaveOptions() g_plugin.setDword("DefaultTimeout", options.default_timeout); g_plugin.setDword("WinWidth", options.win_width); g_plugin.setDword("WinMaxHeight", options.win_max_height); - g_plugin.setByte("Location", (BYTE)options.location); - g_plugin.setByte("Opacity", (BYTE)options.opacity); + g_plugin.setByte("Location", (uint8_t)options.location); + g_plugin.setByte("Opacity", (uint8_t)options.opacity); g_plugin.setByte("Border", (options.border ? 1 : 0)); g_plugin.setByte("RoundCorners", (options.round ? 1 : 0)); g_plugin.setByte("AvatarRoundCorners", (options.av_round ? 1 : 0)); @@ -64,11 +64,11 @@ void SaveOptions() g_plugin.setByte("UseMimMonitor", (options.use_mim_monitor ? 1 : 0)); g_plugin.setByte("RightIcon", (options.right_icon ? 1 : 0)); if (ServiceExists(MS_AV_DRAWAVATAR)) - g_plugin.setByte("AVLayout", (BYTE)options.av_layout); + g_plugin.setByte("AVLayout", (uint8_t)options.av_layout); g_plugin.setDword("AVSize", options.av_size); g_plugin.setDword("TextIndent", options.text_indent); g_plugin.setByte("GlobalHover", (options.global_hover ? 1 : 0)); - g_plugin.setByte("TimeLayout", (BYTE)options.time_layout); + g_plugin.setByte("TimeLayout", (uint8_t)options.time_layout); char buff[128]; for (int i = 0; i < _countof(options.disable_status); i++) { diff --git a/src/core/stdpopup/src/services.cpp b/src/core/stdpopup/src/services.cpp index 771f51d049..52bdcd5dbc 100644 --- a/src/core/stdpopup/src/services.cpp +++ b/src/core/stdpopup/src/services.cpp @@ -204,7 +204,7 @@ void UpdateMenu() static INT_PTR TogglePopups(WPARAM, LPARAM) { - BYTE val = Popup_Enabled(); + uint8_t val = Popup_Enabled(); Popup_Enable(!val); UpdateMenu(); return 0; -- cgit v1.2.3