diff options
author | George Hazan <ghazan@miranda.im> | 2020-07-23 14:15:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-07-23 14:15:06 +0300 |
commit | bc8768c453fade64f20ff18c24092a41f94993a0 (patch) | |
tree | 908a832615b7dab0ff09c70d1c70e39bf3ff247e | |
parent | db937fbda0117e8bec530e7deda7b94eea106e78 (diff) |
fixes #2493 (Проблема с Юникодом в диалоге добавления контакта)
30 files changed, 52 insertions, 61 deletions
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 4967352196..4ecd537ee6 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -48,15 +48,11 @@ void AddContactDlgOpts(HWND hdlg, const char* szProto, BOOL bAuthOptsOnly = FALS SetDlgItemText(hdlg, IDC_AUTHREQ, (flags & PF4_NOCUSTOMAUTH) ? L"" : TranslateT("Please authorize my request and add me to your contact list."));
- char* szUniqueId = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- if (szUniqueId) {
- size_t cbLen = mir_strlen(szUniqueId) + 2;
- wchar_t* pszUniqueId = (wchar_t*)mir_alloc(cbLen * sizeof(wchar_t));
- mir_snwprintf(pszUniqueId, cbLen, L"%S:", szUniqueId);
- SetDlgItemText(hdlg, IDC_IDLABEL, pszUniqueId);
- mir_free(pszUniqueId);
- }
- else SetDlgItemText(hdlg, IDC_IDLABEL, TranslateT("Contact ID:"));
+ wchar_t *wszUniqueId = (wchar_t *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ if (wszUniqueId)
+ SetDlgItemText(hdlg, IDC_IDLABEL, CMStringW(wszUniqueId) + L":");
+ else
+ SetDlgItemText(hdlg, IDC_IDLABEL, TranslateT("Contact ID:"));
flags = (szProto) ? CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) : 0;
if (flags & PF1_NUMERICUSERID) {
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 2a6144c5b3..f4a0b1335d 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -186,7 +186,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara HWND hLV = GetDlgItem(hwndDlg, IDC_CONTACTS);
ListView_SetExtendedListViewStyle(hLV, LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT);
// add columns
- RecvListView_AddColumn(hLV, 120, _A2T((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0)), 0);
+ RecvListView_AddColumn(hLV, 120, (wchar_t*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0), 0);
RecvListView_AddColumn(hLV, 100, TranslateT("Nick"), 1);
RecvListView_AddColumn(hLV, 100, TranslateT("First Name"), 2);
RecvListView_AddColumn(hLV, 100, TranslateT("Last Name"), 3);
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 790d2b9a32..68de205802 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -153,9 +153,9 @@ bool Uid(MCONTACT hContact, char *szProto, wchar_t *buff, int bufflen) bool UidName(char *szProto, wchar_t *buff, int bufflen) { if (szProto) { - char *szUidName = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + wchar_t *szUidName = (wchar_t *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (szUidName && (INT_PTR)szUidName != CALLSERVICE_NOTFOUND) { - a2t(szUidName, buff, bufflen); + wcsncpy_s(buff, bufflen, szUidName, _TRUNCATE); return true; } } diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 0e733a79ce..660cac158d 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -344,14 +344,14 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai) return nullptr;
const char *szRes = nullptr;
- wchar_t *tszRes = nullptr;
+ wchar_t *wszRes = nullptr;
ptrA szProto(mir_u2a(ai->argv.w[1]));
if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PINAME)))
- tszRes = Hlp_GetProtocolName(szProto);
+ wszRes = Hlp_GetProtocolName(szProto);
else if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PIUIDTEXT))) {
- szRes = (const char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
- if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND || szRes == nullptr)
+ wszRes = (wchar_t *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ if (INT_PTR(wszRes) == CALLSERVICE_NOTFOUND || wszRes == nullptr)
return nullptr;
}
else if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PIUIDSETTING))) {
@@ -360,15 +360,15 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai) return nullptr;
}
else if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PINICK)))
- tszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
+ wszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
- if (szRes == nullptr && tszRes == nullptr)
+ if (szRes == nullptr && wszRes == nullptr)
return nullptr;
- if (szRes != nullptr && tszRes == nullptr)
- tszRes = mir_a2u(szRes);
+ if (szRes != nullptr && wszRes == nullptr)
+ wszRes = mir_a2u(szRes);
- return tszRes;
+ return wszRes;
}
static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
diff --git a/plugins/mRadio/i_service.inc b/plugins/mRadio/i_service.inc index 894392716d..c129046170 100644 --- a/plugins/mRadio/i_service.inc +++ b/plugins/mRadio/i_service.inc @@ -12,7 +12,7 @@ begin PFLAGNUM_4:
result:=PF4_NOCUSTOMAUTH or PF4_AVATARS;
PFLAG_UNIQUEIDTEXT:
- result:=int_ptr(Translate('Radio station URL'));
+ result:=int_ptr(TranslateW('Radio station URL'));
else
result:=0;
end
diff --git a/protocols/CurrencyRates/src/Forex.cpp b/protocols/CurrencyRates/src/Forex.cpp index 73b0707959..2d2622b6b4 100644 --- a/protocols/CurrencyRates/src/Forex.cpp +++ b/protocols/CurrencyRates/src/Forex.cpp @@ -213,7 +213,7 @@ INT_PTR CurrencyRateProtoFunc_GetCaps(WPARAM wParam, LPARAM) { switch (wParam) { case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)Translate("Currency Symbol"); + return (INT_PTR)TranslateT("Currency Symbol"); } return 0; diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index b346de4d88..6cc81030bf 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -200,7 +200,7 @@ INT_PTR CDiscordProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4: return PF4_FORCEAUTH | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_SUPPORTIDLE | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_SERVERMSGID | PF4_OFFLINEFILES; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)Translate("User ID"); + return (INT_PTR)TranslateT("User ID"); } return 0; } diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index fc620b8cae..77ad692cf1 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -70,7 +70,7 @@ static INT_PTR __cdecl EMPGetCaps(WPARAM wParam, LPARAM) case PFLAGNUM_3:
return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("User name, IP address or '*'");
+ return (INT_PTR)TranslateT("User name, IP address or '*'");
default:
return 0;
}
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp index 6b97d82ae3..cc2092bda3 100644 --- a/protocols/Facebook/src/proto.cpp +++ b/protocols/Facebook/src/proto.cpp @@ -170,7 +170,7 @@ INT_PTR FacebookProto::GetCaps(int type, MCONTACT) return FACEBOOK_MESSAGE_LIMIT; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR) "Facebook ID"; + return (INT_PTR) L"Facebook ID"; } return 0; } diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 5d94dad46c..3d4d606aaa 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -156,7 +156,7 @@ INT_PTR GaduProto::GetCaps(int type, MCONTACT) case PFLAGNUM_5:
return PF2_LONGAWAY;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("Gadu-Gadu Number");
+ return (INT_PTR)TranslateT("Gadu-Gadu Number");
}
return 0;
}
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 34fce1907d..77258fa674 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -485,7 +485,7 @@ INT_PTR CIcqProto::GetCaps(int type, MCONTACT) break; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)Translate("UIN/e-mail/phone"); + return (INT_PTR)TranslateT("UIN/e-mail/phone"); } return nReturn; diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 76995ff9ef..908c078c35 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -34,7 +34,7 @@ static INT_PTR icqGetCaps(WPARAM wParam, LPARAM) return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("ICQ number");
+ return (INT_PTR)TranslateT("ICQ number");
}
return 0;
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 94afd00dd6..ed12929143 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -443,7 +443,7 @@ INT_PTR CIrcProto::GetCaps(int type, MCONTACT) return PF4_NOAUTHDENYREASON | PF4_NOCUSTOMAUTH;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("Nickname");
+ return (INT_PTR)TranslateT("Nickname");
case PFLAG_MAXLENOFMESSAGE:
return 400;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index b91f9bc881..bbaeabc147 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -611,7 +611,7 @@ INT_PTR CJabberProto::GetCaps(int type, MCONTACT hContact) return dwFlags;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("JID");
+ return (INT_PTR)TranslateT("JID");
case PFLAG_MAXCONTACTSPERPACKET:
char szClientJid[JABBER_MAX_JID_LEN];
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index ee936a7b46..d928599a1e 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -96,7 +96,7 @@ INT_PTR MinecraftDynmapProto::GetCaps(int type, MCONTACT) case PFLAG_MAXLENOFMESSAGE: return MINECRAFTDYNMAP_MESSAGE_LIMIT; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR) Translate("Visible name"); + return (INT_PTR) TranslateT("Visible name"); } return 0; } diff --git a/protocols/NewsAggregator/Src/Services.cpp b/protocols/NewsAggregator/Src/Services.cpp index b7abe6146c..96410b14c9 100644 --- a/protocols/NewsAggregator/Src/Services.cpp +++ b/protocols/NewsAggregator/Src/Services.cpp @@ -82,7 +82,7 @@ INT_PTR NewsAggrGetCaps(WPARAM wp, LPARAM) case PFLAGNUM_4: return PF4_AVATARS; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR) "News Feed"; + return (INT_PTR)L"News Feed"; default: return 0; } diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index eee9e19127..00a065c94a 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -99,7 +99,7 @@ INT_PTR OmegleProto::GetCaps(int type, MCONTACT) case PFLAG_MAXLENOFMESSAGE:
return OMEGLE_MESSAGE_LIMIT;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("Visible name");
+ return (INT_PTR)TranslateT("Visible name");
}
return 0;
}
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 594c9d9874..425445fc67 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -119,7 +119,7 @@ INT_PTR CSametimeProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4:
return PF4_SUPPORTTYPING;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("ID");
+ return (INT_PTR)TranslateT("ID");
case PFLAG_MAXLENOFMESSAGE:
return MAX_MESSAGE_SIZE;
default:
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 9547c455fc..4536dc4b8f 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -105,7 +105,7 @@ INT_PTR CSkypeProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4: return PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES | PF4_SERVERMSGID; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)Translate("Skypename"); + return (INT_PTR)TranslateT("Skypename"); } return 0; } diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 80e33876b9..463196b604 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -195,7 +195,7 @@ INT_PTR CSteamProto::GetCaps(int type, MCONTACT) case PFLAGNUM_5: return PF2_HEAVYDND | PF2_FREECHAT; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)Translate("SteamID"); + return (INT_PTR)TranslateT("SteamID"); default: return 0; } diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index c6ad418329..1862bbc926 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -69,7 +69,7 @@ INT_PTR CToxProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4:
return PF4_SINGLEFILEONLY | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)"Tox ID";
+ return (INT_PTR)L"Tox ID";
case PFLAG_MAXLENOFMESSAGE:
return TOX_MAX_MESSAGE_LENGTH;
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index ec930e16c8..bd6a00b815 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -118,7 +118,7 @@ INT_PTR CTwitterProto::GetCaps(int type, MCONTACT) case PFLAG_MAXLENOFMESSAGE:
return 159; // 140 + <max length of a users name (15 apparently)> + 4 ("RT @"). this allows for the new style retweets
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR) "Username";
+ return (INT_PTR)TranslateT("User name");
}
return 0;
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 71c6493afe..291d6d249b 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -503,7 +503,7 @@ INT_PTR CVkProto::GetCaps(int type, MCONTACT) return 4096;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)"VKontakte ID";
+ return (INT_PTR)L"VKontakte ID";
}
return 0;
}
diff --git a/protocols/Weather/src/weather_svcs.cpp b/protocols/Weather/src/weather_svcs.cpp index bc86236668..3b53b7ee74 100644 --- a/protocols/Weather/src/weather_svcs.cpp +++ b/protocols/Weather/src/weather_svcs.cpp @@ -74,7 +74,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM) break; case PFLAG_UNIQUEIDTEXT: - ret = (INT_PTR)Translate("Station ID"); + ret = (INT_PTR)TranslateT("Station ID"); break; } return ret; diff --git a/protocols/WebView/src/webview_services.cpp b/protocols/WebView/src/webview_services.cpp index b1ffa1915b..0800f8938f 100644 --- a/protocols/WebView/src/webview_services.cpp +++ b/protocols/WebView/src/webview_services.cpp @@ -209,7 +209,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM) case PFLAGNUM_5: return PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT; case PFLAG_UNIQUEIDTEXT: - return (INT_PTR)Translate("Site URL"); + return (INT_PTR)TranslateT("Site URL"); default: return 0; } diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp index 8d945d22e9..5126aba275 100644 --- a/protocols/YAMN/src/services.cpp +++ b/protocols/YAMN/src/services.cpp @@ -5,7 +5,7 @@ static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM) if (wParam == PFLAGNUM_4) return PF4_NOCUSTOMAUTH; if (wParam == PFLAG_UNIQUEIDTEXT) - return (INT_PTR)Translate("Nick"); + return (INT_PTR)TranslateT("Nick"); if (wParam == PFLAG_MAXLENOFMESSAGE) return 400; if (wParam == PFLAGNUM_2) diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 8b3ebfd63f..c4d33c788f 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -491,11 +491,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; } if (dat->showProtoId) { - char *szUniqueId = (char*)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); - if (szUniqueId) - SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId); + wchar_t *wszUniqueId = (wchar_t *)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + if (wszUniqueId) + SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, wszUniqueId); else - SetDlgItemText(hwndDlg, IDC_BYPROTOID, TranslateT("Handle")); + SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, TranslateT("Handle")); if (protoCaps & PF1_NUMERICUSERID) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE) | ES_NUMBER); diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 1e3560fd28..f8119452c3 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -71,7 +71,7 @@ INT_PTR Meta_GetCaps(WPARAM wParam, LPARAM) return 2000;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)"Metacontact";
+ return (INT_PTR)L"Metacontact";
}
return 0;
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 1f5913d960..969e9411ea 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -700,13 +700,15 @@ BOOL CAccountListCtrl::OnDrawItem(DRAWITEMSTRUCT *lps) lps->rcItem.top += sz.cy + 2;
if (acc->ppro && Proto_IsProtocolLoaded(acc->szProtoName)) {
- char *szIdName = (char *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
- ptrW tszIdName(szIdName ? mir_a2u(szIdName) : mir_wstrdup(TranslateT("Account ID")));
+ wchar_t *wszIdName = (wchar_t *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
+ if (wszIdName == nullptr)
+ wszIdName = TranslateT("Account ID");
+
ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, 0, acc->szModuleName));
if (tszUniqueID != nullptr)
- text.Format(L"%s: %s", tszIdName.get(), tszUniqueID.get());
+ text.Format(L"%s: %s", wszIdName, tszUniqueID.get());
else
- text.Format(L"%s: %s", tszIdName.get(), TranslateT("<unknown>"));
+ text.Format(L"%s: %s", wszIdName, TranslateT("<unknown>"));
}
else text.Format(TranslateT("Protocol is not loaded."));
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index a904f7984d..38232205d1 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -66,8 +66,6 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) int columnOrder[NUM_COLUMNID];
bool colOrdersValid = true;
for (int i = 0; i < NUM_COLUMNID; i++) {
- bool bNeedsFree = false;
-
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
if (szColumnNames[i] != nullptr)
lvc.pszText = TranslateW(szColumnNames[i]);
@@ -76,10 +74,8 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) lvc.pszText = L"ID";
if (szProto) {
INT_PTR ret = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- if (ret != CALLSERVICE_NOTFOUND) {
- bNeedsFree = true;
- lvc.pszText = mir_a2u((char*)ret);
- }
+ if (ret != CALLSERVICE_NOTFOUND)
+ lvc.pszText = (wchar_t*)ret;
}
}
else lvc.mask &= ~LVCF_TEXT;
@@ -90,9 +86,6 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) lvc.cx = db_get_w(0, "FindAdd", szSetting, defaultColumnSizes[i]);
ListView_InsertColumn(hwndResults, i, (LPARAM)&lvc);
- if (bNeedsFree)
- mir_free(lvc.pszText);
-
mir_snprintf(szSetting, "ColOrder%d", i);
columnOrder[i] = db_get_b(0, "FindAdd", szSetting, -1);
if (columnOrder[i] == -1 || columnOrder[i] >= NUM_COLUMNID)
|