From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan 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/Gadu-Gadu/src/avatar.cpp | 28 ++++---- protocols/Gadu-Gadu/src/core.cpp | 118 +++++++++++++++---------------- protocols/Gadu-Gadu/src/dialogs.cpp | 30 ++++---- protocols/Gadu-Gadu/src/filetransfer.cpp | 20 +++--- protocols/Gadu-Gadu/src/gg.cpp | 26 +++---- protocols/Gadu-Gadu/src/gg.h | 8 +-- protocols/Gadu-Gadu/src/gg_proto.cpp | 22 +++--- protocols/Gadu-Gadu/src/gg_proto.h | 56 +++++++-------- protocols/Gadu-Gadu/src/groupchat.cpp | 34 ++++----- protocols/Gadu-Gadu/src/image.cpp | 70 +++++++++--------- protocols/Gadu-Gadu/src/import.cpp | 56 +++++++-------- protocols/Gadu-Gadu/src/links.cpp | 2 +- protocols/Gadu-Gadu/src/oauth.cpp | 4 +- protocols/Gadu-Gadu/src/ownerinfo.cpp | 2 +- protocols/Gadu-Gadu/src/popups.cpp | 12 ++-- protocols/Gadu-Gadu/src/services.cpp | 30 ++++---- protocols/Gadu-Gadu/src/sessions.cpp | 14 ++-- protocols/Gadu-Gadu/src/token.cpp | 4 +- protocols/Gadu-Gadu/src/userutils.cpp | 8 +-- 19 files changed, 272 insertions(+), 272 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 0ecdd36433..f3c8a3cc05 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -26,28 +26,28 @@ ////////////////////////////////////////////////////////// // Avatars support // -void GGPROTO::getAvatarFilename(MCONTACT hContact, TCHAR *pszDest, int cbLen) +void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName); - if (_taccess(pszDest, 0)) { + if (_waccess(pszDest, 0)) { int ret = CreateDirectoryTreeT(pszDest); if (ret == 0) debugLog(L"getAvatarFilename(): Created new directory for avatar cache: %s.", pszDest); else { debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest); showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE); } } - const TCHAR *avatartype = ProtoGetAvatarExtension(getByte(hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE)); + const wchar_t *avatartype = ProtoGetAvatarExtension(getByte(hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE)); if (hContact != NULL) { DBVARIANT dbv; if (!getString(hContact, GG_KEY_AVATARHASH, &dbv)) { - TCHAR* avatarHashT = mir_a2t(dbv.pszVal); + wchar_t* avatarHashT = mir_a2t(dbv.pszVal); mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype); mir_free(avatarHashT); db_free(&dbv); @@ -83,11 +83,11 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) if ((strncmp(resp->pData, "", 8) == 0) || (strncmp(resp->pData, "pData); + wchar_t *xmlAction = mir_a2t(resp->pData); HXML hXml = xmlParseString(xmlAction, 0, L"result"); if (hXml != NULL) { HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0); - const TCHAR *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL; + const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL; if (blank != NULL && mir_tstrcmp(blank, L"1")) { node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0); *avatarts = node != NULL ? mir_t2a(xmlGetText(node)) : NULL; @@ -262,15 +262,15 @@ void __cdecl GGPROTO::avatarrequestthread(void*) setByte(data->hContact, GG_KEY_AVATARTYPE, (BYTE)avatarType); getAvatarFilename(ai.hContact, ai.filename, _countof(ai.filename)); - file_fd = _topen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE); + file_fd = _wopen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE); if (file_fd != -1) { _write(file_fd, resp->pData, resp->dataLength); _close(file_fd); result = 1; debugLog(L"avatarrequestthread() new avatar_transfers item. Saved data to file=%s.", ai.filename); } else { - debugLog(L"avatarrequestthread(): _topen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno)); - TCHAR error[512]; + debugLog(L"avatarrequestthread(): _wopen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno)); + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); } @@ -358,11 +358,11 @@ void __cdecl GGPROTO::setavatarthread(void *param) debugLogA("setavatarthread(): started. Trying to set user avatar."); //read file - TCHAR *szFilename = (TCHAR*)param; - int file_fd = _topen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD); + wchar_t *szFilename = (wchar_t*)param; + int file_fd = _wopen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD); if (file_fd == -1) { debugLog(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); mir_free(szFilename); @@ -507,7 +507,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) } -void GGPROTO::setAvatar(const TCHAR *szFilename) +void GGPROTO::setAvatar(const wchar_t *szFilename) { #ifdef DEBUGMODE debugLogA("setAvatar(): ForkThread 3 GGPROTO::setavatarthread"); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 2632b89d75..05e746cf8f 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -236,19 +236,19 @@ void __cdecl GGPROTO::mainthread(void *) int hostnum = 0, hostcount = 0; GGHOST hosts[64]; // Gadu-gadu login errors - static const struct tagReason { int type; TCHAR *str; } reason[] = { - { GG_FAILURE_RESOLVING, LPGENT("Miranda was unable to resolve the name of the Gadu-Gadu server to its numeric address.") }, - { GG_FAILURE_CONNECTING, LPGENT("Miranda was unable to make a connection with a server. It is likely that the server is down, in which case you should wait for a while and try again later.") }, - { GG_FAILURE_INVALID, LPGENT("Received invalid server response.") }, - { GG_FAILURE_READING, LPGENT("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") }, - { GG_FAILURE_WRITING, LPGENT("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") }, - { GG_FAILURE_PASSWORD, LPGENT("Your Gadu-Gadu number and password combination was rejected by the Gadu-Gadu server. Please check login details at Options -> Network -> Gadu-Gadu and try again.") }, - { GG_FAILURE_404, LPGENT("Connecting to Gadu-Gadu hub failed.") }, - { GG_FAILURE_TLS, LPGENT("Cannot establish secure connection.") }, - { GG_FAILURE_NEED_EMAIL, LPGENT("Server disconnected asking you for changing your e-mail.") }, - { GG_FAILURE_INTRUDER, LPGENT("Too many login attempts with invalid password.") }, - { GG_FAILURE_UNAVAILABLE, LPGENT("Gadu-Gadu servers are now down. Try again later.") }, - { 0, LPGENT("Unknown") } + static const struct tagReason { int type; wchar_t *str; } reason[] = { + { GG_FAILURE_RESOLVING, LPGENW("Miranda was unable to resolve the name of the Gadu-Gadu server to its numeric address.") }, + { GG_FAILURE_CONNECTING, LPGENW("Miranda was unable to make a connection with a server. It is likely that the server is down, in which case you should wait for a while and try again later.") }, + { GG_FAILURE_INVALID, LPGENW("Received invalid server response.") }, + { GG_FAILURE_READING, LPGENW("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") }, + { GG_FAILURE_WRITING, LPGENW("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") }, + { GG_FAILURE_PASSWORD, LPGENW("Your Gadu-Gadu number and password combination was rejected by the Gadu-Gadu server. Please check login details at Options -> Network -> Gadu-Gadu and try again.") }, + { GG_FAILURE_404, LPGENW("Connecting to Gadu-Gadu hub failed.") }, + { GG_FAILURE_TLS, LPGENW("Cannot establish secure connection.") }, + { GG_FAILURE_NEED_EMAIL, LPGENW("Server disconnected asking you for changing your e-mail.") }, + { GG_FAILURE_INTRUDER, LPGENW("Too many login attempts with invalid password.") }, + { GG_FAILURE_UNAVAILABLE, LPGENW("Gadu-Gadu servers are now down. Try again later.") }, + { 0, LPGENW("Unknown") } }; time_t logonTime = 0; time_t timeDeviation = getWord(GG_KEY_TIMEDEVIATION, GG_KEYDEF_TIMEDEVIATION); @@ -359,8 +359,8 @@ void __cdecl GGPROTO::mainthread(void *) if (dcc && getByte(GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING)) { if (!getString(GG_KEY_FORWARDHOST, &dbv)) { if (!(p.external_addr = gg_dnslookup(this, dbv.pszVal))) { - TCHAR error[128]; - TCHAR* forwardHostT = mir_a2t(dbv.pszVal); + wchar_t error[128]; + wchar_t* forwardHostT = mir_a2t(dbv.pszVal); mir_sntprintf(error, TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT); mir_free(forwardHostT); showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX); @@ -390,8 +390,8 @@ retry: { if (!(p.server_addr = gg_dnslookup(this, hosts[hostnum].hostname))) { - TCHAR error[128]; - TCHAR* hostnameT = mir_a2t(hosts[hostnum].hostname); + wchar_t error[128]; + wchar_t* hostnameT = mir_a2t(hosts[hostnum].hostname); mir_sntprintf(error, TranslateT("Server hostname %s is invalid. Using default hostname provided by the network."), hostnameT); mir_free(hostnameT); showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX); @@ -414,7 +414,7 @@ retry: // Check if connection attempt wasn't cancelled by the user if (m_iDesiredStatus != ID_STATUS_OFFLINE) { - TCHAR error[128], *perror = NULL; + wchar_t error[128], *perror = NULL; // Lookup for error desciption if (errno == EACCES) { for (int i = 0; reason[i].type; i++) if (reason[i].type == gg_failno) { @@ -480,7 +480,7 @@ retry: { broadcastnewstatus(m_iDesiredStatus); // Change status of the contact with our own UIN (if got yourself added to the contact list) - TCHAR *status_descr = mir_utf8decodeT(p.status_descr); + wchar_t *status_descr = mir_utf8decodeT(p.status_descr); changecontactstatus(p.uin, p.status, status_descr, 0, 0, 0, 0); mir_free(status_descr); } @@ -562,7 +562,7 @@ retry: for (; n->uin; n++) { - TCHAR *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeT(e->event.notify_descr.descr) : NULL; + wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeT(e->event.notify_descr.descr) : NULL; changecontactstatus(n->uin, n->status, descrT, 0, n->remote_ip, n->remote_port, n->version); if (descrT) mir_free(descrT); } @@ -575,7 +575,7 @@ retry: int i; for(i = 0; e->event.notify60[i].uin; i++) { if (e->event.notify60[i].uin == uin) continue; - TCHAR *descrT = mir_utf8decodeT(e->event.notify60[i].descr); + wchar_t *descrT = mir_utf8decodeT(e->event.notify60[i].descr); changecontactstatus(e->event.notify60[i].uin, e->event.notify60[i].status, descrT, e->event.notify60[i].time, e->event.notify60[i].remote_ip, e->event.notify60[i].remote_port, e->event.notify60[i].version); @@ -617,12 +617,12 @@ retry: { // Loadup fields const char *__fmnumber = gg_pubdir50_get(res, i, GG_PUBDIR50_UIN); - TCHAR *__nickname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME)); - TCHAR *__firstname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME)); - TCHAR *__lastname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME)); - TCHAR *__familyname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME)); - TCHAR *__city = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY)); - TCHAR *__familycity = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY)); + wchar_t *__nickname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME)); + wchar_t *__firstname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME)); + wchar_t *__lastname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME)); + wchar_t *__familyname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME)); + wchar_t *__city = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY)); + wchar_t *__familycity = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY)); const char *__birthyear = gg_pubdir50_get(res, i, GG_PUBDIR50_BIRTHYEAR); const char *__gender = gg_pubdir50_get(res, i, GG_PUBDIR50_GENDER); const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS); @@ -632,10 +632,10 @@ retry: debugLogA("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq); if (res->seq == GG_SEQ_SEARCH) { - TCHAR strFmt1[64]; - TCHAR strFmt2[64]; + wchar_t strFmt1[64]; + wchar_t strFmt2[64]; - _tcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE); + wcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE); if (__city) { mir_sntprintf(strFmt1, L", %s %s", TranslateT("City:"), __city); mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2)); @@ -655,11 +655,11 @@ retry: memset(&psr, 0, sizeof(psr)); psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.nick.t = __nickname; - psr.firstName.t = __firstname; - psr.lastName.t = __lastname; - psr.email.t = strFmt2; - psr.id.t = _ultot(uin, strFmt1, 10); + psr.nick.w = __nickname; + psr.firstName.w = __firstname; + psr.lastName.w = __lastname; + psr.email.w = strFmt2; + psr.id.w = _ultot(uin, strFmt1, 10); psr.uin = uin; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM)&psr); } @@ -757,7 +757,7 @@ retry: // Status (deprecated) case GG_EVENT_STATUS: { - TCHAR *descrT = mir_utf8decodeT(e->event.status.descr); + wchar_t *descrT = mir_utf8decodeT(e->event.status.descr); changecontactstatus(e->event.status.uin, e->event.status.status, descrT, 0, 0, 0, 0); mir_free(descrT); } @@ -770,7 +770,7 @@ retry: int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE); uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0); - TCHAR *descrT = mir_utf8decodeT(e->event.status60.descr); + wchar_t *descrT = mir_utf8decodeT(e->event.status60.descr); if (e->event.status60.uin == uin) { @@ -822,19 +822,19 @@ retry: // Check if groupchat if (e->event.msg.recipients_count && gc_enabled && !getByte(GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF)) { - TCHAR *chat = gc_getchat(e->event.msg.sender, e->event.msg.recipients, e->event.msg.recipients_count); + wchar_t *chat = gc_getchat(e->event.msg.sender, e->event.msg.recipients, e->event.msg.recipients_count); if (chat) { - TCHAR id[32]; + wchar_t id[32]; UIN2IDT(e->event.msg.sender, id); GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; time_t t = time(NULL); gce.ptszUID = id; - TCHAR* messageT = mir_utf8decodeT(e->event.msg.message); + wchar_t* messageT = mir_utf8decodeT(e->event.msg.message); gce.ptszText = messageT; - gce.ptszNick = (TCHAR*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0); + gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0); gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time; gce.dwFlags = GCEF_ADDTOLOG; debugLog(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id); @@ -886,18 +886,18 @@ retry: case GG_EVENT_MULTILOGON_MSG: if (e->event.multilogon_msg.recipients_count && gc_enabled && !getByte(GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF)) { - TCHAR *chat = gc_getchat(e->event.multilogon_msg.sender, e->event.multilogon_msg.recipients, e->event.multilogon_msg.recipients_count); + wchar_t *chat = gc_getchat(e->event.multilogon_msg.sender, e->event.multilogon_msg.recipients, e->event.multilogon_msg.recipients_count); if (chat) { - TCHAR id[32]; + wchar_t id[32]; UIN2IDT(getDword(GG_KEY_UIN, 0), id); GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; gce.ptszUID = id; - TCHAR* messageT = mir_utf8decodeT(e->event.multilogon_msg.message); + wchar_t* messageT = mir_utf8decodeT(e->event.multilogon_msg.message); gce.ptszText = messageT; - TCHAR* nickT; + wchar_t* nickT; if (!getTString(GG_KEY_NICK, &dbv)){ nickT = mir_tstrdup(dbv.ptszVal); db_free(&dbv); @@ -965,12 +965,12 @@ retry: sessions_updatedlg(); if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - const TCHAR* szText = time(NULL) - logonTime > 3 + const wchar_t* szText = time(NULL) - logonTime > 3 ? TranslateT("You have logged in at another location") : TranslateT("You are logged in at another location"); for (i = 0; i < e->event.multilogon_info.count; i++) { - TCHAR szMsg[MAX_SECONDLINE]; + wchar_t szMsg[MAX_SECONDLINE]; if (iIndexes && iIndexes[i]) continue; @@ -1052,14 +1052,14 @@ retry: debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin, dcc7->filename, dcc7->size); - TCHAR* filenameT = mir_a2t((char*)dcc7->filename); + wchar_t* filenameT = mir_a2t((char*)dcc7->filename); PROTORECVFILET pre = {0}; pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.descr.t = filenameT; - pre.files.t = &filenameT; + pre.descr.w = filenameT; + pre.files.w = &filenameT; pre.lParam = (LPARAM)dcc7; ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre); @@ -1146,8 +1146,8 @@ retry: case GG_EVENT_XML_ACTION: if (getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS)) { HXML hXml; - TCHAR *xmlAction; - TCHAR *tag; + wchar_t *xmlAction; + wchar_t *tag; xmlAction = mir_a2t(e->event.xml_action.data); tag = mir_a2t("events"); @@ -1307,7 +1307,7 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM) //////////////////////////////////////////////////////////// // When db settings changed -static TCHAR* sttSettingToTchar( DBVARIANT* value ) +static wchar_t* sttSettingToTchar( DBVARIANT* value ) { switch(value->type) { case DBVT_ASCIIZ: @@ -1342,7 +1342,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) // Contact is being renamed if (gc_enabled && !strcmp(cws->szModule, m_szModuleName) && !strcmp(cws->szSetting, GG_KEY_NICK)){ - TCHAR* ptszVal = sttSettingToTchar(&(cws->value)); + wchar_t* ptszVal = sttSettingToTchar(&(cws->value)); if(ptszVal==NULL) return 0; // Groupchat window contact is being renamed @@ -1375,7 +1375,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) { // If name changed... change nick if (!strcmp(cws->szSetting, "MyHandle")){ - TCHAR* ptszVal = sttSettingToTchar(&(cws->value)); + wchar_t* ptszVal = sttSettingToTchar(&(cws->value)); if(ptszVal==NULL) return 0; setTString(hContact, GG_KEY_NICK, ptszVal); mir_free(ptszVal); @@ -1518,7 +1518,7 @@ void GGPROTO::notifyall() //////////////////////////////////////////////////////////// // Get contact by uin // -MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) +MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) { #ifdef DEBUGMODE debugLogA("getcontact(): uin=%d create=%d inlist=%d", uin, create, inlist); @@ -1570,7 +1570,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) gg_pubdir50(sess, req); gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1); gg_pubdir50_free(req); - TCHAR* uinT = mir_a2t(ditoa(uin)); + wchar_t* uinT = mir_a2t(ditoa(uin)); setTString(hContact, GG_KEY_NICK, uinT); mir_free(uinT); debugLogA("getcontact(): Search for nick on uin: %d", uin); @@ -1591,7 +1591,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) // Change status of the contact with our own UIN (if got yourself added to the contact list) if (getDword(GG_KEY_UIN, 0) == uin) { gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1); - TCHAR *szMsg = mir_tstrdup(getstatusmsg(m_iStatus)); + wchar_t *szMsg = mir_tstrdup(getstatusmsg(m_iStatus)); gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1); changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0); mir_free(szMsg); @@ -1685,7 +1685,7 @@ int GGPROTO::status_gg2m(int status) //////////////////////////////////////////////////////////// // Called when contact status is changed // -void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int, uint32_t remote_ip, uint16_t remote_port, uint32_t version) +void GGPROTO::changecontactstatus(uin_t uin, int status, const wchar_t *idescr, int, uint32_t remote_ip, uint16_t remote_port, uint32_t version) { #ifdef DEBUGMODE debugLogA("changecontactstatus(): uin=%d status=%d", uin, status); diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index f3c500cc79..e4a593496f 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -38,9 +38,9 @@ extern INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special, int disableIfUndef) { DBVARIANT dbv = {0}; - TCHAR str[256]; - TCHAR *ptstr = NULL; - TCHAR* valT = NULL; + wchar_t str[256]; + wchar_t *ptstr = NULL; + wchar_t* valT = NULL; int unspecified = 0; dbv.type = DBVT_DELETED; @@ -69,7 +69,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule } } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); - ptstr = _itot(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); + ptstr = _itow(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); } break; case DBVT_WORD: @@ -84,7 +84,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0); - ptstr = _itot(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); + ptstr = _itow(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); } break; case DBVT_DWORD: @@ -104,7 +104,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule ptstr = str; mir_sntprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); } else { - ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); + ptstr = _itow(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); } break; case DBVT_ASCIIZ: @@ -120,7 +120,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); valT = mir_utf8decodeT(dbv.pszVal); ptstr = str; - _tcscpy_s(str, _countof(str), valT); + wcscpy_s(str, _countof(str), valT); mir_free(valT); break; default: @@ -170,7 +170,7 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd) // static void gg_optsdlgcheck(HWND hwndDlg) { - TCHAR text[128]; + wchar_t text[128]; GetDlgItemText(hwndDlg, IDC_UIN, text, _countof(text)); if (text[0]) { GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text)); @@ -785,7 +785,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!dat || dat->hContact || dat->disableUpdate) break; { - TCHAR text[256]; + wchar_t text[256]; GGPROTO *gg = dat->gg; if (!gg->isonline()) @@ -873,22 +873,22 @@ int GGPROTO::options_init(WPARAM wParam, LPARAM) odp.flags = ODPF_TCHAR; odp.position = 1003000; odp.hInstance = hInstance; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = m_tszUserName; + odp.pwszGroup = LPGENW("Network"); + odp.pwszTitle = m_tszUserName; odp.dwInitParam = (LPARAM)this; odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE; - odp.ptszTab = LPGENT("General"); + odp.pwszTab = LPGENW("General"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL); odp.pfnDlgProc = gg_genoptsdlgproc; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Conference"); + odp.pwszTab = LPGENW("Conference"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_CONFERENCE); odp.pfnDlgProc = gg_confoptsdlgproc; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Advanced"); + odp.pwszTab = LPGENW("Advanced"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_ADVANCED); odp.pfnDlgProc = gg_advoptsdlgproc; Options_AddPage(wParam, &odp); @@ -923,7 +923,7 @@ int GGPROTO::details_init(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = gg_detailsdlgproc; odp.position = -1900000000; odp.pszTemplate = pszTemplate; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.dwInitParam = (LPARAM)this; UserInfo_AddPage(wParam, &odp); diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 2b65aefdb4..14a82d4b58 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,14 +381,14 @@ void __cdecl GGPROTO::dccmainthread(void*) { // Make new ggtransfer struct local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL); - TCHAR* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename); + wchar_t* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename); PROTORECVFILET pre = {0}; pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.descr.t = filenameT; - pre.files.t = &filenameT; + pre.descr.w = filenameT; + pre.files.w = &filenameT; pre.lParam = (LPARAM)local_dcc; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1); @@ -659,7 +659,7 @@ void __cdecl GGPROTO::dccmainthread(void*) debugLogA("dccmainthread(): end. DCC Server Thread Ending"); } -HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) +HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) { struct gg_dcc *dcc = (struct gg_dcc *) hTransfer; char fileName[MAX_PATH], *path = mir_t2a(szPath); @@ -677,7 +677,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) if ((dcc->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1) { debugLogA("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); @@ -699,7 +699,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) return hTransfer; } -HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) +HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) { struct gg_dcc7 *dcc7 = (struct gg_dcc7 *) hTransfer; char fileName[MAX_PATH], *path = mir_t2a(szPath); @@ -726,7 +726,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) if ((dcc7->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1) { debugLogA("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER); @@ -850,7 +850,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) //////////////////////////////////////////////////////////// // File receiving allowed // -HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath) +HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath) { // Check if its proper dcc struct gg_common *c = (struct gg_common *) hTransfer; @@ -882,7 +882,7 @@ int GGPROTO::FileCancel(MCONTACT, HANDLE hTransfer) //////////////////////////////////////////////////////////// // File receiving denied // -int GGPROTO::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *) +int GGPROTO::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t *) { // Check if its proper dcc struct gg_common *c = (struct gg_common *) hTransfer; @@ -906,7 +906,7 @@ int GGPROTO::RecvFile(MCONTACT hContact, PROTORECVFILET* pre) //////////////////////////////////////////////////////////// // Called when user sends a file // -HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR *, TCHAR** ppszFiles) +HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles) { char *bslash, *filename; DWORD ip, ver; diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 62b12b934b..11c44a47de 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -55,14 +55,14 @@ static unsigned long crc_table[256]; ////////////////////////////////////////////////////////// // Extra winsock function for error description // -TCHAR* ws_strerror(int code) +wchar_t* ws_strerror(int code) { - static TCHAR err_desc[160]; + static wchar_t err_desc[160]; // Not a windows error display WinSock if (code == 0) { - TCHAR buff[128]; + wchar_t buff[128]; int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL); if (len == 0) mir_sntprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError()); @@ -132,7 +132,7 @@ unsigned long crc_get(char *mem) // http_error_string() // // returns http error text -const TCHAR *http_error_string(int h) +const wchar_t *http_error_string(int h) { switch (h) { @@ -173,22 +173,22 @@ void GGPROTO::cleanuplastplugin(DWORD version) if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){ debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version); - TCHAR avatarsPath[MAX_PATH]; + wchar_t avatarsPath[MAX_PATH]; mir_sntprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName); debugLog(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath); - TCHAR spec[MAX_PATH + 10]; + wchar_t spec[MAX_PATH + 10]; mir_sntprintf(spec, L"%s\\*.(null)", avatarsPath); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(spec, &ffd); if (hFind != INVALID_HANDLE_VALUE) { do { - TCHAR filePathT [2*MAX_PATH + 10]; + wchar_t filePathT [2*MAX_PATH + 10]; mir_sntprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName); - if (!_taccess(filePathT, 0)){ + if (!_waccess(filePathT, 0)){ debugLog(L"cleanuplastplugin() 1: remove file = %s", filePathT); - _tremove(filePathT); + _wremove(filePathT); } } while (FindNextFile(hFind, &ffd) != 0); FindClose(hFind); @@ -238,7 +238,7 @@ static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM) if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0)) Menu_ShowItem(gg->hBlockMenuItem, false); else - Menu_ModifyItem(gg->hBlockMenuItem, gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block")); + Menu_ModifyItem(gg->hBlockMenuItem, gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENW("&Unblock") : LPGENW("&Block")); return 0; } @@ -289,12 +289,12 @@ void GGPROTO::menus_init() mi.root = hRoot; mi.flags = CMIF_TCHAR; - mi.name.t = LPGENT("Conference"); + mi.name.w = LPGENW("Conference"); mi.position = 200001; mi.hIcolibItem = iconList[14].hIcolib; HGENMENU hGCRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName); - mi.name.t = LPGENT("Contact list"); + mi.name.w = LPGENW("Contact list"); mi.position = 200002; mi.hIcolibItem = iconList[7].hIcolib; HGENMENU hCLRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName); @@ -307,7 +307,7 @@ void GGPROTO::menus_init() ////////////////////////////////////////////////////////// // Module instance initialization // -static GGPROTO *gg_proto_init(const char* pszProtoName, const TCHAR* tszUserName) +static GGPROTO *gg_proto_init(const char* pszProtoName, const wchar_t* tszUserName) { GGPROTO *gg = new GGPROTO(pszProtoName, tszUserName); g_Instances.insert(gg); diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index 4dc5f9bf3b..34e753122c 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -101,7 +101,7 @@ typedef struct { uin_t *recipients; int recipients_count; - TCHAR id[32]; + wchar_t id[32]; BOOL ignore; } GGGC; @@ -306,11 +306,11 @@ extern IconItem iconList[]; // Methods /* Helper functions */ -const TCHAR *http_error_string(int h); +const wchar_t *http_error_string(int h); unsigned long crc_get(char *mem); int gg_normalizestatus(int status); char *gg_status2db(int status, const char *suffix); -TCHAR *ws_strerror(int code); +wchar_t *ws_strerror(int code); char *as_strerror(int code); uint32_t swap32(uint32_t x); const char *gg_version2string(int v); @@ -329,7 +329,7 @@ void gg_links_instancemenu_init(); void gg_links_init(); #define UIN2IDA(uin,id) _itoa(uin,id,10) -#define UIN2IDT(uin,id) _itot(uin,id,10) +#define UIN2IDT(uin,id) _itow(uin,id,10) // Debug functions const char *ggdebug_eventtype(gg_event *e); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 81eb4f0bf6..10ea01e41b 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -21,7 +21,7 @@ #include "gg.h" -GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : +GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : PROTO(pszProtoName, tszUserName), avatar_requests(1, NumericKeySortT), avatar_transfers(1, NumericKeySortT) @@ -39,7 +39,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : InitializeCriticalSection(&sessions_mutex); // Register m_hNetlibUser user - TCHAR name[128]; + wchar_t name[128]; mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { 0 }; @@ -67,8 +67,8 @@ GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED); - TCHAR szPath[MAX_PATH]; - mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (TCHAR*)VARST(L"%miranda_userdata%"), m_tszUserName); + wchar_t szPath[MAX_PATH]; + mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName); hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName); DWORD dwVersion; @@ -131,9 +131,9 @@ MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr) if (psr->cbSize == sizeof(GGSEARCHRESULT)) uin = psr->uin; else - uin = _ttoi(psr->id.t); + uin = _wtoi(psr->id.w); - return getcontact(uin, 1, flags & PALF_TEMPORARY ? 0 : 1, psr->nick.t); + return getcontact(uin, 1, flags & PALF_TEMPORARY ? 0 : 1, psr->nick.w); } ////////////////////////////////////////////////////////// @@ -252,7 +252,7 @@ void __cdecl GGPROTO::searchthread(void *) ////////////////////////////////////////////////////////// // when basic search // -HANDLE GGPROTO::SearchBasic(const TCHAR *id) +HANDLE GGPROTO::SearchBasic(const wchar_t *id) { if (!isonline()) return 0; @@ -289,7 +289,7 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id) ////////////////////////////////////////////////////////// // search by details // -HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName) +HANDLE GGPROTO::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) { // Check if connected and if there's a search data if (!isonline()) @@ -377,7 +377,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) CMStringA szQuery; // Fetch search data - TCHAR text[64]; + wchar_t text[64]; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); if (mir_tstrlen(text)) { T2Utf firstName_utf8(text); @@ -622,10 +622,10 @@ HANDLE GGPROTO::GetAwayMsg(MCONTACT hContact) // when away message is being set // registered as ProtoService PS_SETAWAYMSGT // -int GGPROTO::SetAwayMsg(int iStatus, const TCHAR *newMsg) +int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) { int status = gg_normalizestatus(iStatus); - TCHAR **msgPtr; + wchar_t **msgPtr; debugLog(L"SetAwayMsg(): PS_SETAWAYMSG(%d, \"%s\".)", iStatus, newMsg); diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 6508103fef..9107c49cdd 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -24,7 +24,7 @@ struct GGPROTO : public PROTO { - GGPROTO( const char*, const TCHAR* ); + GGPROTO( const char*, const wchar_t* ); ~GGPROTO(); //==================================================================================== @@ -33,28 +33,28 @@ struct GGPROTO : public PROTO virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - 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 FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason ); 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 SearchByName( const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName ); + virtual HANDLE __cdecl SearchBasic( const wchar_t* id ); + virtual HANDLE __cdecl SearchByName( const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName ); virtual HWND __cdecl SearchAdvanced( HWND owner ); virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET* ); - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); + virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles ); virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg ); virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode ); 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 ); @@ -97,7 +97,7 @@ struct GGPROTO : public PROTO void notifyuser(MCONTACT hContact, int refresh); void setalloffline(); void disconnect(); - MCONTACT getcontact(uin_t uin, int create, int inlist, TCHAR *nick); + MCONTACT getcontact(uin_t uin, int create, int inlist, wchar_t *nick); void __cdecl mainthread(void *empty); int isonline(); int refreshstatus(int status); @@ -107,8 +107,8 @@ struct GGPROTO : public PROTO int contactdeleted(WPARAM wParam, LPARAM lParam); int dbsettingchanged(WPARAM wParam, LPARAM lParam); void notifyall(); - void changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version); - TCHAR *getstatusmsg(int status); + void changecontactstatus(uin_t uin, int status, const wchar_t *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version); + wchar_t *getstatusmsg(int status); void dccstart(); void dccconnect(uin_t uin); int gettoken(GGTOKEN *token); @@ -117,11 +117,11 @@ struct GGPROTO : public PROTO void menus_init(); /* Avatar functions */ - void getAvatarFilename(MCONTACT hContact, TCHAR *pszDest, int cbLen); + void getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen); void requestAvatarTransfer(MCONTACT hContact, char *szAvatarURL); void requestAvatarInfo(MCONTACT hContact, int iWaitFor); void getOwnAvatar(); - void setAvatar(const TCHAR *szFilename); + void setAvatar(const wchar_t *szFilename); bool getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts); INT_PTR __cdecl getavatarcaps(WPARAM wParam, LPARAM lParam); @@ -136,14 +136,14 @@ struct GGPROTO : public PROTO void __cdecl setavatarthread(void*); /* File transfer functions */ - HANDLE fileallow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath); + HANDLE fileallow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath); int filecancel(MCONTACT hContact, HANDLE hTransfer); - int filedeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason); + int filedeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason); int recvfile(MCONTACT hContact, PROTORECVFILET* pre); - HANDLE sendfile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles); + HANDLE sendfile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles); - HANDLE dccfileallow(HANDLE hTransfer, const TCHAR* szPath); - HANDLE dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath); + HANDLE dccfileallow(HANDLE hTransfer, const wchar_t* szPath); + HANDLE dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath); int dccfiledeny(HANDLE hTransfer); int dcc7filedeny(HANDLE hTransfer); @@ -170,7 +170,7 @@ struct GGPROTO : public PROTO int img_shutdown(); int img_sendonrequest(gg_event* e); BOOL img_opened(uin_t uin); - void *img_loadpicture(gg_event* e, TCHAR *szFileName); + void *img_loadpicture(gg_event* e, wchar_t *szFileName); int img_display(MCONTACT hContact, void *img); int img_displayasmsg(MCONTACT hContact, void *img); @@ -193,9 +193,9 @@ struct GGPROTO : public PROTO int gc_init(); void gc_menus_init(HGENMENU hRoot); int gc_destroy(); - TCHAR * gc_getchat(uin_t sender, uin_t *recipients, int recipients_count); - GGGC *gc_lookup(const TCHAR *id); - int gc_changenick(MCONTACT hContact, TCHAR *ptszNick); + wchar_t * gc_getchat(uin_t sender, uin_t *recipients, int recipients_count); + GGGC *gc_lookup(const wchar_t *id); + int gc_changenick(MCONTACT hContact, wchar_t *ptszNick); int __cdecl gc_event(WPARAM wParam, LPARAM lParam); @@ -204,7 +204,7 @@ struct GGPROTO : public PROTO /* Popups functions */ void initpopups(); - void showpopup(const TCHAR* nickname, const TCHAR* msg, int flags); + void showpopup(const wchar_t* nickname, const wchar_t* msg, int flags); /* Sessions functions */ INT_PTR __cdecl sessions_view(WPARAM wParam, LPARAM lParam); @@ -235,12 +235,12 @@ struct GGPROTO : public PROTO UINT_PTR timer; struct { - TCHAR *online; - TCHAR *away; - TCHAR *dnd; - TCHAR *freechat; - TCHAR *invisible; - TCHAR *offline; + wchar_t *online; + wchar_t *away; + wchar_t *dnd; + wchar_t *freechat; + wchar_t *invisible; + wchar_t *offline; } modemsg; HGENMENU hMainMenu[7]; diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 5bf54545b1..85790434eb 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -66,7 +66,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::gc_openconf); mi.position = 2000050001; mi.hIcolibItem = iconList[14].hIcolib; - mi.name.t = LPGENT("Open &conference..."); + mi.name.w = LPGENW("Open &conference..."); hMainMenu[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName); // Clear ignored conferences @@ -74,7 +74,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::gc_clearignored); mi.position = 2000050002; mi.hIcolibItem = iconList[15].hIcolib; - mi.name.t = LPGENT("&Clear ignored conferences"); + mi.name.w = LPGENW("&Clear ignored conferences"); hMainMenu[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName); } } @@ -94,7 +94,7 @@ int GGPROTO::gc_destroy() return 1; } -GGGC* GGPROTO::gc_lookup(const TCHAR *id) +GGGC* GGPROTO::gc_lookup(const wchar_t *id) { GGGC *chat; list_t l; @@ -149,7 +149,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) // Message typed / send only if online if (isonline() && (gch->pDest->iType == GC_USER_MESSAGE) && gch->ptszText) { - TCHAR id[32]; + wchar_t id[32]; UIN2IDT(uin, id); DBVARIANT dbv; @@ -157,7 +157,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) GCEVENT gce = { sizeof(gce), &gcd }; gce.ptszUID = id; gce.ptszText = gch->ptszText; - TCHAR* nickT; + wchar_t* nickT; if (!getTString(GG_KEY_NICK, &dbv)){ nickT = mir_tstrdup(dbv.ptszVal); db_free(&dbv); @@ -188,7 +188,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) if (gch->pDest->iType == GC_USER_PRIVMESS) { MCONTACT hContact = NULL; - if ((uin = _ttoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL))) + if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL))) CallService(MS_MSG_SENDMESSAGE, hContact, 0); } debugLog(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, gch->ptszText); @@ -207,11 +207,11 @@ typedef struct _gg_gc_echat //////////////////////////////////////////////////////////////////////////////// // This is main groupchat initialization routine // -TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count) +wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count) { list_t l; GGGC *chat; - TCHAR id[32]; + wchar_t id[32]; uin_t uin; DBVARIANT dbv; GCDEST gcd = { m_szModuleName, 0, GC_EVENT_ADDGROUP }; @@ -279,9 +279,9 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count (getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN) == 1 && unknown >= getWord(GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN)))) { - TCHAR *senderName = unknownSender ? + wchar_t *senderName = unknownSender ? TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0); - TCHAR error[256]; + wchar_t error[256]; mir_sntprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"), senderName, recipients_count + 1, unknown); chat->ignore = MessageBox(NULL, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK; @@ -302,8 +302,8 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count } // Create new chat window - TCHAR status[256]; - TCHAR *senderName; + wchar_t status[256]; + wchar_t *senderName; if (sender) { senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0); @@ -324,7 +324,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcwindow.ptszStatusbarText = status; // Here we put nice new hash sign - TCHAR *name = (TCHAR*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(TCHAR)); + wchar_t *name = (wchar_t*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t)); *name = '#'; mir_tstrcpy(name + 1, gcwindow.ptszName); gcwindow.ptszName = name; @@ -352,7 +352,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count { UIN2IDT(uin, id); - TCHAR* nickT; + wchar_t* nickT; if (!getTString(GG_KEY_NICK, &dbv)) { nickT = mir_tstrdup(dbv.ptszVal); db_free(&dbv); @@ -470,7 +470,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa else if (hwndList && (count = gg_gc_countcheckmarks(hwndList)) >= 2) { // Create new participiants table - TCHAR* chat; + wchar_t* chat; uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t)); gg->debugLogA("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count); for (MCONTACT hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) { @@ -617,7 +617,7 @@ INT_PTR GGPROTO::gc_openconf(WPARAM, LPARAM) return 1; } -int GGPROTO::gc_changenick(MCONTACT hContact, TCHAR *ptszNick) +int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick) { list_t l; uin_t uin = getDword(hContact, GG_KEY_UIN, 0); @@ -632,7 +632,7 @@ int GGPROTO::gc_changenick(MCONTACT hContact, TCHAR *ptszNick) // Rename this window if it's exising in the chat if (chat->recipients[i] == uin) { - TCHAR id[32]; + wchar_t id[32]; UIN2IDT(uin, id); GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_NICK }; diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index bd6313b5b0..a883917caf 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -40,7 +40,7 @@ typedef struct _GGIMAGEENTRY { HBITMAP hBitmap; - TCHAR *lpszFileName; + wchar_t *lpszFileName; char *lpData; unsigned long nSize; struct _GGIMAGEENTRY *lpNext; @@ -212,20 +212,20 @@ int gg_img_paint(HWND hwnd, GGIMAGEENTRY *dat) //////////////////////////////////////////////////////////////////////////////// // Returns supported image filters // -TCHAR *gg_img_getfilter(TCHAR *szFilter, int nSize) +wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize) { - TCHAR *szFilterName, *szFilterMask; - TCHAR *pFilter = szFilter; + wchar_t *szFilterName, *szFilterMask; + wchar_t *pFilter = szFilter; // Match relative to ImgDecoder presence szFilterName = TranslateT("Image files (*.bmp,*.gif,*.jpeg,*.jpg,*.png)"); szFilterMask = L"*.bmp;*.gif;*.jpeg;*.jpg;*.png"; // Make up filter - _tcsncpy(pFilter, szFilterName, nSize); + wcsncpy(pFilter, szFilterName, nSize); pFilter += mir_tstrlen(pFilter) + 1; if (pFilter >= szFilter + nSize) return NULL; - _tcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter)); + wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter)); pFilter += mir_tstrlen(pFilter) + 1; if (pFilter >= szFilter + nSize) return NULL; *pFilter = 0; @@ -243,11 +243,11 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) GGPROTO* gg = ((GGIMAGEDLGDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->gg; - TCHAR szFilter[128]; + wchar_t szFilter[128]; gg_img_getfilter(szFilter, _countof(szFilter)); - TCHAR szFileName[MAX_PATH]; - _tcsncpy(szFileName, dat->lpszFileName, _countof(szFileName)); + wchar_t szFileName[MAX_PATH]; + wcsncpy(szFileName, dat->lpszFileName, _countof(szFileName)); OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; @@ -259,7 +259,7 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) ofn.Flags = OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT; if (GetSaveFileName(&ofn)) { - FILE *fp = _tfopen(szFileName, L"w+b"); + FILE *fp = _wfopen(szFileName, L"w+b"); if (fp) { fwrite(dat->lpData, dat->nSize, 1, fp); @@ -418,7 +418,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Set main window image Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_IMAGE)); - TCHAR *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128]; + wchar_t *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128]; if (dat->bReceiving) mir_sntprintf(szTitle, TranslateT("Image from %s"), szName); else @@ -494,7 +494,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->bReceiving) { - TCHAR szTitle[128]; + wchar_t szTitle[128]; mir_sntprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal); SetDlgItemText(hwndDlg, IDC_IMG_NAME, szTitle); } @@ -660,8 +660,8 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_CHOOSEIMG: { - TCHAR szFilter[128]; - TCHAR szFileName[MAX_PATH]; + wchar_t szFilter[128]; + wchar_t szFileName[MAX_PATH]; OPENFILENAME ofn = {0}; gg_img_getfilter(szFilter, _countof(szFilter)); @@ -738,16 +738,16 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, MCONTACT hContact) // Checks if an image is already saved to the specified path // Returns 1 if yes, 0 if no or -1 if different image on this path is found // -int gg_img_isexists(TCHAR *szPath, GGIMAGEENTRY *dat) +int gg_img_isexists(wchar_t *szPath, GGIMAGEENTRY *dat) { struct _stat st; - if (_tstat(szPath, &st) != 0) + if (_wstat(szPath, &st) != 0) return 0; if (st.st_size == dat->nSize) { - FILE *fp = _tfopen(szPath, L"rb"); + FILE *fp = _wfopen(szPath, L"rb"); if (!fp) return 0; char *lpData = (char*)mir_alloc(dat->nSize); if (fread(lpData, 1, dat->nSize, fp) == dat->nSize) @@ -770,11 +770,11 @@ int gg_img_isexists(TCHAR *szPath, GGIMAGEENTRY *dat) //////////////////////////////////////////////////////////////////////////// // Determine if image's file name has the proper extension // -TCHAR *gg_img_hasextension(TCHAR *filename) +wchar_t *gg_img_hasextension(wchar_t *filename) { if (filename != NULL && *filename != '\0') { - TCHAR *imgtype = _tcsrchr(filename, '.'); + wchar_t *imgtype = wcsrchr(filename, '.'); if (imgtype != NULL) { size_t len = mir_tstrlen(imgtype); @@ -797,12 +797,12 @@ TCHAR *gg_img_hasextension(TCHAR *filename) int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) { GGIMAGEENTRY *dat = (GGIMAGEENTRY *)img; - TCHAR szPath[MAX_PATH], path[MAX_PATH], *pImgext, imgext[6]; + wchar_t szPath[MAX_PATH], path[MAX_PATH], *pImgext, imgext[6]; size_t tPathLen; int i, res; if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) { - TCHAR *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%"); + wchar_t *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%"); tPathLen = mir_sntprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName); mir_free(tmpPath); } @@ -811,13 +811,13 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) tPathLen = mir_tstrlen(szPath); } - if ( _taccess(szPath, 0)){ + if ( _waccess(szPath, 0)){ int ret = CreateDirectoryTreeT(szPath); if (ret == 0){ debugLog(L"img_displayasmsg(): Created new directory for image cache: %s.", szPath); } else { debugLog(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE); } @@ -826,7 +826,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName); if ((pImgext = gg_img_hasextension(szPath)) == NULL) pImgext = szPath + mir_tstrlen(szPath); - _tcsncpy_s(imgext, pImgext, _TRUNCATE); + wcsncpy_s(imgext, pImgext, _TRUNCATE); for (i = 1; ; ++i) { if ((res = gg_img_isexists(szPath, dat)) != -1) break; @@ -835,13 +835,13 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (res == 0) { // Image file not found, thus create it - FILE *fp = _tfopen(szPath, L"w+b"); + FILE *fp = _wfopen(szPath, L"w+b"); if (fp) { res = fwrite(dat->lpData, dat->nSize, 1, fp) > 0; fclose(fp); } else { debugLog(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); return 0; @@ -849,7 +849,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } if (res != 0) { - TCHAR image_msg[MAX_PATH + 11]; + wchar_t image_msg[MAX_PATH + 11]; mir_sntprintf(image_msg, L"[img]%s[/img]", szPath); T2Utf szMessage(image_msg); @@ -926,7 +926,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) //////////////////////////////////////////////////////////////////////////// // Helper function to determine image file format and the right extension // -const TCHAR *gg_img_guessfileextension(const char *lpData) +const wchar_t *gg_img_guessfileextension(const char *lpData) { if (lpData != NULL) { @@ -945,7 +945,7 @@ const TCHAR *gg_img_guessfileextension(const char *lpData) //////////////////////////////////////////////////////////////////////////// // Image Window : Loading picture and sending for display // -void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) +void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) { if (!szFileName && (!e || !e->event.image_reply.size || !e->event.image_reply.image || !e->event.image_reply.filename)) @@ -958,11 +958,11 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) // Copy the file name if (szFileName) { - FILE *fp = _tfopen(szFileName, L"rb"); + FILE *fp = _wfopen(szFileName, L"rb"); if (!fp) { free(dat); debugLog(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno)); - TCHAR error[512]; + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName); showpopup(m_tszUserName, error, GG_POPUP_ERROR); return NULL; @@ -996,7 +996,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) return NULL; } fclose(fp); - dat->lpszFileName = _tcsdup(szFileName); + dat->lpszFileName = wcsdup(szFileName); } // Copy picture from packet else if (e && e->event.image_reply.filename) @@ -1008,9 +1008,9 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) ptrT tmpFileName( mir_a2t(e->event.image_reply.filename)); if (!gg_img_hasextension(tmpFileName)) { // Add missing file extension - const TCHAR *szImgType = gg_img_guessfileextension(dat->lpData); + const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData); if (*szImgType) { - dat->lpszFileName = (TCHAR*)calloc(sizeof(TCHAR), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1); + dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1); if (dat->lpszFileName != NULL) { mir_tstrcpy(dat->lpszFileName, tmpFileName); mir_tstrcat(dat->lpszFileName, szImgType); @@ -1019,7 +1019,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) } if (dat->lpszFileName == NULL) - dat->lpszFileName = _tcsdup( _A2T( e->event.image_reply.filename)); + dat->lpszFileName = wcsdup( _A2T( e->event.image_reply.filename)); } //////////////////////////////////////////////////////////////////// diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 9b5a0cde73..08a882079e 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -223,12 +223,12 @@ void GGPROTO::parsecontacts(char *contacts) // Write misc data if (hContact && strFirstName){ - TCHAR *tstrFirstName = mir_a2t(strFirstName); + wchar_t *tstrFirstName = mir_a2t(strFirstName); setTString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName); mir_free(tstrFirstName); } if (hContact && strLastName){ - TCHAR *tstrLastName = mir_a2t(strLastName); + wchar_t *tstrLastName = mir_a2t(strLastName); setTString(hContact, GG_KEY_PD_LASTNAME, tstrLastName); mir_free(tstrLastName); } @@ -276,7 +276,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) gg_EnterCriticalSection(&sess_mutex, "import_server", 65, "sess_mutex", 1); if (gg_userlist_request(sess, GG_USERLIST_GET, NULL) == -1) { - TCHAR error[128]; + wchar_t error[128]; gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1); mir_sntprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); @@ -314,7 +314,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) gg_EnterCriticalSection(&sess_mutex, "remove_server", 66, "sess_mutex", 1); if (gg_userlist_request(sess, GG_USERLIST_PUT, NULL) == -1) { - TCHAR error[128]; + wchar_t error[128]; gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1); mir_sntprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); @@ -330,30 +330,30 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) INT_PTR GGPROTO::import_text(WPARAM, LPARAM) { - TCHAR str[MAX_PATH]; - TCHAR filter[512], *pfilter; + wchar_t str[MAX_PATH]; + wchar_t filter[512], *pfilter; struct _stat st; OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - _tcsncpy(filter, TranslateT("Text files"), _countof(filter)); + wcsncpy(filter, TranslateT("Text files"), _countof(filter)); mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter)); pfilter = filter + mir_tstrlen(filter) + 1; if (pfilter >= filter + _countof(filter)) return 0; - _tcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter)); + wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + _countof(filter)) return 0; - _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter)); + wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter)); mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + _countof(filter)) return 0; - _tcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter)); + wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + _countof(filter)) return 0; @@ -373,8 +373,8 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) #endif if (!GetOpenFileName(&ofn)) return 0; - FILE *f = _tfopen(str, L"r"); - _tstat(str, &st); + FILE *f = _wfopen(str, L"r"); + _wstat(str, &st); if (f && st.st_size) { @@ -389,7 +389,7 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) } else { - TCHAR error[256]; + wchar_t error[256]; mir_sntprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); debugLog(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno)); @@ -401,29 +401,29 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) INT_PTR GGPROTO::export_text(WPARAM, LPARAM) { - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; OPENFILENAME ofn = {0}; - TCHAR filter[512], *pfilter; + wchar_t filter[512], *pfilter; - _tcsncpy(str, TranslateT("contacts"), _countof(str)); + wcsncpy(str, TranslateT("contacts"), _countof(str)); mir_tstrncat(str, L".txt", _countof(str) - mir_tstrlen(str)); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - _tcsncpy(filter, TranslateT("Text files"), _countof(filter)); + wcsncpy(filter, TranslateT("Text files"), _countof(filter)); mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter)); pfilter = filter + mir_tstrlen(filter) + 1; if (pfilter >= filter + _countof(filter)) return 0; - _tcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter)); + wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + _countof(filter)) return 0; - _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter)); + wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter)); mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + _countof(filter)) return 0; - _tcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter)); + wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + _countof(filter)) return 0; @@ -440,7 +440,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) #endif if (!GetSaveFileName(&ofn)) return 0; - FILE *f = _tfopen(str, L"w"); + FILE *f = _wfopen(str, L"w"); if (f) { char *contacts = gg_makecontacts(this, 0); fwrite(contacts, sizeof(char), mir_strlen(contacts), f); @@ -451,7 +451,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) } else { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); debugLog(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno)); @@ -494,7 +494,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) gg_EnterCriticalSection(&sess_mutex, "export_server", 67, "sess_mutex", 1); if (gg_userlist_request(sess, GG_USERLIST_PUT, contacts) == -1) { - TCHAR error[128]; + wchar_t error[128]; gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1); mir_sntprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); @@ -524,7 +524,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::import_server); mi.position = 2000500001; mi.hIcolibItem = iconList[1].hIcolib; - mi.name.t = LPGENT("Import List From &Server"); + mi.name.w = LPGENW("Import List From &Server"); hMainMenu[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName); // Import from textfile @@ -533,7 +533,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::import_text); mi.position = 2000500002; mi.hIcolibItem = iconList[2].hIcolib; - mi.name.t = LPGENT("Import List From &Text File..."); + mi.name.w = LPGENW("Import List From &Text File..."); hMainMenu[3] = Menu_AddProtoMenuItem(&mi, m_szModuleName); // Remove from server @@ -542,7 +542,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::remove_server); mi.position = 2000500003; mi.hIcolibItem = iconList[3].hIcolib; - mi.name.t = LPGENT("&Remove List From Server"); + mi.name.w = LPGENW("&Remove List From Server"); hMainMenu[4] = Menu_AddProtoMenuItem(&mi, m_szModuleName); // Export to server @@ -551,7 +551,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::export_server); mi.position = 2005000001; mi.hIcolibItem = iconList[4].hIcolib; - mi.name.t = LPGENT("Export List To &Server"); + mi.name.w = LPGENW("Export List To &Server"); hMainMenu[5] = Menu_AddProtoMenuItem(&mi, m_szModuleName); // Export to textfile @@ -560,6 +560,6 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::export_text); mi.position = 2005000002; mi.hIcolibItem = iconList[5].hIcolib; - mi.name.t = LPGENT("Export List To &Text File..."); + mi.name.w = LPGENW("Export List To &Text File..."); hMainMenu[6] = Menu_AddProtoMenuItem(&mi, m_szModuleName); } diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 7033e9749a..cc388ac8e8 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -118,7 +118,7 @@ void GGPROTO::links_instance_init() CMenuItem mi; mi.flags = CMIF_TCHAR; mi.position = g_Instances.getCount(); - mi.name.t = m_tszUserName; + mi.name.w = m_tszUserName; hInstanceMenuItem = Menu_AddItem(hInstanceMenu, &mi, this); } } diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 2bcff16f9e..818daa2d8d 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -315,7 +315,7 @@ int GGPROTO::oauth_receivetoken() if (resp) { nlc = resp->nlc; if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) { - TCHAR *xmlAction = mir_a2t(resp->pData); + wchar_t *xmlAction = mir_a2t(resp->pData); HXML hXml = xmlParseString(xmlAction, 0, L"result"); if (hXml != NULL) { HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0); @@ -384,7 +384,7 @@ int GGPROTO::oauth_receivetoken() resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req); if (resp) { if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) { - TCHAR *xmlAction = mir_a2t(resp->pData); + wchar_t *xmlAction = mir_a2t(resp->pData); HXML hXml = xmlParseString(xmlAction, 0, L"result"); if (hXml != NULL) { HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0); diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 125c0da27d..7d7ebeb5cd 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -56,7 +56,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0))) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); debugLog(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno)); diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index e8ca28f164..ca8ff1fa74 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -23,8 +23,8 @@ struct PopupData { unsigned flags; - TCHAR* title; - TCHAR* text; + wchar_t* title; + wchar_t* text; GGPROTO* gg; }; @@ -72,7 +72,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar // void GGPROTO::initpopups() { - TCHAR szDescr[256]; + wchar_t szDescr[256]; char szName[256]; POPUPCLASS puc = {0}; @@ -111,8 +111,8 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { char szName[256]; POPUPDATACLASS ppd = {sizeof(ppd)}; - ppd.ptszTitle = puData->title; - ppd.ptszText = puData->text; + ppd.pwszTitle = puData->title; + ppd.pwszText = puData->text; ppd.PluginData = puData; ppd.pszClassName = szName; @@ -149,7 +149,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) mir_free(puData); } -void GGPROTO::showpopup(const TCHAR* nickname, const TCHAR* msg, int flags) +void GGPROTO::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags) { if (Miranda_Terminated()) return; diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index d5c5c99217..f067ae87b7 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -49,7 +49,7 @@ char *gg_status2db(int status, const char *suffix) ////////////////////////////////////////////////////////// // gets protocol status // -TCHAR* GGPROTO::getstatusmsg(int status) +wchar_t* GGPROTO::getstatusmsg(int status) { switch(status) { case ID_STATUS_ONLINE: @@ -99,7 +99,7 @@ int GGPROTO::refreshstatus(int status) } else { - TCHAR *szMsg = NULL; + wchar_t *szMsg = NULL; // Select proper msg gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 69, "modemsg_mutex", 1); szMsg = getstatusmsg(status); @@ -191,7 +191,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) { if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){ debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS"); - _tcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal); + wcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal); pai->format = ProtoGetAvatarFormat(pai->filename); db_free(&dbv); return GAIR_SUCCESS; @@ -229,7 +229,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (AvatarHash != NULL && AvatarSavedHash != NULL) { getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename)); if (!mir_strcmp(AvatarHash, AvatarSavedHash)) { - if (_taccess(pai->filename, 0) == 0){ + if (_waccess(pai->filename, 0) == 0){ debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged. return GAIR_SUCCESS", uin); return GAIR_SUCCESS; } @@ -239,9 +239,9 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) return GAIR_WAITFOR; } if ((wParam & GAIF_FORCE) != 0) { - if (_tremove(pai->filename) != 0){ - debugLog(L"getavatarinfo(): refresh. _tremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); - TCHAR error[512]; + if (_wremove(pai->filename) != 0){ + debugLog(L"getavatarinfo(): refresh. _wremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); } @@ -254,9 +254,9 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) else if ((wParam & GAIF_FORCE) != 0) { if (AvatarHash == NULL && AvatarSavedHash != NULL) { getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename)); - if (_tremove(pai->filename) != 0){ - debugLog(L"getavatarinfo(): delete. _tremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); - TCHAR error[512]; + if (_wremove(pai->filename) != 0){ + debugLog(L"getavatarinfo(): delete. _wremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno)); + wchar_t error[512]; mir_sntprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename); showpopup(m_tszUserName, error, GG_POPUP_ERROR); } @@ -284,7 +284,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) // INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) { - TCHAR *szFilename = (TCHAR*)wParam; + wchar_t *szFilename = (wchar_t*)wParam; int len = (int)lParam; if (szFilename == NULL || len <= 0) { @@ -298,7 +298,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) } getAvatarFilename(NULL, szFilename, len); - if (_taccess(szFilename, 0) == 0){ + if (_waccess(szFilename, 0) == 0){ debugLogA("getmyavatar(): Incoming request for self avatar information. returned ok."); return 0; } else { @@ -314,7 +314,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) // INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) { - TCHAR *szFilename = (TCHAR*)lParam; + wchar_t *szFilename = (wchar_t*)lParam; if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS)) return -2; @@ -335,7 +335,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) setByte(GG_KEY_AVATARTYPEPREV, getByte(GG_KEY_AVATARTYPE, -1)); setByte(GG_KEY_AVATARTYPE, (BYTE)iAvType); - TCHAR szMyFilename[MAX_PATH]; + wchar_t szMyFilename[MAX_PATH]; getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename)); if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) { debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType); @@ -355,7 +355,7 @@ INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam) INT_PTR res = 0; gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1); - TCHAR *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus); + wchar_t *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus); if (isonline() && szMsg) res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szMsg) : (INT_PTR)mir_t2a(szMsg); gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1); diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index bd68343587..13db5b1072 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -127,7 +127,7 @@ static BOOL IsOverAction(HWND hwndDlg) LVHITTESTINFO hti; RECT rc; HDC hdc; - TCHAR szText[256]; + wchar_t szText[256]; SIZE textSize; int textPosX; @@ -164,7 +164,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam); { - TCHAR oldTitle[256], newTitle[256]; + wchar_t oldTitle[256], newTitle[256]; HANDLE hProtoAckEvent; GetWindowText(hwndDlg, oldTitle, _countof(oldTitle)); @@ -265,7 +265,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc); if (nm->nmcd.hdr.idFrom == IDC_SESSIONS && nm->iSubItem == 3) { - TCHAR szText[256]; + wchar_t szText[256]; szText[0] = 0; ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText)); FillRect(nm->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW)); @@ -320,7 +320,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w switch (iSelection) { case 10001: { - TCHAR szText[512], szClientName[256], szIP[64], szLoginTime[64]; + wchar_t szText[512], szClientName[256], szIP[64], szLoginTime[64]; HGLOBAL hData; if (!OpenClipboard(hwndDlg)) break; @@ -333,7 +333,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w mir_sntprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime); if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL) { - mir_tstrcpy((TCHAR*)GlobalLock(hData), szText); + mir_tstrcpy((wchar_t*)GlobalLock(hData), szText); GlobalUnlock(hData); SetClipboardData(CF_TEXT, hData); } @@ -343,7 +343,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w case 10002: { - TCHAR szUrl[256], szIP[64]; + wchar_t szUrl[256], szIP[64]; szIP[0] = 0; ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP)); mir_sntprintf(szUrl, L"http://whois.domaintools.com/%s", szIP); @@ -424,6 +424,6 @@ void GGPROTO::sessions_menus_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::sessions_view); mi.position = 200003; mi.hIcolibItem = iconList[16].hIcolib; - mi.name.t = LPGENT("Concurrent &sessions"); + mi.name.w = LPGENW("Concurrent &sessions"); Menu_AddProtoMenuItem(&mi, m_szModuleName); } diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 0a76e2e3ae..da89d11331 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -113,7 +113,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_http *h = gg_token(0); if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0)); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); gg_free_pubdir(h); @@ -122,7 +122,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_token *t = (struct gg_token *)h->data; if (!t || !h->body) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error)); MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP); gg_free_pubdir(h); diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 4f40b99e37..0a2e424c2f 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -39,7 +39,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) if (!gg->gettoken(&token)) return NULL; if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"), (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Registration rejected") : ws_strerror(errno))); @@ -85,7 +85,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"), (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad number or password") : ws_strerror(errno))); @@ -137,7 +137,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"), (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Invalid data entered") : ws_strerror(errno))); @@ -179,7 +179,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne struct gg_http *h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0); if (!h || !(s = (gg_pubdir*)h->data) || !s->success) { - TCHAR error[128]; + wchar_t error[128]; mir_sntprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"), (h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno))); MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP); -- cgit v1.2.3