From 1c2aef4924fbc71d57b8bd49b0572de9a6a55095 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 30 Apr 2015 20:10:57 +0000 Subject: fix [13311] git-svn-id: http://svn.miranda-ng.org/main/trunk@13318 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../Clist_modern/src/modern_skinned_profile.cpp | 74 +++++++++++----------- 1 file changed, 38 insertions(+), 36 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/modern_skinned_profile.cpp b/plugins/Clist_modern/src/modern_skinned_profile.cpp index 3927b1fbd6..8a14909d94 100644 --- a/plugins/Clist_modern/src/modern_skinned_profile.cpp +++ b/plugins/Clist_modern/src/modern_skinned_profile.cpp @@ -13,7 +13,7 @@ CSkinnedProfile CSkinnedProfile::_me; CSkinnedProfile::CSkinnedProfile() { - Init(); + Init(); } CSkinnedProfile::~CSkinnedProfile() @@ -24,90 +24,92 @@ CSkinnedProfile::~CSkinnedProfile() HRESULT CSkinnedProfile::Init() { mir_cslock lck(_Lock); + SkinnedProfile.clear(); return S_OK; } HRESULT CSkinnedProfile::Clear() { mir_cslock lck(_Lock); + SkinnedProfile.clear(); return S_OK; } -ValueVariant* CSkinnedProfile::_GetValue( const char * szSection, const char * szKey ) +ValueVariant* CSkinnedProfile::_GetValue(const char * szSection, const char * szKey) { - KeyList_t::iterator k_it = SkinnedProfile.find( szSection ); - if ( k_it == SkinnedProfile.end() ) + KeyList_t::iterator k_it = SkinnedProfile.find(szSection); + if (k_it == SkinnedProfile.end()) return NULL; // Not skinned - ValueList_t::iterator v_it = k_it->second.find( szKey ); - if ( v_it == k_it->second.end() ) + ValueList_t::iterator v_it = k_it->second.find(szKey); + if (v_it == k_it->second.end()) return NULL; // Not skinned - return &( v_it->second ); + return &(v_it->second); }; -BYTE CSkinnedProfile::SpiGetSkinByte( HANDLE hContact, const char * szSection, const char * szKey, const BYTE defValue ) +BYTE CSkinnedProfile::SpiGetSkinByte(HANDLE hContact, const char * szSection, const char * szKey, const BYTE defValue) { - if ( hContact ) - return db_get_b( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all + if (hContact) + return db_get_b(hContact, szSection, szKey, defValue); //per-contact settings are not skinnablr at all mir_cslock lck(_Lock); - ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey ); + ValueVariant* value = SkinProfile()->_GetValue(szSection, szKey); - if ( value == NULL ) // not skinned => return DB - return db_get_w( hContact, szSection, szKey, defValue ); + if (value == NULL) // not skinned => return DB + return db_get_w(hContact, szSection, szKey, defValue); - else if ( !value->IsEmpty() ) + else if (!value->IsEmpty()) return value->GetByte(); return defValue; // skinned but empty => return default value } -WORD CSkinnedProfile::SpiGetSkinWord( HANDLE hContact, const char * szSection, const char * szKey, const WORD defValue ) +WORD CSkinnedProfile::SpiGetSkinWord(HANDLE hContact, const char * szSection, const char * szKey, const WORD defValue) { - if ( hContact ) - return db_get_w( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all + if (hContact) + return db_get_w(hContact, szSection, szKey, defValue); //per-contact settings are not skinnablr at all mir_cslock lck(_Lock); - ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey ); - - if ( value == NULL ) // not skinned => return DB - return db_get_w( hContact, szSection, szKey, defValue ); - - else if ( !value->IsEmpty() ) + ValueVariant* value = SkinProfile()->_GetValue(szSection, szKey); + + if (value == NULL) // not skinned => return DB + return db_get_w(hContact, szSection, szKey, defValue); + + else if (!value->IsEmpty()) return value->GetWord(); return defValue; // skinned but empty => return default value } -DWORD CSkinnedProfile::SpiGetSkinDword( HANDLE hContact, const char * szSection, const char * szKey, const DWORD defValue ) +DWORD CSkinnedProfile::SpiGetSkinDword(HANDLE hContact, const char * szSection, const char * szKey, const DWORD defValue) { - if ( hContact ) - return db_get_dw( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all + if (hContact) + return db_get_dw(hContact, szSection, szKey, defValue); //per-contact settings are not skinnablr at all mir_cslock lck(_Lock); - ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey ); + ValueVariant* value = SkinProfile()->_GetValue(szSection, szKey); + + if (value == NULL) // not skinned => return DB + return db_get_dw(hContact, szSection, szKey, defValue); + + else if (!value->IsEmpty()) + return value->GetDword(); - if ( value == NULL ) // not skinned => return DB - return db_get_dw( hContact, szSection, szKey, defValue ); - - else if ( !value->IsEmpty() ) - return value->GetDword(); - return defValue; // skinned but empty => return default value } -BOOL CSkinnedProfile::SpiCheckSkinned( HANDLE hContact, const char * szSection, const char * szKey ) +BOOL CSkinnedProfile::SpiCheckSkinned(HANDLE hContact, const char * szSection, const char * szKey) { - if ( hContact ) + if (hContact) return FALSE; mir_cslock lck(_Lock); - return ( SkinProfile()->_GetValue( szSection, szKey ) == NULL ); + return (SkinProfile()->_GetValue(szSection, szKey) == NULL); } #endif // _DEBUG // REMOVE ME, as soon as ghazan will implement msvcprt.lib msvcrt.lib analogs to vc6tovc7.lib -- cgit v1.2.3