From 77ece3939612fb0133d20815883e4ed50a10230e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 23 Jan 2014 20:05:16 +0000 Subject: fixes bug #188 completely git-svn-id: http://svn.miranda-ng.org/main/trunk@7842 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_cachefuncs.cpp | 56 +++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'plugins/Clist_modern/src/modern_cachefuncs.cpp') diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 1333682716..f41b7c1db9 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -73,7 +73,7 @@ void Cache_GetTimezone(ClcData *dat, HANDLE hContact) void Cache_GetText(ClcData *dat, ClcContact *contact, BOOL forceRenew) { Cache_GetFirstLineText(dat, contact); - if ( !dat->force_in_dialog) { + if (!dat->force_in_dialog) { ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(contact->hContact); if ((dat->second_line_show && (forceRenew || pdnce->szSecondLineText == NULL)) || (dat->third_line_show && (forceRenew || pdnce->szThirdLineText == NULL))) gtaAddRequest(dat,contact, contact->hContact); @@ -133,7 +133,7 @@ void CSmileyString::_CopySmileyList( SortedList *plInput ) { // ASSERT( plText == NULL ); - if ( !plInput || plInput->realCount == 0 ) return; + if (!plInput || plInput->realCount == 0 ) return; plText = List_Create( 0, 1 ); for ( int i=0; i < plInput->realCount; i++ ) { @@ -165,7 +165,7 @@ void CSmileyString::DestroySmileyList() if ( plText->items[i] != NULL ) { ClcContactTextPiece *piece = (ClcContactTextPiece *) plText->items[i]; - if ( !IsBadWritePtr(piece, sizeof(ClcContactTextPiece))) { + if (!IsBadWritePtr(piece, sizeof(ClcContactTextPiece))) { if (piece->type == TEXT_PIECE_TYPE_SMILEY && piece->smiley != g_hListeningToIcon) DestroyIcon_protect(piece->smiley); mir_free(piece); @@ -193,7 +193,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, DestroySmileyList(); - if ( !dat->text_replace_smileys || !replace_smileys || szText == NULL) + if (!dat->text_replace_smileys || !replace_smileys || szText == NULL) return; int text_size = (int)_tcslen( szText ); @@ -295,9 +295,9 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE; text[0] = '\0'; // Get XStatusName - if ( !noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { + if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { DBVARIANT dbv = {0}; - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); db_free(&dbv); @@ -315,9 +315,9 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus } // Get XStatusName - if ( !noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { + if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { DBVARIANT dbv = {0}; - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); db_free(&dbv); @@ -342,7 +342,7 @@ void GetListeningTo(TCHAR *text, int text_size, ClcCacheEntry *pdnce) if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) return; - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) { CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); db_free(&dbv); } @@ -363,9 +363,9 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) noAwayMsg = TRUE; // Get XStatusMsg - if ( !noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { + if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { // Try to get XStatusMsg - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); db_free(&dbv); @@ -377,7 +377,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst // Get StatusMsg if (pdnce->hContact && text[0] == '\0') { - if ( !db_get_ts(pdnce->hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_ts(pdnce->hContact, "CList", "StatusMsg", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); db_free(&dbv); @@ -388,9 +388,9 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst } // Get XStatusMsg - if ( !noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto && text[0] == '\0') { + if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto && text[0] == '\0') { // Try to get XStatusMsg - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); db_free(&dbv); @@ -419,7 +419,7 @@ int Cache_GetLineText( DBVARIANT dbv = {0}; // Try to get XStatusMsg - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0) { TCHAR *tmp = NEWTSTR_ALLOCA(text); mir_sntprintf(text, text_size, _T("%s: %s"), tmp, dbv.ptszVal); @@ -434,7 +434,7 @@ int Cache_GetLineText( case TEXT_NICKNAME: if (pdnce->hContact && pdnce->m_cache_cszProto) { DBVARIANT dbv = {0}; - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { lstrcpyn(text, dbv.ptszVal, text_size); db_free(&dbv); CopySkipUnprintableChars(text, text, text_size-1); @@ -448,7 +448,7 @@ int Cache_GetLineText( DBVARIANT dbv = {0}; // Try to get XStatusName - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { if (dbv.pszVal != NULL && dbv.pszVal[0] != 0) { TCHAR *tmp = NEWTSTR_ALLOCA(text); mir_sntprintf(text, text_size, _T("%s: %s"), dbv.pszVal, tmp); @@ -460,7 +460,7 @@ int Cache_GetLineText( else if (use_name_and_message_for_xstatus && xstatus_has_priority) { DBVARIANT dbv = {0}; // Try to get XStatusName - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { if (dbv.pszVal != NULL && dbv.pszVal[0] != 0) mir_sntprintf(text, text_size, _T("%s"), dbv.pszVal); CopySkipUnprintableChars(text, text, text_size-1); @@ -520,7 +520,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0); if (dat->first_line_append_nick && (!dat->force_in_dialog)) { DBVARIANT dbv = {0}; - if ( !db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { + if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { TCHAR nick[SIZEOF(contact->szText)]; lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText)); db_free(&dbv); @@ -536,7 +536,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) } else lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); - if ( !dat->force_in_dialog) { + if (!dat->force_in_dialog) { struct SHORTDATA data = {0}; Sync(CLUI_SyncGetShortData,(WPARAM)pcli->hwndContactTree,(LPARAM)&data); contact->ssText.ReplaceSmileys(&data, pdnce, contact->szText, dat->first_line_draw_smileys); @@ -622,8 +622,8 @@ static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size) DWORD i; BOOL keep = 0; TCHAR * cp = to; - if ( !to) return 0; - if ( !buf) { + if (!to) return 0; + if (!buf) { to[0] = '\0'; return 0; } @@ -632,7 +632,7 @@ static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size) if (buf[i] == 0) break; if (buf[i] > 0 && buf[i] < ' ') { *cp = ' '; - if ( !keep) cp++; + if (!keep) cp++; keep = 1; } else { @@ -673,22 +673,22 @@ static BOOL ExecuteOnAllContacts(ClcData *dat, ExecuteOnAllContactsFuncPtr func, static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param) { - if ( !group) + if (!group) return TRUE; for (int scanIndex = 0 ; scanIndex < group->cl.count ; scanIndex++) { if (group->cl.items[scanIndex]->type == CLCIT_CONTACT) { - if ( !func(group->cl.items[scanIndex], FALSE, param)) + if (!func(group->cl.items[scanIndex], FALSE, param)) return FALSE; if (group->cl.items[scanIndex]->SubAllocated > 0) { for (int i=0 ; i < group->cl.items[scanIndex]->SubAllocated ; i++) - if ( !func(&group->cl.items[scanIndex]->subcontacts[i], TRUE, param)) + if (!func(&group->cl.items[scanIndex]->subcontacts[i], TRUE, param)) return FALSE; } } else if (group->cl.items[scanIndex]->type == CLCIT_GROUP) - if ( !ExecuteOnAllContactsOfGroup(group->cl.items[scanIndex]->group, func, param)) + if (!ExecuteOnAllContactsOfGroup(group->cl.items[scanIndex]->group, func, param)) return FALSE; } @@ -818,7 +818,7 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact) contact->avatar_pos = AVATAR_POS_DONT_HAVE; if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { DBVARIANT dbv; - if ( !db_get_ts(contact->hContact, "ContactPhoto", "File", &dbv)) { + if (!db_get_ts(contact->hContact, "ContactPhoto", "File", &dbv)) { HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal); if (hBmp != NULL) { // Make bounds -- cgit v1.2.3