From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Twitter/src/StringUtil.h | 2 +- protocols/Twitter/src/chat.cpp | 18 +++++++++--------- protocols/Twitter/src/contacts.cpp | 6 +++--- protocols/Twitter/src/main.cpp | 2 +- protocols/Twitter/src/proto.cpp | 16 ++++++++-------- protocols/Twitter/src/ui.cpp | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) (limited to 'protocols/Twitter/src') diff --git a/protocols/Twitter/src/StringUtil.h b/protocols/Twitter/src/StringUtil.h index f1ebdb55e1..51a13123e8 100644 --- a/protocols/Twitter/src/StringUtil.h +++ b/protocols/Twitter/src/StringUtil.h @@ -44,7 +44,7 @@ inline std::wstring UTF8ToWide(const std::string& str) inline bool Compare(const wstring& one, const wstring& two, bool caseSensitive) { - return caseSensitive ? (one == two) : (mir_tstrcmpi(one.c_str(), two.c_str()) == 0); + return caseSensitive ? (one == two) : (mir_wstrcmpi(one.c_str(), two.c_str()) == 0); } #endif//_STRINGUTIL_H_INCLUDED_ diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 940d34eee5..8a7d155f26 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -29,25 +29,25 @@ void TwitterProto::UpdateChat(const twitter_user &update) gce.pDest = &gcd; gce.bIsMe = (update.username == twit_.get_username()); gce.dwFlags = GCEF_ADDTOLOG; - gce.ptszUID = mir_a2t(update.username.c_str()); + gce.ptszUID = mir_a2u(update.username.c_str()); //TODO: write code here to replace % with %% in update.status.text (which is a std::string) std::string chatText = update.status.text; replaceAll(chatText, "%", "%%"); - gce.ptszText = mir_a2t_cp(chatText.c_str(), CP_UTF8); - //gce.ptszText = mir_a2t_cp(update.status.text.c_str(),CP_UTF8); + gce.ptszText = mir_a2u_cp(chatText.c_str(), CP_UTF8); + //gce.ptszText = mir_a2u_cp(update.status.text.c_str(),CP_UTF8); gce.time = static_cast(update.status.time); DBVARIANT nick; MCONTACT hContact = UsernameToHContact(update.username.c_str()); if (hContact && !db_get_s(hContact, "CList", "MyHandle", &nick)) { - gce.ptszNick = mir_a2t(nick.pszVal); + gce.ptszNick = mir_a2u(nick.pszVal); db_free(&nick); } else - gce.ptszNick = mir_a2t(update.username.c_str()); + gce.ptszNick = mir_a2u(update.username.c_str()); CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); @@ -78,7 +78,7 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS: { - ptrA text(mir_t2a(hook->ptszUID)); + ptrA text(mir_u2a(hook->ptszUID)); CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0); } break; @@ -93,8 +93,8 @@ void TwitterProto::AddChatContact(const char *name, const char *nick) GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN }; GCEVENT gce = { sizeof(gce), &gcd }; gce.time = DWORD(time(0)); - gce.ptszNick = mir_a2t(nick ? nick : name); - gce.ptszUID = mir_a2t(name); + gce.ptszNick = mir_a2u(nick ? nick : name); + gce.ptszUID = mir_a2u(name); gce.ptszStatus = L"Normal"; CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); @@ -107,7 +107,7 @@ void TwitterProto::DeleteChatContact(const char *name) GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART }; GCEVENT gce = { sizeof(gce), &gcd }; gce.time = DWORD(time(0)); - gce.ptszNick = mir_a2t(name); + gce.ptszNick = mir_a2u(name); gce.ptszUID = gce.ptszNick; CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 880ba6974a..174046afdb 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -49,7 +49,7 @@ MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *psr) if (m_iStatus != ID_STATUS_ONLINE) return 0; - ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.w)); + ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeW(psr->nick.w)); return AddToClientList(_T2A(psr->nick.w), ""); } @@ -127,8 +127,8 @@ void TwitterProto::DoSearch(void *pArg) if (found) { PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.nick.w = mir_a2t(info.username.c_str()); - psr.firstName.w = mir_a2t(info.real_name.c_str()); + psr.nick.w = mir_a2u(info.username.c_str()); + psr.firstName.w = mir_a2u(info.real_name.c_str()); ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index ccc9b20db5..dc5a40dc99 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -46,7 +46,7 @@ PLUGININFOEX pluginInfo = { static int compare_protos(const TwitterProto *p1, const TwitterProto *p2) { - return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName); + return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); } OBJLIST g_Instances(1, compare_protos); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 5b58154808..c0f1e32b01 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -313,12 +313,12 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.szSettingsModule = m_szModuleName; // Create standard network connection - mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName); + mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; - mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } @@ -326,12 +326,12 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) char module[512]; mir_snprintf(module, "%sAv", m_szModuleName); nlu.szSettingsModule = module; - mir_sntprintf(descr, TranslateT("%s avatar connection"), m_tszUserName); + mir_snwprintf(descr, TranslateT("%s avatar connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; hAvatarNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (hAvatarNetlib_ == NULL) { wchar_t error[200]; - mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)")); + mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)")); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } @@ -380,7 +380,7 @@ int TwitterProto::ShowPinDialog() void TwitterProto::ShowPopup(const wchar_t *text, int Error) { POPUPDATAT popup = {}; - mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName); + mir_snwprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName); wcsncpy_s(popup.lptzText, text, _TRUNCATE); if (Error) { @@ -398,7 +398,7 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) void TwitterProto::ShowPopup(const char *text, int Error) { POPUPDATAT popup = {}; - mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName); + mir_snwprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName); mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText)); if (Error) { popup.iSeconds = -1; @@ -422,7 +422,7 @@ void TwitterProto::SendTweetWorker(void *p) char *text = static_cast(p); if (mir_strlen(mir_utf8decodeA(text)) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here. wchar_t errorPopup[280]; - mir_sntprintf(errorPopup, TranslateT("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text)); + mir_snwprintf(errorPopup, TranslateT("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text)); ShowPopup(errorPopup, 1); return; } @@ -455,7 +455,7 @@ void TwitterProto::UpdateSettings() std::wstring TwitterProto::GetAvatarFolder() { wchar_t path[MAX_PATH]; - mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName); + mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName); return path; } diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index b6e067dab7..e6e5dc2a5e 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -113,7 +113,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Set window title wchar_t title[512]; - mir_sntprintf(title, L"Send Tweet for %s", proto->m_tszUserName); + mir_snwprintf(title, L"Send Tweet for %s", proto->m_tszUserName); SetWindowText(hwndDlg, title); return true; @@ -125,7 +125,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg)); ShowWindow(hwndDlg, SW_HIDE); - char *narrow = mir_t2a_cp(msg, CP_UTF8); + char *narrow = mir_u2a_cp(msg, CP_UTF8); proto->ForkThread(&TwitterProto::SendTweetWorker, narrow); EndDialog(hwndDlg, wParam); -- cgit v1.2.3