summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/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/Db3x_mmap/src
parentfcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (diff)
BYTE -> uint8_t
Diffstat (limited to 'plugins/Db3x_mmap/src')
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp14
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp10
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h12
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp6
4 files changed, 21 insertions, 21 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 7778535d2c..39f523be8e 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -74,7 +74,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::ReadCryptoKey(MBinBuffer &buf)
STDMETHODIMP_(BOOL) CDb3Mmap::StoreCryptoKey()
{
size_t iKeyLength = m_crypto->getKeyLength();
- BYTE *pKey = (BYTE*)_alloca(iKeyLength);
+ uint8_t *pKey = (uint8_t*)_alloca(iKeyLength);
m_crypto->getKey(pKey, iKeyLength);
DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "StoredKey" };
@@ -196,7 +196,7 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
len = *(PWORD)(pBlob + 1);
// we need to convert a string into utf8 and encrypt it
if (!m_bEncrypted) {
- BYTE bSave = pBlob[len + 3]; pBlob[len + 3] = 0;
+ uint8_t bSave = pBlob[len + 3]; pBlob[len + 3] = 0;
arSettings.insert(new VarDescr(szSetting, mir_utf8encode((LPCSTR)pBlob + 3)));
pBlob[len + 3] = bSave;
}
@@ -207,7 +207,7 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
len = *(PWORD)(pBlob + 1);
// we need to encrypt these strings
if (!m_bEncrypted) {
- BYTE bSave = pBlob[len + 3]; pBlob[len + 3] = 0;
+ uint8_t bSave = pBlob[len + 3]; pBlob[len + 3] = 0;
arSettings.insert(new VarDescr(szSetting, (LPCSTR)pBlob + 3));
pBlob[len + 3] = bSave;
}
@@ -234,7 +234,7 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
for (auto &p : arSettings) {
if (!m_bEncrypted) {
size_t encodedLen;
- BYTE *pResult = m_crypto->encodeString(p->szValue, &encodedLen);
+ uint8_t *pResult = m_crypto->encodeString(p->szValue, &encodedLen);
if (pResult != nullptr) {
DBCONTACTWRITESETTING dbcws = { szModule, p->szVar };
dbcws.value.type = DBVT_ENCRYPTED;
@@ -285,8 +285,8 @@ void CDb3Mmap::ToggleEventsEncryption(MCONTACT contactID)
size_t len;
DWORD ofsDest;
- mir_ptr<BYTE> pBlob;
- BYTE *pSource = DBRead(offset + offsetof(DBEvent, blob), nullptr);
+ mir_ptr<uint8_t> pBlob;
+ uint8_t *pSource = DBRead(offset + offsetof(DBEvent, blob), nullptr);
if (!m_bEncrypted) { // we need more space
if ((pBlob = m_crypto->encodeBuffer(pSource, evt.cbBlob, &len)) == nullptr)
return;
@@ -313,7 +313,7 @@ void CDb3Mmap::ToggleEventsEncryption(MCONTACT contactID)
evt.flags |= DBEF_ENCRYPTED;
}
else {
- if ((pBlob = (BYTE*)m_crypto->decodeBuffer(pSource, evt.cbBlob, &len)) == nullptr)
+ if ((pBlob = (uint8_t*)m_crypto->decodeBuffer(pSource, evt.cbBlob, &len)) == nullptr)
return;
ofsDest = offset; // reuse the old space
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp
index 69928a404c..806f51e955 100644
--- a/plugins/Db3x_mmap/src/dbevents.cpp
+++ b/plugins/Db3x_mmap/src/dbevents.cpp
@@ -64,12 +64,12 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei)
dbe.flags = dbei->flags;
dbe.wEventType = dbei->eventType;
dbe.cbBlob = dbei->cbBlob;
- BYTE *pBlob = dbei->pBlob;
+ uint8_t *pBlob = dbei->pBlob;
- mir_ptr<BYTE> pCryptBlob;
+ mir_ptr<uint8_t> pCryptBlob;
if (m_bEncrypted) {
size_t len;
- BYTE *pResult = m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len);
+ uint8_t *pResult = m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len);
if (pResult != nullptr) {
pCryptBlob = pBlob = pResult;
dbe.cbBlob = (DWORD)len;
@@ -302,7 +302,7 @@ BOOL CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
dbei->cbBlob = dbe->cbBlob;
if (bytesToCopy && dbei->pBlob) {
- BYTE *pSrc;
+ uint8_t *pSrc;
if (m_dbHeader.version >= DB_095_1_VERSION)
pSrc = DBRead(DWORD(hDbEvent) + offsetof(DBEvent, blob), nullptr);
else
@@ -310,7 +310,7 @@ BOOL CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
if (dbe->flags & DBEF_ENCRYPTED) {
dbei->flags &= ~DBEF_ENCRYPTED;
size_t len;
- BYTE* pBlob = (BYTE*)m_crypto->decodeBuffer(pSrc, dbe->cbBlob, &len);
+ uint8_t* pBlob = (uint8_t*)m_crypto->decodeBuffer(pSrc, dbe->cbBlob, &len);
if (pBlob == nullptr)
return 1;
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index 43907534cf..4963ab95bf 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -78,7 +78,7 @@ DWORD __forceinline GetSettingValueLength(uint8_t *pSetting)
struct DBSignature
{
char name[15];
- BYTE eof;
+ uint8_t eof;
};
struct ModuleName
@@ -90,7 +90,7 @@ struct ModuleName
#include <pshpack1.h>
struct DBHeader
{
- BYTE signature[16]; // 'Miranda ICQ DB',0,26
+ uint8_t signature[16]; // 'Miranda ICQ DB',0,26
DWORD version; // as 4 bytes, ie 1.2.3.10 = 0x0102030a
DWORD ofsFileEnd; // offset of the end of the database - place to write new structures
DWORD slackSpace; // a counter of the number of bytes that have been
@@ -123,7 +123,7 @@ struct DBModuleName
{
DWORD signature;
DWORD ofsNext; // offset to the next module name in the chain
- BYTE cbName; // number of characters in this module name
+ uint8_t cbName; // number of characters in this module name
char name[1]; // name, no nul terminator
};
@@ -136,7 +136,7 @@ struct DBContactSettings
DWORD cbBlob; // size of the blob in bytes. May be larger than the
// actual size for reducing the number of moves
// required using granularity in resizing
- BYTE blob[1]; // the blob. a back-to-back sequence of DBSetting
+ uint8_t blob[1]; // the blob. a back-to-back sequence of DBSetting
// structs, the last has cbName = 0
};
@@ -152,7 +152,7 @@ struct DBEvent_094 // previous event storage format
DWORD flags; // see m_database.h, db/event/add
WORD wEventType; // module-defined event type
DWORD cbBlob; // number of bytes in the blob
- BYTE blob[1]; // the blob. module-defined formatting
+ uint8_t blob[1]; // the blob. module-defined formatting
};
struct DBEvent
@@ -167,7 +167,7 @@ struct DBEvent
DWORD flags; // see m_database.h, db/event/add
WORD wEventType; // module-defined event type
DWORD cbBlob; // number of bytes in the blob
- BYTE blob[1]; // the blob. module-defined formatting
+ uint8_t blob[1]; // the blob. module-defined formatting
bool __forceinline markedRead() const
{
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index 9ed7ba662e..e4fa495431 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -112,7 +112,7 @@ LBL_Seek:
if (isStatic && (pBlob[0] & DBVTF_VARIABLELENGTH) && VLT(dbv->type) != VLT(pBlob[0]))
return 1;
- BYTE iType = dbv->type = pBlob[0];
+ uint8_t iType = dbv->type = pBlob[0];
switch (iType) {
case DBVT_DELETED: /* this setting is deleted */
dbv->type = DBVT_DELETED;
@@ -150,7 +150,7 @@ LBL_Seek:
memmove(dbv->pbVal, pBlob + 3, dbv->cpbVal);
}
else {
- dbv->pbVal = (BYTE *)mir_alloc(varLen);
+ dbv->pbVal = (uint8_t *)mir_alloc(varLen);
memmove(dbv->pbVal, pBlob + 3, varLen);
}
dbv->cpbVal = varLen;
@@ -419,7 +419,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSettingWorker(MCONTACT contactID, DBCO
break;
}
- BYTE zero = 0;
+ uint8_t zero = 0;
DBWrite(ofsBlobPtr, &zero, 1);
// quit