diff options
author | ghazan <ghazan@miranda.im> | 2021-12-26 14:36:32 +0300 |
---|---|---|
committer | ghazan <ghazan@miranda.im> | 2021-12-26 14:36:32 +0300 |
commit | 129687d805025b4e292174ffb3d224a55baf24d2 (patch) | |
tree | f07999fd9a604d81a9905a95c7b26f4caa9161d8 /src/mir_app | |
parent | 4f510d6e82caeee262234d7b83ce2c4db3c82102 (diff) |
further code cleaning
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/contacts.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/db_events.cpp | 30 | ||||
-rw-r--r-- | src/mir_app/src/db_intf.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/plugins.h | 4 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 06bedc465d..1a33be2375 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -147,7 +147,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s DBVARIANT dbv2;
if (!db_get_ws(hContact, szProto, "LastName", &dbv2)) {
size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
- wchar_t *buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
+ wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t)*len);
if (buf != nullptr)
mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
db_free(&dbv);
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 5e7d3b376d..9f7653d1c0 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -162,7 +162,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp }
if (dbei->eventType == EVENTTYPE_FILE) {
- char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD);
+ char *buf = LPSTR(dbei->pBlob) + sizeof(uint32_t);
ptrW tszFileName(getEventString(dbei, buf));
ptrW tszDescription(getEventString(dbei, buf));
CMStringW wszText(tszFileName);
@@ -187,7 +187,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp str[dbei->cbBlob] = 0;
if (dbei->flags & DBEF_UTF) {
- WCHAR *msg = nullptr;
+ wchar_t *msg = nullptr;
mir_utf8decodecp(str, codepage, &msg);
if (msg)
return (INT_PTR)msg;
@@ -272,37 +272,37 @@ DB::AUTH_BLOB::AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR ln m_szEmail(mir_strdup(email)),
m_szReason(mir_strdup(reason))
{
- m_size = DWORD(sizeof(DWORD) * 2 + 5 + mir_strlen(m_szNick) + mir_strlen(m_szFirstName) + mir_strlen(m_szLastName) + mir_strlen(m_szEmail) + mir_strlen(m_szReason));
+ m_size = uint32_t(sizeof(uint32_t) * 2 + 5 + mir_strlen(m_szNick) + mir_strlen(m_szFirstName) + mir_strlen(m_szLastName) + mir_strlen(m_szEmail) + mir_strlen(m_szReason));
}
DB::AUTH_BLOB::AUTH_BLOB(PBYTE blob)
{
PBYTE pCurBlob = blob;
- m_dwUin = *(PDWORD)pCurBlob;
- pCurBlob += sizeof(DWORD);
- m_hContact = *(PDWORD)pCurBlob;
- pCurBlob += sizeof(DWORD);
+ m_dwUin = *(Puint32_t)pCurBlob;
+ pCurBlob += sizeof(uint32_t);
+ m_hContact = *(Puint32_t)pCurBlob;
+ pCurBlob += sizeof(uint32_t);
m_szNick = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
m_szFirstName = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
m_szLastName = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
m_szEmail = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
m_szReason = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- m_size = DWORD(pCurBlob - blob);
+ m_size = uint32_t(pCurBlob - blob);
}
DB::AUTH_BLOB::~AUTH_BLOB()
{
}
-PBYTE DB::AUTH_BLOB::makeBlob()
+uint8_t* DB::AUTH_BLOB::makeBlob()
{
- PBYTE pBlob, pCurBlob;
- pCurBlob = pBlob = (PBYTE)mir_alloc(m_size + 1);
+ uint8_t *pBlob, *pCurBlob;
+ pCurBlob = pBlob = (uint8_t*)mir_alloc(m_size + 1);
- *((PDWORD)pCurBlob) = m_dwUin;
- pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)m_hContact;
- pCurBlob += sizeof(DWORD);
+ *((uint32_t*)pCurBlob) = m_dwUin;
+ pCurBlob += sizeof(uint32_t);
+ *((uint32_t*)pCurBlob) = (uint32_t)m_hContact;
+ pCurBlob += sizeof(uint32_t);
mir_snprintf((char*)pCurBlob, m_size - 8, "%s%c%s%c%s%c%s%c%s%c",
(m_szNick) ? m_szNick.get() : "", 0,
diff --git a/src/mir_app/src/db_intf.cpp b/src/mir_app/src/db_intf.cpp index af6ab6c1f9..16ec3a4e16 100644 --- a/src/mir_app/src/db_intf.cpp +++ b/src/mir_app/src/db_intf.cpp @@ -48,7 +48,7 @@ MIR_APP_DLL(DATABASELINK*) FindDatabasePlugin(const wchar_t *ptszFileName) {
for (auto &it : arDbPlugins) {
int error = it->grokHeader(ptszFileName);
- if (error == ERROR_SUCCESS || error == EGROKPRF_OBSOLETE)
+ if (error == EGROKPRF_NOERROR || error == EGROKPRF_OBSOLETE)
return it;
}
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index 6c6d8153b2..6b686265ab 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -5,8 +5,8 @@ #define DEFMOD_REMOVED_PROTOCOLNETLIB 22
// basic export prototypes
-typedef int(__cdecl *Miranda_Plugin_Load) (void);
-typedef int(__cdecl *Miranda_Plugin_Unload) (void);
+typedef int(MIR_CDECL *Miranda_Plugin_Load) (void);
+typedef int(MIR_CDECL *Miranda_Plugin_Unload) (void);
struct pluginEntry
{
|