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 /plugins | |
parent | fd7566b5de6b59bb18ff380cb1fa3f3f1089b70b (diff) |
useless field DBEVENTINFO::cbSize removed
Diffstat (limited to 'plugins')
107 files changed, 145 insertions, 224 deletions
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;
|