From d5df87b152c42caadd2f41bd2712663caf4bd4e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 17 Nov 2020 12:24:08 +0300 Subject: fix for processing db_mc_getSub() return value --- plugins/UserInfoEx/src/classMAnnivDate.cpp | 6 +++--- plugins/UserInfoEx/src/dlg_propsheet.cpp | 2 +- plugins/UserInfoEx/src/mir_db.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index fc32530755..1916ce8d35 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -487,7 +487,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) const int def = db_mc_getDefaultNum(hContact); if (def > -1 && def < INT_MAX) { MCONTACT hSubContact = db_mc_getSub(hContact, def); - if (hSubContact != NULL && !DBGetBirthDate(hSubContact, nullptr)) { + if (hSubContact && !DBGetBirthDate(hSubContact, nullptr)) { RemoveFlags(MADF_HASCUSTOM); SetFlags(MADF_HASMETA); } @@ -501,7 +501,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) for (int i = 0; i < cnt; i++) { if (i != def) { MCONTACT hSubContact = db_mc_getSub(hContact, i); - if (hSubContact != NULL && !DBGetBirthDate(hSubContact, nullptr)) { + if (hSubContact && !DBGetBirthDate(hSubContact, nullptr)) { RemoveFlags(MADF_HASCUSTOM); SetFlags(MADF_HASMETA); break; @@ -771,7 +771,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo // update metasubcontacts for (int i = 0; i < nSubContactCount; i++) { MCONTACT hSubContact = db_mc_getSub(hContact, i); - if (hSubContact != NULL) { + if (hSubContact) { if (!mdbIgnore.DBGetDate(hSubContact, Proto_GetBaseAccountName(hSubContact), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) mdbIgnore.DBWriteDateStamp(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED); diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index d7099f1667..e61f5e1e93 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -1295,7 +1295,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar int numSubs = db_mc_getSubCount(pPs->hContact); for (int i = 0; i < numSubs; i++) { MCONTACT hSubContact = db_mc_getSub(pPs->hContact, i); - if (hSubContact != NULL) { + if (hSubContact) { if (ProtoServiceExists(Proto_GetBaseAccountName(hSubContact), PSS_GETINFO)) { pPs->infosUpdated = (TAckInfo *)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1)); pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact; diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index cbd411f569..f237952e40 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -213,7 +213,7 @@ BYTE GetEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetti // try to get setting from the default subcontact first if (def > -1 && def < INT_MAX) { hSubContact = db_mc_getSub(hContact, def); - if (hSubContact != NULL) + if (hSubContact) result = DB::Setting::GetEx(hSubContact, pszModule, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType) != 0; } // scan all subcontacts for the setting @@ -224,7 +224,7 @@ BYTE GetEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetti for (i = 0; result && i < cnt; i++) { if (i != def) { hSubContact = db_mc_getSub(hContact, i); - if (hSubContact != NULL) + if (hSubContact) result = DB::Setting::GetEx(hSubContact, pszModule, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType) != 0; } } } } } } @@ -268,7 +268,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps // try to get setting from the default subcontact first if (def > -1 && def < INT_MAX) { hSubContact = db_mc_getSub(hContact, def); - if (hSubContact != NULL) { + if (hSubContact) { wFlags = GetCtrl(hSubContact, pszSubModule, nullptr, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); if (wFlags != 0) { wFlags &= ~CTRLF_HASCUSTOM; @@ -283,7 +283,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps for (i = 0; i < cnt; i++) { if (i != def) { hSubContact = db_mc_getSub(hContact, i); - if (hSubContact != NULL) { + if (hSubContact) { wFlags = GetCtrl(hSubContact, pszSubModule, nullptr, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); if (wFlags != 0) { wFlags &= ~CTRLF_HASCUSTOM; -- cgit v1.2.3