diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-17 17:19:19 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-17 17:19:19 +0300 |
commit | b327ed7872ca83c3a4249039ba1a3d8dd3ece630 (patch) | |
tree | 5a4ae83dafab23f7832186b5dd0736611998f43c | |
parent | fd7566b5de6b59bb18ff380cb1fa3f3f1089b70b (diff) |
useless field DBEVENTINFO::cbSize removed
158 files changed, 240 insertions, 347 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index 8dd608b9c4..3ec65f0089 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -40,7 +40,6 @@ const type
PDBEVENTINFO = ^TDBEVENTINFO;
TDBEVENTINFO = record
- cbSize : int; // size of the structure
szModule : PAnsiChar; // module that 'owns' this event and controls the data format
timestamp: dword; // timestamp in UNIX time
flags : dword; // the DBEF_* flags above
diff --git a/include/m_database.h b/include/m_database.h index 8dcf896036..23926eba9b 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -172,12 +172,10 @@ typedef struct typedef struct
{
- int cbSize; // size of the structure in bytes
- char *szModule; // pointer to name of the module that 'owns' this
- // event, ie the one that is in control of the data format
- DWORD timestamp; // seconds since 00:00, 01/01/1970. Gives us times until
- // 2106 unless you use the standard C library which is
- // signed and can only do until 2038. In GMT.
+ char *szModule; // pointer to name of the module that 'owns' this event
+ DWORD timestamp; // seconds since 00:00, 01/01/1970. Gives us times until 2106
+ // unless you use the standard C library which is
+ // signed and can only do until 2038. In GMT.
DWORD flags; // the omnipresent flags
WORD eventType; // module-defined event type field
DWORD cbBlob; // size of pBlob in bytes
diff --git a/plugins/Actman/iac_inout.pas b/plugins/Actman/iac_inout.pas index b8effc62ae..dc048411cc 100644 --- a/plugins/Actman/iac_inout.pas +++ b/plugins/Actman/iac_inout.pas @@ -280,7 +280,6 @@ begin ccs.lParam := tlparam(blob);
Proto_ChainSend(0, @ccs);
- dbei.cbSize :=sizeof(dbei);
dbei.cbBlob :=StrLen(blob);
dbei.pBlob :=pByte(blob);
dbei.eventType:=EVENTTYPE_MESSAGE;
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 8a7301518b..791278c898 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -92,7 +92,7 @@ static wchar_t* GetMessageText(BYTE **ppBlob, DWORD *pcbBlob) static int MsgEventAdded(WPARAM, LPARAM hDbEvent)
{
if (currentWatcherType & SDWTF_MESSAGE) {
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hDbEvent);
dbe.pBlob = (BYTE*)mir_alloc(dbe.cbBlob + 2); /* ensure term zero */
if (dbe.pBlob == NULL)
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 59f41519c2..5aaaee8e59 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -428,7 +428,7 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact) int max_pos = 0;
BYTE blob[2048];
for (MEVENT hDbEvent = db_event_first(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(blob);
dbei.pBlob = blob;
if (db_event_get(hDbEvent, &dbei) != 0) continue;
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 2c6c498834..f7cb11eeb5 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -214,7 +214,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) PathToRelativeW(history_filename, rel_path);
T2Utf blob(rel_path);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.timestamp = (DWORD) time(NULL);
diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 7ef7bb0f79..7c8f5af157 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -150,8 +150,7 @@ bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList) dataSize = header.dataSize;
DBEVENTINFO86 messageHeader;
- DBEVENTINFO info = { 0 };
- info.cbSize = sizeof(DBEVENTINFO);
+ DBEVENTINFO info = {};
info.szModule = GetContactProto(hContact);
wchar_t _str[MAXSELECTSTR + 8]; // for safety reason
std::multimap<DWORD, IImport::ExternalMessage> sortedEvents;
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 457b5e57dc..9378fab352 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -38,7 +38,6 @@ HistoryEventList::HistoryEventList() : m_useImportedMessages(true)
{
memset(&m_dbei, 0, sizeof(DBEVENTINFO));
- m_dbei.cbSize = sizeof(DBEVENTINFO);
m_oldBlobSize = 0;
}
@@ -51,7 +50,6 @@ HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter) : m_useImportedMessages(true)
{
memset(&m_dbei, 0, sizeof(DBEVENTINFO));
- m_dbei.cbSize = sizeof(DBEVENTINFO);
m_oldBlobSize = 0;
SetDefFilter(filter);
}
@@ -501,7 +499,7 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage> std::list<EventTempIndex> tempList;
GetTempList(tempList, true, false, m_hContact);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(m_hContact);
db_set_safety_mode(FALSE);
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 2ef6bf3317..f0adc1f203 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -1280,7 +1280,7 @@ void DoError(const TaskOptions& to, const std::wstring _error) error += L"\n";
error += _error;
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
dbei.flags = DBEF_UTF | DBEF_READ;
dbei.timestamp = time(NULL);
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index b7656873cd..f45a362dd8 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -88,8 +88,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info) ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)msg);
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.cbBlob = (int)bufsize;
dbei.pBlob = (PBYTE)(char*)msg;
dbei.eventType = EVENTTYPE_MESSAGE;
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 212ad0205c..920d325940 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -201,10 +201,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) if (!BoltunAutoChat(hContact))
return 0;
- DBEVENTINFO dbei;
- memset(&dbei, 0, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = 0;
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1)
return 0;
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 93d215e2ff..005b8c9343 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -84,7 +84,7 @@ time_t getLastInputMsg(MCONTACT hContact) {
MEVENT hDbEvent = db_event_last(hContact);
while (hDbEvent) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
return dbei.timestamp;
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index cbab6e24f0..ca460f733b 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -69,7 +69,6 @@ int MsgAck(WPARAM, LPARAM lParam) int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
if (!db_get_ws(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
T2Utf pszUtf(dbv.ptszVal);
- dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT;
dbei.szModule = (char*)ack->szModule;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 20277ab2e3..39236d404a 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -157,7 +157,7 @@ static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam) {
g_CluiData.t_now = time(NULL);
if (hContact && lParam) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(lParam, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
db_set_dw(hContact, "CList", "mf_lastmsg", dbei.timestamp);
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index a08196904c..8ef817264e 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -61,7 +61,7 @@ DWORD CompareContacts2_getLMTime(MCONTACT hContact) {
MEVENT hDbEvent = db_event_last(hContact);
while (hDbEvent) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
return dbei.timestamp;
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index fafadeb568..4d8e7a88c1 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -70,7 +70,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) cfg::dat.t_now = time(NULL);
if (hContact && lParam) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(lParam, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
DWORD firstTime = db_get_dw(hContact, "CList", "mf_firstEvent", 0);
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index 0e4d01a554..d395816e92 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -72,7 +72,7 @@ static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep) eventCount = 0;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
while (hEvent) {
db_event_get(hEvent, &dbei);
@@ -139,7 +139,7 @@ void MF_InitCheck(void) DWORD INTSORT_GetLastMsgTime(MCONTACT hContact)
{
for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
return dbei.timestamp;
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 774aabc674..05c1bbed22 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -801,7 +801,6 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re DBEVENTINFO e = { 0 };
char module[128];
- e.cbSize = sizeof(DBEVENTINFO);
e.eventType = EVENTTYPE_MESSAGE;
e.flags = DBEF_SENT;
@@ -1406,7 +1405,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re char buffer[4096];
int count;
int contacts = 0;
- DBEVENTINFO dbEvent = { sizeof(dbEvent) };
+ DBEVENTINFO dbEvent = {};
reply->code = MIMRES_SUCCESS;
mir_snprintf(reply->message, Translate("No unread messages found."));
@@ -1457,7 +1456,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re reply->code = MIMRES_SUCCESS;
while (hEvent) {
- DBEVENTINFO dbEvent = { sizeof(dbEvent) };
+ DBEVENTINFO dbEvent = {};
if (!db_event_get(hEvent, &dbEvent)) //if successful call
if (!(dbEvent.flags & DBEF_READ))
AddHistoryEvent(&dbEvent, contact, reply);
@@ -1499,7 +1498,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re if (count > 0) {
int index = 0;
MEVENT hEvent = db_event_first(hContact);
- DBEVENTINFO dbEvent = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbEvent = {};
char message[4096];
dbEvent.pBlob = (PBYTE)message;
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 4ac9334000..e13363c3ff 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -60,7 +60,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) static int HookDBEventAdded(WPARAM hContact, LPARAM hDbEvent)
{
//process the event
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
db_event_get(hDbEvent, &dbe);
//check if we should process the event
if (dbe.flags & (DBEF_SENT | DBEF_READ) || dbe.eventType != EVENTTYPE_CONTACTS) return 0;
@@ -92,7 +92,7 @@ static void ProcessUnreadEvents(void) {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CONTACTS) {
//process the event
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index bcf588b6a7..511b4c0972 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -196,9 +196,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara RebuildGroupCombo(hwndDlg);
{ // fill listview with received contacts
- DBEVENTINFO dbe = {0};
-
- dbe.cbSize = sizeof(DBEVENTINFO);
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(wndData->mhDbEvent);
if (dbe.cbBlob != -1) // this marks an invalid hDbEvent - all smashed anyway...
dbe.pBlob = (PBYTE)_alloca(dbe.cbBlob);
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 6a9581e02d..cb2318aa17 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -398,7 +398,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
}
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(ackData->hContact);
dbei.eventType = EVENTTYPE_CONTACTS;
dbei.flags = DBEF_SENT | DBEF_UTF;
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 3d5fe121ab..fb528227ad 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -32,7 +32,7 @@ STDMETHODIMP_(LONG) CDb3Mmap::GetEventCount(MCONTACT contactID) STDMETHODIMP_(MEVENT) CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
{
- if (dbei == NULL || dbei->cbSize != sizeof(DBEVENTINFO)) return 0;
+ if (dbei == NULL) return 0;
if (dbei->timestamp == 0) return 0;
DBEvent dbe;
@@ -266,7 +266,7 @@ STDMETHODIMP_(LONG) CDb3Mmap::GetBlobSize(MEVENT hDbEvent) STDMETHODIMP_(BOOL) CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
{
- if (dbei == NULL || dbei->cbSize != sizeof(DBEVENTINFO)) return 1;
+ if (dbei == NULL) return 1;
if (dbei->cbBlob > 0 && dbei->pBlob == NULL) {
dbei->cbBlob = 0;
return 1;
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index 70ff51941b..89cb664be9 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -31,7 +31,7 @@ STDMETHODIMP_(LONG) CDbxMdb::GetEventCount(MCONTACT contactID) STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
{
- if (dbei == NULL || dbei->cbSize != sizeof(DBEVENTINFO)) return 0;
+ if (dbei == NULL) return 0;
if (dbei->timestamp == 0) return 0;
DBEvent dbe;
@@ -207,7 +207,7 @@ STDMETHODIMP_(LONG) CDbxMdb::GetBlobSize(MEVENT hDbEvent) STDMETHODIMP_(BOOL) CDbxMdb::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
{
- if (dbei == NULL || dbei->cbSize != sizeof(DBEVENTINFO)) return 1;
+ if (dbei == NULL) return 1;
if (dbei->cbBlob > 0 && dbei->pBlob == NULL) {
dbei->cbBlob = 0;
return 1;
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 9dd4100a68..d15c691cc2 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -157,7 +157,7 @@ INT_PTR CDropbox::ProtoReceiveMessage(WPARAM, LPARAM lParam) char *message = (char*)pccsd->lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.flags = DBEF_UTF;
dbei.szModule = MODULE;
dbei.timestamp = time(NULL);
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index 0589cddc35..ad6bfa5af4 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -84,8 +84,7 @@ void CDropbox::HandleJsonResponseError(NETLIBHTTPREQUEST *response) MEVENT CDropbox::AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD cbBlob, PBYTE pBlob)
{
- DBEVENTINFO dbei;
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
dbei.timestamp = time(NULL);
dbei.eventType = type;
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index 9fabe869db..e80e5ed9f5 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -85,7 +85,7 @@ void UploadJob::autoSend() if (szProto == NULL)
return;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 632875cf57..9c6b49543e 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -25,7 +25,7 @@ CContactCache::~CContactCache() int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hEvent, &dbei);
if (dbei.eventType != EVENTTYPE_MESSAGE)
return 0;
@@ -86,7 +86,7 @@ void CContactCache::Rebuild() info->rate = 0;
for (MEVENT hEvent = db_event_last(hContact); hEvent; hEvent = db_event_prev(hContact, hEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (!db_event_get(hEvent, &dbei)) {
if (float weight = GetEventWeight(timestamp - dbei.timestamp)) {
if (dbei.eventType == EVENTTYPE_MESSAGE)
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index 21f1115e77..e315d4e3bd 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -72,7 +72,7 @@ void NotifyUser(Account *curAcc) db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_OCCUPIED);
int newMails = (curAcc->oldResults_num == -1) ? (curAcc->results_num) : (curAcc->results_num - curAcc->oldResults_num);
if (opt.LogThreads&&newMails > 0) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_READ;
dbei.szModule = MODULE_NAME;
diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index aa22ba632d..b4e8ed3867 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -132,7 +132,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) int histCount = db_event_count(hContact), actCount = 0;
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob + 1);
db_event_get(hEvent, &dbe);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index b634534e39..82599582d1 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -378,7 +378,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc // Perform deep scan
if ( actualElement->hEvent != NULL )
{
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(actualElement->hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
db_event_get(actualElement->hEvent, &dbe);
@@ -612,7 +612,7 @@ void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos) if (actualElement->linePos == actLinePos) {
MEVENT hEvent = actualElement->hEvent;
if (hEvent != NULL ) {
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
db_event_get(hEvent, &dbe);
@@ -769,7 +769,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz // Perform deep scan
if ( actualElement->hEvent != NULL )
{
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(actualElement->hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
db_event_get(actualElement->hEvent, &dbe);
@@ -1179,7 +1179,7 @@ int DBUpdate(WPARAM wParam, LPARAM hEvent) return 0;
if(hDlg) {
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)mir_alloc((size_t)dbe.cbBlob+1);
db_event_get(hEvent, &dbe);
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index ba0337d818..eed0d360f1 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -3917,13 +3917,13 @@ begin begin
DBEventInfo := GetEventInfo(hDBEvent);
DBEventInfo.szModule := nil;
- Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
+ Item.Size := sizeof(DBEventInfo) + Cardinal(DBEventInfo.cbBlob);
end;
if Item.Size > 0 then
begin
GetMem(Item.Buffer, Item.Size);
- DataOffset := PAnsiChar(Item.Buffer) + DBEventInfo.cbSize;
- Move(DBEventInfo, Item.Buffer^, DBEventInfo.cbSize);
+ DataOffset := PAnsiChar(Item.Buffer) + sizeof(DBEventInfo);
+ Move(DBEventInfo, Item.Buffer^, sizeof(DBEventInfo));
Move(DBEventInfo.pBlob^, DataOffset^, DBEventInfo.cbBlob);
end;
end
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas index f3493adf03..84e21102f4 100644 --- a/plugins/HistoryPlusPlus/hpp_events.pas +++ b/plugins/HistoryPlusPlus/hpp_events.pas @@ -251,7 +251,6 @@ begin if RecentEvent <> hDBEvent then
begin
ZeroMemory(@RecentEventInfo, SizeOf(RecentEventInfo));
- RecentEventInfo.cbSize := SizeOf(RecentEventInfo);
RecentEventInfo.cbBlob := 0;
db_event_get(hDBEvent, @RecentEventInfo);
RecentEvent := hDBEvent;
@@ -266,7 +265,6 @@ begin if RecentEvent <> hDBEvent then
begin
ZeroMemory(@RecentEventInfo, SizeOf(RecentEventInfo));
- RecentEventInfo.cbSize := SizeOf(RecentEventInfo);
RecentEventInfo.cbBlob := 0;
db_event_get(hDBEvent, @RecentEventInfo);
RecentEvent := hDBEvent;
@@ -428,7 +426,6 @@ var BlobSize: integer;
begin
ZeroMemory(@Result, SizeOf(Result));
- Result.cbSize := SizeOf(Result);
BlobSize := db_event_getBlobSize(hDBEvent);
if BlobSize > 0 then
begin
diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas index 2bf5dd6c8c..e0a5f3ea53 100644 --- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas +++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas @@ -1246,7 +1246,6 @@ begin if Items[Index].Custom then
begin
ZeroMemory(@DBEventInfo, SizeOf(DBEventInfo));
- DBEventInfo.cbSize := SizeOf(DBEventInfo);
DBEventInfo.timestamp := Items[Index].CustomEvent.Time;
DBEventInfo.flags := DBEF_READ or DBEF_UTF;
if Items[Index].CustomEvent.Sent then
@@ -1255,7 +1254,7 @@ begin TextUTF := UTF8Encode(Items[Index].CustomEvent.Text) + #0;
DBEventInfo.cbBlob := Length(TextUTF) + 1;
DBEventInfo.pBlob := Pointer(PAnsiChar(TextUTF));
- Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
+ Item.Size := sizeof(DBEventInfo) + Cardinal(DBEventInfo.cbBlob);
end
else
begin
@@ -1264,14 +1263,14 @@ begin begin
DBEventInfo := GetEventInfo(hDBEvent);
DBEventInfo.szModule := nil;
- Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
+ Item.Size := sizeof(DBEventInfo) + Cardinal(DBEventInfo.cbBlob);
end;
end;
if Item.Size > 0 then
begin
GetMem(Item.Buffer, Item.Size);
- DataOffset := PAnsiChar(Item.Buffer) + DBEventInfo.cbSize;
- Move(DBEventInfo, Item.Buffer^, DBEventInfo.cbSize);
+ DataOffset := PAnsiChar(Item.Buffer) + sizeof(DBEventInfo);
+ Move(DBEventInfo, Item.Buffer^, sizeof(DBEventInfo));
Move(DBEventInfo.pBlob^, DataOffset^, DBEventInfo.cbBlob);
end;
end
diff --git a/plugins/HistoryPlusPlus/hpp_sessionsthread.pas b/plugins/HistoryPlusPlus/hpp_sessionsthread.pas index d86372feaf..b9a9109bf1 100644 --- a/plugins/HistoryPlusPlus/hpp_sessionsthread.pas +++ b/plugins/HistoryPlusPlus/hpp_sessionsthread.pas @@ -180,7 +180,6 @@ begin while (hDBEvent <> 0) and not Terminated do
begin
ZeroMemory(@Event, SizeOf(Event));
- Event.cbSize := SizeOf(Event);
Event.cbBlob := 0;
db_event_get(hDBEvent, @Event);
CurTime := Event.Timestamp;
diff --git a/plugins/HistoryStats/src/mirandacontact.cpp b/plugins/HistoryStats/src/mirandacontact.cpp index beb1932627..f217bb5bb7 100644 --- a/plugins/HistoryStats/src/mirandacontact.cpp +++ b/plugins/HistoryStats/src/mirandacontact.cpp @@ -25,7 +25,6 @@ void MirandaContact::fetchSlot(int i) ei.hContact = ci.hContact;
ei.dbe.cbBlob = db_event_getBlobSize(ci.hEvent);
- ei.dbe.cbSize = sizeof(ei.dbe);
if (ei.dbe.cbBlob > ei.nAllocated) {
ei.nAllocated = ei.dbe.cbBlob;
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 48a0f50b23..e9b7316f25 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -153,7 +153,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke // Get first event
for (MEVENT hDBEvent = db_event_first(hContact); hDBEvent != NULL; ) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDBEvent, &dbei);
// should we stop processing?
diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index f88f3f09d9..3b15a902f1 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -172,8 +172,7 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) IEVIEWEVENT ieEvent = data->ieEvent;
ieEvent.iType = IEE_LOG_MEM_EVENTS;
ieEvent.eventData = ieData;
- DBEVENTINFO dbInfo = { 0 };
- dbInfo.cbSize = sizeof(DBEVENTINFO);
+ DBEVENTINFO dbInfo = {};
PBYTE buffer = NULL;
int newSize, oldSize = 0;
while (count < target) {
diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index d3a656f1c6..125f861aba 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -216,9 +216,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat int oldSize, newSize; oldSize = newSize = 0; - DBEVENTINFO dbEvent = { 0 }; - dbEvent.cbSize = sizeof(dbEvent); - + DBEVENTINFO dbEvent = {}; while ((!found) && (hEvent)){ newSize = db_event_getBlobSize(hEvent); if (newSize > oldSize) diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 6e6b4bf3c9..232cc4c203 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -245,7 +245,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) newEvent.hwnd = event->hwnd;
newEvent.eventData = NULL;
for (int eventIdx = 0; hDbEvent != NULL && (eventIdx < event->count || event->count == -1); eventIdx++) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == 0xFFFFFFFF) {
hDbEvent = db_event_next(event->hContact, hDbEvent);
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 701f9fa8b2..1d61ae374d 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -855,7 +855,7 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC MEVENT hEvent = srcDb->FindFirstEvent(hContact);
for (int i = 0; hEvent; i++, hEvent = srcDb->FindNextEvent(hContact, hEvent)) {
// Copy the event and import it
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = srcDb->GetBlobSize(hEvent);
if (dbei.cbBlob > cbAlloc) {
cbAlloc = dbei.cbBlob + 4096 - dbei.cbBlob % 4096;
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index c39c05640b..7a77bc8a05 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -68,7 +68,7 @@ bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) if (hExistingDbEvent == NULL)
return FALSE;
- DBEVENTINFO dbeiExisting = { sizeof(dbeiExisting) };
+ DBEVENTINFO dbeiExisting = {};
db_event_get(hExistingDbEvent, &dbeiExisting);
DWORD dwEventTimeStamp = dbeiExisting.timestamp;
@@ -91,7 +91,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;
@@ -108,7 +107,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 (IsEqualEvent(dbei, dbeiExisting))
@@ -118,7 +116,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) {
@@ -139,7 +136,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) {
@@ -165,7 +161,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) {
diff --git a/plugins/ImportTXT/BICQ5IP.inc b/plugins/ImportTXT/BICQ5IP.inc index 1df28964b0..46ee251e59 100644 --- a/plugins/ImportTXT/BICQ5IP.inc +++ b/plugins/ImportTXT/BICQ5IP.inc @@ -39,7 +39,6 @@ begin while (curxml <> 0) do
begin
fillchar(dbei, SizeOf(dbei), 0);
- dbei.cbSize := SizeOf(dbei);
dbei.szModule := PAnsiChar(proto);
if TryStrToInt(xmlgetText(xmlgetChildByPath(curxml, 'time', false)), tm)
then
diff --git a/plugins/ImportTXT/BRMSIP.inc b/plugins/ImportTXT/BRMSIP.inc index 9576c2c83c..a270102f8d 100644 --- a/plugins/ImportTXT/BRMSIP.inc +++ b/plugins/ImportTXT/BRMSIP.inc @@ -34,7 +34,6 @@ begin while Cardinal(i) < fsz do
begin
fillchar(dbei, sizeof(dbei), 0);
- dbei.cbSize := sizeof(dbei);
dbei.szModule := PAnsiChar(proto);
rsz := RLInteger(pt + i + $08);
if PByte(pt + i + $10)^ = $00 then
diff --git a/plugins/ImportTXT/BbayanIP.inc b/plugins/ImportTXT/BbayanIP.inc index 1e301f8654..d0f1d5ab7b 100644 --- a/plugins/ImportTXT/BbayanIP.inc +++ b/plugins/ImportTXT/BbayanIP.inc @@ -27,7 +27,6 @@ begin with dbei do
begin
fillchar(dbei, sizeof(dbei), 0);
- dbei.cbSize := sizeof(dbei);
dbei.szModule := PAnsiChar(proto);
dbei.timestamp := ImportTU.timestamp(
RLWORD(pt + i + 5),
diff --git a/plugins/ImportTXT/BmContactIP.inc b/plugins/ImportTXT/BmContactIP.inc index 55476792bd..cc81555d56 100644 --- a/plugins/ImportTXT/BmContactIP.inc +++ b/plugins/ImportTXT/BmContactIP.inc @@ -21,13 +21,13 @@ begin i := 0;
while cardinal(i) < fsz do
begin
- dbei.cbSize := PInteger(pt + i)^;
+ evSize := PInteger(pt + i)^;
dbei.szModule := PAnsiChar(proto);
dbei.timestamp := PDWORD(pt + i + $08)^;
dbei.flags := PDWORD(pt + i + $0C)^;
dbei.eventtype := PDWORD(pt + i + $10)^;
dbei.cbBlob := PDWORD(pt + i + $14)^;
- dbei.pBlob := PBYTE(pt + i + dbei.cbSize);
+ dbei.pBlob := PBYTE(pt + i + evSize);
if not IsDuplicateEvent(DContact.hContact, dbei) then
if db_event_add(DContact.hContact, @dbei) <> 0 then
@@ -40,7 +40,7 @@ begin end
else
inc(Duplicates);
- inc(i, dbei.cbSize + integer(dbei.cbBlob));
+ inc(i, evSize + integer(dbei.cbBlob));
DoMessage(ITXT_THREAD_PROGRESS, i, 0);
end;
end
diff --git a/plugins/ImportTXT/BqhfIP.inc b/plugins/ImportTXT/BqhfIP.inc index aa7a9a8758..cd99bbfaa3 100644 --- a/plugins/ImportTXT/BqhfIP.inc +++ b/plugins/ImportTXT/BqhfIP.inc @@ -92,7 +92,6 @@ begin while Cardinal(i) < fsz do
begin
fillchar(dbei, sizeof(dbei), 0);
- dbei.cbSize := sizeof(dbei);
dbei.szModule := PAnsiChar(proto);
dbei.timestamp := RLInteger(pt + i + $12);
dbei.timestamp := dbei.timestamp -
diff --git a/plugins/ImportTXT/ImportThrd.pas b/plugins/ImportTXT/ImportThrd.pas index 4c4468d5e7..4315977a0a 100644 --- a/plugins/ImportTXT/ImportThrd.pas +++ b/plugins/ImportTXT/ImportThrd.pas @@ -95,7 +95,6 @@ begin end;
FillChar(dbeiExisting, SizeOf(dbeiExisting), Byte(0));
- dbeiExisting.cbSize := SizeOf(dbeiExisting);
dbeiExisting.cbBlob := 0;
db_event_get(hExistingDbEvent, @dbeiExisting);
dwFirstEventTimeStamp := dbeiExisting.timestamp;
@@ -108,7 +107,6 @@ begin end;
FillChar(dbeiExisting, SizeOf(dbeiExisting), Byte(0));
- dbeiExisting.cbSize := SizeOf(dbeiExisting);
dbeiExisting.cbBlob := 0;
db_event_get(hExistingDbEvent, @dbeiExisting);
dwLastEventTimeStamp := dbeiExisting.timestamp;
@@ -134,7 +132,6 @@ begin while (hExistingDbEvent <> 0) do
begin
FillChar(dbeiExisting, SizeOf(dbeiExisting), Byte(0));
- dbeiExisting.cbSize := SizeOf(dbeiExisting);
dbeiExisting.cbBlob := 0;
db_event_get(hExistingDbEvent, @dbeiExisting);
// compare event
@@ -208,7 +205,6 @@ var s: WideString;
begin
FillChar(dbei, SizeOf(dbei), Byte(0));
- dbei.cbSize := SizeOf(dbei);
dbei.eventType := EVENTTYPE_MESSAGE;
dbei.flags := Direction;
proto := GetContactProto(hContact);
@@ -533,6 +529,7 @@ var tempstr: PAnsiChar;
var
dbei: TDBEVENTINFO;
+ evSize: integer;
proto: AnsiString;
pt: int_ptr;
fsz: cardinal;
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index e34ba2ceea..e42c7a939b 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -200,7 +200,7 @@ BOOL checkGlobalXstatus() DBEVENTINFO createMsgEventInfo(MCONTACT hContact)
{
- DBEVENTINFO einfo = { sizeof(einfo) };
+ DBEVENTINFO einfo = {};
einfo.eventType = EVENTTYPE_MESSAGE;
einfo.szModule = GetContactProto(hContact);
return einfo;
@@ -211,7 +211,7 @@ DBEVENTINFO readEventInfo(MEVENT hDbEvent, MCONTACT hContact) if (hDbEvent == NCONVERS_BLINKID) // we need to handle nconvers' blink event
return createMsgEventInfo(hContact);
- DBEVENTINFO einfo = { sizeof(einfo) };
+ DBEVENTINFO einfo = {};
db_event_get(hDbEvent, &einfo);
return einfo;
}
@@ -337,7 +337,7 @@ BOOL checkMsgTimestamp(MCONTACT hContact, MEVENT hEventCurrent, DWORD timestampC return TRUE;
for (MEVENT hEvent = db_event_prev(hContact, hEventCurrent); hEvent; hEvent = db_event_prev(hContact, hEvent)) {
- DBEVENTINFO einfo = { sizeof(einfo) };
+ DBEVENTINFO einfo = {};
if (!db_event_get(hEvent, &einfo)) {
if ((einfo.timestamp + wSecondsOlder) <= timestampCurrent)
return TRUE;
@@ -399,7 +399,7 @@ BOOL checkXstatus(char *szProto) static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent)
{
//get DBEVENTINFO without pBlob
- DBEVENTINFO einfo = { sizeof(einfo) };
+ DBEVENTINFO einfo = {};
if (!db_event_get(hEvent, &einfo) && !(einfo.flags & DBEF_SENT))
if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg && checkOpenWindow(hContact) && checkMsgTimestamp(hContact, hEvent, einfo.timestamp)) ||
(einfo.eventType == EVENTTYPE_URL && bFlashOnURL) ||
diff --git a/plugins/MessageState/src/utils.cpp b/plugins/MessageState/src/utils.cpp index 7c285b42c7..57246f8f44 100644 --- a/plugins/MessageState/src/utils.cpp +++ b/plugins/MessageState/src/utils.cpp @@ -4,7 +4,7 @@ time_t GetLastSentMessageTime(MCONTACT hContact) {
for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent))
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.flags & DBEF_SENT)
return dbei.timestamp;
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 4ce2bf8165..a5b89fbf77 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -290,8 +290,7 @@ HANDLE MirandaUtils::sendMessageMiranda(MCONTACT hContact, char *msgBuffer) void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_t bufSize, char* targetHandleSzProto)
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = targetHandleSzProto;
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 7a916f63d2..79a07c898a 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -275,8 +275,6 @@ static int db_UnreadEvents(lua_State *L) void MakeDbEvent(lua_State *L, DBEVENTINFO &dbei)
{
- dbei.cbSize = sizeof(dbei);
-
lua_getfield(L, -1, "Module");
dbei.szModule = mir_strdup(lua_tostring(L, -1));
lua_pop(L, 1);
@@ -694,7 +692,6 @@ void MT<DBEVENTINFO>::Init(lua_State *L, DBEVENTINFO **dbei) MEVENT hDbEvent = luaL_checkinteger(L, 1);
*dbei = (DBEVENTINFO*)mir_calloc(sizeof(DBEVENTINFO));
- (*dbei)->cbSize = sizeof(DBEVENTINFO);
(*dbei)->cbBlob = db_event_getBlobSize((MEVENT)hDbEvent);
(*dbei)->pBlob = (PBYTE)mir_calloc((*dbei)->cbBlob);
db_event_get((MEVENT)hDbEvent, (*dbei));
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp index cf13c1ff35..05a064eedf 100644 --- a/plugins/MirLua/src/m_message.cpp +++ b/plugins/MirLua/src/m_message.cpp @@ -41,8 +41,7 @@ static int message_Send(lua_State *L) }
else if ((res = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message)) != ACKRESULT_FAILED)
{
- DBEVENTINFO dbei;
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.szModule = MODULE;
dbei.timestamp = time(NULL);
dbei.eventType = EVENTTYPE_MESSAGE;
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index 131cf2b273..0791b761e0 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -20,7 +20,7 @@ void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) { if (!DeleteEvents.first) return; mir_cslock lck(RemoveChainCS); DeleteEventNode *prev =0, *current, *next; - DBEVENTINFO info = { sizeof(info) }; + DBEVENTINFO info = {}; next = DeleteEvents.first; while (current = next) { if (difftime(time(0), current->timestamp) < 1) break; @@ -113,7 +113,7 @@ int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam) unsigned len = (unsigned)strlen(LANG_INLINE_PREFIX); - DBEVENTINFO info = { sizeof(info) }; + DBEVENTINFO info = {}; info.cbBlob = len * 2; info.pBlob = (PBYTE)_alloca(info.cbBlob); if (db_event_get(lParam, &info)) diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index b6755f5dca..bc1bf2957f 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -662,8 +662,7 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob) // Only add the message to the history if the contact isn't an irc chatroom if (!(pIRCCon && db_get_b(pJob->hContact, szProto, "ChatRoom", 0) != 0)) { // Add the message to the database - DBEVENTINFO dbei = { 0 }; - dbei.cbSize = sizeof(dbei); + DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = szProto; @@ -817,15 +816,11 @@ void CAppletManager::MarkMessageAsRead(MCONTACT hContact, MEVENT hEvent) bool CAppletManager::TranslateDBEvent(CEvent *pEvent, WPARAM hContact, LPARAM hdbevent) { // Create struct for dbevent - DBEVENTINFO dbevent; - memset(&dbevent, 0, sizeof(dbevent)); - //dbevent.flags |= PREF_UNICODE; - dbevent.cbSize = sizeof(dbevent); + DBEVENTINFO dbevent = {}; dbevent.cbBlob = db_event_getBlobSize(hdbevent); if (dbevent.cbBlob == -1) // hdbevent is invalid - { return false; - } + dbevent.pBlob = (PBYTE)malloc(dbevent.cbBlob); if (db_event_get(hdbevent, &dbevent) != 0) { free(dbevent.pBlob); diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 995ff36544..dc40c7c1cd 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -64,7 +64,7 @@ public: hUser = hU;
hDbEvent = hDBE;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
time = dbei.timestamp;
}
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 6deb7aaccb..351a907e7c 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1105,7 +1105,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) DWORD uin = *((PDWORD)(dbei.pBlob));
int n = mir_snwprintf(szTemp, L"%d", uin);
if (bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n)) {
- char *pszEnd = (char *)(dbei.pBlob + dbei.cbSize);
+ char *pszEnd = (char *)(dbei.pBlob + sizeof(dbei));
for (int i = 0; i < nStringCount && pszCurBlobPos < pszEnd; i++) {
if (*pszCurBlobPos) {
if (!bWriteNewLine(hFile, nIndent) ||
@@ -1214,7 +1214,7 @@ int nExportEvent(WPARAM hContact, LPARAM hDbEvent) if (!db_get_b(hContact, MODULE, "EnableLog", 1))
return 0;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
int nSize = db_event_getBlobSize(hDbEvent);
if (nSize > 0) {
dbei.cbBlob = nSize;
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index bb9faf5125..3752fad651 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -65,8 +65,7 @@ void __cdecl AutoreplyDelayThread(void *_ad) ProtoChainSend(ad->hContact, PSS_MESSAGE, 0, (LPARAM)pszReply);
if (g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_LOGREPLY)) { // store in the history
- DBEVENTINFO dbeo = { 0 };
- dbeo.cbSize = sizeof(dbeo);
+ DBEVENTINFO dbeo = {};
dbeo.eventType = EVENTTYPE_MESSAGE;
dbeo.flags = DBEF_SENT | DBEF_UTF;
dbeo.szModule = szProto;
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 275372ef71..b9ef026ca1 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -62,7 +62,7 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) return 0;
//get DBEVENTINFO without pBlob
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
db_event_get(hDbEvent, &dbe);
//do not show popups for sub-contacts
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 4edd1c8bad..e354f6a573 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -429,7 +429,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, U }
//get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
if (hEvent) {
if ((pluginOptions->bPreview || eventType == EVENTTYPE_ADDED || eventType == EVENTTYPE_AUTHREQUEST)) {
dbe.cbBlob = db_event_getBlobSize(hEvent);
@@ -532,8 +532,7 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) iEvent++;
//get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
- DBEVENTINFO dbe = {0};
- dbe.cbSize = sizeof(dbe);
+ DBEVENTINFO dbe = {};
dbe.pBlob = NULL;
dbe.cbBlob = 0;
if (pdata->pluginOptions->bPreview && eventData->hEvent) {
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 8b559d2098..0e2a271722 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -265,8 +265,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt) ptrW str(GetStr(smi, tmplt));
T2Utf blob(str);
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.cbBlob = (DWORD)mir_strlen(blob) + 1;
dbei.pBlob = (PBYTE)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
@@ -351,8 +350,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) GetStatusText(hContact, newStatus, oldStatus, stzStatusText);
T2Utf blob(stzStatusText);
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.cbBlob = (DWORD)mir_strlen(blob) + 1;
dbei.pBlob = (PBYTE)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 42a705852d..0ebdb88bb1 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -296,8 +296,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) T2Utf blob(stzLogText);
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.cbBlob = (DWORD)mir_strlen(blob) + 1;
dbei.pBlob = (PBYTE)(char*)blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index afa1d8a579..2985a09b1f 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -570,7 +570,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) void HistoryLog(MCONTACT hContact, db_event evt) { - DBEVENTINFO Event = { sizeof(Event) }; + DBEVENTINFO Event = {}; Event.szModule = szGPGModuleName; Event.eventType = evt.eventType; Event.flags = evt.flags; diff --git a/plugins/New_GPG/src/utilities.h b/plugins/New_GPG/src/utilities.h index d677ff400d..c1840d274b 100644 --- a/plugins/New_GPG/src/utilities.h +++ b/plugins/New_GPG/src/utilities.h @@ -50,7 +50,6 @@ public: flags = 0;
timestamp = time(0);
szModule = 0;
- cbSize = 0;
cbBlob = DWORD(mir_strlen(msg)+1);
pBlob = (PBYTE)msg;
}
@@ -62,7 +61,6 @@ public: flags = 0;
timestamp = time;
szModule = 0;
- cbSize = 0;
}
db_event(char* msg, DWORD time, int type)
{
@@ -75,7 +73,6 @@ public: flags = 0;
timestamp = time;
szModule = 0;
- cbSize = 0;
}
db_event(char* msg, int type)
{
@@ -88,7 +85,6 @@ public: eventType = EVENTTYPE_MESSAGE;
timestamp = time(0);
szModule = 0;
- cbSize = 0;
}
db_event(char* msg, DWORD time, int type, DWORD _flags)
{
@@ -101,9 +97,9 @@ public: flags = _flags;
timestamp = time;
szModule = 0;
- cbSize = 0;
}
};
+
void HistoryLog(MCONTACT, db_event);
void fix_line_term(std::string &s);
void fix_line_term(std::wstring &s);
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 7435337b2d..14a7984c2c 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -139,9 +139,7 @@ static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStr else
message.Replace(L"#<category>#", category);
- DBEVENTINFO olddbei = { 0 };
- olddbei.cbSize = sizeof(olddbei);
-
+ DBEVENTINFO olddbei = {};
bool MesExist = false;
T2Utf pszTemp(message);
DWORD cbMemoLen = 10000, cbOrigLen = (DWORD)mir_strlen(pszTemp);
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index b5e4bbfe8d..3e735690ae 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -56,7 +56,7 @@ extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) void RemoveReadEvents(MCONTACT hContact = 0)
{
- DBEVENTINFO info = { sizeof(info) };
+ DBEVENTINFO info = {};
bool remove;
mir_cslock lck(list_cs);
@@ -116,7 +116,7 @@ int OnDatabaseEventAdd(WPARAM hContact, LPARAM hDBEvent) if (db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) == 0)
return 0;
- DBEVENTINFO info = { sizeof(info) };
+ DBEVENTINFO info = {};
if (!db_event_get(hDBEvent, &info)) {
if (info.eventType == EVENTTYPE_MESSAGE) {
EventListNode *node = (EventListNode *)malloc(sizeof(EventListNode));
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index ca4e0f406c..721eb3e520 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -477,7 +477,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact) {
T2Utf buff(n->senText);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = MODULENAME;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.timestamp = (DWORD)time(NULL);
@@ -491,7 +491,7 @@ void Nudge_ShowStatus(CNudgeElement *n, MCONTACT hContact, DWORD timestamp) {
T2Utf buff(n->recText);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = MODULENAME;
dbei.eventType = 1;
dbei.flags = DBEF_UTF;
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 6c0ca19da0..ce2c20ad34 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -126,8 +126,7 @@ void PasteIt(MCONTACT hContact, int mode) {
if (!isChat)
{
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index fb5b4ad19c..3aa148af28 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -811,8 +811,7 @@ struct ReplyEditData void AddMessageToDB(MCONTACT hContact, char *msg)
{
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(hContact);
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 0fcbed5858..499005b6ae 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -201,7 +201,7 @@ int ModulesLoaded(WPARAM, LPARAM) // handle of contact is set as window-userdata
int EventAdded(WPARAM wparam, LPARAM hDbEvent)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if ( !(dbei.flags & DBEF_SENT) || (dbei.flags & DBEF_READ)
|| !db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0)
diff --git a/plugins/QuickSearch/i_ok.inc b/plugins/QuickSearch/i_ok.inc index 3211939c55..c57c721dc7 100644 --- a/plugins/QuickSearch/i_ok.inc +++ b/plugins/QuickSearch/i_ok.inc @@ -377,7 +377,6 @@ begin if DbEvent<>0 then
begin
ZeroMemory(@dbei,sizeof(dbei));
- dbei.cbSize:=SizeOf(dbei);
db_event_get(DbEvent, @dbei);
res.data:=dbei.timestamp;
res.text:=TimeToStrW(res.data);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index 7697ba6d6a..f90f90e462 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -456,7 +456,7 @@ void log_to_history(const IQuotesProvider* pProvider, tstring s = format_rate(pProvider, hContact, rsFormat);
T2Utf psz(s.c_str());
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = QUOTES_PROTOCOL_NAME;
dbei.timestamp = static_cast<DWORD>(nTime);
dbei.flags = DBEF_READ | DBEF_UTF;
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 7f973db613..d2b5693eaf 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -395,9 +395,7 @@ INT_PTR OnMenuCommandShowList(WPARAM, LPARAM) __time64_t curTime;
//DWORD t;
- DBEVENTINFO dbe;
- memset(&dbe, 0, sizeof(dbe));
- dbe.cbSize = sizeof(dbe);
+ DBEVENTINFO dbe = {};
BYTE buf[1];
dbe.pBlob = buf;
MEVENT curEvent;
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 31ccea8fdf..a88d44f33e 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -94,7 +94,7 @@ int ReadMsgSMS(WPARAM, LPARAM lParam) {
CLISTEVENT *cle = (CLISTEVENT*)lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(((CLISTEVENT*)lParam)->hDbEvent)) == -1)
return 1;
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
@@ -115,7 +115,7 @@ int ReadAckSMS(WPARAM, LPARAM lParam) {
CLISTEVENT *cle = (CLISTEVENT*)lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(cle->hDbEvent)) == -1)
return 1;
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
@@ -133,7 +133,7 @@ int ReadAckSMS(WPARAM, LPARAM lParam) void RestoreUnreadMessageAlerts(void)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index e4f50f03e8..e5e0233eda 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -48,7 +48,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) if (GetXMLFieldEx(lpszXML, dwXMLSize, &lpszPhone, &dwPhoneSize, "sms_message", "sender", NULL)) {
LPSTR lpszMessageUTF;
size_t dwBuffLen, dwMessageXMLEncodedSize, dwMessageXMLDecodedSize;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dwBuffLen = (dwDataSize + MAX_PATH);
dbei.pBlob = (LPBYTE)MEMALLOC((dwBuffLen + dwPhoneSize));
@@ -91,8 +91,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) dwPhoneSize = MultiByteToWideChar(CP_UTF8, 0, szPhone, (int)dwPhoneSize, tszPhone, MAX_PHONE_LEN);
MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize);
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.szModule = GetModuleName(hContact);
dbei.timestamp = time(NULL);
dbei.flags = DBEF_UTF;
@@ -210,7 +209,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) {
char szServiceFunction[MAX_PATH], *pszServiceFunctionName;
wchar_t szToolTip[MAX_PATH];
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 0;
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 637ccfae0c..c1fb06c02d 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -733,7 +733,6 @@ void SendSMSWindowDBAdd(HWND hWndDlg) {
SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
if (psswdWindowData) {
- psswdWindowData->pdbei->cbSize = sizeof(DBEVENTINFO);
psswdWindowData->pdbei->szModule = GetModuleName(psswdWindowData->hContact);
db_event_add(psswdWindowData->hContact, psswdWindowData->pdbei);
MEMFREE(psswdWindowData->pdbei);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 8c2f469b17..52f0525a3f 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -143,7 +143,7 @@ static int ackevent(WPARAM, LPARAM lParam) hContact = (db_mc_isMeta(hContact)) ? db_mc_getSrmmSub(item->hContact) : item->hContact;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT | ((item->flags & PREF_RTL) ? DBEF_RTL : 0);
dbei.szModule = GetContactProto(hContact);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index ba32b638a2..08012ac957 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -798,13 +798,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP // This finds the first message to display, it works like shit
dat->hDbEventFirst = db_event_firstUnread(dat->hContact);
if (dat->hDbEventFirst != NULL) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(dat->hDbEventFirst, &dbei);
if (DbEventIsMessageOrCustom(&dbei) && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT))
notifyUnread = true;
}
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
MEVENT hPrevEvent;
switch (historyMode) {
case LOADHISTORY_COUNT:
@@ -851,7 +851,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
MEVENT hdbEvent = db_event_last(dat->hContact);
if (hdbEvent) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
do {
db_event_get(hdbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
@@ -1138,7 +1138,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP MEVENT hDbEvent = dat->hDbUnreadEventFirst;
dat->hDbUnreadEventFirst = NULL;
while (hDbEvent != NULL) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & DBEF_SENT) && (DbEventIsMessageOrCustom(&dbei) || dbei.eventType == EVENTTYPE_URL))
pcli->pfnRemoveEvent(dat->hContact, hDbEvent);
@@ -1257,7 +1257,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case HM_DBEVENTADDED:
if (wParam == dat->hContact) {
MEVENT hDbEvent = lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dat->hDbEventFirst == NULL)
dat->hDbEventFirst = hDbEvent;
@@ -1618,7 +1618,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mir_free(buffer);
}
else {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(dat->hDbEventLast);
if (dbei.cbBlob == 0xFFFFFFFF)
break;
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index be1a850a03..b0b5e673cd 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -114,7 +114,7 @@ int DbEventIsShown(DBEVENTINFO &dbei) EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, MEVENT hDbEvent)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1)
return NULL;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 2857737506..aed59ba130 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -91,7 +91,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
{
MEVENT hDbEvent = (MEVENT)lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ))
return 0;
@@ -249,7 +249,7 @@ static void RestoreUnreadMessageAlerts(void) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = 0;
db_event_get(hDbEvent, &dbei);
if ((dbei.flags & (DBEF_SENT | DBEF_READ)) || !DbEventIsMessageOrCustom(&dbei))
diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index 1d561307e4..9ed7a92671 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -2,7 +2,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_SENT | DBEF_READ;
dbei.timestamp = time(NULL);
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 618edc1315..a8d0a19496 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -376,7 +376,7 @@ int CSend::OnSend(void *obj, WPARAM, LPARAM lParam) void CSend::DB_EventAdd(WORD EventType) { - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.szModule = m_pszProto; dbei.eventType = EventType; dbei.flags = DBEF_SENT; diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 04fd134bc5..e4d87817d7 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -151,7 +151,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) return FALSE;
// detect size of msg
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (db_event_get(hDBEvent, &dbei))
return 0;
@@ -216,7 +216,6 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) T2Utf pszUtf(ptszTemp);
ProtoChainSend(hContact, PSS_MESSAGE, 0, pszUtf);
- dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT; //DBEF_READ;
dbei.szModule = pszProto;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index fe48153a0e..3cf7247c4a 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -244,7 +244,6 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _dbei->szModule = szAuthEventModule;
_dbei->timestamp = dbei->timestamp;
_dbei->flags = 0;
- _dbei->cbSize = sizeof(DBEVENTINFO);
_dbei->pBlob = _dbv.pbVal + sizeof(DWORD);
db_event_add(hContact,_dbei);
db_unset(hContact, PLUGIN_NAME, "AuthEvent");
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index a95f2a976f..fd963d0aa5 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -458,11 +458,11 @@ int LogToSystemHistory(char *message, char *origmessage) { char msg[MAX_BUFFER_LENGTH]; time_t tm; - DBEVENTINFO dbei; if (message == NULL) return 0; - dbei.cbSize = sizeof(DBEVENTINFO); + + DBEVENTINFO dbei = {}; dbei.timestamp = time(&tm); dbei.szModule = PLUGIN_NAME; dbei.pBlob = (PBYTE)msg; @@ -488,10 +488,7 @@ void MarkUnread(MCONTACT hContact) if (db_get(hContact, PLUGIN_NAME, "LastMsgEvents", &_dbv) == 0) { pos = _dbv.pbVal; while (pos - _dbv.pbVal < _dbv.cpbVal) { - DBEVENTINFO _dbei; - memset(&_dbei, 0, sizeof(_dbei)); - _dbei.cbSize = sizeof(_dbei); - + DBEVENTINFO _dbei = {}; memcpy(&_dbei.eventType, pos, sizeof(WORD)); pos += sizeof(WORD); memcpy(&_dbei.flags, pos, sizeof(DWORD)); pos += sizeof(DWORD); memcpy(&_dbei.timestamp, pos, sizeof(DWORD)); pos += sizeof(DWORD); diff --git a/plugins/StatusChange/src/main.cpp b/plugins/StatusChange/src/main.cpp index 6bd837044f..fc34c136b3 100644 --- a/plugins/StatusChange/src/main.cpp +++ b/plugins/StatusChange/src/main.cpp @@ -48,7 +48,7 @@ static int StatusChangeGetMessage(WPARAM, LPARAM hDbEvent) int status;
BOOL read, send, change_status;
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
db_event_get(hDbEvent, &dbe);
status = (int)CallProtoService(dbe.szModule, PS_GETSTATUS, 0, 0);
diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index 3f5311b9ad..a2571810f9 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -19,7 +19,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, hContact, hDbEvent) { - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) return 0; diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index e8646548cb..b7a08422ab 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -5,8 +5,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) UNREFERENCED_PARAMETER(wParam);
MEVENT hDbEvent = (MEVENT)lParam;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (-1 == dbei.cbBlob)
return 0;
diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp index f5ea232f94..562ac2a570 100644 --- a/plugins/StopSpamPlus/src/utils.cpp +++ b/plugins/StopSpamPlus/src/utils.cpp @@ -16,7 +16,7 @@ bool IsExistMyMessage(MCONTACT hContact) {
MEVENT hDbEvent = db_event_first(hContact);
while (hDbEvent) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (db_event_get(hDbEvent, &dbei))
break;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index bdace029f2..dca01dc9c6 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -504,7 +504,7 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent) else
szHeader[0] = 0;
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
if (pdata->pluginOptions->bPreview && hContact) {
dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob);
@@ -569,7 +569,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve if (!PluginConfig.g_bPopupAvail)
return 0;
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
// fix for a crash
if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
dbe.cbBlob = db_event_getBlobSize(hEvent);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 446dec3455..1df30b4efd 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1474,7 +1474,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) HWND hwndDlg = dat->hwnd, hwndContainer = pContainer->hwnd, hwndTab = GetParent(dat->hwnd); MEVENT hDbEvent = (MEVENT)lParam; - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (dat->hDbEventFirst == NULL) dat->hDbEventFirst = hDbEvent; diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 217061eea3..5706e0d843 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -524,7 +524,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) sendLater->addContact(hContact);
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_MESSAGE) {
if (M.FindWindow(hContact) != NULL)
@@ -588,7 +588,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) text.Format(TranslateT("changed status from %s to %s."), szOldStatus, szNewStatus);
T2Utf szMsg(text);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.pBlob = (PBYTE)(char*)szMsg;
dbei.cbBlob = (int)mir_strlen(szMsg) + 1;
dbei.flags = DBEF_UTF | DBEF_READ;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 968e72ba61..c5999eee9f 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -406,7 +406,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) { wchar_t szName[CONTAINER_NAMELEN + 1]; - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); HWND hwnd = M.FindWindow(hContact); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 0c979772c5..40cfee8e07 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1361,7 +1361,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
for (MEVENT hdbEvent = db_event_last(dat->hContact); hdbEvent; hdbEvent = db_event_prev(dat->hContact, hdbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hdbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
dat->lastMessage = dbei.timestamp;
@@ -1421,7 +1421,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // show a popup if wanted...
if (newData->bWantPopup) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
newData->bWantPopup = FALSE;
db_event_get(newData->hdbEvent, &dbei);
tabSRMM_ShowPopup(dat->hContact, newData->hdbEvent, dbei.eventType, 0, 0, hwndDlg, dat->cache->getActiveProto());
@@ -2738,7 +2738,7 @@ quote_from_last: SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin == sel.cpMax) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDBEvent);
wchar_t *szText = (wchar_t*)mir_alloc((dbei.cbBlob + 1) * sizeof(wchar_t)); //URLs are made one char bigger for crlf
dbei.pBlob = (BYTE*)szText;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index d655767595..b34c26cd99 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1120,7 +1120,7 @@ void TSAPI FindFirstEvent(TWindowData *dat) int i;
MEVENT hPrevEvent;
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
// ability to load only current session's history
if (dat->bActualHistory)
i = dat->cache->getSessionMsgCount();
@@ -1144,7 +1144,7 @@ void TSAPI FindFirstEvent(TWindowData *dat) break;
case LOADHISTORY_TIME:
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (dat->hDbEventFirst == NULL)
dbei.timestamp = time(NULL);
else
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 23be946173..f87e1e4c40 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -455,7 +455,6 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, if (streamData->dbei != 0)
dbei = *(streamData->dbei);
else {
- dbei.cbSize = sizeof(dbei);
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1)
return NULL;
@@ -1350,7 +1349,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp if (streamData.dbei != 0)
isSent = (streamData.dbei->flags & DBEF_SENT) != 0;
else {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEventFirst, &dbei);
isSent = (dbei.flags & DBEF_SENT) != 0;
}
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 7dd855c5f2..8887fd1123 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -437,7 +437,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack) CSendLaterJob *p = m_sendLaterJobList[i];
if (p->hProcess == ack->hProcess && p->hTargetContact == ack->hContact && !(p->fSuccess || p->fFailed)) {
if (!p->fSuccess) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = GetContactProto((p->hContact));
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index f63fa6d90a..dcabc6bc29 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -346,7 +346,7 @@ void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const wchar_ return; size_t iMsgLen; - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_ERRMSG; if (iSendJobIndex >= 0) { dbei.pBlob = (BYTE *)m_jobs[iSendJobIndex].szSendBuffer; @@ -553,7 +553,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam) return 0; } - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = GetContactProto(job.hContact); @@ -644,8 +644,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b szNote = TranslateT("The send later feature is not available on this protocol."); T2Utf utfText(szNote); - DBEVENTINFO dbei; - dbei.cbSize = sizeof(dbei); + DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = GetContactProto(dat->hContact); diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 073ac365f5..ea0458703b 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -341,14 +341,13 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH); } - DBEVENTINFO dbei = { 0 }; + DBEVENTINFO dbei = {}; dbei.szModule = dat->szProto; dbei.timestamp = time(NULL); dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE; dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType; if (dbei.eventType == EVENTTYPE_ERRMSG) dbei.szModule = (char *)L"Sample error message"; - dbei.cbSize = sizeof(dbei); dbei.pBlob = (iIndex == 6) ? (BYTE *)"is now offline (was online)" : (BYTE *)"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."; dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob) + 1; dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0; diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index fe25c8d43c..67f668faf1 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -122,7 +122,7 @@ void StripBBCodesInPlace(wchar_t *ptszText) DWORD LastMessageTimestamp(MCONTACT hContact, bool received) { for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) return dbei.timestamp; @@ -165,7 +165,7 @@ bool UidName(char *szProto, wchar_t *buff, int bufflen) wchar_t* GetLastMessageText(MCONTACT hContact, bool received) { for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) { dbei.pBlob = (BYTE *)alloca(dbei.cbBlob); @@ -382,7 +382,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int MEVENT dbe = db_event_last(hTmpContact); while (dbe != NULL) { - DBEVENTINFO dbei = { sizeof(dbei) }; + DBEVENTINFO dbei = {}; if (!db_event_get(dbe, &dbei)) { if (dbei.eventType == EVENTTYPE_MESSAGE) { dwNewTs = max(dwNewTs, dbei.timestamp); diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 69bf9a954e..8d274db355 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -110,7 +110,7 @@ int SettingChanged(WPARAM, LPARAM lParam) // needed for msg_count_xxx substitutions
int EventDeleted(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (!db_event_get(lParam, &dbei))
if (dbei.eventType == EVENTTYPE_MESSAGE)
db_unset(wParam, MODULE, "LastCountTS");
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index c3b8f48f8e..de3135c5b4 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -402,7 +402,7 @@ BYTE CExImContactXML::ExportEvents() // read out all events for the current contact
for (MEVENT hDbEvent = db_event_first(_hContact); hDbEvent != NULL; hDbEvent = db_event_next(_hContact, hDbEvent)) {
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ DBEVENTINFO dbei = {};
if (DB::Event::GetInfoWithData(hDbEvent, &dbei))
continue;
@@ -939,7 +939,7 @@ int CExImContactXML::ImportEvent(LPCSTR pszModule, TiXmlElement *xmlEvent) return ERROR_NOT_ADDED;
// timestamp must be valid
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
xmlEvent->Attribute("time", (LPINT)&dbei.timestamp);
if (dbei.timestamp == 0)
return ERROR_INVALID_TIMESTAMP;
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index f1b8feaf83..00deddc966 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -33,7 +33,7 @@ namespace Contact { **/
DWORD WhenAdded(DWORD dwUIN, LPCSTR)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
for (MEVENT edbe = db_event_first(NULL); edbe != NULL; edbe = db_event_next(NULL, edbe)) {
// get eventtype and compare
if (!DB::Event::GetInfo(edbe, &dbei) && dbei.eventType == EVENTTYPE_ADDED) {
@@ -513,7 +513,6 @@ namespace Event { bool GetInfo(MEVENT hEvent, DBEVENTINFO *dbei)
{
- dbei->cbSize = sizeof(DBEVENTINFO);
dbei->cbBlob = 0;
dbei->pBlob = NULL;
return db_event_get(hEvent, dbei) != 0;
@@ -531,7 +530,6 @@ bool GetInfo(MEVENT hEvent, DBEVENTINFO *dbei) bool GetInfoWithData(MEVENT hEvent, DBEVENTINFO *dbei)
{
- dbei->cbSize = sizeof(DBEVENTINFO);
if (!dbei->cbBlob) {
INT_PTR size = db_event_getBlobSize(hEvent);
dbei->cbBlob = (size != -1) ? (DWORD)size : 0;
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index da9874adad..0c3c2af113 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -415,14 +415,9 @@ static BOOL isValidDbEvent(DBEVENTINFO *dbe, int flags) static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags)
{
- DBEVENTINFO dbe;
BOOL bEventOk;
do {
- memset(&dbe, 0, sizeof(DBEVENTINFO));
- dbe.cbSize = sizeof(DBEVENTINFO);
- dbe.cbBlob = 0;
- dbe.pBlob = NULL;
if (hContact != NULL) {
if ((flags & DBE_FIRST) && (flags & DBE_UNREAD)) {
hDbEvent = db_event_firstUnread(hContact);
@@ -442,6 +437,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) MEVENT hMatchEvent = NULL, hSearchEvent = NULL;
DWORD matchTimestamp = 0, priorTimestamp = 0;
+ DBEVENTINFO dbe = {};
if (flags & DBE_FIRST) {
for (MCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
@@ -502,7 +498,8 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) }
}
}
- dbe.cbBlob = 0;
+
+ DBEVENTINFO dbe = {};
if (db_event_get(hDbEvent, &dbe))
bEventOk = FALSE;
else
@@ -569,7 +566,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai) if (hDbEvent == NULL)
return NULL;
- DBEVENTINFO dbe = { sizeof(dbe) };
+ DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hDbEvent);
dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob);
if (db_event_get(hDbEvent, &dbe)) {
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index d64353c2cd..e4f3cb47f3 100644 --- a/plugins/Watrack/proto/proto.pas +++ b/plugins/Watrack/proto/proto.pas @@ -62,7 +62,6 @@ begin FillChar(dbeo,SizeOf(dbeo),0);
with dbeo do
begin
- cbSize :=SizeOf(dbeo);
eventType:=atype;
szModule :=PluginShort;
if data=nil then
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 5331c2be74..3054f13e3c 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -189,7 +189,7 @@ int UpdateWeather(MCONTACT hContact) T2Utf szMessage(str2);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = WEATHERPROTONAME;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_READ | DBEF_UTF;
diff --git a/plugins/WinterSpeak/src/EventInformation.cpp b/plugins/WinterSpeak/src/EventInformation.cpp index f9a9799a4f..f5c8e1ad9f 100644 --- a/plugins/WinterSpeak/src/EventInformation.cpp +++ b/plugins/WinterSpeak/src/EventInformation.cpp @@ -33,7 +33,6 @@ bool EventInformation::isValidEvent(MEVENT event) memset(&m_event_info, 0, sizeof(m_event_info));
// find out and assign the space we need for the new event
- m_event_info.cbSize = sizeof(m_event_info);
m_event_info.cbBlob = db_event_getBlobSize(event);// CallService(MS_DB_EVENT_GETBLOBSIZE, reinterpret_cast<LPARAM>(event), 0);
if (-1 == m_event_info.cbBlob)
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index 25ba83707b..2233816700 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -103,7 +103,7 @@ static int ProtoAck(WPARAM, LPARAM lParam) static bool isReceiveMessage(MEVENT hDbEvent)
{
- DBEVENTINFO info = { sizeof(info) };
+ DBEVENTINFO info = {};
db_event_get(hDbEvent, &info);
// i don't understand why it works and how it works, but it works correctly - practice way (ìåòîäîì òûêà)
// so, i think correct condition would be : eventType == EVENTTYPE_MESSAGE && info.flags & DBEF_READ, but it really isn't
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 1eba786e9e..3e1f6f3d6a 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -68,7 +68,7 @@ int ProtoAck(WPARAM,LPARAM lparam) time_t ltime;
time(<ime);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = "yaRelay";
dbei.timestamp = ltime;
dbei.flags = DBEF_SENT | DBEF_UTF;
@@ -118,7 +118,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent) return 0;
// receive message from DB
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDBEvent);
if (dbei.cbBlob == -1)
return 0;
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index f1260e9ad0..5a1a11bf4c 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -130,7 +130,6 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) {
logmsg("HookedNewEvent1");
DBEVENTINFO dbe;
- dbe.cbSize = sizeof(dbe);
dbe.cbBlob = db_event_getBlobSize(hDBEvent);
if (dbe.cbBlob == -1)
return 0;
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);
diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp index 51d0006890..44ad9644bb 100644 --- a/src/core/stdauth/src/auth.cpp +++ b/src/core/stdauth/src/auth.cpp @@ -47,7 +47,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) wchar_t szTooltip[256];
MEVENT hDbEvent = (MEVENT)lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(lParam, &dbei);
if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED))
return 0;
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 97845bd930..e05db13492 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
{
//blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
db_event_get(hDbEvent, &dbei);
@@ -161,7 +161,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
//blob is: uin(DWORD), hcontact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
db_event_get(hDbEvent, &dbei);
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDOK:
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
@@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDCANCEL:
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 7bb233df4f..aa311ec063 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -122,7 +122,7 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) {
DWORD dwSignature;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(DWORD);
dbei.pBlob = (PBYTE)&dwSignature;
db_event_get(lParam, &dbei);
@@ -274,7 +274,7 @@ static void RemoveUnreadFileEvents(void) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
MEVENT hDbEvent = db_event_firstUnread(hContact);
while (hDbEvent) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
db_event_markRead(hContact, hDbEvent);
@@ -359,7 +359,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) if (pre->fileCount == 0)
return 0;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(ccs->hContact);
dbei.timestamp = pre->timestamp;
dbei.eventType = EVENTTYPE_FILE;
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index c3a8eeb365..f5eda50d2d 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -222,7 +222,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l db_event_markRead(dat->hContact, dat->hDbEvent);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(dat->hDbEvent);
if (dbei.cbBlob > 4 && dbei.cbBlob <= 8196) {
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob + 1);
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 9427d258b2..9c320a63d3 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -75,7 +75,6 @@ static void SetOpenFileButtonStyle(HWND hwndButton, int enabled) void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei) { - dbei.cbSize = sizeof(dbei); dbei.szModule = GetContactProto(dat->hContact); dbei.eventType = EVENTTYPE_FILE; dbei.flags = DBEF_SENT; diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index e2b1e7544c..d334eb19ef 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -92,7 +92,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz return;
}
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & PREF_RTL ? DBEF_RTL : 0);
dbei.szModule = GetContactProto(hContact);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 4393ef0d74..75e388a03f 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -506,7 +506,7 @@ void CSrmmWindow::OnInitDialog() if (hPrevEvent == NULL)
break;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
m_hDbEventFirst = hPrevEvent;
db_event_get(hPrevEvent, &dbei);
if (!DbEventIsShown(&dbei))
@@ -515,7 +515,7 @@ void CSrmmWindow::OnInitDialog() break;
case LOADHISTORY_TIME:
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
if (m_hDbEventFirst == NULL)
dbei.timestamp = (DWORD)time(NULL);
else
@@ -544,7 +544,7 @@ void CSrmmWindow::OnInitDialog() MEVENT hdbEvent = db_event_last(m_hContact);
if (hdbEvent) {
do {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hdbEvent, &dbei);
if ((dbei.eventType == EVENTTYPE_MESSAGE) && !(dbei.flags & DBEF_SENT)) {
m_lastMessage = dbei.timestamp;
@@ -1178,7 +1178,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_hDbEventFirst == NULL)
m_hDbEventFirst = hDbEvent;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
bool isMessage = (dbei.eventType == EVENTTYPE_MESSAGE), isSent = ((dbei.flags & DBEF_SENT) != 0);
if (DbEventIsShown(&dbei)) {
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index a49be9f4cb..b4eb69150f 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -201,7 +201,7 @@ int DbEventIsShown(DBEVENTINFO *dbei) //mir_free() the return value
static bool CreateRTFFromDbEvent(LogStreamData *dat)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(dat->hDbEvent);
if (dbei.cbBlob == -1)
return false;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 9073c0970f..4bc28191a7 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -54,7 +54,7 @@ static int SRMMStatusToPf2(int status) static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(lParam, &dbei);
if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
@@ -237,7 +237,7 @@ static void RestoreUnreadMessageAlerts(void) for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
bool autoPopup = false;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = 0;
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 0969ec8acd..79ff971c34 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -146,7 +146,7 @@ static void FillHistoryThread(void* param) int i = db_event_count(hInfo->hContact);
SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_INITSTORAGE, i, i * 40);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
int oldBlobSize = 0;
MEVENT hDbEvent = db_event_last(hInfo->hContact);
@@ -273,7 +273,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), TRUE);
MEVENT hDbEvent = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, sel, 0);
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if ((int)dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
@@ -295,7 +295,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (index == LB_ERR)
break;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
int oldBlobSize = 0;
MEVENT hDbEventStart = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 7d568f49e8..7fac8f56a3 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -68,7 +68,7 @@ public: Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_ADDCONTACT);
if (m_acs.handleType == HANDLE_EVENT) {
DWORD dwUin;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = sizeof(DWORD);
dbei.pBlob = (PBYTE)&dwUin;
db_event_get(m_acs.hDbEvent, &dbei);
@@ -85,7 +85,7 @@ public: hContact = 0;
if (m_acs.handleType == HANDLE_EVENT) {
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.cbBlob = db_event_getBlobSize(m_acs.hDbEvent);
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
db_event_get(m_acs.hDbEvent, &dbei);
@@ -178,7 +178,7 @@ public: switch (m_acs.handleType) {
case HANDLE_EVENT:
{
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
db_event_get(m_acs.hDbEvent, &dbei);
hContact = (MCONTACT)CallProtoServiceInt(NULL, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)m_acs.hDbEvent);
}
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index df027c4616..24dbeb55a8 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -102,7 +102,7 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf) static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatype)
{
- if (dbei == NULL || dbei->szModule == NULL || dbei->cbSize != sizeof(DBEVENTINFO))
+ if (dbei == NULL || dbei->szModule == NULL)
return 0;
DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
@@ -308,7 +308,7 @@ PBYTE DB_AUTH_BLOB::makeBlob() (m_szFirstName) ? m_szFirstName : "", 0,
(m_szLastName) ? m_szLastName : "", 0,
(m_szEmail) ? m_szEmail : "", 0,
- (m_szReason) ? m_szReason : 0);
+ (m_szReason) ? m_szReason : "", 0);
return pBlob;
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index beb1d25389..b71d63bc99 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -158,8 +158,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) ptrA pszTemp;
mir_ptr<BYTE> pszBlob;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = {};
dbei.flags = DBEF_UTF;
dbei.szModule = GetContactProto(ccs->hContact);
dbei.timestamp = pre->timestamp;
@@ -187,7 +186,7 @@ static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam) {
PROTORECVEVENT* pre = (PROTORECVEVENT*)lParam;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = {};
dbei.szModule = (char*)wParam;
dbei.timestamp = pre->timestamp;
dbei.flags = DBEF_UTF | pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
|