diff options
author | George Hazan <ghazan@miranda.im> | 2020-11-17 12:24:08 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-11-17 12:24:08 +0300 |
commit | d5df87b152c42caadd2f41bd2712663caf4bd4e2 (patch) | |
tree | 72ee1453622933c3003e95cdc122c1c7baed5309 | |
parent | 7bb7189d67da6f916bbc9f4076d1319cd03f65d2 (diff) |
fix for processing db_mc_getSub() return value
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/classMAnnivDate.cpp | 6 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.cpp | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 2e4965ee9c..e010dd2663 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -43,7 +43,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) int bHideOffline = Clist::HideOffline;
for (int j = 0; j < subcount; j++) {
MCONTACT hsub = db_mc_getSub(cont->hContact, j);
- if (hsub == -1)
+ if (!hsub)
continue;
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hsub);
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;
|