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/Yahoo/src/avatar.cpp | 8 ++--- protocols/Yahoo/src/chat.cpp | 26 +++++++-------- protocols/Yahoo/src/file_transfer.cpp | 6 ++-- protocols/Yahoo/src/links.cpp | 2 +- protocols/Yahoo/src/main.cpp | 2 +- protocols/Yahoo/src/proto.cpp | 4 +-- protocols/Yahoo/src/search.cpp | 4 +-- protocols/Yahoo/src/util.cpp | 4 +-- protocols/Yahoo/src/yahoo.cpp | 62 +++++++++++++++++------------------ 9 files changed, 59 insertions(+), 59 deletions(-) (limited to 'protocols/Yahoo/src') diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 34f68acc0a..93dbff7f38 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -596,17 +596,17 @@ void CYahooProto::request_avatar(const char* who) void CYahooProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, int cbLen, int type) { - int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); + int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); if (_waccess(pszDest, 0)) CreateDirectoryTreeT(pszDest); if (hContact != NULL) { int ck_sum = getDword(hContact, "PictCK", 0); - tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%lX", ck_sum); + tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%lX", ck_sum); } else - tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName); + tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName); wcsncpy_s((pszDest + tPathLen), (cbLen - tPathLen), (type == 1 ? L".swf" : L".png"), _TRUNCATE); } @@ -750,7 +750,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (getDword("AvatarHash", 0)) { if (!getTString("AvatarFile", &dbv)) { if (_waccess(dbv.ptszVal, 0) == 0) { - mir_tstrncpy(buffer, dbv.ptszVal, size - 1); + mir_wstrncpy(buffer, dbv.ptszVal, size - 1); buffer[size - 1] = '\0'; ret = 0; diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index ce59ae92f6..486286857d 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -41,7 +41,7 @@ struct InviteChatReqParam CYahooProto* ppro; InviteChatReqParam(const char* room, const char* who, const char* msg, CYahooProto* ppro) - : room(mir_strdup(room)), who(mir_strdup(who)), msg(mir_utf8decodeT(msg)), ppro(ppro) {} + : room(mir_strdup(room)), who(mir_strdup(who)), msg(mir_utf8decodeW(msg)), ppro(ppro) {} ~InviteChatReqParam() { mir_free(room); mir_free(who); mir_free(msg); } @@ -52,9 +52,9 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA void ext_yahoo_conf_userdecline(int id, const char*, const char *who, const char *room, const char *msg) { wchar_t info[1024]; - wchar_t *whot = mir_utf8decodeT(who); - wchar_t *msgt = mir_utf8decodeT(msg); - mir_sntprintf(info, TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : L""); + wchar_t *whot = mir_utf8decodeW(who); + wchar_t *msgt = mir_utf8decodeW(msg); + mir_snwprintf(info, TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : L""); GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_INFORMATION, info); mir_free(msgt); mir_free(whot); @@ -98,7 +98,7 @@ void ext_yahoo_conf_userleave(int id, const char*, const char *who, const char * void ext_yahoo_conf_message(int id, const char*, const char *who, const char *room, const char *msg, int utf8) { - wchar_t *msgt = utf8 ? mir_utf8decodeT(msg) : mir_a2t(msg); + wchar_t *msgt = utf8 ? mir_utf8decodeW(msg) : mir_a2u(msg); GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_MESSAGE, msgt); mir_free(msgt); } @@ -150,7 +150,7 @@ void CYahooProto::ChatRegister(void) void CYahooProto::ChatStart(const char* room) { - wchar_t* idt = mir_a2t(room); + wchar_t* idt = mir_a2u(room); GCSESSION gcw = { sizeof(gcw) }; gcw.iType = GCW_CHATROOM; @@ -178,7 +178,7 @@ void CYahooProto::ChatStart(const char* room) void CYahooProto::ChatLeave(const char* room) { - wchar_t* idt = mir_a2t(room); + wchar_t* idt = mir_a2u(room); GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -197,8 +197,8 @@ void CYahooProto::ChatLeaveAll(void) void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const wchar_t* msg) { - wchar_t* idt = mir_a2t(room); - wchar_t* snt = mir_a2t(who); + wchar_t* idt = mir_a2u(room); + wchar_t* snt = mir_a2u(who); MCONTACT hContact = getbuddyH(who); wchar_t* nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0) : snt; @@ -225,8 +225,8 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0; - char *room = mir_t2a(gch->pDest->ptszID); - char *who = mir_t2a(gch->ptszUID); + char *room = mir_u2a(gch->pDest->ptszID); + char *who = mir_u2a(gch->ptszUID); switch (gch->pDest->iType) { case GC_SESSION_TERMINATE: @@ -310,7 +310,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items; } else if (gcmi->Type == MENU_ON_NICKLIST) { - char* id = mir_t2a(gcmi->pszUID); + char* id = mir_u2a(gcmi->pszUID); if (!_stricmp(m_yahoo_id, id)) { static const gc_item Items[] = { @@ -359,7 +359,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, YList* &who, c wchar_t buf[128] = L""; SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); - who = y_list_append(who, mir_t2a(buf)); + who = y_list_append(who, mir_u2a(buf)); } else { DBVARIANT dbv; diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index c0620894dd..50156ddd5d 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -60,7 +60,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, MCONTACT hContact, cons for (YList *l = fs; l; l = l->next) { yahoo_file_info *fi = (yahoo_file_info*)l->data; - ft->pfts.ptszFiles[i++] = mir_utf8decodeT(fi->filename); + ft->pfts.ptszFiles[i++] = mir_utf8decodeW(fi->filename); ft->pfts.totalBytes += fi->filesize; } @@ -297,7 +297,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char*, unsigned long si * * Don't rely on workingDir to be right, since it's not used to check if file exists. */ - mir_sntprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile); + mir_snwprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile); FREE(sf->pfts.tszCurrentFile); sf->pfts.tszCurrentFile = wcsdup(filefull); @@ -721,7 +721,7 @@ HANDLE __cdecl CYahooProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* //LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user); ft->pfts.tszWorkingDir = wcsdup(szPath); - size_t len = mir_tstrlen(ft->pfts.tszWorkingDir) - 1; + size_t len = mir_wstrlen(ft->pfts.tszWorkingDir) - 1; if (ft->pfts.tszWorkingDir[len] == '\\') ft->pfts.tszWorkingDir[len] = 0; diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index c42f3ce9ad..1eaeadaf44 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -63,7 +63,7 @@ static char* get_buddy(wchar_t ** arg) *arg = tok ? tok + 1 : NULL; - return mir_t2a(buf); + return mir_u2a(buf); } diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index 87d254bace..f7c04b8097 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -72,7 +72,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lp static int CompareProtos(const CYahooProto* p1, const CYahooProto* p2) { - return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName); + return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); } LIST g_instances(1, CompareProtos); diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index a2610c5f7b..56ad2d559e 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -67,7 +67,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu); wchar_t tModuleDescr[100]; - mir_sntprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName); + mir_snwprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName); NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); @@ -541,7 +541,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg(MCONTACT hContact) int __cdecl CYahooProto::SetAwayMsg(int status, const wchar_t* msg) { - char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL; + char *c = msg && msg[0] ? mir_utf8encodeW(msg) : NULL; debugLogA("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c); diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index d08a08df66..5b0427d2a4 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -24,7 +24,7 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) { wchar_t *id = (wchar_t *)snsearch; - if (mir_tstrlen(id) < 4) { + if (mir_wstrlen(id) < 4) { ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); MessageBoxA(NULL, "Please enter a valid ID to search for.", "Search", MB_OK); return; @@ -161,7 +161,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) wchar_t searchid[128]; GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, _countof(searchid)); - if (mir_tstrlen(searchid) == 0) { + if (mir_wstrlen(searchid) == 0) { ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); MessageBoxA(NULL, "Please enter a valid ID to search for.", "Search", MB_OK); return; diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 44584763b6..4e792b6162 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -112,8 +112,8 @@ int CYahooProto::ShowPopup(const wchar_t* nickname, const wchar_t* msg, const ch POPUPDATAT ppd = { 0 }; ppd.PluginWindowProc = PopupWindowProc; - mir_tstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName)); - mir_tstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText)); + mir_wstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName)); + mir_wstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText)); if (szURL != NULL) { ppd.lchIcon = LoadIconEx(!mir_strcmpi(szURL, "http://mail.yahoo.com") ? "mail" : "calendar"); diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index b9aca199e2..ec97c1c3f1 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -217,8 +217,8 @@ void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const wchar_t * T2Utf u_msg(msg); ptrA ident(getStringA(hContact, "MyIdentity")); - ptrT fname(getTStringA(NULL, "FirstName")); - ptrT lname(getTStringA(NULL, "LastName")); + ptrW fname(getTStringA(NULL, "FirstName")); + ptrW lname(getTStringA(NULL, "LastName")); SetStringUtf(hContact, "YGroup", group); @@ -529,7 +529,7 @@ void CYahooProto::ext_got_calendar(const char *url, int type, const char *msg, i { LOG(("[ext_got_calendar] URL:%s type: %d msg: %s svc: %d", url, type, msg, svc)); - ptrT tszMsg(mir_utf8decodeT(msg)); + ptrW tszMsg(mir_utf8decodeW(msg)); if (!ShowPopup(TranslateT("Calendar Reminder"), tszMsg, url)) ShowNotification(TranslateT("Calendar Reminder"), tszMsg, NIIF_INFO); } @@ -672,11 +672,11 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) } else LOG(("[ext_rejected] Buddy not on our buddy list")); - ptrT tszWho(mir_utf8decodeT(who)); - ptrT tszMsg(mir_utf8decodeT(msg)); + ptrW tszWho(mir_utf8decodeW(who)); + ptrW tszMsg(mir_utf8decodeW(msg)); wchar_t buff[1024]; - mir_sntprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho); + mir_snwprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho); MessageBox(NULL, tszMsg, buff, MB_OK | MB_ICONINFORMATION); } @@ -926,15 +926,15 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) wchar_t z[MAX_SECONDLINE], title[MAX_CONTACTNAME]; if (from == NULL) { - mir_sntprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail")); - mir_sntprintf(z, TranslateT("You have %i unread messages"), cnt); + mir_snwprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail")); + mir_snwprintf(z, TranslateT("You have %i unread messages"), cnt); } else { - mir_sntprintf(title, TranslateT("New Mail (%i messages)"), cnt); + mir_snwprintf(title, TranslateT("New Mail (%i messages)"), cnt); - ptrT tszFrom(mir_utf8decodeT(from)); - ptrT tszSubj(mir_utf8decodeT(subj)); - mir_sntprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj); + ptrW tszFrom(mir_utf8decodeW(from)); + ptrW tszSubj(mir_utf8decodeW(subj)); + mir_snwprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj); } if (!ShowPopup(title, z, "http://mail.yahoo.com")) @@ -950,8 +950,8 @@ void CYahooProto::ext_system_message(const char *me, const char *who, const char { LOG(("[ext_system_message] System Message to: %s from: %s msg: %s", me, who, msg)); - ptrT tszWho(mir_utf8decodeT(who)); - ptrT tszMsg(mir_utf8decodeT(msg)); + ptrW tszWho(mir_utf8decodeW(who)); + ptrW tszMsg(mir_utf8decodeW(msg)); ShowPopup((who != NULL) ? tszWho : TranslateT("Yahoo System Message"), tszMsg, NULL); } @@ -1010,7 +1010,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) if (errormsg) { LOG(("[ext_got_ping] Error msg: %s", errormsg)); - ptrT tszMsg(mir_utf8decodeT(errormsg)); + ptrW tszMsg(mir_utf8decodeW(errormsg)); ShowError(TranslateT("Yahoo Ping Error"), tszMsg); return; } @@ -1065,33 +1065,33 @@ void CYahooProto::ext_login_response(int succ, const char *url) } if (succ == YAHOO_LOGIN_UNAME) { - mir_sntprintf(buff, TranslateT("Could not log into Yahoo service - username not recognized. Please verify that your username is correctly typed.")); + mir_snwprintf(buff, TranslateT("Could not log into Yahoo service - username not recognized. Please verify that your username is correctly typed.")); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID); } else if (succ == YAHOO_LOGIN_PASSWD) { - mir_sntprintf(buff, TranslateT("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed.")); + mir_snwprintf(buff, TranslateT("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed.")); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD); } else if (succ == YAHOO_LOGIN_LOCK) { - mir_sntprintf(buff, TranslateT("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), _A2T(url)); + mir_snwprintf(buff, TranslateT("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), _A2T(url)); } else if (succ == YAHOO_LOGIN_DUPL) { - mir_sntprintf(buff, TranslateT("You have been logged out of the Yahoo service, possibly due to a duplicate login.")); + mir_snwprintf(buff, TranslateT("You have been logged out of the Yahoo service, possibly due to a duplicate login.")); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION); } else if (succ == YAHOO_LOGIN_LOGOFF) { - //mir_sntprintf(buff, TranslateT("You have been logged out of the Yahoo service.")); + //mir_snwprintf(buff, TranslateT("You have been logged out of the Yahoo service.")); //ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION); return; // we logged out.. so just sign-off.. } else if (succ == -1) { /// Can't Connect or got disconnected. if (m_iStatus == ID_STATUS_CONNECTING) - mir_sntprintf(buff, TranslateT("Could not connect to the Yahoo service. Check your server/port and proxy settings.")); + mir_snwprintf(buff, TranslateT("Could not connect to the Yahoo service. Check your server/port and proxy settings.")); else return; } - else mir_sntprintf(buff, TranslateT("Could not log in, unknown reason: %d."), succ); + else mir_snwprintf(buff, TranslateT("Could not log in, unknown reason: %d."), succ); delSetting(YAHOO_PWTOKEN); @@ -1110,35 +1110,35 @@ void CYahooProto::ext_login_response(int succ, const char *url) void CYahooProto::ext_error(const char *err, int fatal, int num) { - ptrT tszErr(mir_utf8decodeT(err)); + ptrW tszErr(mir_utf8decodeW(err)); wchar_t buff[1024]; LOG(("[ext_error] Error: fatal: %d, num: %d, err: %s", fatal, num, err)); switch (num) { case E_UNKNOWN: - mir_sntprintf(buff, TranslateT("Unknown error %s"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("Unknown error %s"), (wchar_t*)tszErr); break; case E_CUSTOM: - mir_sntprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr); break; case E_CONFNOTAVAIL: - mir_sntprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr); break; case E_IGNOREDUP: - mir_sntprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr); break; case E_IGNORENONE: - mir_sntprintf(buff, TranslateT("%s is not in the ignore list"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("%s is not in the ignore list"), (wchar_t*)tszErr); break; case E_IGNORECONF: - mir_sntprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (wchar_t*)tszErr); break; case E_SYSTEM: - mir_sntprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr); break; case E_CONNECTION: - mir_sntprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr); + mir_snwprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr); debugLogA("Error: %S", buff); return; } -- cgit v1.2.3