diff options
author | George Hazan <george.hazan@gmail.com> | 2023-09-24 14:04:32 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-09-24 14:04:32 +0300 |
commit | 2e00d85fc5af3d80918ca62e29abbbb4a7377b9e (patch) | |
tree | b7c659b0e8f6191673b202eeadf216bacebc2ce3 /plugins | |
parent | 0b4b240c8c0974b8f7b1a830df2d14d3d30cb08a (diff) |
we don't need CMStringW& as the Get* parameter
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/SmileyAdd/src/customsmiley.cpp | 1 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/options.cpp | 10 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/services.cpp | 15 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileys.cpp | 13 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileys.h | 2 |
5 files changed, 19 insertions, 22 deletions
diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index e3958760e5..29cbc02de8 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -45,7 +45,6 @@ bool SmileyPackCListType::AddSmiley(const char *pszModule, const wchar_t *path) return smpack->LoadSmiley(path);
}
-
SmileyPackCType* SmileyPackCListType::GetSmileyPack(const char *pszModule)
{
for (auto &it : m_SmileyPacks)
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 6d2049647b..76c73a2569 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -316,10 +316,8 @@ class CGategoriesOptions : public COptionsBaseDialog ProtoName = dbv.pwszVal;
db_free(&dbv);
}
- else
- ProtoName.Empty();
+ else ProtoName.Empty();
- CMStringW FileName;
if (!ProtoName.IsEmpty()) {
PhysProtoName += ProtoName;
SmileyCategoryType *scm = tmpsmcat.GetSmileyCategory(PhysProtoName);
@@ -388,8 +386,7 @@ public: tmpsmcat = g_SmileyCategories;
- auto &smc = g_SmileyCategories.GetSmileyCategoryList();
- for (auto &it : smc) {
+ for (auto &it : g_SmileyCategories.GetSmileyCategoryList()) {
HICON hIcon = nullptr;
if (it->IsProto()) {
hIcon = (HICON)CallProtoService(_T2A(it->GetName().c_str()), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
@@ -416,8 +413,7 @@ public: // Cleanup database
CMStringW empty;
- auto &smc = g_SmileyCategories.GetSmileyCategoryList();
- for (auto &it : smc)
+ for (auto &it : g_SmileyCategories.GetSmileyCategoryList())
if (tmpsmcat.GetSmileyCategory(it->GetName()) == nullptr)
opt.WritePackFileName(empty, it->GetName());
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index bd8dcf2b4e..4adb1cab94 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -304,8 +304,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) INT_PTR ReloadPack(WPARAM, LPARAM lParam)
{
if (lParam) {
- CMStringW categoryName = _A2T((char*)lParam);
- SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(categoryName);
+ SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(_A2T((char *)lParam));
if (smc != nullptr)
smc->Load();
}
@@ -362,8 +361,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) switch (wParam) {
case PRAC_ADDED:
if (acc != nullptr) {
- CMStringW catname(L"Standard");
- const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
+ const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(L"Standard")->GetFilename();
g_SmileyCategories.AddAccountAsCategory(acc, defaultFile);
}
break;
@@ -373,7 +371,8 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) CMStringW name(_A2T(acc->szModuleName));
SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(name);
if (smc != nullptr) {
- if (acc->tszAccountName) name = acc->tszAccountName;
+ if (acc->tszAccountName)
+ name = acc->tszAccountName;
smc->SetDisplayName(name);
}
}
@@ -386,8 +385,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) case PRAC_CHECKED:
if (acc != nullptr) {
if (acc->bIsEnabled) {
- CMStringW catname(L"Standard");
- const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
+ const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(L"Standard")->GetFilename();
g_SmileyCategories.AddAccountAsCategory(acc, defaultFile);
}
else g_SmileyCategories.DeleteAccountAsCategory(acc);
@@ -407,8 +405,7 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
if (strcmp(cws->szSetting, "Transport") == 0) {
- CMStringW catname(L"Standard");
- SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(catname);
+ SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(L"Standard");
if (smc != nullptr)
g_SmileyCategories.AddContactTransportAsCategory(hContact, smc->GetFilename());
}
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index a9f69a1c5c..0d6492a59b 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -704,10 +704,13 @@ void SmileyCategoryListType::ClearAndLoadAll(void) it->Load();
}
-SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMStringW &name)
+SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const wchar_t *pwszName)
{
+ if (!pwszName)
+ return nullptr;
+
for (auto &it : m_SmileyCategories)
- if (name.CompareNoCase(it->GetName()) == 0)
+ if (it->GetName().CompareNoCase(pwszName) == 0)
return it;
return nullptr;
@@ -780,8 +783,10 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr db_free(&dbv);
}
- if (!PhysProtoName.IsEmpty())
- paths = g_SmileyCategories.GetSmileyCategory(PhysProtoName) ? g_SmileyCategories.GetSmileyCategory(PhysProtoName)->GetFilename() : L"";
+ if (!PhysProtoName.IsEmpty()) {
+ auto *p = g_SmileyCategories.GetSmileyCategory(PhysProtoName);
+ paths = (p) ? p->GetFilename() : L"";
+ }
// assemble default path
if (paths.IsEmpty()) {
diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h index 334b6236f6..2a4df721dd 100644 --- a/plugins/SmileyAdd/src/smileys.h +++ b/plugins/SmileyAdd/src/smileys.h @@ -283,7 +283,7 @@ class SmileyCategoryListType public:
void SetSmileyPackStore(SmileyPackListType *pSPS) { m_pSmileyPackStore = pSPS; }
- SmileyCategoryType* GetSmileyCategory(const CMStringW &name);
+ SmileyCategoryType* GetSmileyCategory(const wchar_t *pwszName);
SmileyCategoryType* GetSmileyCategory(unsigned index);
SmileyPackType* GetSmileyPack(const CMStringW &name);
SmileyCategoryVectorType& GetSmileyCategoryList(void) { return m_SmileyCategories; }
|