diff options
author | George Hazan <george.hazan@gmail.com> | 2023-09-24 19:57:47 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-09-24 19:57:47 +0300 |
commit | 35b2770647c4e96130d35733f9cac94f09d39843 (patch) | |
tree | e80b137df0791fecc755ef83d7a6b500fd31a338 /plugins/SmileyAdd | |
parent | a1d6a1f6dc12e1303a2d80c1a25070bf38fa64c4 (diff) |
code cleaning
Diffstat (limited to 'plugins/SmileyAdd')
-rw-r--r-- | plugins/SmileyAdd/src/services.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index adf533896b..73fcb7e450 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -55,12 +55,12 @@ SmileyPackType* FindSmileyPack(const char *proto, MCONTACT hContact, SmileyPackC categoryName = L"AllProto";
categoryName += dbv.pwszVal;
db_free(&dbv);
- CMStringW categoryFileName = g_SmileyCategories.GetSmileyCategory(categoryName) ? g_SmileyCategories.GetSmileyCategory(categoryName)->GetFilename() : L"";
- if (categoryFileName.IsEmpty())
+
+ auto *p = g_SmileyCategories.GetSmileyCategory(categoryName);
+ if (!p || p->GetFilename().IsEmpty())
categoryName = _A2T(protonam);
}
- else
- categoryName = _A2T(protonam);
+ else categoryName = _A2T(protonam);
}
}
}
@@ -93,8 +93,10 @@ INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam) memcpy(&smrec, smre, min(smre->cbSize, sizeof(smrec)));
static const CHARRANGE selection = { 0, LONG_MAX };
- if (smre->rangeToReplace == nullptr) smrec.rangeToReplace = (CHARRANGE*)&selection;
- else if (smrec.rangeToReplace->cpMax < 0) smrec.rangeToReplace->cpMax = LONG_MAX;
+ if (smre->rangeToReplace == nullptr)
+ smrec.rangeToReplace = (CHARRANGE*)&selection;
+ else if (smrec.rangeToReplace->cpMax < 0)
+ smrec.rangeToReplace->cpMax = LONG_MAX;
SmileyPackCType *smcp = nullptr;
SmileyPackType *SmileyPack = FindSmileyPack(smrec.Protocolname, smrec.hContact, (smrec.flags & SAFLRE_NOCUSTOM) ? nullptr : &smcp);
@@ -109,7 +111,8 @@ INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam) static int GetInfoCommandE(SMADD_INFO2 *smre, bool retDup)
{
- if (smre == nullptr) return FALSE;
+ if (smre == nullptr)
+ return FALSE;
SmileyPackType *SmileyPack = FindSmileyPack(smre->Protocolname);
if (SmileyPack == nullptr || SmileyPack->SmileyCount() == 0) {
|