From ed4897b7ef69e862806a8c07f1fd475262d0c36e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jul 2019 20:58:51 +0300 Subject: massive warning fix --- plugins/Clist_modern/src/modern_cachefuncs.cpp | 4 +- plugins/Clist_modern/src/modern_statusbar.cpp | 2 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 12 ++--- plugins/Db3x_mmap/src/dbcrypt.cpp | 8 ++-- plugins/Db3x_mmap/src/ui.cpp | 2 +- plugins/DbEditorPP/src/copymodule.cpp | 2 +- plugins/DbEditorPP/src/deletemodule.cpp | 2 +- plugins/DbEditorPP/src/main.cpp | 4 +- plugins/DbEditorPP/src/watchedvars.cpp | 3 +- plugins/IEView/src/ChatHTMLBuilder.cpp | 2 +- plugins/IEView/src/HistoryHTMLBuilder.cpp | 6 +-- plugins/IEView/src/MUCCHTMLBuilder.cpp | 8 ++-- plugins/IEView/src/ScriverHTMLBuilder.cpp | 10 ++--- plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 12 ++--- plugins/Import/src/import.cpp | 4 +- plugins/MirLua/src/script_loader.cpp | 4 +- plugins/PluginUpdater/src/Utils.cpp | 10 ++--- plugins/Scriver/src/infobar.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 2 +- plugins/SmileyAdd/src/smileys.cpp | 2 +- plugins/TabSRMM/src/chat_tools.cpp | 2 +- plugins/TabSRMM/src/eventpopups.cpp | 13 ++---- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/modplus.cpp | 4 +- plugins/TabSRMM/src/sendlater.cpp | 3 +- plugins/TabSRMM/src/sendqueue.cpp | 8 ++-- plugins/TabSRMM/src/sidebar.cpp | 52 ++++++++++------------ plugins/TabSRMM/src/sidebar.h | 2 +- plugins/TabSRMM/src/utils.h | 2 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 2 +- .../src/ex_import/classExImContactBase.cpp | 4 +- .../src/ex_import/classExImContactXML.cpp | 2 +- plugins/Variables/src/contact.cpp | 2 +- plugins/Variables/src/parse_metacontacts.cpp | 6 +-- plugins/Variables/src/parse_miranda.cpp | 2 +- protocols/CloudFile/src/http_request.h | 6 +-- protocols/Discord/src/proto.cpp | 2 +- protocols/Gadu-Gadu/src/avatar.cpp | 2 +- protocols/Gadu-Gadu/src/core.cpp | 6 +-- protocols/Gadu-Gadu/src/gg.cpp | 2 +- protocols/Gadu-Gadu/src/services.cpp | 2 +- protocols/ICQ-WIM/src/utils.cpp | 2 +- protocols/JabberG/src/jabber_byte.cpp | 2 +- protocols/JabberG/src/jabber_chat.cpp | 14 +++--- protocols/JabberG/src/jabber_events.cpp | 4 +- protocols/JabberG/src/jabber_file.cpp | 4 +- protocols/JabberG/src/jabber_groupchat.cpp | 4 +- protocols/JabberG/src/jabber_iqid.cpp | 2 +- protocols/JabberG/src/jabber_menu.cpp | 4 +- protocols/JabberG/src/jabber_misc.cpp | 8 ++-- protocols/JabberG/src/jabber_opt.cpp | 2 +- protocols/JabberG/src/jabber_search.cpp | 2 +- protocols/JabberG/src/jabber_secur.cpp | 6 +-- protocols/JabberG/src/jabber_thread.cpp | 6 +-- protocols/MSN/src/msn_auth.cpp | 4 +- protocols/MSN/src/msn_chat.cpp | 4 +- protocols/MSN/src/msn_ieembed.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 4 +- protocols/MSN/src/msn_proto.cpp | 3 +- protocols/MSN/src/msn_skypeab.cpp | 15 ++++--- protocols/MSN/src/msn_soapab.cpp | 2 +- protocols/NewsAggregator/Src/Authentication.cpp | 2 +- protocols/Omegle/src/communication.cpp | 2 +- protocols/Sametime/src/sametime_proto.cpp | 2 +- protocols/Sametime/src/sametime_session.cpp | 2 +- protocols/SkypeWeb/src/requests/asm/files.h | 4 +- protocols/SkypeWeb/src/requests/capabilities.h | 2 +- protocols/SkypeWeb/src/requests/chatrooms.h | 16 +++---- protocols/SkypeWeb/src/requests/endpoint.h | 4 +- protocols/SkypeWeb/src/requests/history.h | 8 ++-- protocols/SkypeWeb/src/requests/messages.h | 8 ++-- protocols/SkypeWeb/src/requests/poll.h | 2 +- protocols/SkypeWeb/src/requests/status.h | 2 +- protocols/SkypeWeb/src/requests/subscriptions.h | 4 +- protocols/SkypeWeb/src/skype_avatars.cpp | 4 +- protocols/SkypeWeb/src/skype_files.cpp | 8 ++-- protocols/SkypeWeb/src/skype_profile.cpp | 2 +- protocols/Steam/src/steam_avatars.cpp | 4 +- protocols/Steam/src/steam_contacts.cpp | 20 ++++----- protocols/Steam/src/steam_messages.cpp | 2 +- protocols/Tox/src/tox_accounts.cpp | 2 +- protocols/Tox/src/tox_avatars.cpp | 6 +-- protocols/Tox/src/tox_transfer.cpp | 2 +- protocols/VKontakte/src/misc.cpp | 2 +- protocols/VKontakte/src/vk_avatars.cpp | 4 +- protocols/VKontakte/src/vk_chats.cpp | 16 +++---- protocols/VKontakte/src/vk_history.cpp | 4 +- protocols/VKontakte/src/vk_pollserver.cpp | 7 +-- protocols/VKontakte/src/vk_proto.cpp | 4 +- protocols/VKontakte/src/vk_thread.cpp | 2 +- protocols/Weather/src/weather_update.cpp | 8 ++-- protocols/YAMN/src/browser/mailbrowser.cpp | 2 +- src/mir_app/src/clisttray.cpp | 6 +-- src/mir_app/src/db_events.cpp | 20 ++++----- src/mir_app/src/db_ini.cpp | 2 +- src/mir_app/src/netlibbind.cpp | 2 +- src/mir_app/src/netlibopenconn.cpp | 2 +- src/mir_app/src/options.cpp | 2 +- src/mir_app/src/profilemanager.cpp | 2 +- src/mir_app/src/proto_opts.cpp | 6 +-- src/mir_app/src/srmm_toolbar.cpp | 4 +- src/mir_core/src/winver.cpp | 2 +- 103 files changed, 259 insertions(+), 269 deletions(-) diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index cdaea88e47..cb9afa6e86 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -404,7 +404,7 @@ LBL_Status: ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusMsg")); if (tszXStatusMsg != nullptr && tszXStatusMsg[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); - mir_snwprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg); + mir_snwprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg.get()); CopySkipUnprintableChars(text, text, text_size - 1); } } @@ -426,7 +426,7 @@ LBL_Status: ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusName")); if (tszXStatusName != nullptr && tszXStatusName[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); - mir_snwprintf(text, text_size, L"%s: %s", tszXStatusName, tmp); + mir_snwprintf(text, text_size, L"%s: %s", tszXStatusName.get(), tmp); CopySkipUnprintableChars(text, text, text_size - 1); } } diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index ff6ee9fa94..fb968fb775 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -246,7 +246,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) p->bIsDimmed = 0; if (g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS) { char szTemp[2048]; - mir_snprintf(szTemp, "%s|", p->szAccountName); + mir_snprintf(szTemp, "%s|", p->szAccountName.get()); p->bIsDimmed = strstr(g_CluiData.protoFilter, szTemp) ? 0 : 1; } diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index ef58779033..b0877304fa 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -500,23 +500,23 @@ static void UpdateFilters() mir_snwprintf(szTemp, TranslateT("Configuring view mode: %s"), szTempBuf); SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp); } - mir_snprintf(szSetting, "%c%s_PF", 246, szBuf); + mir_snprintf(szSetting, "%c%s_PF", 246, szBuf.get()); ptrA szPF(db_get_sa(0, CLVM_MODULE, szSetting)); if (szPF == nullptr) return; - mir_snprintf(szSetting, "%c%s_GF", 246, szBuf); + mir_snprintf(szSetting, "%c%s_GF", 246, szBuf.get()); ptrW szGF(db_get_wsa(0, CLVM_MODULE, szSetting)); if (szGF == nullptr) return; - mir_snprintf(szSetting, "%c%s_OPT", 246, szBuf); + mir_snprintf(szSetting, "%c%s_OPT", 246, szBuf.get()); if ((opt = db_get_dw(0, CLVM_MODULE, szSetting, -1)) != -1) SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0)); - mir_snprintf(szSetting, "%c%s_SM", 246, szBuf); + mir_snprintf(szSetting, "%c%s_SM", 246, szBuf.get()); DWORD statusMask = db_get_dw(0, CLVM_MODULE, szSetting, 0); - mir_snprintf(szSetting, "%c%s_SSM", 246, szBuf); + mir_snprintf(szSetting, "%c%s_SSM", 246, szBuf.get()); stickyStatusMask = db_get_dw(0, CLVM_MODULE, szSetting, -1); dwFlags = db_get_dw(0, CLVM_MODULE, szBuf, 0); { @@ -589,7 +589,7 @@ static void UpdateFilters() EnableWindow(GetDlgItem(clvmHwnd, IDC_LASTMSGVALUE), useLastMsg); EnableWindow(GetDlgItem(clvmHwnd, IDC_LASTMESSAGEUNIT), useLastMsg); - mir_snprintf(szSetting, "%c%s_LM", 246, szBuf); + mir_snprintf(szSetting, "%c%s_LM", 246, szBuf.get()); DWORD lmdat = db_get_dw(0, CLVM_MODULE, szSetting, 0); SetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE); diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 230c717ccb..21798eae69 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -43,12 +43,14 @@ struct VarDescr { VarDescr(LPCSTR var, LPCSTR value) : szVar(mir_strdup(var)), - szValue(mir_strdup(value)) + szValue(mir_strdup(value)), + iLen(0) {} VarDescr(LPCSTR var, LPSTR value) : szVar(mir_strdup(var)), - szValue(value) + szValue(value), + iLen(0) {} VarDescr(LPCSTR var, PBYTE value, int len) : @@ -58,7 +60,7 @@ struct VarDescr {} ptrA szVar, szValue; - int iLen; + int iLen; }; struct SettingUgraderParam diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index 610d378321..d1374638bd 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -333,7 +333,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM) SET_UID(mi, 0x50321866, 0xba1, 0x46dd, 0xb3, 0xa6, 0xc3, 0xcc, 0x55, 0xf2, 0x42, 0x9e); mi.flags = CMIF_UNICODE; - mi.hIcolibItem = iconList[1].hIcolib; + mi.hIcolibItem = iconList[0].hIcolib; mi.name.w = db->GetMenuTitle(); mi.pszService = MS_DB_CHANGEPASSWORD; hSetPwdMenu = Menu_AddMainMenuItem(&mi); diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index e0adfe2812..00fe3d5ef7 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -28,7 +28,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar mac = (ModuleAndContact *)lParam; wchar_t name[NAME_SIZE], msg[MSG_SIZE]; - mir_snwprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module)); + mir_snwprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module).get()); SetWindowText(hwnd, msg); for (auto &hContact : Contacts()) { diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 343aa625da..fadb491816 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -10,7 +10,7 @@ int deleteModule(MCONTACT hContact, const char *module, int confirm) if (confirm && g_plugin.getByte("WarnOnDelete", 1)) { wchar_t text[MSG_SIZE]; - mir_snwprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module)); + mir_snwprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module).get()); if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO) return 0; } diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 939a1b554d..af14893ded 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -478,9 +478,9 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max if (szProto && szProto[0]) { if (g_Order) - mir_snwprintf(value, maxlen, L"(%s) %s", _A2T(szProto), name); + mir_snwprintf(value, maxlen, L"(%S) %s", szProto, name); else - mir_snwprintf(value, maxlen, L"%s (%s)", name, _A2T(szProto)); + mir_snwprintf(value, maxlen, L"%s (%S)", name, szProto); } else mir_wstrncpy(value, name, maxlen); diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 7cd8ef85b5..c1c10266e5 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -351,7 +351,8 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) // 2nd line int type = GetValue(hContact, module, setting, value, _countof(value)); - mir_snwprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""), _A2T(module), _A2T(setting), DBVType(type), value); + mir_snwprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""), + _A2T(module).get(), _A2T(setting).get(), DBVType(type), value); POPUPDATAW ppd; ppd.lchContact = (MCONTACT)hContact; diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 0c95589461..9e8b8cc5a7 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -239,7 +239,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) str.AppendFormat("%s ", timestampToString(eventData->time)); if ((dwData & IEEDD_GC_SHOW_NICK) && eventData->iType == IEED_GC_EVENT_MESSAGE) - str.AppendFormat("%s: ", isSent ? "nameOut" : "nameIn", szName); + str.AppendFormat("%s: ", isSent ? "nameOut" : "nameIn", szName.get()); if (dwData & IEEDD_GC_MSG_ON_NEW_LINE) str.Append("
"); diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 11725edb12..e119e4c84a 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -258,12 +258,12 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event else str.Append(" "); - str.AppendFormat("%s:", isSent ? "nameOut" : "nameIn", szName); + str.AppendFormat("%s:", isSent ? "nameOut" : "nameIn", szName.get()); str.AppendFormat("%s
", isSent ? "timeOut" : "timeIn", timestampToString(eventData->time)); if (eventData->iType == IEED_EVENT_FILE) - str.AppendFormat("%s:
%s", isSent ? Translate("Outgoing File Transfer") : Translate("Incoming File Transfer"), szText); + str.AppendFormat("%s:
%s", isSent ? Translate("Outgoing File Transfer") : Translate("Incoming File Transfer"), szText.get()); else - str.AppendFormat("%s", szText); + str.Append(szText); str.Append("\n"); setLastEventType(MAKELONG(eventData->dwFlags, eventData->iType)); diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index c59be8a15d..f7885430c1 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -202,7 +202,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) str.AppendFormat("%s ", isSent ? "timestamp" : "timestamp", timestampToString(dwData, eventData->time)); if (dwData & IEEDD_MUCC_SHOW_NICK) - str.AppendFormat("%s: ", isSent ? "nameOut" : "nameIn", szName); + str.AppendFormat("%s: ", isSent ? "nameOut" : "nameIn", szName.get()); if (dwData & IEEDD_MUCC_MSG_ON_NEW_LINE) str.Append("
"); @@ -222,7 +222,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) style.AppendFormat("font-style: %s;", eventData->fontStyle & IE_FONT_ITALIC ? "italic" : "normal"); style.AppendFormat("text-decoration: %s;", eventData->fontStyle & IE_FONT_UNDERLINE ? "underline" : "none"); } - str.AppendFormat("%s", className, style.c_str(), szText); + str.AppendFormat("%s", className, style.c_str(), szText.get()); str.Append("\n"); } else if (eventData->iType == IEED_MUCC_EVENT_JOINED || eventData->iType == IEED_MUCC_EVENT_LEFT || eventData->iType == IEED_MUCC_EVENT_TOPIC) { @@ -250,7 +250,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) str.AppendFormat("%s ", "timestamp", timestampToString(dwData, eventData->time)); str.AppendFormat("", className); - str.AppendFormat(Translate(eventText), szText); + str.AppendFormat(Translate(eventText), szText.get()); str.Append(""); str.Append("\n"); } @@ -258,7 +258,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) const char *className = "error"; szText = encodeUTF8(NULL, event->pszProto, eventData->pszText, ENF_NONE, isSent); str.AppendFormat("
", "divError"); - str.AppendFormat(" %s: %s", className, Translate("Error"), szText); + str.AppendFormat(" %s: %s", className, Translate("Error"), szText.get()); str.Append("
\n"); } diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 8157734247..bcb7096ba5 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -354,9 +354,9 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event if ((dwFlags & SMF_LOG_SHOWNICK && eventData->iType == IEED_EVENT_MESSAGE && isGroupBreak) || eventData->iType == IEED_EVENT_STATUSCHANGE) { if (eventData->iType == IEED_EVENT_MESSAGE) { if (showColon) - str.AppendFormat(" %s", isSent ? "nameOut" : "nameIn", szName); + str.AppendFormat(" %s", isSent ? "nameOut" : "nameIn", szName.get()); else - str.AppendFormat("%s", isSent ? "nameOut" : "nameIn", szName); + str.AppendFormat("%s", isSent ? "nameOut" : "nameIn", szName.get()); showColon = true; if (dwFlags & SMF_LOG_GROUPMESSAGES) { @@ -364,7 +364,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event showColon = false; } } - else str.AppendFormat("%s ", szName); + else str.AppendFormat("%s ", szName.get()); } if (dwFlags & SMF_LOG_SHOWTIME && dwFlags & SMF_LOG_GROUPMESSAGES && dwFlags & SMF_LOG_MARKFOLLOWUPS && eventData->iType == IEED_EVENT_MESSAGE && isGroupBreak) { @@ -384,9 +384,9 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event if (eventData->iType == IEED_EVENT_FILE) { str.AppendFormat("%s: %s", className, - (isSent) ? Translate("File sent") : Translate("File received"), szText); + (isSent) ? Translate("File sent") : Translate("File received"), szText.get()); } - else str.AppendFormat("%s", className, szText); + else str.AppendFormat("%s", className, szText.get()); str.Append("\n"); setLastEventType(MAKELONG(eventData->dwFlags, eventData->iType)); diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index d4910a93c9..1b51148521 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -352,9 +352,9 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event else className = isSent ? "hNameOut" : "hNameIn"; if (dwFlags & MWF_LOG_UNDERLINE) - str.AppendFormat("%s%s", className, szName, (dwFlags & MWF_LOG_SHOWTIME) ? " " : ": "); + str.AppendFormat("%s%s", className, szName.get(), (dwFlags & MWF_LOG_SHOWTIME) ? " " : ": "); else - str.AppendFormat("%s%s", className, szName, (dwFlags & MWF_LOG_SHOWTIME) ? " " : ": "); + str.AppendFormat("%s%s", className, szName.get(), (dwFlags & MWF_LOG_SHOWTIME) ? " " : ": "); } if (dwFlags & MWF_LOG_SHOWTIME && (isGroupBreak || dwFlags2 & MWF_SHOW_MARKFOLLOWUPTS)) { const char *className; @@ -371,7 +371,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event } if ((eventData->iType == IEED_EVENT_STATUSCHANGE) || ((dwFlags & MWF_LOG_SHOWNICK) && !(dwFlags & MWF_LOG_SWAPNICK) && isGroupBreak)) { if (eventData->iType == IEED_EVENT_STATUSCHANGE) - str.AppendFormat("%s ", szName); + str.AppendFormat("%s ", szName.get()); else { const char *className = ""; if (!isHistory) @@ -379,9 +379,9 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event else className = isSent ? "hNameOut" : "hNameIn"; if (dwFlags & MWF_LOG_UNDERLINE) - str.AppendFormat("%s: ", className, szName); + str.AppendFormat("%s: ", className, szName.get()); else - str.AppendFormat("%s: ", className, szName); + str.AppendFormat("%s: ", className, szName.get()); } } if (dwFlags & MWF_LOG_NEWLINE && eventData->iType != IEED_EVENT_STATUSCHANGE && eventData->iType != IEED_EVENT_ERRMSG && isGroupBreak) @@ -397,7 +397,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event else if (eventData->iType == IEED_EVENT_STATUSCHANGE) className = "statusChange"; - str.AppendFormat("%s", className, szText); + str.AppendFormat("%s", className, szText.get()); str.Append("\n"); setLastEventType(MAKELONG(eventData->dwFlags, eventData->iType)); setLastEventTime(eventData->time); diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 5b6c728eed..b0edaa5298 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -674,7 +674,7 @@ void CImportBatch::ImportMeta(DBCachedContact *ccSrc) if (tszNick && *tszNick) { db_set_ws(hDest, "CList", "MyHandle", tszNick); - AddMessage(LPGENW("Added metacontact '%s'"), tszNick); + AddMessage(LPGENW("Added metacontact '%s'"), tszNick.get()); } else AddMessage(LPGENW("Added metacontact")); } @@ -803,7 +803,7 @@ MCONTACT CImportBatch::ImportContact(MCONTACT hSrc) if (tszNick && *tszNick) { db_set_ws(hDst, "CList", "MyHandle", tszNick); - AddMessage(LPGENW("Added %S contact %s, '%s'"), szDstModuleName, pszUniqueID, tszNick); + AddMessage(LPGENW("Added %S contact %s, '%s'"), szDstModuleName, pszUniqueID, tszNick.get()); } else AddMessage(LPGENW("Added %S contact %s"), szDstModuleName, pszUniqueID); diff --git a/plugins/MirLua/src/script_loader.cpp b/plugins/MirLua/src/script_loader.cpp index 32ff9346f8..f480c261e1 100644 --- a/plugins/MirLua/src/script_loader.cpp +++ b/plugins/MirLua/src/script_loader.cpp @@ -17,12 +17,12 @@ void CMLuaScriptLoader::SetPaths() FoldersGetCustomPathW(g_hCLibsFolder, path, _countof(path), VARSW(MIRLUA_PATHT)); pathA = mir_utf8encodeW(path); - lua_pushfstring(L, "%s\\?.%s", pathA, _T2A(LUACLIBSCRIPTEXT)); + lua_pushfstring(L, "%s\\?.%s", pathA.get(), _T2A(LUACLIBSCRIPTEXT).get()); lua_setfield(L, -2, "cpath"); FoldersGetCustomPathW(g_hScriptsFolder, path, _countof(path), VARSW(MIRLUA_PATHT)); pathA = mir_utf8encodeW(path); - lua_pushfstring(L, "%s\\?.%s;%s\\?.%s", pathA, _T2A(LUATEXTSCRIPTEXT), pathA, _T2A(LUAPRECSCRIPTEXT)); + lua_pushfstring(L, "%s\\?.%s;%s\\?.%s", pathA.get(), _T2A(LUATEXTSCRIPTEXT).get(), pathA.get(), _T2A(LUAPRECSCRIPTEXT).get()); lua_setfield(L, -2, "path"); lua_pop(L, 1); diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 321ce1bd71..335a85b5f6 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -143,7 +143,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) // Download version info FILEURL pFileUrl; - mir_snwprintf(pFileUrl.tszDownloadURL, L"%s/hashes.zip", baseUrl); + mir_snwprintf(pFileUrl.tszDownloadURL, L"%s/hashes.zip", baseUrl.get()); mir_snwprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath); pFileUrl.CRCsum = 0; @@ -152,19 +152,19 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) Netlib_CloseHandle(nlc); if (!ret) { - Netlib_LogfW(hNetlibUser,L"Downloading list of available updates from %s failed",baseUrl); + Netlib_LogfW(hNetlibUser, L"Downloading list of available updates from %s failed", baseUrl.get()); ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR); Skin_PlaySound("updatefailed"); return false; } - if(!unzip(pFileUrl.tszDiskPath, g_tszTempPath, nullptr,true)) { - Netlib_LogfW(hNetlibUser,L"Unzipping list of available updates from %s failed",baseUrl); + if (!unzip(pFileUrl.tszDiskPath, g_tszTempPath, nullptr, true)) { + Netlib_LogfW(hNetlibUser, L"Unzipping list of available updates from %s failed", baseUrl.get()); ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR); Skin_PlaySound("updatefailed"); return false; } - + DeleteFile(pFileUrl.tszDiskPath); wchar_t tszTmpIni[MAX_PATH] = {0}; diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index f043c0a554..6cd62573ff 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -83,7 +83,7 @@ void CSrmmWindow::RefreshInfobar() wchar_t szText[2048]; SETTEXTEX st; if (szXStatusMsg && *szXStatusMsg) - mir_snwprintf(szText, L"%s (%s)", TranslateW(szXStatusName), szXStatusMsg); + mir_snwprintf(szText, L"%s (%s)", TranslateW(szXStatusName), szXStatusMsg.get()); else if (szXStatusName && *szXStatusName) wcsncpy_s(szText, TranslateW(szXStatusName), _TRUNCATE); else diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index ddc1f27bda..25147078a3 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -960,7 +960,7 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) ptrW pszWord(GetRichTextWord(m_log.GetHwnd(), &ptl)); if (pszWord && pszWord[0]) { wchar_t szMenuText[4096]; - mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWord); + mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWord.get()); ModifyMenu(hSubMenu, 5, MF_STRING | MF_BYPOSITION, 5, szMenuText); SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList); } diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 100d695ddb..4a8a033588 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -237,7 +237,7 @@ void SmileyType::CallSmileyService(MCONTACT hContact) } char str[MAXMODULELABELLENGTH]; - mir_snprintf(str, "%s%s", proto, _T2A(name.c_str())); + mir_snprintf(str, "%s%S", proto, name.c_str()); CallService(str, ConvertServiceParam(hContact, par1.c_str()), ConvertServiceParam(hContact, par2.c_str())); diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index ca0c7955d4..c693595013 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -105,7 +105,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa pd.lchIcon = LoadIconEx("window"); PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName); - mir_snwprintf(pd.lpwzContactName, L"%s - %s", (pa == nullptr) ? _A2T(pszProtoName) : pa->tszAccountName, Clist_GetContactDisplayName(hContact)); + mir_snwprintf(pd.lpwzContactName, L"%s - %s", (pa == nullptr) ? _A2T(pszProtoName).get() : pa->tszAccountName, Clist_GetContactDisplayName(hContact)); wcsncpy_s(pd.lpwzText, TranslateW(szBuf), _TRUNCATE); pd.iSeconds = g_Settings.iPopupTimeout; diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 0f0890098c..0ce8f1b1c9 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -283,13 +283,13 @@ static wchar_t* GetPreviewT(WORD eventType, DBEVENTINFO *dbe) if (szDescr && Utils::safe_strlen(szDescr, dbe->cbBlob - sizeof(DWORD) - namelength - 1) > 0) { ptrW tszDescr(DbEvent_GetString(dbe, szDescr)); if (tszFileName && tszDescr) { - mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, tszDescr); + mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName.get(), tszDescr.get()); return mir_wstrdup(buf); } } if (tszFileName) { - mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, TranslateT("No description given")); + mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName.get(), TranslateT("No description given")); return mir_wstrdup(buf); } } @@ -441,13 +441,8 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve pdata->eventData[0].tszText[MAX_SECONDLINE - 1] = 0; pdata->nrEventsAlloced = NR_MERGED; pdata->nrMerged = 1; - - // fix for broken popups -- process failures - if (PUAddPopupW(&pud) < 0) { - mir_free(pdata->eventData); - mir_free(pdata); - } - else arPopupList.insert(pdata); + PUAddPopupW(&pud); + arPopupList.insert(pdata); if (dbe.pBlob) mir_free(dbe.pBlob); diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index cbef09d56a..aea8159720 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -277,7 +277,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckMenuItem(submenu, ID_TRAYCONTEXT_DISABLEALLPOPUPS, MF_BYCOMMAND | (nen_options.iDisable ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(submenu, ID_TRAYCONTEXT_DON40223, MF_BYCOMMAND | (nen_options.iNoSounds ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(submenu, ID_TRAYCONTEXT_DON, MF_BYCOMMAND | (nen_options.iNoAutoPopup ? MF_CHECKED : MF_UNCHECKED)); - EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport) ? MF_ENABLED : MF_GRAYED); + EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_ENABLED : MF_GRAYED)); CheckMenuItem(submenu, ID_TRAYCONTEXT_SHOWTHETRAYICON, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_CHECKED : MF_UNCHECKED)); BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (iSelection) { diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 33dd5f359a..3c3684dc8b 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -497,7 +497,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) wchar_t temp[256]; ptrW szVersion(db_get_wsa(m_dat->m_cache->getActiveContact(), m_dat->m_cache->getActiveProto(), "MirVer")); if (szVersion) - mir_snwprintf(temp, TranslateT(" Client: %s"), szVersion); + mir_snwprintf(temp, TranslateT(" Client: %s"), szVersion.get()); else mir_snwprintf(temp, TranslateT(" Client not cached yet")); wcscat_s(szBuf, 256, temp); diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 10cf7aaab3..8d7215bddf 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -100,7 +100,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, nullptr); if (res != 0) { bufSize = textlenght + mir_wstrlen(arMenuLines[res-1]) + 2; - pwszFormatedText.Format(arMenuLines[res-1], pszText); + pwszFormatedText.Format(arMenuLines[res-1], pszText.get()); } for (auto &it : arMenuLines) @@ -110,7 +110,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) else if (textlenght) { SendDlgItemMessage(cbcd->hwndFrom, IDC_SRMM_MESSAGE, EM_GETSELTEXT, 0, (LPARAM)pszText); - pwszFormatedText.Format(L"[img]%s[/img]", pszText); + pwszFormatedText.Format(L"[img]%s[/img]", pszText.get()); bbd.pwszTooltip = nullptr; bbd.hIcon = nullptr; diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 892a4c1910..456f10b32e 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -294,14 +294,13 @@ int CSendLater::addJob(const char *szSetting, void *lParam) else return 0; } - else if (szSetting[0] == 'M') { + else { char *szSep = strchr(const_cast(szSetting), '|'); if (!szSep) return 0; *szSep = 0; szOrig_Utf = szSep + 1; } - else return 0; CSendLaterJob *job = new CSendLaterJob; diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index ea6daa21ea..b43c0b1c8a 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -583,21 +583,21 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b time_t now = time(0); wchar_t tszTimestamp[30]; wcsftime(tszTimestamp, _countof(tszTimestamp), L"%Y.%m.%d - %H:%M", _localtime32((__time32_t *)&now)); - mir_snprintf(szKeyName, "S%d", now); + mir_snprintf(szKeyName, "S%d", (int)now); mir_snwprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp); } - else mir_snwprintf(tszHeader, L"M%d|", time(0)); + else mir_snwprintf(tszHeader, L"M%d|", (int)time(0)); T2Utf utf_header(tszHeader); size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10; char *tszMsg = reinterpret_cast(mir_alloc(required)); if (fIsSendLater) { - mir_snprintf(tszMsg, required, "%s%s", job->szSendBuffer, utf_header); + mir_snprintf(tszMsg, required, "%s%s", job->szSendBuffer, utf_header.get()); db_set_s(hContact ? hContact : job->hContact, "SendLater", szKeyName, tszMsg); } else { - mir_snprintf(tszMsg, required, "%s%s", utf_header, job->szSendBuffer); + mir_snprintf(tszMsg, required, "%s%s", utf_header.get(), job->szSendBuffer); sendLater->addJob(tszMsg, (void*)hContact); } mir_free(tszMsg); diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index ade164bd21..5f43e104c4 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -691,18 +691,16 @@ const CSideBarButton* CSideBar::setActiveItem(const CTabBaseDlg *dat) * Layout() with the parameter set to false is required to perform the * position update. */ -void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) +void CSideBar::Layout() { if (!m_isVisible) return; - RECT rcWnd; - - rc = &rcWnd; + RECT rcWnd; ::GetClientRect(m_hwndScrollWnd, &rcWnd); if (m_currentLayout->pfnLayout) { - m_currentLayout->pfnLayout(this, const_cast(rc)); + m_currentLayout->pfnLayout(this, &rcWnd); return; } @@ -711,8 +709,8 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) BOOL topEnabled = FALSE, bottomEnabled = FALSE; HWND hwnd; LONG spaceUsed = 0; - DWORD dwFlags = SWP_NOZORDER | SWP_NOACTIVATE; - LONG iSpaceAvail = rc->bottom; + DWORD dwFlags = SWP_NOZORDER | SWP_NOACTIVATE; + LONG iSpaceAvail = rcWnd.bottom; m_firstVisibleOffset = max(0, m_firstVisibleOffset); @@ -734,14 +732,14 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) if (p->isTopAligned()) { if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible - if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */ + if (nullptr != hwnd) /* Wine fix. */ hdwp = ::DeferWindowPos(hdwp, hwnd, nullptr, 2, -(m_firstVisibleOffset - m_totalItemHeight), m_elementWidth, height, SWP_SHOWWINDOW | dwFlags); spaceUsed += ((height + 1) - (m_firstVisibleOffset - m_totalItemHeight)); m_totalItemHeight += (height + 1); } else { - if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */ + if (nullptr != hwnd) /* Wine fix. */ hdwp = ::DeferWindowPos(hdwp, hwnd, nullptr, 2, spaceUsed, m_elementWidth, height, SWP_SHOWWINDOW | dwFlags); spaceUsed += (height + 1); m_totalItemHeight += (height + 1); @@ -749,30 +747,28 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) } } topEnabled = m_firstVisibleOffset > 0; - bottomEnabled = (m_totalItemHeight - m_firstVisibleOffset > rc->bottom); + bottomEnabled = (m_totalItemHeight - m_firstVisibleOffset > rcWnd.bottom); ::EndDeferWindowPos(hdwp); - if (!fOnlyCalc) { - RECT rcContainer; - ::GetClientRect(m_pContainer->m_hwnd, &rcContainer); - - LONG dx = m_dwFlags & SIDEBARORIENTATION_LEFT ? m_pContainer->m_tBorder_outer_left : - rcContainer.right - m_pContainer->m_tBorder_outer_right - (m_elementWidth + 4); - - ::SetWindowPos(m_up->getHwnd(), nullptr, dx, m_pContainer->m_tBorder_outer_top + m_pContainer->m_pMenuBar->getHeight(), - m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW); - ::SetWindowPos(m_down->getHwnd(), nullptr, dx, (rcContainer.bottom - 14 - m_pContainer->m_statusBarHeight - 1), - m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW); - ::EnableWindow(m_up->getHwnd(), topEnabled); - ::EnableWindow(m_down->getHwnd(), bottomEnabled); - ::InvalidateRect(m_up->getHwnd(), nullptr, FALSE); - ::InvalidateRect(m_down->getHwnd(), nullptr, FALSE); - } + RECT rcContainer; + ::GetClientRect(m_pContainer->m_hwnd, &rcContainer); + + LONG dx = m_dwFlags & SIDEBARORIENTATION_LEFT ? m_pContainer->m_tBorder_outer_left : + rcContainer.right - m_pContainer->m_tBorder_outer_right - (m_elementWidth + 4); + + ::SetWindowPos(m_up->getHwnd(), nullptr, dx, m_pContainer->m_tBorder_outer_top + m_pContainer->m_pMenuBar->getHeight(), + m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW); + ::SetWindowPos(m_down->getHwnd(), nullptr, dx, (rcContainer.bottom - 14 - m_pContainer->m_statusBarHeight - 1), + m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW); + ::EnableWindow(m_up->getHwnd(), topEnabled); + ::EnableWindow(m_down->getHwnd(), bottomEnabled); + ::InvalidateRect(m_up->getHwnd(), nullptr, FALSE); + ::InvalidateRect(m_down->getHwnd(), nullptr, FALSE); } inline void CSideBar::Invalidate() { - Layout(nullptr); + Layout(); } void CSideBar::showAll(int showCmd) @@ -836,7 +832,7 @@ void CSideBar::processScrollerButtons(UINT commandID) else if (commandID == IDC_SIDEBARUP && ::IsWindowEnabled(m_up->getHwnd())) m_firstVisibleOffset = max(0, m_firstVisibleOffset - 10); - Layout(nullptr); + Layout(); } void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG, LONG height) const diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index 41a99fe912..424cfd0269 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -135,7 +135,7 @@ public: void updateSession(CTabBaseDlg *dat); void processScrollerButtons(UINT cmd); - void Layout(const RECT *rc = nullptr, bool fOnlyCalc = false); + void Layout(); void setVisible(bool fNewVisibility); void showAll(int showCmd); diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 96729013d1..261cebca55 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -160,7 +160,7 @@ private: UINT m_uId; HFONT m_hFontCaption; DWORD m_dwFlags; - HWND m_hwnd; + HWND m_hwnd = nullptr; bool m_fIsModal; INT_PTR CALLBACK dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 666dbf5235..ae3378cfff 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -120,7 +120,7 @@ private: // check if icq is online if (!IsProtoOnline((*_pPd)->szModuleName)) MsgBox(_pPs->hDlg, MB_ICON_WARNING, TranslateT("Upload details"), - CMStringW(FORMAT, TranslateT("Protocol '%s' is offline"), _A2T((*_pPd)->szModuleName)), + CMStringW(FORMAT, TranslateT("Protocol '%s' is offline"), _A2T((*_pPd)->szModuleName).get()), TranslateT("You are not currently connected to the ICQ network.\nYou must be online in order to update your information on the server.\n\nYour changes will be saved to database only.")); // start uploading process diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 36896aa558..19dc88f493 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -294,9 +294,9 @@ void CExImContactBase::toIni(FILE* file, int modCount) ptrW pszCI(Contact_GetInfo(CNF_DISPLAY, _hContact, _pszProto)); ptrA pszUID(uid2String(FALSE)); if (_pszUIDKey && pszUID) - mir_snprintf(name, "%S *(%s)*<%s>*{%s}*", pszCI, _pszProto, _pszUIDKey, pszUID); + mir_snprintf(name, "%S *(%s)*<%s>*{%s}*", pszCI.get(), _pszProto, _pszUIDKey, pszUID.get()); else - mir_snprintf(name, "%S (%s)", pszCI, _pszProto); + mir_snprintf(name, "%S (%s)", pszCI.get(), _pszProto); } // it is not the best solution (but still works if only basic modules export) - need rework diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 82cefe4a85..499878340a 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -673,7 +673,7 @@ int CExImContactXML::Import(BYTE keepMetaSubContact) do { // update progressbar and abort if user clicked cancel int result = _pXmlFile->_progress.UpdateContact(L"Sub Contact: %s (%S)", - ptrW(mir_utf8decodeW(xContact->Attribute("nick"))), xContact->Attribute("proto")); + ptrW(mir_utf8decodeW(xContact->Attribute("nick"))).get(), xContact->Attribute("proto")); // user clicked abort button if (!result) diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 8c8144a665..b397164a29 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -210,7 +210,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat if ((dwFlags & CI_PROTOID) && !bMatch) { ptrW cInfo(getContactInfoT(CNF_UNIQUEID, hContact)); if (cInfo) { - tmp.Format(L"<%S:%s>", szProto, cInfo); + tmp.Format(L"<%S:%s>", szProto, cInfo.get()); if (tmp == tszContact) bMatch = true; } diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 0d06cafffc..7a4d6df88c 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -44,7 +44,7 @@ static wchar_t* parseGetParent(ARGUMENTSINFO *ai) szUniqueID = mir_wstrdup(tszID); } - return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach(); + return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID.get()).Detach(); } static wchar_t* parseGetDefault(ARGUMENTSINFO *ai) @@ -72,7 +72,7 @@ static wchar_t* parseGetDefault(ARGUMENTSINFO *ai) szUniqueID = mir_wstrdup(tszID); } - return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach(); + return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID.get()).Detach(); } static wchar_t* parseGetMostOnline(ARGUMENTSINFO *ai) @@ -100,7 +100,7 @@ static wchar_t* parseGetMostOnline(ARGUMENTSINFO *ai) szUniqueID = mir_wstrdup(tszID); } - return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach(); + return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID.get()).Detach(); } void registerMetaContactsTokens() diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index e093fce35c..3d51668705 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -393,7 +393,7 @@ static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai) if (szUniqueID == NULL) return nullptr; - return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach(); + return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID.get()).Detach(); } static BOOL isValidDbEvent(DBEVENTINFO *dbe, int flags) diff --git a/protocols/CloudFile/src/http_request.h b/protocols/CloudFile/src/http_request.h index c74b2ae40c..f63102f1cc 100644 --- a/protocols/CloudFile/src/http_request.h +++ b/protocols/CloudFile/src/http_request.h @@ -64,11 +64,7 @@ protected: length = mir_strlen(ePair) + 7; char *value = (char*)mir_calloc(length + 1); - mir_snprintf( - value, - length, - "Basic %s", - ePair); + mir_snprintf(value, length, "Basic %s", ePair.get()); headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount + 1)); headers[headersCount].szName = mir_strdup("Authorization"); diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index b3388a3268..94b1ed0fb7 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -559,7 +559,7 @@ void CDiscordProto::SendFileThread(void *param) pFileName = p->wszFileName.GetBuffer(); szBody.Append(szBoundary + "\r\n"); - szBody.AppendFormat("Content-Disposition: form-data; name=\"file\"; filename=\"%s\"\r\n", ptrA(mir_utf8encodeW(pFileName))); + szBody.AppendFormat("Content-Disposition: form-data; name=\"file\"; filename=\"%s\"\r\n", ptrA(mir_utf8encodeW(pFileName)).get()); szBody.AppendFormat("Content-Type: %S\r\n", ProtoGetAvatarMimeType(ProtoGetAvatarFileFormat(p->wszFileName))); szBody.Append("\r\n"); diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 2a2c40f71d..7c6c8ad707 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -28,7 +28,7 @@ // void GaduProto::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); if (_waccess(pszDest, 0)) { int ret = CreateDirectoryTreeW(pszDest); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 1ed90ba67c..d1d74dbc57 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -363,7 +363,7 @@ void __cdecl GaduProto::mainthread(void *) showpopup(m_tszUserName, error.c_str(), GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX); } else - debugLogA("mainthread() (%x): Loading forwarding host %s and port %d.", pHost, p.external_port, this); + debugLogA("mainthread() (%x): Loading forwarding host %s and port %d.", pHost.get(), p.external_port, this); if (p.external_addr) p.external_port = m_gaduOptions.forwardPort; @@ -960,7 +960,7 @@ retry: mir_snwprintf(szMsg, L"%s (%s)", szText, *e->event.multilogon_info.sessions[i].name != '\0' ? - _A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client")); + _A2T(e->event.multilogon_info.sessions[i].name).get() : TranslateT("Unknown client")); showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON); } mir_free(iIndexes); @@ -1217,7 +1217,7 @@ void GaduProto::OnContactDeleted(MCONTACT hContact) if (isChatRoom(hContact) && wszRoomId != NULL && gc_enabled) { GGGC *chat = gc_lookup(wszRoomId); - debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, wszRoomId); + debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, wszRoomId.get()); if (chat) { // Destroy chat entry diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index ad6f811ade..09a379ecfc 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -168,7 +168,7 @@ void GaduProto::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version); wchar_t avatarsPath[MAX_PATH]; - mir_snwprintf(avatarsPath, L"%s\\%s", VARSW(L"%miranda_avatarcache%"), m_tszUserName); + mir_snwprintf(avatarsPath, L"%s\\%s", VARSW(L"%miranda_avatarcache%").get(), m_tszUserName); debugLogW(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath); diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 2b959d6e9d..8fee1a1798 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -222,7 +222,7 @@ INT_PTR GaduProto::getavatarinfo(WPARAM wParam, LPARAM lParam) if (AvatarName) { char AvatarNameWithTS[128]; - mir_snprintf(AvatarNameWithTS, "%s%s", ++AvatarName, AvatarTs); + mir_snprintf(AvatarNameWithTS, "%s%s", ++AvatarName, AvatarTs.get()); AvatarHash = gg_avatarhash(AvatarNameWithTS); } } diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 10a7874498..55465a77b3 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -143,7 +143,7 @@ void CIcqProto::Json2string(MCONTACT hContact, const JSONNode &node, const char void CIcqProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 58fabd9362..bb40258434 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -502,7 +502,7 @@ int CJabberProto::ByteSendProxyParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jb data[4] = 40; char szAuthString[256]; - mir_snprintf(szAuthString, "%s%s%s", jbt->sid, ptrA(JabberPrepareJid(jbt->srcJID)), ptrA(JabberPrepareJid(jbt->dstJID))); + mir_snprintf(szAuthString, "%s%s%s", jbt->sid, ptrA(JabberPrepareJid(jbt->srcJID)).get(), ptrA(JabberPrepareJid(jbt->dstJID)).get()); debugLogA("Auth: '%s'", szAuthString); JabberShaStrBuf buf; diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index c0e3fa6923..d1ff8e9e93 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -178,16 +178,16 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus switch (type) { case INFO_BAN: if (m_bGcLogBans) - buf.Format(TranslateU("User %s is now banned."), user->m_szResourceName); + buf.Format(TranslateU("User %s is now banned."), user->m_szResourceName.get()); break; case INFO_STATUS: if (m_bGcLogStatuses) { wchar_t *ptszDescr = Clist_GetStatusModeDescription(user->m_iStatus, 0); if (user->m_szStatusMessage) - buf.Format(TranslateU("User %s changed status to %s with message: %s"), user->m_szResourceName, ptszDescr, user->m_szStatusMessage); + buf.Format(TranslateU("User %s changed status to %s with message: %s"), user->m_szResourceName.get(), ptszDescr, user->m_szStatusMessage.get()); else - buf.Format(TranslateU("User %s changed status to %s"), user->m_szResourceName, ptszDescr); + buf.Format(TranslateU("User %s changed status to %s"), user->m_szResourceName.get(), ptszDescr); } break; @@ -207,7 +207,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus case AFFILIATION_OUTCAST: name = TranslateU("Outcast"); break; } if (name) - buf.Format(TranslateU("Affiliation of %s was changed to '%s'."), user->m_szResourceName, name); + buf.Format(TranslateU("Affiliation of %s was changed to '%s'."), user->m_szResourceName.get(), name); } break; @@ -222,7 +222,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus } if (name) - buf.Format(TranslateU("Role of %s was changed to '%s'."), user->m_szResourceName, name); + buf.Format(TranslateU("Role of %s was changed to '%s'."), user->m_szResourceName.get(), name); } break; } @@ -839,7 +839,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)Skin_LoadProtoIcon(dat->ppro->m_szModuleName, dat->him->m_iStatus), 0); char buf[256]; - mir_snprintf(buf, TranslateU("%s from\n%s"), dat->him->m_szResourceName, dat->item->jid); + mir_snprintf(buf, TranslateU("%s from\n%s"), dat->him->m_szResourceName.get(), dat->item->jid); SetDlgItemTextUtf(hwndDlg, IDC_HEADERBAR, buf); SetDlgItemTextUtf(hwndDlg, IDC_TXT_NICK, dat->him->m_szResourceName); @@ -998,7 +998,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* // do not use snprintf to avoid possible problems with % symbol if (char *p = strstr(szMessage, "%s")) { *p = 0; - buf.Format("%s%s%s", szMessage, him->m_szResourceName, p + 2); + buf.Format("%s%s%s", szMessage.get(), him->m_szResourceName.get(), p + 2); } else buf = szMessage; buf.Replace("%%", "%"); diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 936d97c7e9..8bc1189fdf 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -121,7 +121,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT ptrA newNick(sttSettingToTchar(cws)); if (newNick && mir_strcmp(item->nick, newNick)) { - debugLogA("Renaming contact %s: %s -> %s", item->jid, item->nick, newNick); + debugLogA("Renaming contact %s: %s -> %s", item->jid, item->nick, newNick.get()); AddContactToRoster(item->jid, newNick, item->group); } } @@ -132,7 +132,7 @@ void __cdecl CJabberProto::OnAddContactForever(MCONTACT hContact) if (jid == nullptr) return; - debugLogA("Add %s permanently to list", jid); + debugLogA("Add %s permanently to list", jid.get()); ptrA nick(db_get_utfa(hContact, "CList", "MyHandle")); if (nick == nullptr) nick = getUStringA(hContact, "Nick"); diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 1d0f2e007e..7d6d767e52 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -100,7 +100,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) break; } - debugLogA("FT Got: %s", str); + debugLogA("FT Got: %s", str.get()); if (ft->state == FT_CONNECTING) { // looking for "HTTP/1.1 200 OK" if (sscanf(str, "HTTP/%*d.%*d %d %*s", &code) == 1 && code == 200) { @@ -292,7 +292,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) } char szAddr[256]; - mir_snprintf(szAddr, "http://%s:%d/%s", myAddr, nlb.wPort, pFileName.c_str()); + mir_snprintf(szAddr, "http://%s:%d/%s", myAddr.get(), nlb.wPort, pFileName.c_str()); XmlNodeIq iq("set", ft->szId, MakeJid(ft->jid, ptszResource)); TiXmlElement *query = iq << XQUERY(JABBER_FEAT_OOB); diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 7e18ceae1b..d0758f3faf 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -457,7 +457,7 @@ public: break; char jid[JABBER_MAX_JID_LEN]; - mir_snprintf(jid, "%s@%s (%s)", info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateU("")); + mir_snprintf(jid, "%s@%s (%s)", info.m_room.get(), info.m_server.get(), info.m_nick ? info.m_nick.get() : TranslateU("")); SetDlgItemTextUtf(m_hwnd, IDC_RECENT1 + i, jid); } sttJoinDlgShowRecentItems(m_hwnd, i); @@ -737,7 +737,7 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) JABBER_LIST_ITEM *item = param->ppro->ListGetItemPtr(LIST_CHATROOM, param->jid); if (item != nullptr) { CMStringW szBuffer, szTitle; - szTitle.Format(TranslateT("Change nickname in <%s>"), item->name ? item->name : Utf2T(item->jid)); + szTitle.Format(TranslateT("Change nickname in <%s>"), item->name ? item->name : Utf2T(item->jid).get()); if (item->nick) szBuffer = Utf2T(item->nick); diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index d390839d85..eb528f544b 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -238,7 +238,7 @@ void CJabberProto::OnIqResultGetAuth(const TiXmlElement *iqNode, CJabberIqInfo*) if (XmlFirstChild(queryNode, "digest") != nullptr && m_ThreadInfo->szStreamId) { JabberShaStrBuf buf; char text[200]; - mir_snprintf(text, "%s%s", m_ThreadInfo->szStreamId, m_ThreadInfo->conn.password); + mir_snprintf(text, "%s%s", m_ThreadInfo->szStreamId.get(), m_ThreadInfo->conn.password); query << XCHILD("digest", JabberSha1(text, buf)); } else if (XmlFirstChild(queryNode, "password") != nullptr) diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index bdd1684ca2..e2a35eb5c0 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -396,7 +396,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) } CMStringW szTmp; - szTmp.Format(L"%s [%s, %d]", Utf2T(r->m_szResourceName), Clist_GetStatusModeDescription(r->m_iStatus, 0), r->m_iPriority); + szTmp.Format(L"%s [%s, %d]", Utf2T(r->m_szResourceName).get(), Clist_GetStatusModeDescription(r->m_iStatus, 0), r->m_iPriority); Menu_ModifyItem(m_phMenuResourceItems[i], szTmp, hIcon); DestroyIcon(hIcon); } @@ -948,7 +948,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) wchar_t buf[256]; mir_snwprintf(buf, TranslateT("Last active (%s)"), - LI->m_pLastSeenResource ? Utf2T(LI->m_pLastSeenResource->m_szResourceName) : TranslateT("No activity yet, use server's choice")); + LI->m_pLastSeenResource ? Utf2T(LI->m_pLastSeenResource->m_szResourceName.get()) : TranslateT("No activity yet, use server's choice")); AppendMenu(hMenu, MF_STRING, MENUITEM_LASTSEEN, buf); AppendMenu(hMenu, MF_STRING, MENUITEM_SERVER, TranslateT("Highest priority (server's choice)")); diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index b6ef4735d9..ed77e4595a 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -135,7 +135,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -290,14 +290,14 @@ void CJabberProto::FormatMirVer(const pResourceStatus &resource, CMStringA &res) // no caps info? set MirVer = resource name if (resource->m_pCaps == nullptr) { - debugLogA("JabberUpdateMirVer: for rc %s: %s", resource->m_szResourceName, resource->m_szResourceName); + debugLogA("JabberUpdateMirVer: for rc %s: %s", resource->m_szResourceName.get(), resource->m_szResourceName.get()); if (resource->m_szResourceName) res = resource->m_szResourceName; } // XEP-0115 caps mode else { CJabberClientPartialCaps *pCaps = resource->m_pCaps; - debugLogA("JabberUpdateMirVer: for rc %s: %s#%s", resource->m_szResourceName, pCaps->GetNode(), pCaps->GetHash()); + debugLogA("JabberUpdateMirVer: for rc %s: %s#%s", resource->m_szResourceName.get(), pCaps->GetNode(), pCaps->GetHash()); // unknown software const char *szDefaultName = GetSoftName(pCaps->GetNode()); @@ -331,7 +331,7 @@ void CJabberProto::FormatMirVer(const pResourceStatus &resource, CMStringA &res) if (resource->m_szResourceName && !strstr(res, resource->m_szResourceName)) if (strstr(res, "Miranda IM") || strstr(res, "Miranda NG") || m_bShowForeignResourceInMirVer) - res.AppendFormat(" [%s]", resource->m_szResourceName); + res.AppendFormat(" [%s]", resource->m_szResourceName.get()); } void CJabberProto::UpdateMirVer(MCONTACT hContact, const pResourceStatus &r) diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index c8eb921250..c45e89aa23 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -326,7 +326,7 @@ CCtrlEditJid::CCtrlEditJid(CDlgBase* dlg, int ctrlId): static void sttStoreJidFromUI(CJabberProto *ppro, CCtrlEdit &txtUsername, CCtrlCombo &cbServer) { - ppro->setWString("jid", CMStringW(FORMAT, L"%s@%s", ptrW(txtUsername.GetText()), ptrW(cbServer.GetText()))); + ppro->setWString("jid", CMStringW(FORMAT, L"%s@%s", ptrW(txtUsername.GetText()).get(), ptrW(cbServer.GetText()).get())); } class CDlgOptAccount : public CJabberDlgBase diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 24bdfe9ce4..ee0e59b825 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -273,7 +273,7 @@ static void SearchReturnResults(CJabberProto *ppro, HANDLE id, LIST Utf2T wszNick(nick); wchar_t buff[200]; if (mir_wstrcmpi(wszNick, Results.psr.id.w)) - mir_snwprintf(buff, L"%s (%s)", wszNick, Results.psr.id.w); + mir_snwprintf(buff, L"%s (%s)", wszNick.get(), Results.psr.id.w); else wcsncpy_s(buff, wszNick, _TRUNCATE); diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 5d807f51d6..3e95bc9a39 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -197,7 +197,7 @@ char* TMD5Auth::getChallenge(const char *challenge) int cbLen = mir_snprintf(buf, 8000, "username=\"%s\",realm=\"%s\",nonce=\"%s\",cnonce=\"%s\",nc=%08d," "qop=auth,digest-uri=\"xmpp/%s\",charset=utf-8,response=%08x%08x%08x%08x", - info->conn.username, realm, nonce, cnonce, iCallCount, serv, + info->conn.username, realm, nonce, cnonce, iCallCount, serv.get(), htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3])); return mir_base64_encode(buf, cbLen); @@ -276,7 +276,7 @@ char* TScramAuth::getChallenge(const char *challenge) mir_sha1_finish(&ctx, storedKey); char authmsg[4096]; - int authmsgLen = mir_snprintf(authmsg, "%s,%s,c=biws,r=%s", msg1, chl, snonce); + int authmsgLen = mir_snprintf(authmsg, "%s,%s,c=biws,r=%s", msg1, chl.get(), snonce.get()); BYTE clientSig[MIR_SHA1_HASH_SIZE]; HMAC(EVP_sha1(), storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen, clientSig, &len); @@ -295,7 +295,7 @@ char* TScramAuth::getChallenge(const char *challenge) char buf[4096]; ptrA encproof(mir_base64_encode(clientProof, sizeof(clientProof))); - int cbLen = mir_snprintf(buf, "c=biws,r=%s,p=%s", snonce, encproof); + int cbLen = mir_snprintf(buf, "c=biws,r=%s,p=%s", snonce.get(), encproof.get()); return mir_base64_encode(buf, cbLen); } diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index bd146d967a..57e18df43f 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1541,7 +1541,7 @@ void CJabberProto::UpdateJidDbSettings(const char *jid) item->getTemp()->m_iStatus = status; if (nSelectedResource != -1) { pResourceStatus r(item->arResources[nSelectedResource]); - debugLogA("JabberUpdateJidDbSettings: updating jid %s to rc %s", item->jid, r->m_szResourceName); + debugLogA("JabberUpdateJidDbSettings: updating jid %s to rc %s", item->jid, r->m_szResourceName.get()); if (r->m_szStatusMessage) db_set_utf(hContact, "CList", "StatusMsg", r->m_szStatusMessage); else @@ -1631,7 +1631,7 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info) if (strchr(from, '@') == nullptr) { UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); } - debugLogA("%s (%s) online, set contact status to %s", nick, from, T2Utf(Clist_GetStatusModeDescription(status, 0))); + debugLogA("%s (%s) online, set contact status to %s", nick.get(), from, T2Utf(Clist_GetStatusModeDescription(status, 0)).get()); if (m_bEnableAvatars) { bool bHasAvatar = false, bRemovedAvatar = false; @@ -1739,7 +1739,7 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info) RebuildInfoFrame(); } else { - debugLogA("%s (%s) requests authorization", szNick, from); + debugLogA("%s (%s) requests authorization", szNick.get(), from); DBAddAuthRequest(from, szNick); } return; diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index c2956d09af..f7e12316e0 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -971,7 +971,7 @@ void CMsnProto::MSN_SendATH(ThreadData *info) "t=%s" "%s" "%s%s\r\n", - (const char*)authSSLToken ? ptrA(HtmlEncode(authSSLToken)) : "", + (const char*)authSSLToken ? ptrA(HtmlEncode(authSSLToken)).get() : "", authUIC, GetMyUsername(NETID_MSN), GetMyUsername(NETID_SKYPE)); break; @@ -982,7 +982,7 @@ void CMsnProto::MSN_SendATH(ThreadData *info) "%s" "chatservice.live.com" "\r\n", - (const char*)authStrToken ? ptrA(HtmlEncode(authStrToken)) : "", + (const char*)authStrToken ? ptrA(HtmlEncode(authStrToken)).get() : "", authUIC); break; } diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index b18124501a..61d6c44e52 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -141,7 +141,7 @@ void CMsnProto::MSN_Kickuser(GCHOOK *gch) GCThreadData *thread = MSN_GetThreadByChatId(gch->ptszID); msnNsThread->sendPacketPayload("DEL", "MSGR\\THREAD", "%d:%s%s", - thread->netId, thread->szEmail, _T2A(gch->ptszUID)); + thread->netId, thread->szEmail, _T2A(gch->ptszUID).get()); } void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole) @@ -149,7 +149,7 @@ void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole) GCThreadData *thread = MSN_GetThreadByChatId(gch->ptszID); msnNsThread->sendPacketPayload("PUT", "MSGR\\THREAD", "%d:%s%s%s", - thread->netId, thread->szEmail, _T2A(gch->ptszUID), pszRole); + thread->netId, thread->szEmail, _T2A(gch->ptszUID).get(), pszRole); } const wchar_t *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID) diff --git a/protocols/MSN/src/msn_ieembed.cpp b/protocols/MSN/src/msn_ieembed.cpp index e094d4f722..c9b4b964a7 100644 --- a/protocols/MSN/src/msn_ieembed.cpp +++ b/protocols/MSN/src/msn_ieembed.cpp @@ -376,7 +376,7 @@ IHTMLDocument2* IEEmbed::getDocument() void IEEmbed::navigate(const wchar_t *url) { - pWebBrowser->Navigate((WCHAR *)url, nullptr, nullptr, nullptr, nullptr); + pWebBrowser->Navigate((BSTR)url, nullptr, nullptr, nullptr, nullptr); } void IEEmbed::navigate(char *url) diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index d38ac42e3c..a52bbbcbe6 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -145,7 +145,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) // MSN_GetAvatarFileName - gets a file name for an contact's avatar void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext) { - size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); if (_waccess(pszDest, 0)) CreateDirectoryTreeW(pszDest); @@ -637,7 +637,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) szStatusName, MyOptions.szMachineGuid, myFlags, myFlagsEx, myFlagsExEx, MyOptions.szMachineGuid, szPlace, - msgptr?ptrA(HtmlEncode(*msgptr)):"", GetMyUsername(NETID_SKYPE), + msgptr ? ptrA(HtmlEncode(*msgptr)).get() : "", GetMyUsername(NETID_SKYPE), MyOptions.szMachineGuid, MyOptions.szMachineGuid); msnNsThread->sendPacketPayload("PUT", "MSGR\\PRESENCE", diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 24bd25f121..1ab70262a8 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -830,7 +830,8 @@ int CMsnProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONTACT *hCo msg.Append(""); for (int i = 0; i < nContacts; i++) { ptrA wlid(getStringA(hContactsList[i], "wlid")); - if (wlid != NULL) msg.AppendFormat("", wlid); + if (wlid != NULL) + msg.AppendFormat("", wlid.get()); } msg.Append(""); seq = msnNsThread->sendMessage('1', tEmail, netId, msg, MSG_CONTACT); diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index eb5fa20886..6de0e34483 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -146,7 +146,7 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) ptrA skypename(mir_u2a(ptrW(json_as_string(node)))); ptrW value; char szWLId[128]; - mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename); + mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename.get()); MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false); if (hContact) { @@ -192,7 +192,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "username"))))); ptrW value; char szWLId[128]; - mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename); + mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename.get()); MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false); if (hContact) { @@ -202,12 +202,13 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) if (value = get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_wtoi(value) == 1 ? 'M' : 'F')); if (value = get_json_str(item, "birthday")) { int d, m, y; - swscanf(value, L"%d-%d-%d", &y, &m, &d); - setWord(hContact, "BirthYear", y); - setByte(hContact, "BirthDay", d); - setByte(hContact, "BirthMonth", m); + if (swscanf(value, L"%d-%d-%d", &y, &m, &d) == 3) { + setWord(hContact, "BirthYear", y); + setByte(hContact, "BirthDay", d); + setByte(hContact, "BirthMonth", m); + } } - if (value = get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0)); + if (value = get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, _T2A(value), 0)); if (value = get_json_str(item, "province")) setWString(hContact, "State", value); if (value = get_json_str(item, "city")) setWString(hContact, "City", value); if (value = get_json_str(item, "homepage")) setWString(hContact, "Homepage", value); diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 6a98c797de..3b73664455 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -814,7 +814,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas char *szCircleTicket = ezxml_txt(ezxml_get(body, "CircleResult", 0, "CircleTicket", -1)); ptrA szCircleTicketEnc(mir_base64_encode(szCircleTicket, mir_strlen(szCircleTicket))); if (szCircleTicketEnc) - msnNsThread->sendPacket("USR", "SHA A %s", szCircleTicketEnc); + msnNsThread->sendPacket("USR", "SHA A %s", szCircleTicketEnc.get()); } } diff --git a/protocols/NewsAggregator/Src/Authentication.cpp b/protocols/NewsAggregator/Src/Authentication.cpp index 35c5cb36bd..33b080bb6c 100644 --- a/protocols/NewsAggregator/Src/Authentication.cpp +++ b/protocols/NewsAggregator/Src/Authentication.cpp @@ -39,7 +39,7 @@ void CreateAuthString(char *auth, MCONTACT hContact, CFeedEditor *pDlg) mir_free(tlogin); mir_free(tpass); - mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode(str, (size_t)len))); + mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode(str, (size_t)len)).get()); } CAuthRequest::CAuthRequest(CFeedEditor *pDlg, MCONTACT hContact) : diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 66f1205f12..d8100fbabe 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -510,7 +510,7 @@ bool Omegle_client::events() // We got info about count of connected people there ptrW count(json_as_string(json_get(data, "count"))); wchar_t strT[255]; - mir_snwprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); + mir_snwprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count.get()); parent->UpdateChat(nullptr, strT); } diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index f47f031ffb..ace07a8da0 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -24,7 +24,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN m_hNetlibUser = Netlib_RegisterUser(&nlu); RegisterGLibLogger(); - debugLogW(L"CSametimeProto::CSametimeProto() start m_szModuleName=[%s], m_tszUserName=[%s]", _A2T(m_szModuleName), m_tszUserName); + debugLogW(L"CSametimeProto::CSametimeProto() start m_szModuleName=[%S], m_tszUserName=[%s]", m_szModuleName, m_tszUserName); SametimeInitIcons(); diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 2e27b39822..2eef58c14a 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -501,7 +501,7 @@ int CSametimeProto::LogOut() int CSametimeProto::OnLogInRedirect(char* newHost) { - debugLogW(L"OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]", newHost ? _A2T(newHost) : "(null)"); + debugLogA("OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]", newHost ? newHost : "(null)"); if (!newHost || !mir_strcmp(newHost, options.server_name) || db_get_b(0, m_szModuleName, "ForceLogin", 0) == 1) { debugLogW(L"OnLogInRedirect() forceLogin"); diff --git a/protocols/SkypeWeb/src/requests/asm/files.h b/protocols/SkypeWeb/src/requests/asm/files.h index 89d42274d3..721aac16b3 100644 --- a/protocols/SkypeWeb/src/requests/asm/files.h +++ b/protocols/SkypeWeb/src/requests/asm/files.h @@ -8,7 +8,7 @@ public: { flags &= (~NLHRF_DUMPASTEXT); Headers - << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken) + << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken.get()) << CHAR_VALUE("Content-Type", "text/json"); JSONNode node, jPermissions, jPermission(JSON_ARRAY); @@ -30,7 +30,7 @@ public: HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/original", szObject) { Headers - << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken) + << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken.get()) << CHAR_VALUE("Content-Type", "application/octet-stream"); pData = (char*)mir_alloc(size); diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h index 70ca5f7311..0c4366ce95 100644 --- a/protocols/SkypeWeb/src/requests/capabilities.h +++ b/protocols/SkypeWeb/src/requests/capabilities.h @@ -27,7 +27,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); JSONNode privateInfo; privateInfo.set_name("privateInfo"); privateInfo << JSONNode("epname", hostname); diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index 1b6b352411..1a7c234539 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -32,7 +32,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; @@ -45,7 +45,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node; node @@ -66,7 +66,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node(JSON_NODE); @@ -92,7 +92,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); JSONNode node; JSONNode members(JSON_ARRAY); members.set_name("members"); @@ -122,7 +122,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); } }; @@ -135,7 +135,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); JSONNode node; @@ -154,7 +154,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); } }; @@ -167,7 +167,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); JSONNode node; node << JSONNode(propname, value); diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h index fe9c3c6a3e..446b4630dd 100644 --- a/protocols/SkypeWeb/src/requests/endpoint.h +++ b/protocols/SkypeWeb/src/requests/endpoint.h @@ -27,7 +27,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("Authentication", "skypetoken=%s", ppro->m_szApiToken); + << FORMAT_VALUE("Authentication", "skypetoken=%s", ppro->m_szApiToken.get()); Body << VALUE("{}"); } @@ -41,7 +41,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); } }; diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h index 30294dff30..f67718e49b 100644 --- a/protocols/SkypeWeb/src/requests/history.h +++ b/protocols/SkypeWeb/src/requests/history.h @@ -31,7 +31,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } @@ -41,7 +41,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; @@ -60,7 +60,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; @@ -73,7 +73,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 949704cbea..8ec058ba7a 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -26,7 +26,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node; @@ -48,7 +48,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); CMStringA content; @@ -74,7 +74,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); const char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping"; @@ -98,7 +98,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); //"lastReadMessageTimestamp;modificationTime;lastReadMessageId" diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h index 2c306ff958..4bc9da6e43 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -28,7 +28,7 @@ public: flags |= NLHRF_PERSISTENT; Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); } }; #endif //_SKYPE_POLL_H_ \ No newline at end of file diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h index c66cbd8ec2..900c4348cf 100644 --- a/protocols/SkypeWeb/src/requests/status.h +++ b/protocols/SkypeWeb/src/requests/status.h @@ -26,7 +26,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node(JSON_NODE); diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index 979c472639..dc18432208 100644 --- a/protocols/SkypeWeb/src/requests/subscriptions.h +++ b/protocols/SkypeWeb/src/requests/subscriptions.h @@ -26,7 +26,7 @@ public: { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode interestedResources(JSON_ARRAY); interestedResources.set_name("interestedResources"); @@ -55,7 +55,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get()); JSONNode node; diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 56fc8f1869..094e857a56 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -107,7 +107,7 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) if (IsOnline()) { PushRequest(new GetAvatarRequest(szUrl), &CSkypeProto::OnReceiveAvatar, (void*)pai->hContact); - debugLogA("Requested to read an avatar from '%s'", szUrl); + debugLogA("Requested to read an avatar from '%s'", szUrl.get()); return GAIR_WAITFOR; } @@ -125,7 +125,7 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARSW(L"%miranda_avatarcache%"), m_tszUserName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARSW(L"%miranda_avatarcache%").get(), m_tszUserName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 17cbab0b34..12cf2200ba 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -81,16 +81,16 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a auto *pTitle = doc.NewElement("Title"); pTitle->SetText(tszFile); pRoot->InsertEndChild(pTitle); auto *pDescr = doc.NewElement("Description"); pDescr->SetText(fup->tszDesc.get()); pRoot->InsertEndChild(pDescr); - auto *xmlA = doc.NewElement("a"); xmlA->SetText(CMStringA(FORMAT, "https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", fup->uid)); - xmlA->SetAttribute("href", CMStringA(FORMAT, "https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", fup->uid)); + auto *xmlA = doc.NewElement("a"); xmlA->SetText(CMStringA(FORMAT, "https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", fup->uid.get())); + xmlA->SetAttribute("href", CMStringA(FORMAT, "https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", fup->uid.get())); pRoot->InsertEndChild(xmlA); auto *xmlOrigName = doc.NewElement("OriginalName"); xmlOrigName->SetAttribute("v", tszFile); pRoot->InsertEndChild(xmlOrigName); auto *xmlSize = doc.NewElement("FileSize"); xmlSize->SetAttribute("v", (int)fup->size); pRoot->InsertEndChild(xmlSize); pRoot->SetAttribute("Type", "File.1"); - pRoot->SetAttribute("uri", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s", fup->uid)); - pRoot->SetAttribute("url_thumbnail", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s/views/thumbnail", fup->uid)); + pRoot->SetAttribute("uri", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s", fup->uid.get())); + pRoot->SetAttribute("url_thumbnail", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s/views/thumbnail", fup->uid.get())); tinyxml2::XMLPrinter printer(0, true); doc.Print(&printer); diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 58b28f3434..684526bdaa 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -233,7 +233,7 @@ void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hConta if (firstname) { CMStringW nick(firstname); if (lastname) - nick.AppendFormat(L" %s", lastname); + nick.AppendFormat(L" %s", lastname.get()); setWString(hContact, "Nick", nick); } else if (lastname) diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 828840de94..d01c3b0358 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -3,7 +3,7 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact) { wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -11,7 +11,7 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact) ptrA steamId(getStringA(hContact, "SteamID")); if (steamId != NULL) - mir_snwprintf(path, MAX_PATH, L"%s\\%s.jpg", path, _A2T(steamId)); + mir_snwprintf(path, MAX_PATH, L"%s\\%S.jpg", path, steamId.get()); else return nullptr; diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 63e4c05905..cd576ac374 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -278,7 +278,7 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) ptrW nick(getWStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; - mir_snwprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); + mir_snwprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick.get()); ShowNotification(message); } @@ -311,7 +311,7 @@ void CSteamProto::ContactIsAskingAuth(MCONTACT hContact) lastName = mir_strdup(""); char reason[MAX_PATH]; - mir_snprintf(reason, Translate("%s has added you to contact list"), nickName); + mir_snprintf(reason, Translate("%s has added you to contact list"), nickName.get()); DB_AUTH_BLOB blob(hContact, nickName, firstName, lastName, steamId, reason); @@ -486,7 +486,7 @@ void CSteamProto::OnGotAvatar(const HttpResponse &response, void *arg) if (!response.IsSuccess()) { ptrA steamId(getStringA(ai.hContact, "SteamID")); - debugLogA(__FUNCTION__ ": failed to get avatar %s", steamId); + debugLogA(__FUNCTION__ ": failed to get avatar %s", steamId.get()); if (ai.hContact) ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)& ai, 0); @@ -517,7 +517,7 @@ void CSteamProto::OnFriendAdded(const HttpResponse &response, void *arg) who = mir_wstrdup(steamId); wchar_t message[MAX_PATH]; - mir_snwprintf(message, L"Error adding friend %s", who); + mir_snwprintf(message, L"Error adding friend %s", who.get()); JSONNode root = JSONNode::parse(response.Content); if (root) { @@ -531,19 +531,19 @@ void CSteamProto::OnFriendAdded(const HttpResponse &response, void *arg) int errorCode = errors[first].as_int(); switch (errorCode) { case 11: - mir_snwprintf(message, L"All communication with %s is blocked. Communication is only possible if you have lifted the blocking. To do this, visit the user's Steam Community page.", who); + mir_snwprintf(message, L"All communication with %s is blocked. Communication is only possible if you have lifted the blocking. To do this, visit the user's Steam Community page.", who.get()); break; case 15: - mir_snwprintf(message, L"Request to %s can not be sent. His/her friends list is full.", who); + mir_snwprintf(message, L"Request to %s can not be sent. His/her friends list is full.", who.get()); break; case 24: mir_wstrcpy(message, L"Your account does not meet the requirements to use this feature. Visit Steam Support to get more information."); break; case 25: - mir_snwprintf(message, L"Request to %s can not be sent. Your friends list is full.", who); + mir_snwprintf(message, L"Request to %s can not be sent. Your friends list is full.", who.get()); break; case 40: - mir_snwprintf(message, L"Error adding friend %s. The communication between you and the other Steam member is blocked.", who); + mir_snwprintf(message, L"Error adding friend %s. The communication between you and the other Steam member is blocked.", who.get()); break; case 84: mir_wstrcpy(message, L"You've been sending too many invitations lately. Please try again in a day or two."); @@ -634,7 +634,7 @@ void CSteamProto::OnPendingApproved(const JSONNode &root, void *arg) int success = root["success"].as_int(); if (success == 0) { json_string error = root["error_text"].as_string(); - debugLogA(__FUNCTION__ ": failed to approve pending from %s (%s)", steamId, ptrA(mir_utf8decodeA(error.c_str()))); + debugLogA(__FUNCTION__ ": failed to approve pending from %s (%s)", steamId.get(), ptrA(mir_utf8decodeA(error.c_str())).get()); } } @@ -648,7 +648,7 @@ void CSteamProto::OnPendingIgnoreded(const JSONNode &root, void *arg) int success = root["success"].as_int(); if (success == 0) { json_string error = root["error_text"].as_string(); - debugLogA(__FUNCTION__ ": failed to ignore pending from %s (%s)", steamId, ptrA(mir_utf8decodeA(error.c_str()))); + debugLogA(__FUNCTION__ ": failed to ignore pending from %s (%s)", steamId.get(), ptrA(mir_utf8decodeA(error.c_str())).get()); } } diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index d06eb54de2..b9b37914a3 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -44,7 +44,7 @@ void CSteamProto::OnMessageSent(const HttpResponse &response, void *arg) } if (mir_strcmpi(error.c_str(), "OK") != 0) { - debugLogA(__FUNCTION__ ": failed to send message for %s (%s)", steamId, error.c_str()); + debugLogA(__FUNCTION__ ": failed to send message for %s (%s)", steamId.get(), error.c_str()); ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, _A2T(error.c_str())); } else { diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index ff40c4bb2e..c89f28fb82 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -8,7 +8,7 @@ int CToxProto::OnAccountRenamed(WPARAM wParam, LPARAM lParam) ptrW newPath(GetToxProfilePath()); wchar_t oldPath[MAX_PATH]; - mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), m_accountName); + mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%").get(), m_accountName); _wrename(oldPath, newPath); m_accountName = mir_wstrdup(m_tszUserName); } diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 0e1aa6aa97..0a255512a0 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -3,7 +3,7 @@ wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact) { wchar_t *path = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1); - mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -18,7 +18,7 @@ wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact) if (hContact && mir_wstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2) address[TOX_PUBLIC_KEY_SIZE * 2] = 0; - mir_snwprintf(path, MAX_PATH, L"%s\\%s.png", path, address); + mir_snwprintf(path, MAX_PATH, L"%s\\%s.png", path, address.get()); return path; } @@ -214,7 +214,7 @@ void CToxProto::OnGotFriendAvatarInfo(Tox *tox, AvatarTransferParam *transfer) } wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); OnFileAllow(tox, transfer->pfts.hContact, transfer, path); } diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index f1939c2475..659b8d9e2e 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -23,7 +23,7 @@ void CToxProto::OnFriendFile(Tox *tox, uint32_t friendNumber, uint32_t fileNumbe ptrW address(proto->getWStringA(hContact, TOX_SETTINGS_ID)); wchar_t avatarName[MAX_PATH]; - mir_snwprintf(avatarName, MAX_PATH, L"%s.png", address); + mir_snwprintf(avatarName, MAX_PATH, L"%s.png", address.get()); AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize); transfer->pfts.flags |= PFTS_RECEIVING; diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 18b19121df..8cb14eab53 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -441,7 +441,7 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul pPhonePref = strstr(pPhonePref + 1, " "); if (pPhonePref && sscanf(pPhonePref, " %[^<]", szSufixTel) == 1) { wszTitle.Format(TranslateT("Enter the missing digits between %s and %s of the phone number linked to your account"), - ptrW(mir_a2u(szPrefixTel)), ptrW(mir_a2u(szSufixTel))); + ptrW(mir_a2u(szPrefixTel)).get(), ptrW(mir_a2u(szSufixTel)).get()); MessageBoxW(nullptr, wszTitle, TranslateT("Attention!"), MB_ICONWARNING | MB_OK); } } diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index a2ab5e8dbc..be39afde35 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -104,7 +104,7 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) pReq->m_bApiReq = false; Push(pReq); - debugLogA("Requested to read an avatar from '%s'", szUrl); + debugLogA("Requested to read an avatar from '%s'", szUrl.get()); return GAIR_WAITFOR; } @@ -130,7 +130,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen) { - int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName); DWORD dwAttributes = GetFileAttributes(pwszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index fc9c834ad1..069bbc1142 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -306,7 +306,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (wszAction == L"chat_create") { CMStringW wszActionText = jnMsg["action_text"].as_mstring(); - wszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), wszActionText.IsEmpty() ? L" " : wszActionText); + wszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), wszActionText.IsEmpty() ? L" " : wszActionText.c_str()); } else if (wszAction == L"chat_kick_user") { CMStringW wszActionMid = jnMsg["action_mid"].as_mstring(); @@ -327,10 +327,9 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (cu == nullptr) wszBody.AppendFormat(L"%s (%s)", TranslateT("kick user"), UserProfileUrl(a_uid).c_str()); else - wszBody.AppendFormat(L"%s %s (%s)", TranslateT("kick user"), cu->m_wszNick, UserProfileUrl(a_uid).c_str()); + wszBody.AppendFormat(L"%s %s (%s)", TranslateT("kick user"), cu->m_wszNick.get(), UserProfileUrl(a_uid).c_str()); } - else - wszBody = TranslateT("kick user"); + else wszBody = TranslateT("kick user"); } } } @@ -350,16 +349,15 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (cu == nullptr) wszBody.AppendFormat(L"%s (%s)", TranslateT("invite user"), UserProfileUrl(a_uid).c_str()); else - wszBody.AppendFormat(L"%s %s (%s)", TranslateT("invite user"), cu->m_wszNick, UserProfileUrl(a_uid).c_str()); + wszBody.AppendFormat(L"%s %s (%s)", TranslateT("invite user"), cu->m_wszNick.get(), UserProfileUrl(a_uid).c_str()); } - else - wszBody = TranslateT("invite user"); + else wszBody = TranslateT("invite user"); } } } else if (wszAction == L"chat_title_update") { CMStringW wszTitle = jnMsg["action_text"].as_mstring(); - wszBody.AppendFormat(L"%s \"%s\"", TranslateT("change chat title to"), wszTitle.IsEmpty() ? L" " : wszTitle); + wszBody.AppendFormat(L"%s \"%s\"", TranslateT("change chat title to"), wszTitle.IsEmpty() ? L" " : wszTitle.c_str()); if (!bIsHistory) SetChatTitle(cc, wszTitle); @@ -852,7 +850,7 @@ void CVkProto::ChatContactTypingThread(void *p) m_ChatsTyping.remove(cp); m_ChatsTyping.insert(param); - Srmm_SetStatusText(hChatContact, CMStringW(FORMAT, TranslateT("%s is typing a message..."), cu->m_wszNick)); + Srmm_SetStatusText(hChatContact, CMStringW(FORMAT, TranslateT("%s is typing a message..."), cu->m_wszNick.get())); } Sleep(9500); diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index b661b2e438..642a836173 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -209,7 +209,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque CMStringW str(FORMAT, TranslateT("Error loading message history for %s from server."), pwszNick); MsgPopup(param->hContact, str, TranslateT("Error"), true); - debugLogW(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask); + debugLogW(L"CVkProto::OnReceiveHistoryMessages error for %s m_iLoadHistoryTask=%d", pwszNick.get(), m_iLoadHistoryTask); if (m_iLoadHistoryTask == 0 && m_bNotifyForEndLoadingHistoryAllContact) { MsgPopup(TranslateT("Loading messages for all contacts is completed."), TranslateT("Loading history")); @@ -334,7 +334,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque ptrW pwszNick(db_get_wsa(param->hContact, m_szModuleName, "Nick")); CMStringW str(FORMAT, TranslateT("Loading messages for %s is completed."), pwszNick); - debugLogW(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick, m_iLoadHistoryTask); + debugLogW(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", pwszNick.get(), m_iLoadHistoryTask); if (m_bNotifyForEndLoadingHistory) MsgPopup(param->hContact, str, TranslateT("Loading history")); diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 09c5a59878..4a4bad243c 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -55,9 +55,10 @@ void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * if (!m_hPollingThread) { debugLogA("CVkProto::OnReceivePollingInfo m_hPollingThread is nullptr"); debugLogA("CVkProto::OnReceivePollingInfo m_pollingTs = '%s' m_pollingKey = '%s' m_pollingServer = '%s'", - m_pollingTs ? m_pollingTs : "", - m_pollingKey ? m_pollingKey : "", - m_pollingServer ? m_pollingServer : ""); + m_pollingTs ? m_pollingTs.get() : "", + m_pollingKey ? m_pollingKey.get() : "", + m_pollingServer ? m_pollingServer.get() : ""); + if (m_pollingTs != nullptr && m_pollingKey != nullptr && m_pollingServer != nullptr) { debugLogA("CVkProto::OnReceivePollingInfo PollingThread starting..."); m_hPollingThread = ForkThreadEx(&CVkProto::PollingThread, nullptr, nullptr); diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 1ad8b6abd3..d1198e1a5d 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -643,7 +643,7 @@ int CVkProto::GetInfo(MCONTACT hContact, int) void CVkProto::OnContactDeleted(MCONTACT hContact) { ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick")); - debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick); + debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick.get()); if (db_get_b(hContact, "CList", "NotOnList") || getBool(hContact, "SilentDelete") || isChatRoom((MCONTACT)hContact)) return; @@ -656,7 +656,7 @@ void CVkProto::OnContactDeleted(MCONTACT hContact) CVkContactDeleteForm dlg(this, param); dlg.DoModal(); - debugLogW(L"CVkProto::OnContactDeleted %s DeleteDialog=%d DeleteFromFriendlist=%d", pwszNick, param->bDeleteDialog, param->bDeleteFromFriendlist); + debugLogW(L"CVkProto::OnContactDeleted %s DeleteDialog=%d DeleteFromFriendlist=%d", pwszNick.get(), param->bDeleteDialog, param->bDeleteFromFriendlist); if (!(param->bDeleteDialog || param->bDeleteFromFriendlist)) return; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 0014b5ae3b..638d5e2e37 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -883,7 +883,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) if (flag == 0) { CMStringW pwszMsg; ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick")); - pwszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick); + pwszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick.get()); if (IDNO == MessageBoxW(nullptr, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO)) return 1; } diff --git a/protocols/Weather/src/weather_update.cpp b/protocols/Weather/src/weather_update.cpp index 12736b35be..1701b25868 100644 --- a/protocols/Weather/src/weather_update.cpp +++ b/protocols/Weather/src/weather_update.cpp @@ -406,19 +406,19 @@ int GetWeatherData(MCONTACT hContact) // generate update URL switch (i) { case 0: - mir_snprintf(loc, Data->UpdateURL, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL, _T2A(id).get()); break; case 1: - mir_snprintf(loc, Data->UpdateURL2, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL2, _T2A(id).get()); break; case 2: - mir_snprintf(loc, Data->UpdateURL3, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL3, _T2A(id).get()); break; case 3: - mir_snprintf(loc, Data->UpdateURL4, _T2A(id)); + mir_snprintf(loc, Data->UpdateURL4, _T2A(id).get()); break; default: diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp index b225516021..dc25d78161 100644 --- a/protocols/YAMN/src/browser/mailbrowser.cpp +++ b/protocols/YAMN/src/browser/mailbrowser.cpp @@ -634,7 +634,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN, if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopupRun + MN->Virtual.PopupRun)) { wchar_t tszMsg[250]; - mir_snwprintf(tszMsg, TranslateT("%s : %d new mail message(s), %d total"), _A2T(ActualAccount->Name), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); + mir_snwprintf(tszMsg, TranslateT("%s : %d new mail message(s), %d total"), _A2T(ActualAccount->Name).get(), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); if (!(nflags & YAMN_ACC_CONTNOEVENT)) { CLISTEVENT evt = {}; diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 2277ea364f..d9118001c7 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -112,7 +112,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c if (ProtoXStatus != nullptr) { if (!tszTip.IsEmpty()) tszTip.AppendChar('\n'); - tszTip.AppendFormat(L"%-24.24s\n", ProtoXStatus); + tszTip.AppendFormat(L"%-24.24s\n", ProtoXStatus.get()); } } else tszTip.AppendFormat(L"%s %s", pa->tszAccountName, szStatus); @@ -129,7 +129,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c if (db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) { if (hasTips()) { if (ProtoXStatus != nullptr) - mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%s%s%-12.12s\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus); + mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%s%s%-12.12s\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus.get()); else mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%s%s%-12.12s\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus); } @@ -140,7 +140,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c else { if (hasTips()) { if (ProtoXStatus != nullptr) - mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%-12.12s\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus); + mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%-12.12s\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus.get()); else mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%-12.12s\t%s", pa->tszAccountName, szStatus); } diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 67e4e3b526..b4301ce4e6 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -120,7 +120,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp CMStringW nick, text; if (tszFirst || tszLast) { - nick.AppendFormat(L"%s %s", tszFirst, tszLast); + nick.AppendFormat(L"%s %s", tszFirst.get(), tszLast.get()); nick.Trim(); } if (tszEmail) { @@ -139,10 +139,10 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp if (dbei->eventType == EVENTTYPE_AUTHREQUEST) { ptrW tszReason(dbei->getString(blob.get_reason())); text.Format(TranslateT("Authorization request from %s%s: %s"), - (tszNick == nullptr) ? Clist_GetContactDisplayName(blob.get_contact()) : tszNick, nick.c_str(), tszReason); + (tszNick == nullptr) ? Clist_GetContactDisplayName(blob.get_contact()) : tszNick.get(), nick.c_str(), tszReason.get()); } else text.Format(TranslateT("You were added by %s%s"), - (tszNick == nullptr) ? Clist_GetContactDisplayName(blob.get_contact()) : tszNick, nick.c_str()); + (tszNick == nullptr) ? Clist_GetContactDisplayName(blob.get_contact()) : tszNick.get(), nick.c_str()); return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text); } @@ -154,9 +154,9 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp ptrW tszUin(getEventString(dbei, buf)); ptrW tszNick(getEventString(dbei, buf)); if (tszNick && *tszNick) - text.AppendFormat(L"\"%s\" ", tszNick); + text.AppendFormat(L"\"%s\" ", tszNick.get()); if (tszUin && *tszUin) - text.AppendFormat(L"<%s>; ", tszUin); + text.AppendFormat(L"<%s>; ", tszUin.get()); } return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text); } @@ -305,11 +305,11 @@ PBYTE DB_AUTH_BLOB::makeBlob() pCurBlob += sizeof(DWORD); mir_snprintf((char*)pCurBlob, m_size - 8, "%s%c%s%c%s%c%s%c%s%c", - (m_szNick) ? m_szNick : "", 0, - (m_szFirstName) ? m_szFirstName : "", 0, - (m_szLastName) ? m_szLastName : "", 0, - (m_szEmail) ? m_szEmail : "", 0, - (m_szReason) ? m_szReason : "", 0); + (m_szNick) ? m_szNick.get() : "", 0, + (m_szFirstName) ? m_szFirstName.get() : "", 0, + (m_szLastName) ? m_szLastName.get() : "", 0, + (m_szEmail) ? m_szEmail.get() : "", 0, + (m_szReason) ? m_szReason.get() : "", 0); return pBlob; } diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp index cfc2ab0427..2113837ce0 100644 --- a/src/mir_app/src/db_ini.cpp +++ b/src/mir_app/src/db_ini.cpp @@ -481,7 +481,7 @@ LBL_NewLine: break; default: wchar_t buf[250]; - mir_snwprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName)); + mir_snwprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName).get()); MessageBox(nullptr, buf, TranslateT("Install database settings"), MB_ICONWARNING | MB_OK); break; } diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp index ca551c20e1..4f39d7d9c2 100644 --- a/src/mir_app/src/netlibbind.cpp +++ b/src/mir_app/src/netlibbind.cpp @@ -166,7 +166,7 @@ static void __cdecl NetlibBindAcceptThread(NetlibBoundPort *nlbp) } else s = 0; - Netlib_Logf(nlbp->nlu, "New incoming connection on port %u from %s (%p)", nlbp->wPort, ptrA(Netlib_AddressToString(&sin)), (void*)s); + Netlib_Logf(nlbp->nlu, "New incoming connection on port %u from %s (%p)", nlbp->wPort, ptrA(Netlib_AddressToString(&sin)).get(), (void*)s); NetlibConnection *nlc = new NetlibConnection(); nlc->nlu = nlbp->nlu; diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index 80faef277c..ee4bb5d996 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -550,7 +550,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) } for (ai = air; ai && !Miranda_IsTerminated(); ai = ai->ai_next) { - Netlib_Logf(nlu, "(%p) Connecting to ip %s ....", nlc, ptrA(Netlib_AddressToString((sockaddr_in*)ai->ai_addr))); + Netlib_Logf(nlu, "(%p) Connecting to ip %s ....", nlc, ptrA(Netlib_AddressToString((sockaddr_in*)ai->ai_addr)).get()); retry: nlc->s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (nlc->s == INVALID_SOCKET) { diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index cbd2dbc969..e935a6b702 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -411,7 +411,7 @@ class COptionsDlg : public CDlgBase void GetTreeSettingName(int idx, char *buf, size_t bufSize) { - mir_snprintf(buf, bufSize, "%s%S", OPTSTATE_PREFIX, (idx < 0) ? m_arOpd[-idx]->ptszGroup : m_arOpd[idx]->ptszTitle); + mir_snprintf(buf, bufSize, "%s%S", OPTSTATE_PREFIX, (idx < 0) ? m_arOpd[-idx]->ptszGroup.get() : m_arOpd[idx]->ptszTitle.get()); } void SaveOptionsTreeState() diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index a2ffcafd58..4414f91594 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -216,7 +216,7 @@ public: return false; // profile placed in "profile_name" subfolder - mir_snwprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, szName, szName); + mir_snwprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, szName.get(), szName.get()); m_pd->newProfile = 1; m_pd->dblink = (DATABASELINK *)m_driverList.GetItemData(curSel); diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index f64dff3ea0..db222aff0b 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -704,9 +704,9 @@ BOOL CAccountListCtrl::OnDrawItem(DRAWITEMSTRUCT *lps) ptrW tszIdName(szIdName ? mir_a2u(szIdName) : mir_wstrdup(TranslateT("Account ID"))); ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, 0, acc->szModuleName)); if (tszUniqueID != nullptr) - text.Format(L"%s: %s", tszIdName, tszUniqueID); + text.Format(L"%s: %s", tszIdName.get(), tszUniqueID.get()); else - text.Format(L"%s: %s", tszIdName, TranslateT("")); + text.Format(L"%s: %s", tszIdName.get(), TranslateT("")); } else text.Format(TranslateT("Protocol is not loaded.")); @@ -873,7 +873,7 @@ bool CAccountFormDlg::OnApply() if (m_action == PRAC_UPGRADED) { BOOL oldProto = m_pa->bOldProto; wchar_t szPlugin[MAX_PATH]; - mir_snwprintf(szPlugin, L"%s.dll", _A2T(m_pa->szProtoName)); + mir_snwprintf(szPlugin, L"%S.dll", m_pa->szProtoName); int idx = accounts.getIndex(m_pa); UnloadAccount(m_pa, 0); accounts.remove(idx); diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 7b47a9afbe..b3c1aba600 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -124,7 +124,7 @@ MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN _hLang) // download database settings char SettingName[1024]; - mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonID); + mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName.get(), cbd->m_dwButtonID); DBVARIANT dbv = { 0 }; if (!db_get_s(0, BB_MODULE_NAME, SettingName, &dbv)) { @@ -448,7 +448,7 @@ static void CB_WriteButtonSettings(MCONTACT hContact, CustomButtonData *cbd) //modulename_buttonID, position_inIM_inCHAT_isLSide_isRSide_CanBeHidden - mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonID); + mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName.get(), cbd->m_dwButtonID); mir_snprintf(SettingParameter, "%d_%u_%u_%u_%u_%u", cbd->m_dwPosition, cbd->m_bIMButton, cbd->m_bChatButton, 0, cbd->m_bRSided, cbd->m_bCanBeHidden); if (!(cbd->m_opFlags & BBSF_NTBDESTRUCT)) db_set_s(hContact, BB_MODULE_NAME, SettingName, SettingParameter); diff --git a/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp index 47a83b62c1..3ca4636057 100644 --- a/src/mir_core/src/winver.cpp +++ b/src/mir_core/src/winver.cpp @@ -342,7 +342,7 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize) HMODULE hNtDll = GetModuleHandleA("ntdll.dll"); if (WGV wine_get_version = (WGV)GetProcAddress(hNtDll, "wine_get_version")) { - ret.AppendFormat(L" (Wine %s)", _A2T(wine_get_version())); + ret.AppendFormat(L" (Wine %S)", wine_get_version()); } mir_wstrncpy(buf, ret, bufSize); -- cgit v1.2.3