diff options
Diffstat (limited to 'protocols')
36 files changed, 64 insertions, 87 deletions
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 25f32001f1..d5ac1af9da 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1207,7 +1207,7 @@ void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsig char* buf = (char*)alloca(len);
mir_snprintf(buf, len, "%s %s", away, s_msg);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_SENT | DBEF_UTF;
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 60b126ff56..76b52bffae 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -369,17 +369,13 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) void CMLan::RecvMessageUrl(CCSDATA* ccs) { - DBEVENTINFO dbei; PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam; - memset(&dbei, 0, sizeof(dbei)); - + DBEVENTINFO dbei = {}; if (!mir_strcmp(ccs->szProtoService, PSR_MESSAGE)) dbei.eventType = EVENTTYPE_MESSAGE; else dbei.eventType = EVENTTYPE_URL; - - dbei.cbSize = sizeof(dbei); dbei.szModule = PROTONAME; dbei.timestamp = pre->timestamp; dbei.flags = pre->flags & PREF_CREATEREAD ? DBEF_READ : 0; @@ -989,7 +985,7 @@ void CMLan::RecvFile(CCSDATA* ccs) char *szFile = pre->szMessage + sizeof(DWORD); char *szDesc = szFile + mir_strlen(szFile) + 1; - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.szModule = PROTONAME; dbei.timestamp = pre->timestamp; dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0); diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index e9aded49e9..7551c71077 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -444,9 +444,7 @@ void FacebookProto::LoadHistory(void *pParam) lastMessageId = msg.message_id; // We don't use ProtoChainRecvMsg here as this is just loading of old messages, which we just add to log - DBEVENTINFO dbei = { 0 }; - dbei.cbSize = sizeof(dbei); - + DBEVENTINFO dbei = {}; if (msg.type == MESSAGE) dbei.eventType = EVENTTYPE_MESSAGE; else if (msg.type == VIDEO_CALL || msg.type == PHONE_CALL) @@ -917,9 +915,7 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo ProtoChainRecvMsg(hContact, &recv); } else { - DBEVENTINFO dbei = { 0 }; - dbei.cbSize = sizeof(dbei); - + DBEVENTINFO dbei = {}; if (msg.type == MESSAGE) dbei.eventType = EVENTTYPE_MESSAGE; else if (msg.type == VIDEO_CALL || msg.type == PHONE_CALL) @@ -1101,8 +1097,7 @@ void FacebookProto::ProcessFriendRequests(void*) DB_AUTH_BLOB blob(hContact, fbu.real_name.c_str(), 0, 0, fbu.user_id.c_str(), reason.c_str()); - DBEVENTINFO dbei = { 0 }; - dbei.cbSize = sizeof(DBEVENTINFO); + DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; dbei.timestamp = ::time(NULL); dbei.flags = DBEF_UTF; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 73ff55b9c0..0cb9fc7a37 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -904,7 +904,7 @@ INT_PTR FacebookProto::OnCancelFriendshipRequest(WPARAM wParam, LPARAM) MCONTACT FacebookProto::HContactFromAuthEvent(MEVENT hEvent) { DWORD body[2]; - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(DWORD) * 2; dbei.pBlob = (PBYTE)&body; diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index eecfe8abd8..da71957b28 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -192,7 +192,7 @@ static MEVENT AddCListNotification(MCONTACT hContact, LPCSTR acc, POPUPDATAT *da {
T2Utf szUrl(url), szText(data->lptzText);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = (LPSTR)acc;
dbei.timestamp = time(NULL);
dbei.flags = DBEF_UTF;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index f619bab6ea..efb64cdd15 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -916,7 +916,7 @@ retry: else if (!e->event.multilogon_msg.recipients_count && e->event.multilogon_msg.message && *e->event.multilogon_msg.message
&& mir_strcmp(e->event.multilogon_msg.message, "\xA0\0"))
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)e->event.multilogon_msg.time;
dbei.flags = DBEF_SENT | DBEF_UTF;
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 1d84255ed6..c9a3442b65 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -198,8 +198,7 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam) db_unset(ccs->hContact, "CList", "Hidden");
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.szModule = protoName;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
@@ -232,7 +231,6 @@ static INT_PTR icqSendUrl(WPARAM, LPARAM lParam) static INT_PTR icqRecvUrl(WPARAM, LPARAM lParam)
{
- DBEVENTINFO dbei;
CCSDATA *ccs = (CCSDATA*)lParam;
PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
char *pszDescr;
@@ -241,8 +239,8 @@ static INT_PTR icqRecvUrl(WPARAM, LPARAM lParam) db_unset(ccs->hContact, "CList", "Hidden");
pszDescr = pre->szMessage + mir_strlen(pre->szMessage) + 1;
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
+
+ DBEVENTINFO dbei = {};
dbei.szModule = protoName;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
@@ -415,7 +413,6 @@ static INT_PTR icqFileCancel(WPARAM, LPARAM lParam) static INT_PTR icqRecvFile(WPARAM, LPARAM lParam)
{
- DBEVENTINFO dbei;
CCSDATA *ccs = (CCSDATA *)lParam;
PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
char *szDesc, *szFile;
@@ -427,8 +424,7 @@ static INT_PTR icqRecvFile(WPARAM, LPARAM lParam) szFile = pre->szMessage + sizeof(DWORD);
szDesc = szFile + mir_strlen(szFile) + 1;
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.szModule = protoName;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 6782a772a0..d015a755b7 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -223,7 +223,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg) CMStringW S = DoColorCodes(msg, TRUE, FALSE);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.timestamp = (DWORD)time(NULL);
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index 938a486e08..8d00e6b7cc 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -191,7 +191,7 @@ int CIcqProto::IsICQContact(MCONTACT hContact) MEVENT CIcqProto::AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, size_t cbBlob, PBYTE pBlob)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = dwTime;
dbei.flags = flags;
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index e385a13aec..fcc6cb3d8f 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -316,7 +316,7 @@ MCONTACT __cdecl CIcqProto::AddToListByEvent(int flags, int iContact, MEVENT hDb DWORD uin = 0;
uid_str uid = { 0 };
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 0;
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index d4d7c0a885..85ef2b029d 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -541,7 +541,7 @@ MCONTACT CIcqProto::HContactFromAuthEvent(MEVENT hEvent) {
DWORD body[3];
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(DWORD) * 2;
dbei.pBlob = (PBYTE)&body;
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 32d5db407f..53165e64a1 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -94,7 +94,7 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) if (!hExistingDbEvent)
return FALSE;
- DBEVENTINFO dbeiExisting = { sizeof(dbeiExisting) };
+ DBEVENTINFO dbeiExisting = {};
db_event_get(hExistingDbEvent, &dbeiExisting);
DWORD dwEventTimeStamp = dbeiExisting.timestamp;
@@ -117,7 +117,6 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) return FALSE;
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
- dbeiExisting.cbSize = sizeof(dbeiExisting);
db_event_get(hExistingDbEvent, &dbeiExisting);
dwEventTimeStamp = dbeiExisting.timestamp;
@@ -135,7 +134,6 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) // check for equal timestamps
if (dbei.timestamp == dwPreviousTimeStamp) {
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
- dbeiExisting.cbSize = sizeof(dbeiExisting);
db_event_get(hPreviousDbEvent, &dbeiExisting);
if (dbei == dbeiExisting)
@@ -145,7 +143,6 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) hExistingDbEvent = db_event_next(hContact, hPreviousDbEvent);
while (hExistingDbEvent != NULL) {
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
- dbeiExisting.cbSize = sizeof(dbeiExisting);
db_event_get(hExistingDbEvent, &dbeiExisting);
if (dbeiExisting.timestamp != dwPreviousTimeStamp) {
@@ -166,7 +163,6 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) // look back
while (hExistingDbEvent != NULL) {
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
- dbeiExisting.cbSize = sizeof(dbeiExisting);
db_event_get(hExistingDbEvent, &dbeiExisting);
if (dbei.timestamp > dbeiExisting.timestamp) {
@@ -192,7 +188,6 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) // look forward
while (hExistingDbEvent != NULL) {
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
- dbeiExisting.cbSize = sizeof(dbeiExisting);
db_event_get(hExistingDbEvent, &dbeiExisting);
if (dbei.timestamp < dbeiExisting.timestamp) {
@@ -267,7 +262,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) T2Utf szEventText(tszBody);
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.szModule = m_szModuleName;
dbei.cbBlob = (DWORD)mir_strlen(szEventText)+1;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index ed0320d301..ee64e3c348 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -50,7 +50,7 @@ void CJabberProto::DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick) DB_AUTH_BLOB blob(hContact, T2Utf(nick), NULL, NULL, T2Utf(jid), NULL);
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_UTF;
@@ -118,7 +118,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) break;
}
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.pBlob = &btEventType;
dbei.cbBlob = sizeof(btEventType);
dbei.eventType = EVENTTYPE_JABBER_PRESENCE;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 075f2defea..be0bbb6e50 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -331,7 +331,7 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEV {
debugLogA("AddToListByEvent");
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return NULL;
if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL)
@@ -355,7 +355,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) if (!m_bJabberOnline)
return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL)
@@ -401,7 +401,7 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) debugLogA("Entering AuthDeny");
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index af4f79f711..c37e85bc31 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -469,7 +469,7 @@ int CJabberProto::RcGetUnreadEventsCount() if (jid == NULL) continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1)
continue;
@@ -556,7 +556,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1)
continue;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 778a2b72e8..0b28ee9157 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -987,7 +987,7 @@ DWORD JabberGetLastContactMessageTime(MCONTACT hContact) DWORD dwTime = 0;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
@@ -1146,7 +1146,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) // chatstates gone event
if (hContact && XmlGetChildByTag(node, "gone", "xmlns", JABBER_FEAT_CHATSTATES) && m_options.LogChatstates) {
BYTE bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.pBlob = &bEventType;
dbei.cbBlob = 1;
dbei.eventType = EVENTTYPE_JABBER_CHATSTATES;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 20ac13f3b8..ede27df68b 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -160,8 +160,7 @@ MCONTACT CMraProto::AddToList(int flags, PROTOSEARCHRESULT *psr) MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent)
{
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) != -1) {
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
if (db_event_get(hDbEvent, &dbei) == 0 &&
@@ -181,7 +180,7 @@ int CMraProto::Authorize(MEVENT hDBEvent) {
if (!m_bLoggedIn) return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDBEvent)) == -1)
return 1;
@@ -199,7 +198,7 @@ int CMraProto::AuthDeny(MEVENT hDBEvent, const wchar_t* szReason) {
if (!m_bLoggedIn) return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDBEvent)) == -1)
return 1;
@@ -323,7 +322,7 @@ HANDLE CMraProto::SearchByName(const wchar_t *pszNick, const wchar_t *pszFirstNa int CMraProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = pre->timestamp;
dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0;
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 8ee2d7101f..99c2f70294 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -559,7 +559,7 @@ bool CMraProto::CmdAuthAck(BinBuffer &buf) if (IsEMailChatAgent(szEmail) == FALSE) {
CMStringA szBuff = CreateBlobFromContact(hContact, L"");
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.flags = DBEF_UTF;
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)_time32(NULL);
@@ -1746,7 +1746,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & CMStringA szBlob = CreateBlobFromContact(hContact, wszMessage);
if (bAutoGrantAuth) { // auto grant auth
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = _time32(NULL);
dbei.flags = DBEF_READ | DBEF_UTF;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 58391b4b29..3d61b36603 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -346,8 +346,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para else {
bool haveWnd = MSN_MsgWndExist(hContact);
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (haveWnd ? 0 : DBEF_READ) | (isRtl ? DBEF_RTL : 0);
dbei.szModule = m_szModuleName;
@@ -1103,7 +1102,7 @@ LBL_InvalidCommand: if (hContact) {
// There are messages to be fetched
if (hDbEvent = db_event_last(hContact)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
ts = dbei.timestamp;
}
@@ -1172,7 +1171,7 @@ LBL_InvalidCommand: /* Protect against double sync (Miranda MSGs only have granularity in seconds) */
MEVENT hDbEvent;
bool bDuplicate = false;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
DWORD cbBlob = (DWORD)mir_strlen(message);
dbei.cbBlob = cbBlob;
BYTE *pszMsgBuf = (BYTE*)mir_calloc(cbBlob);
@@ -1198,7 +1197,6 @@ LBL_InvalidCommand: }
else {
memset(&dbei, 0, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = m_szModuleName;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index d4e873b20f..b9fd6955cd 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -851,7 +851,7 @@ void CMsnProto::MSN_FetchRecentMessages(time_t since) if (!(hDbEvent = db_event_last(hContact)))
continue;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.timestamp>since) since=dbei.timestamp;
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 208320aa45..bde9e9c7f2 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -267,7 +267,7 @@ MCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr) MCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int, MEVENT hDbEvent)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return NULL;
@@ -315,7 +315,7 @@ int CMsnProto::Authorize(MEVENT hDbEvent) if (!msnLoggedIn)
return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 1;
@@ -348,7 +348,7 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) if (!msnLoggedIn)
return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 1;
@@ -811,7 +811,7 @@ int CMsnProto::GetInfo(MCONTACT hContact, int) int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre)
{
PROTOSEARCHRESULT **isrList = (PROTOSEARCHRESULT**)pre->szMessage;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
BYTE *pCurBlob;
int i;
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index f1c79fb526..d1781a386a 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -54,7 +54,7 @@ void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus) MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent)
{
DWORD body[3];
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(DWORD) * 2;
dbei.pBlob = (PBYTE)&body;
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 6cfd2a8e70..2dbe2ced90 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -41,7 +41,7 @@ MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, L mir_cslock lock(messageSyncLock); for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob < messageIdLength) @@ -79,7 +79,7 @@ MEVENT CSkypeProto::AddDbEvent(WORD type, MCONTACT hContact, DWORD timestamp, DW MEVENT CSkypeProto::AppendDBEvent(MCONTACT hContact, MEVENT hEvent, const char *szContent, const char *szUid, time_t edit_time) { mir_cslock lck(m_AppendMessageLock); - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.cbBlob = db_event_getBlobSize(hEvent); mir_ptr<BYTE> blob((PBYTE)mir_alloc(dbei.cbBlob)); dbei.pBlob = blob; @@ -134,8 +134,7 @@ MEVENT CSkypeProto::AppendDBEvent(MCONTACT hContact, MEVENT hEvent, const char * MEVENT CSkypeProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) { - DBEVENTINFO dbei; - dbei.cbSize = sizeof(dbei); + DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; dbei.timestamp = timestamp; dbei.eventType = type; diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 380d6129ed..6530b6ceb6 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -264,7 +264,7 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) {
debugLogA(__FUNCTION__);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
time_t timestamp = dbei.timestamp;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 275d8b0e2a..dd4f476562 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -161,7 +161,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) { debugLogA(__FUNCTION__); - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return NULL; if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL) diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index efb76d7142..5ed053fecb 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -62,7 +62,7 @@ void CSteamProto::SetAllContactsStatus(WORD status) MCONTACT CSteamProto::GetContactFromAuthEvent(MEVENT hEvent) { DWORD body[3]; - DBEVENTINFO dbei = { sizeof(DBEVENTINFO) }; + DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(DWORD)* 2; dbei.pBlob = (PBYTE)&body; diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 00c58ba145..ee625f735c 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -164,7 +164,7 @@ void CSteamProto::ParsePollData(JSONNode *data) if (hContact) { BYTE bEventType = STEAM_DB_EVENT_CHATSTATES_GONE; - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.pBlob = &bEventType; dbei.cbBlob = 1; dbei.eventType = EVENTTYPE_STEAM_CHATSTATES; diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index edf15ab1c6..ae38e33bee 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenDBAddEvent(TlenProtocol *proto, MCONTACT hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = proto->m_szModuleName;
dbei.timestamp = (DWORD) time(NULL);
dbei.flags = flags;
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 2ec63b93f3..efced9bb74 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -225,7 +225,7 @@ MCONTACT TlenProtocol::AddToList(int flags, PROTOSEARCHRESULT *psr) MCONTACT TlenProtocol::AddToListByEvent(int flags, int, MEVENT hDbEvent)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return NULL;
if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == NULL)
@@ -262,7 +262,7 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) if (!isOnline)
return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)-1)
return 1;
if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == NULL)
@@ -307,7 +307,7 @@ int TlenProtocol::AuthDeny(MEVENT hDbEvent, const wchar_t*) if (!isOnline)
return 1;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
if ((dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob)) == NULL)
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index d5cd06e298..2528b62f9e 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -701,7 +701,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) } else {
MEVENT hDbEvent = db_event_last(hContact);
if (hDbEvent != NULL) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get( hDbEvent, &dbei);
if (msgTime < dbei.timestamp) {
msgTime = dbei.timestamp + 1;
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 9cfbd81b00..a2ea294ee0 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -21,7 +21,7 @@ void CToxProto::SetAllContactsStatus(WORD status) MCONTACT CToxProto::GetContactFromAuthEvent(MEVENT hEvent)
{
DWORD body[3];
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(DWORD) * 2;
dbei.pBlob = (PBYTE)&body;
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index c8fb9e6b2b..77b4f0ad84 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -137,7 +137,7 @@ bool CToxProto::IsFileExists(const wchar_t* path) MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, PBYTE pBlob, size_t cbBlob)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = this->m_szModuleName;
dbei.timestamp = timestamp;
dbei.eventType = type;
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 543b0b5723..21c7ce6cb9 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -574,7 +574,7 @@ void TwitterProto::UpdateStatuses(bool pre_read, bool popups, bool tweetToMsg) // i think we maybe should just do that DBEF_READ line instead of stopping ALL this code. have to test.
if (tweetToMsg) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.pBlob = (BYTE*)(i->status.text.c_str());
dbei.cbBlob = (int)i->status.text.size() + 1;
dbei.eventType = TWITTER_DB_EVENT_TYPE_TWEET;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 1b01726814..fb518e1420 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -556,7 +556,7 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added) T2Utf(ptrW(db_get_wsa(hContact, m_szModuleName, "FirstName"))),
T2Utf(ptrW(db_get_wsa(hContact, m_szModuleName, "LastName"))), NULL, NULL);
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_UTF;
@@ -574,7 +574,7 @@ MCONTACT CVkProto::MContactFromDbEvent(MEVENT hDbEvent) return INVALID_CONTACT_ID;
DWORD body[2];
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(DWORD) * 2;
dbei.pBlob = (PBYTE)&body;
@@ -713,7 +713,7 @@ void CVkProto::MarkDialogAsRead(MCONTACT hContact) MCONTACT hMContact = db_mc_tryMeta(hContact);
while ((hDBEvent = db_event_firstUnread(hContact)) != NULL)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (!db_event_get(hDBEvent, &dbei) && !mir_strcmp(m_szModuleName, dbei.szModule))
{
db_event_markRead(hContact, hDBEvent);
@@ -1451,8 +1451,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType) if (iDEIdx == -1)
return;
- DBEVENTINFO dbei;
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
dbei.timestamp = time(NULL);
dbei.eventType = VK_USER_DEACTIVATE_ACTION;
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index ac23773168..44dc556477 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -867,7 +867,7 @@ void CVkProto::NewsClearHistory() MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDBEvent, &dbei);
if (dbei.timestamp < tTime)
db_event_delete(hContact, hDBEvent);
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index b4e392d2b7..4f4bfb15fc 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -94,7 +94,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDBEvent, &dbei);
if (dbei.timestamp > tTime && dbei.eventType != VK_USER_DEACTIVATE_ACTION)
db_event_delete(hContact, hDBEvent);
|