summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-20 13:34:45 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-20 13:34:45 +0300
commite96132b4d5344d2d58d247906bcaefccfb9d5253 (patch)
tree24a9524e4900547f2ba3a461e228fd3c98c0410d /src
parent4dac8bd56f9116ac76423b2664286ed894ca80c2 (diff)
DBEVENTINFO::hContact to be returned inside an event, no need to call db_event_getContact() just after db_event_get()
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp2
-rw-r--r--src/core/stduihist/src/history.cpp2
-rw-r--r--src/mir_app/src/addcontact.cpp2
-rw-r--r--src/mir_app/src/chat_svc.cpp5
-rw-r--r--src/mir_app/src/db_events.cpp16
-rw-r--r--src/mir_app/src/mir_app.def5
-rw-r--r--src/mir_app/src/mir_app64.def5
-rw-r--r--src/mir_app/src/proto_interface.cpp2
-rw-r--r--src/mir_app/src/protocols.cpp2
9 files changed, 19 insertions, 22 deletions
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index 356d7ad6f0..78815ef42b 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -95,7 +95,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, LPARAM lParam)
dbei.szModule = Proto_GetBaseAccountName(hContact);
dbei.timestamp = time(0);
dbei.cbBlob = (uint32_t)(mir_strlen(p->szMsg) + 1);
- dbei.pBlob = (uint8_t*)p->szMsg;
+ dbei.pBlob = p->szMsg;
dbei.szId = (char *)lParam;
MessageWindowEvent evt = { id, hContact, &dbei };
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index 2e59abcf9e..c886b4f341 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
int newBlobSize = db_event_getBlobSize(hDbEvent);
if (newBlobSize > oldBlobSize) {
- dbei.pBlob = (uint8_t*)mir_realloc(dbei.pBlob, newBlobSize);
+ dbei.pBlob = (char *)mir_realloc(dbei.pBlob, newBlobSize);
oldBlobSize = newBlobSize;
}
dbei.cbBlob = oldBlobSize;
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index 4e1c822bec..ad55172acc 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -210,7 +210,7 @@ MIR_APP_DLL(void) Contact::AddByEvent(MEVENT hEvent, MWindow hwndParent)
uint32_t dwData[2];
DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(dwData);
- dbei.pBlob = (uint8_t*)&dwData;
+ dbei.pBlob = (char *)&dwData;
db_event_get(hEvent, &dbei);
if (dwData[0] != 0)
m_szName.Format(L"%d", dwData[0]);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index b7a759e3f0..aacc6d7eb3 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -847,9 +847,8 @@ static int OnEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (auto *pDlg = Srmm_FindDialog(hContact))
pDlg->EventAdded(hDbEvent, dbei);
- MCONTACT hRealContact = db_event_getContact(hDbEvent);
- if (hRealContact != hContact)
- if (auto *pDlg = Srmm_FindDialog(hRealContact))
+ if (dbei.hContact != hContact)
+ if (auto *pDlg = Srmm_FindDialog(dbei.hContact))
pDlg->EventAdded(hDbEvent, dbei);
}
}
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp
index cee5015c96..78d00685ef 100644
--- a/src/mir_app/src/db_events.cpp
+++ b/src/mir_app/src/db_events.cpp
@@ -375,7 +375,7 @@ void DB::FILE_BLOB::write(DB::EventInfo &dbei)
std::string text = root.write();
dbei.cbBlob = (int)text.size() + 1;
- dbei.pBlob = (uint8_t*)mir_realloc(dbei.pBlob, dbei.cbBlob);
+ dbei.pBlob = (char *)mir_realloc(dbei.pBlob, dbei.cbBlob);
memcpy(dbei.pBlob, text.c_str(), dbei.cbBlob);
}
@@ -394,9 +394,9 @@ DB::AUTH_BLOB::AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR ln
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(uint8_t *blob)
+DB::AUTH_BLOB::AUTH_BLOB(char *blob)
{
- char *pCurBlob = (char *)blob;
+ char *pCurBlob = blob;
m_dwUin = *(uint32_t*)pCurBlob;
pCurBlob += sizeof(uint32_t);
m_hContact = *(uint32_t*)pCurBlob;
@@ -406,24 +406,24 @@ DB::AUTH_BLOB::AUTH_BLOB(uint8_t *blob)
m_szLastName = mir_strdup(pCurBlob); pCurBlob += mir_strlen(pCurBlob) + 1;
m_szEmail = mir_strdup(pCurBlob); pCurBlob += mir_strlen(pCurBlob) + 1;
m_szReason = mir_strdup(pCurBlob); pCurBlob += mir_strlen(pCurBlob) + 1;
- m_size = uint32_t(pCurBlob - (char *)blob);
+ m_size = uint32_t(pCurBlob - blob);
}
DB::AUTH_BLOB::~AUTH_BLOB()
{
}
-uint8_t* DB::AUTH_BLOB::makeBlob()
+char* DB::AUTH_BLOB::makeBlob()
{
- uint8_t *pBlob, *pCurBlob;
- pCurBlob = pBlob = (uint8_t*)mir_alloc(m_size + 1);
+ char *pBlob, *pCurBlob;
+ pCurBlob = pBlob = (char *)mir_alloc(m_size + 1);
*((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",
+ mir_snprintf(pCurBlob, m_size - 8, "%s%c%s%c%s%c%s%c%s%c",
(m_szNick) ? m_szNick.get() : "", 0,
(m_szFirstName) ? m_szFirstName.get() : "", 0,
(m_szLastName) ? m_szLastName.get() : "", 0,
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index e2f035218c..83ab5e5a8f 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -289,11 +289,10 @@ Netlib_DestroySecurityProvider @381
Netlib_InitSecurityProvider @382
Netlib_NtlmCreateResponse @383
??0AUTH_BLOB@DB@@QAE@IPBD0000@Z @384 NONAME
-??0AUTH_BLOB@DB@@QAE@PAE@Z @385 NONAME
+??0AUTH_BLOB@DB@@QAE@PAD@Z @385 NONAME
??1AUTH_BLOB@DB@@QAE@XZ @386 NONAME
??4AUTH_BLOB@DB@@QAEAAV01@ABV01@@Z @387 NONAME
??BAUTH_BLOB@DB@@QAEPADXZ @388 NONAME
-??BAUTH_BLOB@DB@@QAEPAEXZ @389 NONAME
?get_contact@AUTH_BLOB@DB@@QBEIXZ @390 NONAME
?get_email@AUTH_BLOB@DB@@QBEPBDXZ @391 NONAME
?get_firstName@AUTH_BLOB@DB@@QBEPBDXZ @392 NONAME
@@ -301,7 +300,7 @@ Netlib_NtlmCreateResponse @383
?get_nick@AUTH_BLOB@DB@@QBEPBDXZ @394 NONAME
?get_reason@AUTH_BLOB@DB@@QBEPBDXZ @395 NONAME
?get_uin@AUTH_BLOB@DB@@QBEIXZ @396 NONAME
-?makeBlob@AUTH_BLOB@DB@@AAEPAEXZ @397 NONAME
+?makeBlob@AUTH_BLOB@DB@@AAEPADXZ @1046 NONAME
?size@AUTH_BLOB@DB@@QBEIXZ @398 NONAME
Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 6c39849c39..a768154279 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -289,11 +289,10 @@ Netlib_DestroySecurityProvider @381
Netlib_InitSecurityProvider @382
Netlib_NtlmCreateResponse @383
??0AUTH_BLOB@DB@@QEAA@IPEBD0000@Z @384 NONAME
-??0AUTH_BLOB@DB@@QEAA@PEAE@Z @385 NONAME
+??0AUTH_BLOB@DB@@QEAA@PEAD@Z @385 NONAME
??1AUTH_BLOB@DB@@QEAA@XZ @386 NONAME
??4AUTH_BLOB@DB@@QEAAAEAV01@AEBV01@@Z @387 NONAME
??BAUTH_BLOB@DB@@QEAAPEADXZ @388 NONAME
-??BAUTH_BLOB@DB@@QEAAPEAEXZ @389 NONAME
?get_contact@AUTH_BLOB@DB@@QEBAIXZ @390 NONAME
?get_email@AUTH_BLOB@DB@@QEBAPEBDXZ @391 NONAME
?get_firstName@AUTH_BLOB@DB@@QEBAPEBDXZ @392 NONAME
@@ -301,7 +300,7 @@ Netlib_NtlmCreateResponse @383
?get_nick@AUTH_BLOB@DB@@QEBAPEBDXZ @394 NONAME
?get_reason@AUTH_BLOB@DB@@QEBAPEBDXZ @395 NONAME
?get_uin@AUTH_BLOB@DB@@QEBAIXZ @396 NONAME
-?makeBlob@AUTH_BLOB@DB@@AEAAPEAEXZ @397 NONAME
+?makeBlob@AUTH_BLOB@DB@@AEAAPEADXZ @397 NONAME
?size@AUTH_BLOB@DB@@QEBAIXZ @398 NONAME
Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp
index 3caf9971aa..3d783df392 100644
--- a/src/mir_app/src/proto_interface.cpp
+++ b/src/mir_app/src/proto_interface.cpp
@@ -220,7 +220,7 @@ MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
dbei.timestamp = pre->timestamp;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (uint32_t)mir_strlen(pre->szMessage) + 1;
- dbei.pBlob = (uint8_t*)pre->szMessage;
+ dbei.pBlob = pre->szMessage;
dbei.szUserId = pre->szUserId;
dbei.szReplyId = pre->szReplyId;
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index bafd0d0d04..5ce2306a5f 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -183,7 +183,7 @@ MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre
dbei.flags = DBEF_UTF | pcre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = pcre->lParam;
- dbei.pBlob = (uint8_t*)pcre->szMessage;
+ dbei.pBlob = pcre->szMessage;
return db_event_add(0, &dbei);
}