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 --- 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 +- 7 files changed, 19 insertions(+), 20 deletions(-) (limited to 'protocols/VKontakte/src') 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; } -- cgit v1.2.3