From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan <george.hazan@gmail.com> Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn.cpp | 2 +- protocols/MSN/src/msn_auth.cpp | 4 +- protocols/MSN/src/msn_avatar.cpp | 6 +-- protocols/MSN/src/msn_chat.cpp | 58 ++++++++++++++--------------- protocols/MSN/src/msn_commands.cpp | 38 +++++++++---------- protocols/MSN/src/msn_ftold.cpp | 2 +- protocols/MSN/src/msn_libstr.cpp | 18 ++++----- protocols/MSN/src/msn_links.cpp | 28 +++++++------- protocols/MSN/src/msn_lists.cpp | 12 +++--- protocols/MSN/src/msn_mail.cpp | 16 ++++---- protocols/MSN/src/msn_menu.cpp | 6 +-- protocols/MSN/src/msn_misc.cpp | 74 ++++++++++++++++++------------------- protocols/MSN/src/msn_natdetect.cpp | 2 +- protocols/MSN/src/msn_opts.cpp | 16 ++++---- protocols/MSN/src/msn_p2p.cpp | 30 +++++++-------- protocols/MSN/src/msn_proto.cpp | 54 +++++++++++++-------------- protocols/MSN/src/msn_proto.h | 52 +++++++++++++------------- protocols/MSN/src/msn_skypeab.cpp | 16 ++++---- protocols/MSN/src/msn_soapstore.cpp | 4 +- protocols/MSN/src/msn_ssl.cpp | 2 +- protocols/MSN/src/msn_std.cpp | 6 +-- protocols/MSN/src/msn_svcs.cpp | 24 ++++++------ protocols/MSN/src/msn_threads.cpp | 2 +- protocols/MSN/src/stdafx.h | 20 +++++----- 24 files changed, 246 insertions(+), 246 deletions(-) (limited to 'protocols/MSN/src') diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index ae71843bd2..2f217da0b5 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -86,7 +86,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) return 0; } -static CMsnProto* msnProtoInit(const char* pszProtoName, const TCHAR* tszUserName) +static CMsnProto* msnProtoInit(const char* pszProtoName, const wchar_t* tszUserName) { CMsnProto *ppro = new CMsnProto(pszProtoName, tszUserName); g_Instances.insert(ppro); diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 27a002ceba..aa1bb8e95c 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -358,7 +358,7 @@ int CMsnProto::MSN_GetPassportAuth(void) time_t ts = time(NULL); - TCHAR szTs1[64], szTs2[64]; + wchar_t szTs1[64], szTs2[64]; TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, L"I", szTs1, _countof(szTs1), 0); TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, L"I", szTs2, _countof(szTs2), 0); @@ -969,7 +969,7 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam) HWND hWnd; MSG msg; WNDCLASSEX wc={0}; - static const TCHAR *ClassName = L"SkypeLoginWindow"; + static const wchar_t *ClassName = L"SkypeLoginWindow"; CoInitialize(NULL); diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index bb7121218a..5836baa234 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -71,7 +71,7 @@ LBL_Error: return false; } - const TCHAR *szExt; + const wchar_t *szExt; int fmt = ProtoGetBufferFormat(nlhrReply->pData, &szExt); if (fmt == PA_FORMAT_UNKNOWN) goto LBL_Error; @@ -80,9 +80,9 @@ LBL_Error: ai.format = fmt; ai.hContact = p->hContact; MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), szExt); - _tremove(ai.filename); + _wremove(ai.filename); - int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); + int fileId = _wopen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); if (fileId == -1) goto LBL_Error; diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 9c13070bc1..995404ea9b 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_proto.h" #include <m_history.h> -static const TCHAR *m_ptszRoles[] = { +static const wchar_t *m_ptszRoles[] = { L"admin", L"user" }; @@ -47,14 +47,14 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p { char *szNet, *szEmail; - _tcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID)); + wcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID)); parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL); info->netId = atoi(szNet); strncpy(info->szEmail, szEmail, sizeof(info->szEmail)); - TCHAR szName[512]; + wchar_t szName[512]; InterlockedIncrement(&m_chatID); - if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), _countof(szName)); + if (*pszTopic) wcsncpy(szName, _A2T(pszTopic), _countof(szName)); else mir_sntprintf(szName, L"%s %s%d", m_tszUserName, TranslateT("Chat #"), m_chatID); @@ -77,7 +77,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce); - mir_free((TCHAR*)gce.ptszUID); + mir_free((wchar_t*)gce.ptszUID); return 0; } @@ -143,7 +143,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) } } -void CMsnProto::MSN_KillChatSession(const TCHAR* id) +void CMsnProto::MSN_KillChatSession(const wchar_t* id) { GCDEST gcd = { m_szModuleName, id, GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -168,7 +168,7 @@ void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole) thread->netId, thread->szEmail, _T2A(gch->ptszUID), pszRole); } -const TCHAR *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID) +const wchar_t *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID) { if (thread) for (int j = 0; j < thread->mJoinedContacts.getCount(); j++) @@ -178,7 +178,7 @@ const TCHAR *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID) return NULL; } -void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID) +void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID) { if (!mir_strcmp(xmli->name, "topicupdate")) { ezxml_t initiator = ezxml_child(xmli, "initiator"); @@ -191,8 +191,8 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID) gce.ptszNick = GetContactNameT(hContInitiator); gce.ptszText = mir_a2t(ezxml_txt(ezxml_child(xmli, "value"))); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); - mir_free((TCHAR*)gce.ptszUID); - mir_free((TCHAR*)gce.ptszText); + mir_free((wchar_t*)gce.ptszUID); + mir_free((wchar_t*)gce.ptszText); } else if (ezxml_t target = ezxml_child(xmli, "target")) { MCONTACT hContInitiator = NULL; @@ -248,7 +248,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID) MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget); gce.ptszNick = GetContactNameT(hContTarget); CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); - mir_free((TCHAR*)gce.ptszUID); + mir_free((wchar_t*)gce.ptszUID); if ((gcd.iType == GC_EVENT_PART || gcd.iType == GC_EVENT_KICK) && gce.bIsMe) { GCDEST gcd2 = { m_szModuleName, mChatID, GC_EVENT_CONTROL }; GCEVENT gce2 = { sizeof(gce2), &gcd2 }; @@ -282,7 +282,7 @@ void CMsnProto::MSN_GCRefreshThreadsInfo(void) msnNsThread->sendPacketPayload("GET", "MSGR\\THREADS", "<threads>%s</threads>", buf); } -void CMsnProto::MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody) +void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody) { GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -292,7 +292,7 @@ void CMsnProto::MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email, gce.time = ts; gce.bIsMe = sentMsg; - TCHAR* p = mir_utf8decodeT(msgBody); + wchar_t* p = mir_utf8decodeT(msgBody); gce.ptszText = EscapeChatTags(p); mir_free(p); @@ -330,7 +330,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0); if (chk) { if (IsHContactInfo(hItem)) { - TCHAR buf[128] = L""; + wchar_t buf[128] = L""; SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); if (buf[0]) str.insert(mir_t2a(buf)); @@ -420,13 +420,13 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) { case IDC_ADDSCR: if (param->ppro->msnLoggedIn) { - TCHAR email[MSN_MAX_EMAIL_LEN]; + wchar_t email[MSN_MAX_EMAIL_LEN]; GetDlgItemText(hwndDlg, IDC_EDITSCR, email, _countof(email)); CLCINFOITEM cii = { 0 }; cii.cbSize = sizeof(cii); cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS; - cii.pszText = _tcslwr(email); + cii.pszText = wcslwr(email); HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1); @@ -501,7 +501,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) if (gch->ptszText && gch->ptszText[0]) { GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID); if (thread) { - TCHAR* pszMsg = UnEscapeChatTags(NEWTSTR_ALLOCA(gch->ptszText)); + wchar_t* pszMsg = UnEscapeChatTags(NEWWSTR_ALLOCA(gch->ptszText)); rtrimt(pszMsg); // remove the ending linebreak msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0); @@ -573,7 +573,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) break; case 40: - const TCHAR *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID)); + const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID)); MSN_Promoteuser(gch, (pszRole && !mir_tstrcmp(pszRole, L"admin")) ? "user" : "admin"); break; } @@ -592,8 +592,8 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) if (gcmi->Type == MENU_ON_LOG) { static const struct gc_item Items[] = { - { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE }, - { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE } + { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE }, + { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE } }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; @@ -603,10 +603,10 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) if (!_stricmp(GetMyUsername(NETID_SKYPE), email)) { static const struct gc_item Items[] = { - { LPGENT("User &details"), 10, MENU_ITEM, FALSE }, - { LPGENT("User &history"), 20, MENU_ITEM, FALSE }, + { LPGENW("User &details"), 10, MENU_ITEM, FALSE }, + { LPGENW("User &history"), 20, MENU_ITEM, FALSE }, { L"", 100, MENU_SEPARATOR, FALSE }, - { LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE } + { LPGENW("&Leave chat session"), 110, MENU_ITEM, FALSE } }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; @@ -614,10 +614,10 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) else { static struct gc_item Items[] = { - { LPGENT("User &details"), 10, MENU_ITEM, FALSE }, - { LPGENT("User &history"), 20, MENU_ITEM, FALSE }, - { LPGENT("&Kick user") , 30, MENU_ITEM, FALSE }, - { LPGENT("&Op user") , 40, MENU_ITEM, FALSE } + { LPGENW("User &details"), 10, MENU_ITEM, FALSE }, + { LPGENW("User &history"), 20, MENU_ITEM, FALSE }, + { LPGENW("&Kick user") , 30, MENU_ITEM, FALSE }, + { LPGENW("&Op user") , 40, MENU_ITEM, FALSE } }; GCThreadData* thread = MSN_GetThreadByChatId(gcmi->pszID); if (thread && thread->mMe && mir_tstrcmpi(thread->mMe->role, L"admin")) { @@ -625,9 +625,9 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) Items[3].bDisabled = TRUE; } else { - const TCHAR *pszRole = MSN_GCGetRole(thread, email); + const wchar_t *pszRole = MSN_GCGetRole(thread, email); if (pszRole && !mir_tstrcmpi(pszRole, L"admin")) - Items[3].pszDesc = LPGENT("&Deop user"); + Items[3].pszDesc = LPGENW("&Deop user"); } gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index c2a02ae5c1..b38a1c2680 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -125,7 +125,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para int msgBytes; char *nick = NULL, *email = NULL; - TCHAR *mChatID = NULL; + wchar_t *mChatID = NULL; bool ubmMsg = strncmp(cmdString, "UBM", 3) == 0; bool sdgMsg = strncmp(cmdString, "SDG", 3) == 0; bool nfyMsg = strncmp(cmdString, "NFY", 3) == 0; @@ -182,7 +182,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para msgBody = tHeader.readFromBuffer(msgBody); if (!(email = NEWSTR_ALLOCA(tHeader["From"]))) return; mChatID = mir_a2t(tHeader["To"]); - if (_tcsncmp(mChatID, L"19:", 3)) mChatID[0]=0; // NETID_THREAD + if (wcsncmp(mChatID, L"19:", 3)) mChatID[0]=0; // NETID_THREAD msgBody = tHeader.readFromBuffer(msgBody); msgBody = tHeader.readFromBuffer(msgBody); nick = NEWSTR_ALLOCA(tHeader["IM-Display-Name"]); @@ -274,7 +274,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para psr[cnt] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT)); psr[cnt]->cbSize = sizeof(psr); psr[cnt]->flags = PSR_TCHAR; - psr[cnt]->id.t = psr[cnt]->nick.t = psr[cnt]->email.t = mir_a2t(wlid); + psr[cnt]->id.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2t(wlid); cnt++; } } @@ -286,7 +286,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para pre.lParam = cnt; ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre); for (cnt=0; cnt<pre.lParam; cnt++) { - mir_free(psr[cnt]->email.t); + mir_free(psr[cnt]->email.w); mir_free(psr[cnt]); } } @@ -519,18 +519,18 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) ft->szInvcookie = (char*)mir_calloc(strlen(uri)+16); sprintf(ft->szInvcookie, "%s/content/imgpsh", uri); - TCHAR tComment[40]; + wchar_t tComment[40]; mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize); PROTORECVFILET pre = { 0 }; pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.descr.t = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment; - pre.files.t = &ft->std.tszCurrentFile; + pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment; + pre.files.w = &ft->std.tszCurrentFile; pre.lParam = (LPARAM)ft; ProtoChainRecvFile(ft->std.hContact, &pre); - if (desc) mir_free(pre.descr.t); + if (desc) mir_free(pre.descr.w); } else uri=NULL; } @@ -574,9 +574,9 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id.t = szEmailT; - psr.nick.t = szEmailT; - psr.email.t = szEmailT; + psr.id.w = szEmailT; + psr.nick.w = szEmailT; + psr.email.w = szEmailT; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, msnSearchId, (LPARAM)&psr); } ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, msnSearchId, 0); @@ -808,7 +808,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) char *format = mir_strdup(parts[3]); char *unknown = NULL; if (ServiceExists(MS_LISTENINGTO_GETUNKNOWNTEXT)) - unknown = mir_utf8encodeT((TCHAR *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0)); + unknown = mir_utf8encodeT((wchar_t *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0)); for (unsigned i = 4; i < pCount; i++) { char part[16]; @@ -848,7 +848,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) if (pCount > 12) lti.ptszType = mir_utf8decodeT(parts[12]); else lti.ptszType = mir_utf8decodeT(parts[1]); - TCHAR *cm = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i); + wchar_t *cm = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i); setTString(hContact, "ListeningTo", cm); mir_free(cm); @@ -898,7 +898,7 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) SkinPlaySound(alertsoundname); - TCHAR* alrt = mir_utf8decodeT(ezxml_txt(xmltxt)); + wchar_t* alrt = mir_utf8decodeT(ezxml_txt(xmltxt)); MSN_ShowPopup(TranslateT("MSN Alert"), alrt, MSN_ALERT_POPUP | MSN_ALLOW_MSGBOX, fullurl); mir_free(alrt); } @@ -1469,15 +1469,15 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, ft->szInvcookie = mir_strdup(Invcookie); ft->p2p_dest = mir_strdup(email); - TCHAR tComment[40]; + wchar_t tComment[40]; mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize); PROTORECVFILET pre = { 0 }; pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.descr.t = tComment; - pre.files.t = &ft->std.tszCurrentFile; + pre.descr.w = tComment; + pre.files.w = &ft->std.tszCurrentFile; pre.lParam = (LPARAM)ft; ProtoChainRecvFile(ft->std.hContact, &pre); return; @@ -1536,7 +1536,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, // netmeeting receive 1 if (Appname != NULL && !_stricmp(Appname, "NetMeeting")) { - TCHAR text[512], *tszEmail = mir_a2t(email); + wchar_t text[512], *tszEmail = mir_a2t(email); mir_sntprintf(text, TranslateT("Accept NetMeeting request from %s?"), tszEmail); mir_free(tszEmail); @@ -1644,7 +1644,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i ptrA buf(mir_base64_encode((PBYTE)lastsml, (unsigned)slen)); ptrA smileyName(mir_urlEncode(buf)); - TCHAR path[MAX_PATH]; + wchar_t path[MAX_PATH]; MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType); ft->std.tszCurrentFile = mir_tstrdup(path); diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index 2a50f97480..a9f220575f 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -57,7 +57,7 @@ void CMsnProto::msnftp_invite(filetransfer *ft) if (isOffline) return; if (thread != NULL) thread->mMsnFtp = ft; - TCHAR* pszFiles = _tcsrchr(ft->std.ptszFiles[0], '\\'); + wchar_t* pszFiles = wcsrchr(ft->std.ptszFiles[0], '\\'); if (pszFiles) pszFiles++; else diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 3ce9e5a841..9e0cd37318 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -static TCHAR* a2tf(const TCHAR* str, bool unicode) +static wchar_t* a2tf(const wchar_t* str, bool unicode) { if (str == NULL) return NULL; @@ -30,7 +30,7 @@ static TCHAR* a2tf(const TCHAR* str, bool unicode) return unicode ? mir_tstrdup(str) : mir_a2t((char*)str); } -void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def) +void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def) { mir_free(dest); dest = NULL; @@ -298,21 +298,21 @@ void stripHTML(char* str) // Process a string, and double all % characters, according to chat.dll's restrictions // Returns a pointer to the new string (old one is not freed) -TCHAR* EscapeChatTags(const TCHAR* pszText) +wchar_t* EscapeChatTags(const wchar_t* pszText) { int nChars = 0; - for (const TCHAR* p = pszText; (p = _tcschr(p, '%')) != NULL; p++) + for (const wchar_t* p = pszText; (p = wcschr(p, '%')) != NULL; p++) nChars++; if (nChars == 0) return mir_tstrdup(pszText); - TCHAR *pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(pszText) + 1 + nChars)); + wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(pszText) + 1 + nChars)); if (pszNewText == NULL) return mir_tstrdup(pszText); - const TCHAR *s = pszText; - TCHAR *d = pszNewText; + const wchar_t *s = pszText; + wchar_t *d = pszNewText; while (*s) { if (*s == '%') *d++ = '%'; @@ -322,9 +322,9 @@ TCHAR* EscapeChatTags(const TCHAR* pszText) return pszNewText; } -TCHAR* UnEscapeChatTags(TCHAR* str_in) +wchar_t* UnEscapeChatTags(wchar_t* str_in) { - TCHAR *s = str_in, *d = str_in; + wchar_t *s = str_in, *d = str_in; while (*s) { if ((*s == '%' && s[1] == '%') || (*s == '\n' && s[1] == '\n')) s++; diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index d047b03213..a46e26e1a6 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -27,14 +27,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static HANDLE hServiceParseLink; -static MCONTACT GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto) +static MCONTACT GetContact(wchar_t *arg, wchar_t **pemail, CMsnProto *proto) { - TCHAR* email = NULL; + wchar_t* email = NULL; do { - TCHAR *tok = _tcschr(arg, '&'); /* next token */ + wchar_t *tok = wcschr(arg, '&'); /* next token */ if (tok != NULL) *tok++ = '\0'; - if (_tcsnicmp(arg, L"contact=", 8) == 0) { + if (wcsnicmp(arg, L"contact=", 8) == 0) { arg += 8; UrlDecode(arg); email = arg; @@ -62,15 +62,15 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) { if (lParam == 0) return 1; /* sanity check */ - TCHAR *arg = (TCHAR*)lParam; + wchar_t *arg = (wchar_t*)lParam; /* skip leading prefix */ - arg = _tcschr(arg, ':'); + arg = wcschr(arg, ':'); if (arg == NULL) return 1; /* parse failed */ for (++arg; *arg == '/'; ++arg) {} - arg = NEWTSTR_ALLOCA(arg); + arg = NEWWSTR_ALLOCA(arg); if (g_Instances.getCount() == 0) return 0; @@ -85,10 +85,10 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) /* add a contact to the list */ - if (_tcsnicmp(arg, L"add?", 4) == 0) { + if (wcsnicmp(arg, L"add?", 4) == 0) { arg += 4; - TCHAR *email; + wchar_t *email; MCONTACT hContact = GetContact(arg, &email, proto); if (email == NULL) return 1; @@ -96,8 +96,8 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) if (hContact == NULL) { PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.nick.t = email; - psr.email.t = email; + psr.nick.w = email; + psr.email.w = email; ADDCONTACTSTRUCT acs = { 0 }; acs.handleType = HANDLE_SEARCHRESULT; @@ -109,7 +109,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) } /* send a message to a contact */ /* "voice" and "video" not yet implemented, perform same action as "chat" */ - else if (_tcsnicmp(arg, L"chat?", 5) == 0) { + else if (wcsnicmp(arg, L"chat?", 5) == 0) { arg += 5; MCONTACT hContact = GetContact(arg, NULL, proto); @@ -119,7 +119,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) return 0; } } - else if (_tcsnicmp(arg, L"voice?", 6) == 0) { + else if (wcsnicmp(arg, L"voice?", 6) == 0) { arg += 6; MCONTACT hContact = GetContact(arg, NULL, proto); @@ -129,7 +129,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) return 0; } } - else if (_tcsnicmp(arg, L"video?", 6) == 0) { + else if (wcsnicmp(arg, L"video?", 6) == 0) { arg += 6; MCONTACT hContact = GetContact(arg, NULL, proto); diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index be82a1b15e..28126efa5d 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -244,12 +244,12 @@ void CMsnProto::MSN_CleanupLists(void) if (p.hContact && !(p.list & (LIST_LL | LIST_FL | LIST_PL)) && p.list != LIST_RL) { int count = db_event_count(p.hContact); if (count) { - TCHAR text[256]; - TCHAR *sze = mir_a2t(p.email); + wchar_t text[256]; + wchar_t *sze = mir_a2t(p.email); mir_sntprintf(text, TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze); mir_free(sze); - TCHAR title[128]; + wchar_t title[128]; mir_sntprintf(title, TranslateT("%s protocol"), m_tszUserName); if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) { @@ -266,7 +266,7 @@ void CMsnProto::MSN_CleanupLists(void) } if (p.list & (LIST_LL | LIST_FL) && p.hContact) { - TCHAR path[MAX_PATH]; + wchar_t path[MAX_PATH]; MSN_GetCustomSmileyFileName(p.hContact, path, _countof(path), "", 0); if (path[0]) { SMADD_CONT cont; @@ -369,7 +369,7 @@ static void AddPrivacyListEntries(HWND hwndList, CMsnProto *proto) for (int i = 0; i < proto->m_arContacts.getCount(); ++i) { MsnContact &cont = proto->m_arContacts[i]; if (!(cont.list & (LIST_FL | LIST_LL))) { - cii.pszText = (TCHAR*)cont.email; + cii.pszText = (wchar_t*)cont.email; hItem = (HANDLE)SendMessage(hwndList, CLM_ADDINFOITEMA, 0, (LPARAM)&cii); SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (cont.list & LIST_LL) ? 1 : 0)); @@ -461,7 +461,7 @@ static void SaveSettings(MCONTACT hItem, HWND hwndList, CMsnProto* proto) continue; } else if (IsHContactInfo(hItem)) { - TCHAR buf[MSN_MAX_EMAIL_LEN]; + wchar_t buf[MSN_MAX_EMAIL_LEN]; SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); WideCharToMultiByte(CP_ACP, 0, buf, -1, szEmail, sizeof(szEmail), 0, 0); diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 364d437356..27cb629258 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -207,8 +207,8 @@ void CMsnProto::processMailData(char* mailData) void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) { - TCHAR tBuffer[512]; - TCHAR tBuffer2[512]; + wchar_t tBuffer[512]; + wchar_t tBuffer2[512]; int UnreadMessages = mUnreadMessages; int UnreadJunkEmails = mUnreadJunkEmails; bool ShowPopup = isInitial; @@ -259,7 +259,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) - TCHAR* msgtxt = _stricmp(From, Fromaddr) ? + wchar_t* msgtxt = _stricmp(From, Fromaddr) ? TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s"); mir_sntprintf(tBuffer, msgtxt, mimeFromW, Fromaddr); @@ -377,17 +377,17 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) { if (!emailEnabled || getByte("DisableHotmailCL", 0)) return; - TCHAR* name = GetContactNameT(hContact); + wchar_t* name = GetContactNameT(hContact); if (name == NULL) return; - TCHAR* ch = name - 1; + wchar_t* ch = name - 1; do { - ch = _tcschr(ch + 1, '['); - } while (ch && !_istdigit(ch[1])); + ch = wcschr(ch + 1, '['); + } while (ch && !iswdigit(ch[1])); if (ch) *ch = 0; rtrimt(name); - TCHAR szNick[128]; + wchar_t szNick[128]; mir_sntprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails); nickChg = true; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 532242e257..ef12418621 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -119,10 +119,10 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int listId = Lists_GetMask(szEmail); bool noChat = !(listId & LIST_FL) || isMe || isChatRoom(hContact); - Menu_ModifyItem(hBlockMenuItem, (listId & LIST_BL) ? LPGENT("&Unblock") : LPGENT("&Block")); + Menu_ModifyItem(hBlockMenuItem, (listId & LIST_BL) ? LPGENW("&Unblock") : LPGENW("&Block")); Menu_ShowItem(hBlockMenuItem, !noChat); - Menu_ModifyItem(hOpenInboxMenuItem, isMe ? LPGENT("Open &Hotmail Inbox") : LPGENT("Send &Hotmail E-mail")); + Menu_ModifyItem(hOpenInboxMenuItem, isMe ? LPGENW("Open &Hotmail Inbox") : LPGENW("Send &Hotmail E-mail")); Menu_ShowItem(hOpenInboxMenuItem, emailEnabled); #ifdef OBSOLETE @@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam { CMsnProto *proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (proto->msnLoggedIn) { - TCHAR str[130]; + wchar_t str[130]; GetDlgItemText(hwndDlg, IDC_NICKNAME, str, _countof(str)); proto->MSN_SendNickname(str); } diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 6d5b581a89..3d76b63cde 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -117,7 +117,7 @@ void CMsnProto::InitCustomFolders(void) { if (InitCstFldRan) return; - TCHAR folder[MAX_PATH]; + wchar_t folder[MAX_PATH]; mir_sntprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName); hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName); @@ -168,11 +168,11 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) } // MSN_GetAvatarFileName - gets a file name for an contact's avatar -void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) +void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext) { size_t tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); - if (_taccess(pszDest, 0)) + if (_waccess(pszDest, 0)) CreateDirectoryTreeT(pszDest); size_t tPathLen2 = tPathLen; @@ -181,7 +181,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t if (getString(hContact, "PictContext", &dbv) == 0) { char* szAvatarHash = MSN_GetAvatarHash(dbv.pszVal); if (szAvatarHash != NULL) { - TCHAR *sztAvatarHash = mir_a2t(szAvatarHash); + wchar_t *sztAvatarHash = mir_a2t(szAvatarHash); tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash); mir_free(sztAvatarHash); mir_free(szAvatarHash); @@ -196,7 +196,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t pszDest[0] = 0; } else { - TCHAR *sztModuleName = mir_a2t(m_szModuleName); + wchar_t *sztModuleName = mir_a2t(m_szModuleName); tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s avatar.", sztModuleName); mir_free(sztModuleName); } @@ -205,15 +205,15 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"*"); bool found = false; - _tfinddata_t c_file; - long hFile = _tfindfirst(pszDest, &c_file); + _wfinddata_t c_file; + long hFile = _wfindfirst(pszDest, &c_file); if (hFile > -1L) { do { - if (_tcsrchr(c_file.name, '.')) { + if (wcsrchr(c_file.name, '.')) { mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name); found = true; } - } while (_tfindnext(hFile, &c_file) == 0); + } while (_wfindnext(hFile, &c_file) == 0); _findclose(hFile); } @@ -225,7 +225,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t } } -int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) +int CMsnProto::MSN_SetMyAvatar(const wchar_t* sztFname, void* pData, size_t cbLen) { mir_sha1_ctx sha1ctx; BYTE sha1c[MIR_SHA1_HASH_SIZE], sha1d[MIR_SHA1_HASH_SIZE]; @@ -278,18 +278,18 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) ptrA szEncodedBuffer(mir_urlEncode(szBuffer)); free(szBuffer); - const TCHAR *szExt; + const wchar_t *szExt; int fmt = ProtoGetBufferFormat(pData, &szExt); if (fmt == PA_FORMAT_UNKNOWN) return fmt; - TCHAR szFileName[MAX_PATH]; + wchar_t szFileName[MAX_PATH]; MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL); - _tremove(szFileName); + _wremove(szFileName); MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), szExt); - int fileId = _topen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); + int fileId = _wopen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); if (fileId >= 0) { _write(fileId, pData, (unsigned)cbLen); _close(fileId); @@ -310,16 +310,16 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) } // MSN_GetCustomSmileyFileName - gets a file name for an contact's custom smiley -void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type) +void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const char* SmileyName, int type) { size_t tPathLen; InitCustomFolders(); - TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR)); + wchar_t* path = (wchar_t*)alloca(cbLen * sizeof(wchar_t)); if (hCustomSmileyFolder == NULL || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) { - TCHAR *tmpPath = Utils_ReplaceVarsT(L"%miranda_userdata%"); - TCHAR *tszModuleName = mir_a2t(m_szModuleName); + wchar_t *tmpPath = Utils_ReplaceVarsT(L"%miranda_userdata%"); + wchar_t *tszModuleName = mir_a2t(m_szModuleName); tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName); mir_free(tszModuleName); mir_free(tmpPath); @@ -333,20 +333,20 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, s DBVARIANT dbv = { 0 }; if (getTString(hContact, "e-mail", &dbv)) { dbv.type = DBVT_ASCIIZ; - dbv.ptszVal = (TCHAR*)mir_alloc(11*sizeof(TCHAR)); - _ui64tot((UINT_PTR)hContact, dbv.ptszVal, 10); + dbv.ptszVal = (wchar_t*)mir_alloc(11*sizeof(wchar_t)); + _ui64tow((UINT_PTR)hContact, dbv.ptszVal, 10); } tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal); db_free(&dbv); } else { - TCHAR *tszModuleName = mir_a2t(m_szModuleName); + wchar_t *tszModuleName = mir_a2t(m_szModuleName); tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", tszModuleName); mir_free(tszModuleName); } - bool exist = _taccess(pszDest, 0) == 0; + bool exist = _waccess(pszDest, 0) == 0; if (type == 0) { if (!exist) pszDest[0] = 0; @@ -356,7 +356,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, s if (!exist) CreateDirectoryTreeT(pszDest); - TCHAR *sztSmileyName = mir_a2t(SmileyName); + wchar_t *sztSmileyName = mir_a2t(SmileyName); mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName, type == MSN_APPID_CUSTOMSMILEY ? L"png" : L"gif"); mir_free(sztSmileyName); @@ -587,7 +587,7 @@ void CMsnProto::MSN_StartStopTyping(GCThreadData* info, bool start) } // Helper to process texts -static char * HtmlEncodeUTF8T(const TCHAR *src) +static char * HtmlEncodeUTF8T(const wchar_t *src) { if (src == NULL) return mir_strdup(""); @@ -633,7 +633,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*) if (msnCurrentMedia.ptszPlayer != NULL) lti.ptszPlayer = L"{7}"; if (msnCurrentMedia.ptszType != NULL) lti.ptszType = L"{8}"; - TCHAR *tmp = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i); + wchar_t *tmp = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i); szFormatEnc = HtmlEncodeUTF8T(tmp); mir_free(tmp); } @@ -788,7 +788,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) if (!getStringUtf("Place", &dbv)) szPlace = dbv.pszVal; else { - TCHAR buf[128] = L"Miranda"; + wchar_t buf[128] = L"Miranda"; DWORD buflen = _countof(buf); GetComputerName(buf, &buflen); szPlace = mir_utf8encodeT(buf); @@ -915,10 +915,10 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) // MSN_ShowError - shows an error void CMsnProto::MSN_ShowError(const char* msgtext, ...) { - TCHAR tBuffer[4096]; + wchar_t tBuffer[4096]; va_list tArgs; - TCHAR *buf = Langpack_PcharToTchar(msgtext); + wchar_t *buf = Langpack_PcharToTchar(msgtext); va_start(tArgs, msgtext); mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs); @@ -983,7 +983,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara // InitPopups - popup plugin support void CMsnProto::InitPopups(void) { - TCHAR desc[256]; + wchar_t desc[256]; char name[256]; POPUPCLASS ppc = { sizeof(ppc) }; @@ -1025,7 +1025,7 @@ void CALLBACK sttMainThreadCallback(void *param) bool iserr = (pud->flags & MSN_SHOW_ERROR) != 0; if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { if (pud->flags & MSN_ALLOW_MSGBOX) { - TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME]; + wchar_t szMsg[MAX_SECONDLINE + MAX_CONTACTNAME]; mir_sntprintf(szMsg, L"%s:\n%s", pud->title, pud->text); int ret = MessageBox(NULL, szMsg, TranslateT("MSN Protocol"), MB_YESNO | (iserr ? MB_ICONERROR : MB_ICONINFORMATION)); @@ -1044,8 +1044,8 @@ void CALLBACK sttMainThreadCallback(void *param) char name[256]; POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.ptszTitle = pud->title; - ppd.ptszText = pud->text; + ppd.pwszTitle = pud->title; + ppd.pwszText = pud->text; ppd.PluginData = pud; ppd.pszClassName = name; @@ -1059,7 +1059,7 @@ void CALLBACK sttMainThreadCallback(void *param) CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); } -void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url) +void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int flags, const char* url) { if (g_bTerminated) return; @@ -1074,7 +1074,7 @@ void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags } -void CMsnProto::MSN_ShowPopup(const MCONTACT hContact, const TCHAR* msg, int flags) +void CMsnProto::MSN_ShowPopup(const MCONTACT hContact, const wchar_t* msg, int flags) { MSN_ShowPopup(GetContactNameT(hContact), msg, flags, NULL); } @@ -1152,7 +1152,7 @@ int filetransfer::create(void) int flags = _O_BINARY | _O_CREAT | _O_WRONLY | _O_APPEND; if (std.currentFileProgress == 0) flags |= _O_TRUNC; - fileId = _topen(std.tszCurrentFile, flags, _S_IREAD | _S_IWRITE); + fileId = _wopen(std.tszCurrentFile, flags, _S_IREAD | _S_IWRITE); if (fileId == -1) proto->MSN_ShowError("Cannot create file '%s' during a file transfer", std.tszCurrentFile); @@ -1172,7 +1172,7 @@ int filetransfer::openNext(void) while (std.ptszFiles && std.ptszFiles[cf]) { struct _stati64 statbuf; - if (_tstati64(std.ptszFiles[cf], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) + if (_wstat64(std.ptszFiles[cf], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) break; ++cf; @@ -1181,7 +1181,7 @@ int filetransfer::openNext(void) if (std.ptszFiles && std.ptszFiles[cf]) { bCompleted = false; replaceStrT(std.tszCurrentFile, std.ptszFiles[cf]); - fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD); + fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD); if (fileId != -1) { std.currentFileSize = _filelengthi64(fileId); std.currentFileProgress = 0; diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index c8a01be35c..30ecdbc16f 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -311,7 +311,7 @@ static bool IsIcfEnabled(void) hr = fwProfile->get_AuthorizedApplications(&fwApps); if (FAILED(hr)) goto error; - TCHAR szFileName[MAX_PATH]; + wchar_t szFileName[MAX_PATH]; GetModuleFileName(NULL, szFileName, _countof(szFileName)); wszFileName = mir_t2u(szFileName); diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 2adbe2c31f..96437c9bef 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -219,7 +219,7 @@ LBL_Continue: case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { bool reconnectRequired = false; - TCHAR screenStr[MAX_PATH]; + wchar_t screenStr[MAX_PATH]; char password[100], szEmail[MSN_MAX_EMAIL_LEN]; DBVARIANT dbv; @@ -567,7 +567,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L } else proto->setString("Password", password); - TCHAR szPlace[64]; + wchar_t szPlace[64]; GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace)); if (szPlace[0]) proto->setTString("Place", szPlace); @@ -627,25 +627,25 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.position = -790000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN); - odp.ptszTitle = m_tszUserName; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszTitle = m_tszUserName; + odp.pwszGroup = LPGENW("Network"); + odp.pwszTab = LPGENW("Account"); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; odp.pfnDlgProc = DlgProcMsnOpts; odp.dwInitParam = (LPARAM)this; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Connection"); + odp.pwszTab = LPGENW("Connection"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN_CONN); odp.pfnDlgProc = DlgProcMsnConnOpts; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Server list"); + odp.pwszTab = LPGENW("Server list"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_LISTSMGR); odp.pfnDlgProc = DlgProcMsnServLists; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Notifications"); + odp.pwszTab = LPGENW("Notifications"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY); odp.pfnDlgProc = DlgProcHotmailPopupOpts; Options_AddPage(wParam, &odp); diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index b130ad25aa..632aede4bc 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -161,7 +161,7 @@ bool p2p_IsDlFileOk(filetransfer* ft) bool res = false; - int fileId = _topen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD); + int fileId = _wopen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD); if (fileId != -1) { BYTE buf[4096]; int bytes; @@ -201,7 +201,7 @@ void CMsnProto::p2p_pictureTransferFailed(filetransfer* ft) } break; } - _tremove(ft->std.tszCurrentFile); + _wremove(ft->std.tszCurrentFile); } void CMsnProto::p2p_savePicture2disk(filetransfer* ft) @@ -209,13 +209,13 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) ft->close(); if (p2p_IsDlFileOk(ft)) { - int fileId = _topen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD); + int fileId = _wopen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD); if (fileId == -1) { p2p_pictureTransferFailed(ft); return; } - const TCHAR* ext; + const wchar_t* ext; int format; BYTE buf[6]; @@ -237,7 +237,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) ai.hContact = ft->std.hContact; MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), ext); - _trename(ft->std.tszCurrentFile, ai.filename); + _wrename(ft->std.tszCurrentFile, ai.filename); // Store also avatar hash char *szAvatarHash = MSN_GetAvatarHash(ft->p2p_object); @@ -259,9 +259,9 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) cont.hContact = ft->std.hContact; cont.type = 1; - TCHAR* pathcpy = mir_tstrdup(ft->std.tszCurrentFile); - mir_tstrcpy(_tcsrchr(pathcpy, '.') + 1, ext); - _trename(ft->std.tszCurrentFile, pathcpy); + wchar_t* pathcpy = mir_tstrdup(ft->std.tszCurrentFile); + mir_tstrcpy(wcsrchr(pathcpy, '.') + 1, ext); + _wrename(ft->std.tszCurrentFile, pathcpy); cont.path = pathcpy; @@ -1173,9 +1173,9 @@ void CMsnProto::p2p_InitFileTransfer( db_free(&dbv); } if (pictmatch) { - TCHAR szFileName[MAX_PATH]; + wchar_t szFileName[MAX_PATH]; MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL); - ft->fileId = _topen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD); + ft->fileId = _wopen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD); if (ft->fileId == -1) { p2p_sendStatus(ft, 603); MSN_ShowError("Your avatar not set correctly. Avatar should be set in View/Change My Details | Avatar"); @@ -1223,15 +1223,15 @@ void CMsnProto::p2p_InitFileTransfer( ft->std.totalBytes = ft->std.currentFileSize = ((HFileContext*)szContext)->dwSize; ft->std.totalFiles = 1; - TCHAR tComment[40]; + wchar_t tComment[40]; mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize); PROTORECVFILET pre = { 0 }; pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.descr.t = tComment; - pre.files.t = &ft->std.tszCurrentFile; + pre.descr.w = tComment; + pre.files.w = &ft->std.tszCurrentFile; pre.lParam = (LPARAM)ft; ProtoChainRecvFile(ft->std.hContact, &pre); } @@ -1698,7 +1698,7 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr break; ft->close(); - if (!(ft->std.flags & PFTS_SENDING)) _tremove(ft->std.tszCurrentFile); + if (!(ft->std.flags & PFTS_SENDING)) _wremove(ft->std.tszCurrentFile); p2p_unregisterSession(ft); } @@ -2024,7 +2024,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) ctx->type = MSN_TYPEID_FTNOPREVIEW; ctx->dwSize = ft->std.currentFileSize; - TCHAR* pszFiles = _tcsrchr(ft->std.tszCurrentFile, '\\'); + wchar_t* pszFiles = wcsrchr(ft->std.tszCurrentFile, '\\'); if (pszFiles) pszFiles++; else diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index d7258e5533..624c736f97 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -33,7 +33,7 @@ static int CompareLists(const MsnContact *p1, const MsnContact *p2) return _stricmp(p1->email, p2->email); } -CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : +CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : PROTO<CMsnProto>(aProtoName, aUserName), m_arContacts(10, CompareLists), m_arGroups(10, CompareId), @@ -125,16 +125,16 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : mailsoundname = (char*)mir_alloc(64); mir_snprintf(mailsoundname, 64, "%s:Hotmail", m_szModuleName); - SkinAddNewSoundExT(mailsoundname, m_tszUserName, LPGENT("Live Mail")); + SkinAddNewSoundExT(mailsoundname, m_tszUserName, LPGENW("Live Mail")); alertsoundname = (char*)mir_alloc(64); mir_snprintf(alertsoundname, 64, "%s:Alerts", m_szModuleName); - SkinAddNewSoundExT(alertsoundname, m_tszUserName, LPGENT("Live Alert")); + SkinAddNewSoundExT(alertsoundname, m_tszUserName, LPGENW("Live Alert")); AvatarQueue_Init(); InitCustomFolders(); - TCHAR szBuffer[MAX_PATH]; + wchar_t szBuffer[MAX_PATH]; char szDbsettings[64]; NETLIBUSER nlu1 = { 0 }; @@ -261,10 +261,10 @@ MCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD MCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - TCHAR *id = psr->id.t ? psr->id.t : psr->email.t; + wchar_t *id = psr->id.w ? psr->id.w : psr->email.w; return AddToListByEmail( psr->flags & PSR_UNICODE ? UTF8((wchar_t*)id) : UTF8((char*)id), - psr->flags & PSR_UNICODE ? UTF8((wchar_t*)psr->nick.t) : UTF8((char*)psr->nick.t), + psr->flags & PSR_UNICODE ? UTF8((wchar_t*)psr->nick.w) : UTF8((char*)psr->nick.w), flags); } @@ -294,7 +294,7 @@ int CMsnProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) } // PSS_AUTHREQUEST -int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage) +int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const wchar_t* szMessage) { if (msnLoggedIn) { char email[MSN_MAX_EMAIL_LEN]; @@ -353,7 +353,7 @@ int CMsnProto::Authorize(MEVENT hDbEvent) } // MsnAuthDeny - called after unsuccessful authorization -int CMsnProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) +int CMsnProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) { if (!msnLoggedIn) return 1; @@ -397,7 +397,7 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) // MsnBasicSearch - search contacts by e-mail void __cdecl CMsnProto::MsnSearchAckThread(void* arg) { - const TCHAR* emailT = (TCHAR*)arg; + const wchar_t* emailT = (wchar_t*)arg; T2Utf email(emailT); if (Lists_IsInList(LIST_FL, email)) { @@ -418,9 +418,9 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id.t = (TCHAR*)emailT; - psr.nick.t = (TCHAR*)emailT; - psr.email.t = (TCHAR*)emailT; + psr.id.w = (wchar_t*)emailT; + psr.nick.w = (wchar_t*)emailT; + psr.email.w = (wchar_t*)emailT; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&psr); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0); @@ -447,17 +447,17 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) } -HANDLE __cdecl CMsnProto::SearchBasic(const TCHAR* id) +HANDLE __cdecl CMsnProto::SearchBasic(const wchar_t* id) { if (!msnLoggedIn) return 0; - TCHAR* email = mir_tstrdup(id); + wchar_t* email = mir_tstrdup(id); ForkThread(&CMsnProto::MsnSearchAckThread, email); return email; } -HANDLE __cdecl CMsnProto::SearchByEmail(const TCHAR* email) +HANDLE __cdecl CMsnProto::SearchByEmail(const wchar_t* email) { return SearchBasic(email); } @@ -491,7 +491,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) { filetransfer* ft = (filetransfer*)arg; - TCHAR filefull[MAX_PATH]; + wchar_t filefull[MAX_PATH]; mir_sntprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile); replaceStrT(ft->std.tszCurrentFile, filefull); @@ -574,7 +574,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) } // MsnFileAllow - starts the file transfer -HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath) +HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath) { filetransfer* ft = (filetransfer*)hTransfer; @@ -584,7 +584,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szP #endif if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) { - TCHAR szCurrDir[MAX_PATH]; + wchar_t szCurrDir[MAX_PATH]; GetCurrentDirectory(_countof(szCurrDir), szCurrDir); ft->std.tszWorkingDir = mir_tstrdup(szCurrDir); } @@ -633,7 +633,7 @@ int __cdecl CMsnProto::FileCancel(MCONTACT, HANDLE hTransfer) } // MsnFileDeny - rejects the file transfer request -int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szReason*/) +int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t* /*szReason*/) { filetransfer* ft = (filetransfer*)hTransfer; @@ -661,7 +661,7 @@ int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szRea } // MsnFileResume - renames a file -int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename) +int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename) { filetransfer* ft = (filetransfer*)hTransfer; @@ -680,7 +680,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s case FILERESUME_RESUME: { struct _stati64 statbuf; - _tstati64(ft->std.tszCurrentFile, &statbuf); + _wstat64(ft->std.tszCurrentFile, &statbuf); ft->std.currentFileProgress = statbuf.st_size; } break; @@ -829,12 +829,12 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) int i; for (i = 0; i < pre->lParam; i++) - dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.t) + 2 + mir_tstrlen(isrList[i]->id.t)); + dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.w) + 2 + mir_tstrlen(isrList[i]->id.w)); dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob); for (i = 0, pCurBlob = dbei.pBlob; i < pre->lParam; i++) { - mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.t)); + mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.w)); pCurBlob += mir_strlen((char*)pCurBlob) + 1; - mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.t)); + mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.w)); pCurBlob += mir_strlen((char*)pCurBlob) + 1; } @@ -849,7 +849,7 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) #ifdef OBSOLETE // MsnSendFile - initiates a file transfer -HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppszFiles) +HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles) { if (!msnLoggedIn) return 0; @@ -871,7 +871,7 @@ HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz int count = 0; while (ppszFiles[count] != NULL) { struct _stati64 statbuf; - if (_tstati64(ppszFiles[count++], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) { + if (_wstat64(ppszFiles[count++], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) { sft->std.totalBytes += statbuf.st_size; ++sft->std.totalFiles; } @@ -1046,7 +1046,7 @@ int __cdecl CMsnProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT } // MsnSetAwayMsg - sets the current status message for a user -int __cdecl CMsnProto::SetAwayMsg(int status, const TCHAR* msg) +int __cdecl CMsnProto::SetAwayMsg(int status, const wchar_t* msg) { char** msgptr = GetStatusMsgLoc(status); diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 2ea0df8129..6f26bf1c80 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CMsnProto : public PROTO<CMsnProto> { - CMsnProto(const char*, const TCHAR*); + CMsnProto(const char*, const wchar_t*); ~CMsnProto(); //==================================================================================== @@ -36,26 +36,26 @@ struct CMsnProto : public PROTO<CMsnProto> virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); virtual int __cdecl Authorize(MEVENT hDbEvent); - virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage); + virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage); - virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath); + virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath); virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason); - virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename); + virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason); + virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename); virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); virtual int __cdecl GetInfo(MCONTACT hContact, int infoType); - virtual HANDLE __cdecl SearchBasic(const TCHAR* id); - virtual HANDLE __cdecl SearchByEmail(const TCHAR* email); + virtual HANDLE __cdecl SearchBasic(const wchar_t* id); + virtual HANDLE __cdecl SearchByEmail(const wchar_t* email); virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*); #ifdef OBSOLETE - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles); + virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles); #endif virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList); @@ -64,7 +64,7 @@ struct CMsnProto : public PROTO<CMsnProto> virtual int __cdecl SetStatus(int iNewStatus); virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg); + virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t* msg); virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); @@ -196,10 +196,10 @@ struct CMsnProto : public PROTO<CMsnProto> void InitCustomFolders(void); char* getSslResult(char** parUrl, const char* parAuthInfo, const char* hdrs, unsigned& status); - bool getMyAvatarFile(char *url, TCHAR *fname); + bool getMyAvatarFile(char *url, wchar_t *fname); void MSN_GoOffline(void); - void MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type); + void MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const char* SmileyName, int Type); const char* MirandaStatusToMSN(int status); WORD MSNStatusToMiranda(const char *status); @@ -233,8 +233,8 @@ struct CMsnProto : public PROTO<CMsnProto> void LoadOptions(void); void InitPopups(void); - void MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url); - void MSN_ShowPopup(const MCONTACT hContact, const TCHAR* msg, int flags); + void MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int flags, const char* url); + void MSN_ShowPopup(const MCONTACT hContact, const wchar_t* msg, int flags); void MSN_ShowError(const char* msgtext, ...); #ifdef OBSOLETE @@ -242,7 +242,7 @@ struct CMsnProto : public PROTO<CMsnProto> #endif void MSN_SendNicknameUtf(const char* nickname); - typedef struct { TCHAR *szName; const char *szMimeType; unsigned char *data; size_t dataSize; } StoreAvatarData; + typedef struct { wchar_t *szName; const char *szMimeType; unsigned char *data; size_t dataSize; } StoreAvatarData; void __cdecl msn_storeAvatarThread(void* arg); void __cdecl msn_storeProfileThread(void*); @@ -305,7 +305,7 @@ struct CMsnProto : public PROTO<CMsnProto> int MSN_GetActiveThreads(ThreadData**); ThreadData* MSN_GetThreadByConnection(HANDLE hConn); ThreadData* MSN_GetThreadByContact(const char* wlid, TInfoType type = SERVER_SWITCHBOARD); - GCThreadData*MSN_GetThreadByChatId(const TCHAR* chatId); + GCThreadData*MSN_GetThreadByChatId(const wchar_t* chatId); ThreadData* MSN_GetP2PThreadByContact(const char *wlid); void MSN_StartP2PTransferByContact(const char* wlid); ThreadData* MSN_GetThreadByPort(WORD wPort); @@ -423,12 +423,12 @@ struct CMsnProto : public PROTO<CMsnProto> int MSN_ChatInit(GCThreadData *info, const char *pszID, const char *pszTopic); void MSN_ChatStart(ezxml_t xmli); - void MSN_KillChatSession(const TCHAR* id); + void MSN_KillChatSession(const wchar_t* id); void MSN_Kickuser(GCHOOK *gch); void MSN_Promoteuser(GCHOOK *gch, const char *pszRole); - const TCHAR *MSN_GCGetRole(GCThreadData* thread, const char *pszWLID); - void MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID); - void MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody); + const wchar_t *MSN_GCGetRole(GCThreadData* thread, const char *pszWLID); + void MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID); + void MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody); void MSN_GCRefreshThreadsInfo(void); MCONTACT MSN_GetChatInernalHandle(MCONTACT hContact); @@ -516,8 +516,8 @@ struct CMsnProto : public PROTO<CMsnProto> void AvatarQueue_Init(void); void AvatarQueue_Uninit(void); - void MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext); - int MSN_SetMyAvatar(const TCHAR* szFname, void* pData, size_t cbLen); + void MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext); + int MSN_SetMyAvatar(const wchar_t* szFname, void* pData, size_t cbLen); void __cdecl MSN_AvatarsThread(void*); @@ -590,8 +590,8 @@ struct CMsnProto : public PROTO<CMsnProto> bool MSN_StoreShareItem(const char* id, bool allowRecurse = true); bool MSN_StoreCreateRelationships(bool allowRecurse = true); bool MSN_StoreDeleteRelationships(bool tile, bool allowRecurse = true); - bool MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true); - bool MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true); + bool MSN_StoreCreateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true); + bool MSN_StoreUpdateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true); bool MSN_StoreFindDocuments(bool allowRecurse = true); ezxml_t storeSoapHdr(const char* service, const char* scenario, ezxml_t& tbdy, char*& httphdr); @@ -605,8 +605,8 @@ struct CMsnProto : public PROTO<CMsnProto> ////////////////////////////////////////////////////////////////////////////////////// - TCHAR *m_DisplayNameCache; - TCHAR* GetContactNameT(MCONTACT hContact); + wchar_t *m_DisplayNameCache; + wchar_t* GetContactNameT(MCONTACT hContact); int getStringUtf(MCONTACT hContact, const char* name, DBVARIANT* result); int getStringUtf(const char* name, DBVARIANT* result); diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index d2b1b52444..034b75f52e 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -41,10 +41,10 @@ bool CMsnProto::APISkypeComRequest(NETLIBHTTPREQUEST *nlhr, NETLIBHTTPHEADER *he return true; } -static TCHAR* get_json_str(JSONNode *item, const char *pszValue) +static wchar_t* get_json_str(JSONNode *item, const char *pszValue) { if (JSONNode *node = json_get(item, pszValue)) { - TCHAR *ret = json_as_string(node); + wchar_t *ret = json_as_string(node); if (!mir_tstrcmp(ret, L"null")) { mir_free(ret); return NULL; @@ -194,10 +194,10 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) if (value = get_json_str(item, "firstname")) setTString(hContact, "FirstName", value); if (value = get_json_str(item, "lastname")) setTString(hContact, "LastName", value); if (value = get_json_str(item, "displayname")) setTString(hContact, "Nick", value); - if (value = get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_ttoi(value) == 1 ? 'M' : 'F')); + 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; - _stscanf(value, L"%d-%d-%d", &y, &m, &d); + swscanf(value, L"%d-%d-%d", &y, &m, &d); setWord(hContact, "BirthYear", y); setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); @@ -387,13 +387,13 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) JSONNode *ContactCards = json_get(item, "ContactCards"); JSONNode *Skype = json_get(ContactCards, "Skype"); - TCHAR *sDisplayName = json_as_string(json_get(Skype, "DisplayName")); - TCHAR *sSkypeName = json_as_string(json_get(Skype, "SkypeName")); + wchar_t *sDisplayName = json_as_string(json_get(Skype, "DisplayName")); + wchar_t *sSkypeName = json_as_string(json_get(Skype, "SkypeName")); PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.id.t = sSkypeName; - psr.nick.t = sDisplayName; + psr.id.w = sSkypeName; + psr.nick.w = sDisplayName; ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, hSearch, (LPARAM)&psr); } json_free(items); diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index 09c8844223..4dafb1f4ef 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -504,7 +504,7 @@ bool CMsnProto::MSN_StoreDeleteRelationships(bool tile, bool allowRecurse) } -bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse) +bool CMsnProto::MSN_StoreCreateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse) { char* reqHdr; ezxml_t tbdy; @@ -586,7 +586,7 @@ bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMime } -bool CMsnProto::MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse) +bool CMsnProto::MSN_StoreUpdateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse) { char* reqHdr; T2Utf szName(sztName); diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index 76a0b6390c..8420e7e501 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.cpp @@ -103,7 +103,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char return result; } -bool CMsnProto::getMyAvatarFile(char *url, TCHAR *fname) +bool CMsnProto::getMyAvatarFile(char *url, wchar_t *fname) { NETLIBHTTPREQUEST nlhr = { 0 }; bool result = true; diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 1edd062c00..29bbda9faf 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -43,12 +43,12 @@ void CMsnProto::setStringUtf(MCONTACT hContact, const char* name, const char* va ///////////////////////////////////////////////////////////////////////////////////////// -TCHAR* CMsnProto::GetContactNameT(MCONTACT hContact) +wchar_t* CMsnProto::GetContactNameT(MCONTACT hContact) { if (hContact) - return (TCHAR*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0); + return (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0); - TCHAR *str = Contact_GetInfo(CNF_DISPLAY, NULL, m_szModuleName); + wchar_t *str = Contact_GetInfo(CNF_DISPLAY, NULL, m_szModuleName); if (str != NULL) { mir_free(m_DisplayNameCache); return m_DisplayNameCache = str; diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 0a9e5b5b0b..a0cc11efe2 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -41,14 +41,14 @@ INT_PTR CMsnProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) INT_PTR CMsnProto::GetAvatar(WPARAM wParam, LPARAM lParam) { - TCHAR* buf = (TCHAR*)wParam; + wchar_t* buf = (wchar_t*)wParam; int size = (int)lParam; if (buf == NULL || size <= 0) return -1; MSN_GetAvatarFileName(NULL, buf, size, NULL); - return _taccess(buf, 0); + return _waccess(buf, 0); } @@ -64,7 +64,7 @@ void CMsnProto::sttFakeAvatarAck(void* arg) INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) { PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam; - TCHAR filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; MsnContact *cont = NULL; if (pai->hContact) { @@ -185,11 +185,11 @@ INT_PTR CMsnProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) { - TCHAR* szFileName = (TCHAR*)lParam; + wchar_t* szFileName = (wchar_t*)lParam; - TCHAR tFileName[MAX_PATH]; + wchar_t tFileName[MAX_PATH]; MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), NULL); - _tremove(tFileName); + _wremove(tFileName); if (szFileName == NULL) { delSetting("PictObject"); @@ -197,7 +197,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) ForkThread(&CMsnProto::msn_storeAvatarThread, NULL); } else { - int fileId = _topen(szFileName, _O_RDONLY | _O_BINARY, _S_IREAD); + int fileId = _wopen(szFileName, _O_RDONLY | _O_BINARY, _S_IREAD); if (fileId < 0) return 1; size_t dwPngSize = _filelengthi64(fileId); @@ -210,8 +210,8 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) _read(fileId, pData, (unsigned)dwPngSize); _close(fileId); - TCHAR drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - _tsplitpath(szFileName, drive, dir, fname, ext); + wchar_t drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; + _wsplitpath(szFileName, drive, dir, fname, ext); MSN_SetMyAvatar(fname, pData, dwPngSize); @@ -355,11 +355,11 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM, LPARAM lParam) if (msnCurrentMedia.cbSize == 0) delSetting("ListeningTo"); else { - TCHAR *text; + wchar_t *text; if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)) - text = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&msnCurrentMedia); + text = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&msnCurrentMedia); else { - text = (TCHAR *)mir_alloc(128 * sizeof(TCHAR)); + text = (wchar_t *)mir_alloc(128 * sizeof(wchar_t)); mir_sntprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""), (msnCurrentMedia.ptszArtist ? msnCurrentMedia.ptszArtist : L"")); } diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 86c5250e83..ea171e6215 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -383,7 +383,7 @@ ThreadData* CMsnProto::MSN_GetThreadByContact(const char* wlid, TInfoType type) return NULL; } -GCThreadData* CMsnProto::MSN_GetThreadByChatId(const TCHAR* chatId) +GCThreadData* CMsnProto::MSN_GetThreadByChatId(const wchar_t* chatId) { if (mir_tstrlen(chatId) == 0) return NULL; diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 6607c74d92..859023b6bc 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -239,10 +239,10 @@ char* getNewUuid(void); time_t IsoToUnixTime(const char *stamp); time_t MsnTSToUnixtime(const char *pszTS); -TCHAR* EscapeChatTags(const TCHAR* pszText); -TCHAR* UnEscapeChatTags(TCHAR* str_in); +wchar_t* EscapeChatTags(const wchar_t* pszText); +wchar_t* UnEscapeChatTags(wchar_t* str_in); -void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def = NULL); +void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def = NULL); char* arrayToHex(BYTE* data, size_t datasz); @@ -268,8 +268,8 @@ typedef struct _tag_PopupData { unsigned flags; char* url; - TCHAR* title; - TCHAR* text; + wchar_t* title; + wchar_t* text; CMsnProto* proto; } PopupData; @@ -542,7 +542,7 @@ typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*); struct GCUserItem { char WLID[MSN_MAX_EMAIL_LEN]; - TCHAR role[8]; + wchar_t role[8]; BYTE btag; }; @@ -554,7 +554,7 @@ struct GCThreadData LIST<GCUserItem> mJoinedContacts; GCUserItem* mCreator; GCUserItem* mMe; - TCHAR mChatID[MSN_MAX_EMAIL_LEN]; + wchar_t mChatID[MSN_MAX_EMAIL_LEN]; int netId; // from mChatID char szEmail[MSN_MAX_EMAIL_LEN]; // frim mChatID }; @@ -577,7 +577,7 @@ struct ThreadData HANDLE mIncomingBoundPort; // Netlib listen for the thread HANDLE hWaitEvent; WORD mIncomingPort; - TCHAR mChatID[10]; + wchar_t mChatID[10]; bool mIsMainThread; clock_t mWaitPeriod; @@ -1028,11 +1028,11 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA struct InviteChatParam { - TCHAR* id; + wchar_t* id; MCONTACT hContact; CMsnProto* ppro; - InviteChatParam(const TCHAR* id, MCONTACT hContact, CMsnProto* ppro) + InviteChatParam(const wchar_t* id, MCONTACT hContact, CMsnProto* ppro) : id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {} ~InviteChatParam() { -- cgit v1.2.3