summaryrefslogtreecommitdiff
path: root/src/mir_core
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 /src/mir_core
parentfcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (diff)
BYTE -> uint8_t
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/Windows/CCtrlClc.cpp4
-rw-r--r--src/mir_core/src/Windows/CCtrlData.cpp2
-rw-r--r--src/mir_core/src/Windows/CDbLink.cpp6
-rw-r--r--src/mir_core/src/Windows/CDlgBase.cpp2
-rw-r--r--src/mir_core/src/Windows/hyperlink.cpp2
-rw-r--r--src/mir_core/src/Windows/langpack.cpp4
-rw-r--r--src/mir_core/src/db.cpp8
-rwxr-xr-xsrc/mir_core/src/http.cpp16
-rw-r--r--src/mir_core/src/md5.cpp24
-rw-r--r--src/mir_core/src/sha1.cpp6
-rw-r--r--src/mir_core/src/sha256.cpp12
-rw-r--r--src/mir_core/src/utils.cpp8
12 files changed, 47 insertions, 47 deletions
diff --git a/src/mir_core/src/Windows/CCtrlClc.cpp b/src/mir_core/src/Windows/CCtrlClc.cpp
index 9239d3d61a..8dfbfc5f06 100644
--- a/src/mir_core/src/Windows/CCtrlClc.cpp
+++ b/src/mir_core/src/Windows/CCtrlClc.cpp
@@ -113,9 +113,9 @@ int CCtrlClc::GetExtraColumns() const
{ return SendMessage(m_hwnd, CLM_GETEXTRACOLUMNS, 0, 0);
}
-BYTE CCtrlClc::GetExtraImage(HANDLE hItem, int iColumn) const
+uint8_t CCtrlClc::GetExtraImage(HANDLE hItem, int iColumn) const
{
- return (BYTE)(SendMessage(m_hwnd, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, 0)) & 0xFFFF);
+ return (uint8_t)(SendMessage(m_hwnd, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, 0)) & 0xFFFF);
}
HIMAGELIST CCtrlClc::GetExtraImageList() const
diff --git a/src/mir_core/src/Windows/CCtrlData.cpp b/src/mir_core/src/Windows/CCtrlData.cpp
index 7f228b159e..ed6f1f194f 100644
--- a/src/mir_core/src/Windows/CCtrlData.cpp
+++ b/src/mir_core/src/Windows/CCtrlData.cpp
@@ -41,7 +41,7 @@ void CCtrlData::OnInit()
OnReset();
}
-void CCtrlData::CreateDbLink(const char* szModuleName, const char* szSetting, BYTE type, DWORD iValue)
+void CCtrlData::CreateDbLink(const char* szModuleName, const char* szSetting, uint8_t type, DWORD iValue)
{
m_dbLink = new CDbLink(szModuleName, szSetting, type, iValue);
}
diff --git a/src/mir_core/src/Windows/CDbLink.cpp b/src/mir_core/src/Windows/CDbLink.cpp
index 4515e032f2..b8719fd677 100644
--- a/src/mir_core/src/Windows/CDbLink.cpp
+++ b/src/mir_core/src/Windows/CDbLink.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
// CDbLink class
-CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, DWORD iValue)
+CDbLink::CDbLink(const char *szModule, const char *szSetting, uint8_t type, DWORD iValue)
: CDataLink(type)
{
m_szModule = mir_strdup(szModule);
@@ -35,7 +35,7 @@ CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, DWORD i
dbv.type = DBVT_DELETED;
}
-CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, wchar_t *szValue)
+CDbLink::CDbLink(const char *szModule, const char *szSetting, uint8_t type, wchar_t *szValue)
: CDataLink(type),
m_iDefault(0)
{
@@ -67,7 +67,7 @@ DWORD CDbLink::LoadInt()
void CDbLink::SaveInt(DWORD value)
{
switch (m_type) {
- case DBVT_BYTE: db_set_b(0, m_szModule, m_szSetting, (BYTE)value); break;
+ case DBVT_BYTE: db_set_b(0, m_szModule, m_szSetting, (uint8_t)value); break;
case DBVT_WORD: db_set_w(0, m_szModule, m_szSetting, (WORD)value); break;
case DBVT_DWORD: db_set_dw(0, m_szModule, m_szSetting, value); break;
}
diff --git a/src/mir_core/src/Windows/CDlgBase.cpp b/src/mir_core/src/Windows/CDlgBase.cpp
index 5949057fda..99854ac47d 100644
--- a/src/mir_core/src/Windows/CDlgBase.cpp
+++ b/src/mir_core/src/Windows/CDlgBase.cpp
@@ -151,7 +151,7 @@ void CDlgBase::Show(int nCmdShow)
/////////////////////////////////////////////////////////////////////////////////////////
-void CDlgBase::CreateLink(CCtrlData& ctrl, const char *szSetting, BYTE type, DWORD iValue)
+void CDlgBase::CreateLink(CCtrlData& ctrl, const char *szSetting, uint8_t type, DWORD iValue)
{
ctrl.CreateDbLink(m_pPlugin.getModule(), szSetting, type, iValue);
}
diff --git a/src/mir_core/src/Windows/hyperlink.cpp b/src/mir_core/src/Windows/hyperlink.cpp
index 65ce93c54a..5118f89982 100644
--- a/src/mir_core/src/Windows/hyperlink.cpp
+++ b/src/mir_core/src/Windows/hyperlink.cpp
@@ -29,7 +29,7 @@ struct HyperlinkWndData
HFONT hEnableFont, hDisableFont;
RECT rcText;
COLORREF enableColor, disableColor, focusColor;
- BYTE flags; /* see HLKF_* */
+ uint8_t flags; /* see HLKF_* */
};
/* flags */
diff --git a/src/mir_core/src/Windows/langpack.cpp b/src/mir_core/src/Windows/langpack.cpp
index f877a7ca5f..e43a2c1b33 100644
--- a/src/mir_core/src/Windows/langpack.cpp
+++ b/src/mir_core/src/Windows/langpack.cpp
@@ -182,7 +182,7 @@ static bool EnterMuuid(const char *p, MUUID &result)
if (*p++ != '{')
return false;
- BYTE *d = (BYTE*)&result;
+ uint8_t *d = (uint8_t*)&result;
for (int nBytes = 0; *p && nBytes < 24; p++) {
if (*p == '-')
@@ -201,7 +201,7 @@ static bool EnterMuuid(const char *p, MUUID &result)
if (sscanf(p, "%2x", &c) != 1)
return false;
- *d++ = (BYTE)c;
+ *d++ = (uint8_t)c;
nBytes++;
p++;
}
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index 3f91edac6f..2b2b41ebcd 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -109,8 +109,8 @@ MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, const char *szModule, const char *
{
switch(dbv.type) {
case DBVT_BYTE: return dbv.bVal;
- case DBVT_WORD: return BYTE(dbv.wVal);
- case DBVT_DWORD: return BYTE(dbv.dVal);
+ case DBVT_WORD: return uint8_t(dbv.wVal);
+ case DBVT_DWORD: return uint8_t(dbv.dVal);
}
g_pCurrDb->FreeVariant(&dbv);
}
@@ -164,7 +164,7 @@ MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const ch
if (g_pCurrDb == nullptr)
return 1;
- dbv->type = (BYTE)nType;
+ dbv->type = (uint8_t)nType;
return g_pCurrDb->GetContactSettingStr(hContact, szModule, szSetting, dbv);
}
@@ -278,7 +278,7 @@ MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, const char *szModule, const char
return g_pCurrDb->WriteContactSetting(hContact, &cws);
}
-MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, const char *szModule, const char *szSetting, BYTE val)
+MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, const char *szModule, const char *szSetting, uint8_t val)
{
if (g_pCurrDb == nullptr) return 1;
diff --git a/src/mir_core/src/http.cpp b/src/mir_core/src/http.cpp
index 6527429223..093a6e1ab7 100755
--- a/src/mir_core/src/http.cpp
+++ b/src/mir_core/src/http.cpp
@@ -67,7 +67,7 @@ MIR_CORE_DLL(CMStringA) mir_urlEncode(const char *szUrl)
CMStringA ret;
- for (const BYTE *s = (const BYTE*)szUrl; *s; s++) {
+ for (const uint8_t *s = (const uint8_t*)szUrl; *s; s++) {
if (('0' <= *s && *s <= '9') || // 0-9
('A' <= *s && *s <= 'Z') || // ABC...XYZ
('a' <= *s && *s <= 'z') || // abc...xyz
@@ -113,11 +113,11 @@ MIR_CORE_DLL(char*) mir_base64_encodebuf(const void *input, size_t inputLen, cha
if (outputLen < mir_base64_encode_bufsize(inputLen))
return nullptr;
- const BYTE *s = (const BYTE*)input;
+ const uint8_t *s = (const uint8_t*)input;
char *p = output;
for (unsigned i=0; i < inputLen; ) {
int rest = 0;
- BYTE chr[3];
+ uint8_t chr[3];
chr[0] = s[i++];
chr[1] = (i < inputLen) ? s[i++] : rest++, 0;
chr[2] = (i < inputLen) ? s[i++] : rest++, 0;
@@ -171,23 +171,23 @@ MIR_CORE_DLL(void*) mir_base64_decode(const char *input, size_t *outputLen)
char *p = output;
while (input < stop) {
- BYTE e[4];
+ uint8_t e[4];
for (int i=0; i < 4; ) {
if (*input == '\n' || *input == '\r') // simply skip a char
input++;
else if (*input == 0) // do not advance input
- e[i++] = (BYTE)-1;
+ e[i++] = (uint8_t)-1;
else
e[i++] = Base64DecodeTable[*input++];
}
- if (e[0] == (BYTE)-1 || e[1] == (BYTE)-1)
+ if (e[0] == (uint8_t)-1 || e[1] == (uint8_t)-1)
break;
*p++ = (e[0] << 2) | (e[1] >> 4);
- if (e[2] != (BYTE)-1)
+ if (e[2] != (uint8_t)-1)
*p++ = ((e[1] & 15) << 4) | (e[2] >> 2);
- if (e[3] != (BYTE)-1)
+ if (e[3] != (uint8_t)-1)
*p++ = ((e[2] & 3) << 6) | e[3];
}
diff --git a/src/mir_core/src/md5.cpp b/src/mir_core/src/md5.cpp
index 8b7b37020f..d09463cdad 100644
--- a/src/mir_core/src/md5.cpp
+++ b/src/mir_core/src/md5.cpp
@@ -122,7 +122,7 @@
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
//gfd*
-static void md5_process(mir_md5_state_t *pms, const BYTE *data /*[64]*/)
+static void md5_process(mir_md5_state_t *pms, const uint8_t *data /*[64]*/)
{
uint32_t
a = pms->abcd[0], b = pms->abcd[1],
@@ -140,13 +140,13 @@ static void md5_process(mir_md5_state_t *pms, const BYTE *data /*[64]*/)
*/
static const int w = 1;
- if (*((const BYTE *)&w)) /* dynamic little-endian */
+ if (*((const uint8_t *)&w)) /* dynamic little-endian */
{
/*
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
- if ( !((data - (const BYTE *)nullptr) & 3)) {
+ if ( !((data - (const uint8_t *)nullptr) & 3)) {
/* data are properly aligned */
X = (const uint32_t *)data;
} else {
@@ -161,7 +161,7 @@ static void md5_process(mir_md5_state_t *pms, const BYTE *data /*[64]*/)
* On big-endian machines, we must arrange the bytes in the
* right order.
*/
- const BYTE *xp = data;
+ const uint8_t *xp = data;
int i;
X = xbuf; /* (dynamic only) */
@@ -290,9 +290,9 @@ MIR_CORE_DLL(void) mir_md5_init(mir_md5_state_t *pms)
pms->abcd[3] = 0x10325476;
}
-MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const BYTE *data, size_t nBytes)
+MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const uint8_t *data, size_t nBytes)
{
- const BYTE *p = data;
+ const uint8_t *p = data;
size_t left = nBytes;
size_t offset = (pms->count[0] >> 3) & 63;
uint32_t nbits = (uint32_t)(nBytes << 3);
@@ -327,29 +327,29 @@ MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const BYTE *data, size_t
memcpy(pms->buf, p, left);
}
-MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, BYTE digest[16])
+MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, uint8_t digest[16])
{
- static const BYTE pad[64] = {
+ static const uint8_t pad[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- BYTE data[8];
+ uint8_t data[8];
int i;
/* Save the length before padding. */
for (i = 0; i < 8; ++i)
- data[i] = (BYTE)(pms->count[i >> 2] >> ((i & 3) << 3));
+ data[i] = (uint8_t)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
mir_md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
mir_md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
- digest[i] = (BYTE)(pms->abcd[i >> 2] >> ((i & 3) << 3));
+ digest[i] = (uint8_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
-MIR_CORE_DLL(void) mir_md5_hash(const BYTE *data, size_t len, BYTE digest[16])
+MIR_CORE_DLL(void) mir_md5_hash(const uint8_t *data, size_t len, uint8_t digest[16])
{
mir_md5_state_t state;
mir_md5_init(&state);
diff --git a/src/mir_core/src/sha1.cpp b/src/mir_core/src/sha1.cpp
index 435f6f440b..4ce2c8dbfe 100644
--- a/src/mir_core/src/sha1.cpp
+++ b/src/mir_core/src/sha1.cpp
@@ -94,7 +94,7 @@ MIR_CORE_DLL(void) mir_sha1_init(mir_sha1_ctx *ctx)
ctx->W[i] = 0;
}
-MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, const BYTE *dataIn, size_t len)
+MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, const uint8_t *dataIn, size_t len)
{
/* Read the data into W and process blocks as they get full
*/
@@ -110,7 +110,7 @@ MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, const BYTE *dataIn, size_t
}
}
-MIR_CORE_DLL(void) mir_sha1_finish(mir_sha1_ctx *ctx, BYTE hashout[20])
+MIR_CORE_DLL(void) mir_sha1_finish(mir_sha1_ctx *ctx, uint8_t hashout[20])
{
unsigned char pad0x80 = 0x80;
unsigned char pad0x00 = 0x00;
@@ -145,7 +145,7 @@ MIR_CORE_DLL(void) mir_sha1_finish(mir_sha1_ctx *ctx, BYTE hashout[20])
mir_sha1_init(ctx);
}
-MIR_CORE_DLL(void) mir_sha1_hash(BYTE *dataIn, size_t len, BYTE hashout[20])
+MIR_CORE_DLL(void) mir_sha1_hash(uint8_t *dataIn, size_t len, uint8_t hashout[20])
{
mir_sha1_ctx ctx;
diff --git a/src/mir_core/src/sha256.cpp b/src/mir_core/src/sha256.cpp
index 63fd940a62..1343929aab 100644
--- a/src/mir_core/src/sha256.cpp
+++ b/src/mir_core/src/sha256.cpp
@@ -103,9 +103,9 @@ static void transform(SHA256_CONTEXT *hd, const unsigned char *data)
memcpy(x, data, 64);
#else
{
- BYTE *p2;
+ uint8_t *p2;
- for (i = 0, p2 = (BYTE*)x; i < 16; i++, p2 += 4) {
+ for (i = 0, p2 = (uint8_t*)x; i < 16; i++, p2 += 4) {
p2[3] = *data++;
p2[2] = *data++;
p2[1] = *data++;
@@ -219,14 +219,14 @@ digest. The handle is prepared for a new cycle, but adding bytes
to the handle will the destroy the returned buffer. Returns: 32
bytes with the message the digest. */
-MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *hd, BYTE hashout[MIR_SHA256_HASH_SIZE])
+MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *hd, uint8_t hashout[MIR_SHA256_HASH_SIZE])
{
uint32_t t, msb, lsb;
mir_sha256_write(hd, nullptr, 0); /* flush */;
t = hd->nblocks;
- /* multiply by 64 to make a BYTE count */
+ /* multiply by 64 to make a uint8_t count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
@@ -262,7 +262,7 @@ MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *hd, BYTE hashout[MIR_SHA256_
hd->buf[63] = lsb;
transform(hd, hd->buf);
- BYTE *p = hashout;
+ uint8_t *p = hashout;
#ifdef WORDS_BIGENDIAN
#define X(a) do { *(uint32_t*)p = hd->h##a ; p += 4; } while(0)
#else /* little endian */
@@ -280,7 +280,7 @@ MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *hd, BYTE hashout[MIR_SHA256_
#undef X
}
-MIR_CORE_DLL(void) mir_sha256_hash(const void *dataIn, size_t len, BYTE hashout[MIR_SHA256_HASH_SIZE])
+MIR_CORE_DLL(void) mir_sha256_hash(const void *dataIn, size_t len, uint8_t hashout[MIR_SHA256_HASH_SIZE])
{
SHA256_CONTEXT tmp;
mir_sha256_init(&tmp);
diff --git a/src/mir_core/src/utils.cpp b/src/mir_core/src/utils.cpp
index 4e13c82d72..0d773d10bc 100644
--- a/src/mir_core/src/utils.cpp
+++ b/src/mir_core/src/utils.cpp
@@ -256,7 +256,7 @@ static char szHexTable[] = "0123456789abcdef";
MIR_CORE_DLL(char*) bin2hex(const void *pData, size_t len, char *dest)
{
- const BYTE *p = (const BYTE*)pData;
+ const uint8_t *p = (const uint8_t*)pData;
char *d = dest;
for (size_t i = 0; i < len; i++, p++) {
@@ -270,7 +270,7 @@ MIR_CORE_DLL(char*) bin2hex(const void *pData, size_t len, char *dest)
MIR_CORE_DLL(wchar_t*) bin2hexW(const void *pData, size_t len, wchar_t *dest)
{
- const BYTE *p = (const BYTE*)pData;
+ const uint8_t *p = (const uint8_t*)pData;
wchar_t *d = dest;
for (size_t i = 0; i < len; i++, p++) {
@@ -302,7 +302,7 @@ MIR_CORE_DLL(bool) hex2bin(const char *pSrc, void *pData, size_t len)
if (pSrc[bufLen*2] != 0 || bufLen > len)
return false;
- BYTE *pDest = (BYTE*)pData;
+ uint8_t *pDest = (uint8_t*)pData;
const char *p = (const char *)pSrc;
for (size_t i = 0; i < bufLen; i++, p += 2)
pDest[i] = hex2dec(p[0]) * 16 + hex2dec(p[1]);
@@ -321,7 +321,7 @@ MIR_CORE_DLL(bool) hex2binW(const wchar_t *pSrc, void *pData, size_t len)
if (pSrc[bufLen * 2] != 0 || bufLen > len)
return false;
- BYTE *pDest = (BYTE*)pData;
+ uint8_t *pDest = (uint8_t*)pData;
const wchar_t *p = (const wchar_t *)pSrc;
for (size_t i = 0; i < bufLen; i++, p += 2)
pDest[i] = hex2dec(p[0]) * 16 + hex2dec(p[1]);