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/AimOscar/src/aim.cpp | 2 +- protocols/AimOscar/src/avatars.cpp | 16 ++++++------- protocols/AimOscar/src/avatars.h | 2 +- protocols/AimOscar/src/chat.cpp | 12 +++++----- protocols/AimOscar/src/conv.cpp | 8 +++---- protocols/AimOscar/src/conv.h | 2 +- protocols/AimOscar/src/file.cpp | 20 ++++++++-------- protocols/AimOscar/src/links.cpp | 46 ++++++++++++++++++------------------- protocols/AimOscar/src/popup.cpp | 6 ++--- protocols/AimOscar/src/proto.cpp | 28 +++++++++++----------- protocols/AimOscar/src/proto.h | 26 ++++++++++----------- protocols/AimOscar/src/server.cpp | 18 +++++++-------- protocols/AimOscar/src/services.cpp | 12 +++++----- protocols/AimOscar/src/theme.cpp | 8 +++---- protocols/AimOscar/src/ui.cpp | 20 ++++++++-------- protocols/AimOscar/src/utility.cpp | 20 ++++++++-------- protocols/AimOscar/src/utility.h | 2 +- 17 files changed, 124 insertions(+), 124 deletions(-) (limited to 'protocols/AimOscar/src') diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp index 6d595ae8e9..d9cbc9b6de 100644 --- a/protocols/AimOscar/src/aim.cpp +++ b/protocols/AimOscar/src/aim.cpp @@ -86,7 +86,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // Load -static PROTO_INTERFACE* protoInit(const char* pszProtoName, const TCHAR* tszUserName) +static PROTO_INTERFACE* protoInit(const char* pszProtoName, const wchar_t* tszUserName) { CAimProto *ppro = new CAimProto(pszProtoName, tszUserName); g_Instances.insert(ppro); diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 52280c13e2..ec3b7c3812 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -95,11 +95,11 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c ai.hContact = contact_from_sn(sn); if (data_len > 0) { - const TCHAR *type; + const wchar_t *type; ai.format = ProtoGetBufferFormat(data, &type); get_avatar_filename(ai.hContact, ai.filename, _countof(ai.filename), type); - 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 >= 0) { _write(fileId, data, data_len); _close(fileId); @@ -116,11 +116,11 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &ai, 0); } -int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) +int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext) { int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); - if (ext && _taccess(pszDest, 0)) + if (ext && _waccess(pszDest, 0)) CreateDirectoryTreeT(pszDest); size_t tPathLen2 = tPathLen; @@ -138,7 +138,7 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbL long hFile = _tfindfirst(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; } @@ -150,15 +150,15 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbL } else { mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext); - found = _taccess(pszDest, 0) == 0; + found = _waccess(pszDest, 0) == 0; } return found ? GAIR_SUCCESS : GAIR_WAITFOR; } -bool get_avatar_hash(const TCHAR* file, char* hash, char** data, unsigned short &size) +bool get_avatar_hash(const wchar_t* file, char* hash, char** data, unsigned short &size) { - int fileId = _topen(file, _O_RDONLY | _O_BINARY, _S_IREAD); + int fileId = _wopen(file, _O_RDONLY | _O_BINARY, _S_IREAD); if (fileId == -1) return false; long lAvatar = _filelength(fileId); diff --git a/protocols/AimOscar/src/avatars.h b/protocols/AimOscar/src/avatars.h index 1188a1ec82..647e897f3f 100644 --- a/protocols/AimOscar/src/avatars.h +++ b/protocols/AimOscar/src/avatars.h @@ -46,7 +46,7 @@ struct avatar_up_req { mir_free(data1); mir_free(data2); } }; -bool get_avatar_hash(const TCHAR* file, char* hash, char** data, unsigned short &size); +bool get_avatar_hash(const wchar_t* file, char* hash, char** data, unsigned short &size); void rescale_image(char *data, unsigned short size, char *&data1, unsigned short &size1); #endif diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index 82508f63f0..dcc0d9449e 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -36,7 +36,7 @@ void CAimProto::chat_register(void) void CAimProto::chat_start(const char* id, unsigned short exchange) { - TCHAR *idt = mir_a2t(id); + wchar_t *idt = mir_a2t(id); GCSESSION gcw = { sizeof(gcw) }; gcw.iType = GCW_CHATROOM; @@ -64,13 +64,13 @@ void CAimProto::chat_start(const char* id, unsigned short exchange) mir_free(idt); } -void CAimProto::chat_event(const char* id, const char* sn, int evt, const TCHAR* msg) +void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_t* msg) { - TCHAR *idt = mir_a2t(id); - TCHAR *snt = mir_a2t(sn); + wchar_t *idt = mir_a2t(id); + wchar_t *snt = mir_a2t(sn); MCONTACT hContact = contact_from_sn(sn); - TCHAR *nick = hContact ? (TCHAR*)pcli->pfnGetContactDisplayName( + wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName( WPARAM(hContact), 0) : snt; GCDEST gcd = { m_szModuleName, idt, evt }; @@ -91,7 +91,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const TCHAR* void CAimProto::chat_leave(const char* id) { - TCHAR *idt = mir_a2t(id); + wchar_t *idt = mir_a2t(id); GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index 287aec3a84..a2e3420b2e 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -538,7 +538,7 @@ char* rtf_to_html(HWND hwndDlg, int DlgItem) isSize = 1; else isSize = 3; - TCHAR text[3] = L""; + wchar_t text[3] = L""; SendDlgItemMessage(hwndDlg, DlgItem, EM_GETSELTEXT, 0, (LPARAM)&text); if (Bold != isBold) { Bold = isBold; @@ -724,11 +724,11 @@ char* get_fname(char *path) return pszFile; } -TCHAR* get_dir(TCHAR *path) +wchar_t* get_dir(wchar_t *path) { - TCHAR *cpath = mir_tstrdup(path); + wchar_t *cpath = mir_tstrdup(path); - TCHAR *swd = _tcsrchr(cpath, '\\'); + wchar_t *swd = wcsrchr(cpath, '\\'); if (swd) swd[1] = 0; else cpath[0] = 0; return cpath; diff --git a/protocols/AimOscar/src/conv.h b/protocols/AimOscar/src/conv.h index b7490cf63e..d12506189b 100644 --- a/protocols/AimOscar/src/conv.h +++ b/protocols/AimOscar/src/conv.h @@ -32,7 +32,7 @@ char* bytes_to_string(char* bytes, int num_bytes); void string_to_bytes(char* string, char* bytes); bool is_utf(const char* msg); char* get_fname(char* path); -TCHAR* get_dir(TCHAR* path); +wchar_t* get_dir(wchar_t* path); struct aimString { diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 9d19984558..d2a392b9a7 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -93,10 +93,10 @@ bool send_init_oft2(file_transfer *ft, char* file) return Netlib_Send(ft->hConn, (char*)oft, len, 0) > 0; } -void CAimProto::report_file_error(TCHAR *fname) +void CAimProto::report_file_error(wchar_t *fname) { - TCHAR errmsg[512]; - TCHAR* error = mir_a2t(_strerror(NULL)); + wchar_t errmsg[512]; + wchar_t* error = mir_a2t(_strerror(NULL)); mir_sntprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error); mir_free(error); ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP); @@ -104,13 +104,13 @@ void CAimProto::report_file_error(TCHAR *fname) bool setup_next_file_send(file_transfer *ft) { - TCHAR *file; + wchar_t *file; struct _stati64 statbuf; for (;;) { file = ft->pfts.ptszFiles[ft->cf]; if (file == NULL) return false; - if (_tstati64(file, &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) + if (_wstat64(file, &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) break; ++ft->cf; @@ -177,7 +177,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI if (type == 0x0202 || type == 0x0207) { debugLogA("P2P: Buddy Accepts our file transfer."); - int fid = _topen(ft->pfts.tszCurrentFile, _O_RDONLY | _O_BINARY, _S_IREAD); + int fid = _wopen(ft->pfts.tszCurrentFile, _O_RDONLY | _O_BINARY, _S_IREAD); if (fid < 0) { report_file_error(ft->pfts.tszCurrentFile); return 2; @@ -309,7 +309,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET memcpy(buf, recv_ft->filename, buflen); enc = _htons(recv_ft->encoding); - TCHAR *name; + wchar_t *name; if (enc == 2) { wchar_t* wbuf = (wchar_t*)buf; wcs_htons(wbuf); @@ -323,7 +323,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET mir_free(buf); - TCHAR fname[256]; + wchar_t fname[256]; mir_sntprintf(fname, L"%s%s", ft->pfts.tszWorkingDir, name); mir_free(name); mir_free(ft->pfts.tszCurrentFile); @@ -334,14 +334,14 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET WaitForSingleObject(ft->hResumeEvent, INFINITE); if (ft->pfts.tszCurrentFile) { - TCHAR* dir = get_dir(ft->pfts.tszCurrentFile); + wchar_t* dir = get_dir(ft->pfts.tszCurrentFile); CreateDirectoryTreeT(dir); mir_free(dir); oft->type = _htons(ft->pfts.currentFileProgress ? 0x0205 : 0x0202); const int flag = ft->pfts.currentFileProgress ? 0 : _O_TRUNC; - fid = _topen(ft->pfts.tszCurrentFile, _O_CREAT | _O_WRONLY | _O_BINARY | flag, _S_IREAD | _S_IWRITE); + fid = _wopen(ft->pfts.tszCurrentFile, _O_CREAT | _O_WRONLY | _O_BINARY | flag, _S_IREAD | _S_IWRITE); if (fid < 0) { report_file_error(fname); diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index 25ae226baa..ea50d67c58 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -22,7 +22,7 @@ static HANDLE hServiceParseLink; extern OBJLIST g_Instances; -static int SingleHexToDecimal(TCHAR c) +static int SingleHexToDecimal(wchar_t c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; @@ -30,9 +30,9 @@ static int SingleHexToDecimal(TCHAR c) return -1; } -static TCHAR* url_decode(TCHAR* str) +static wchar_t* url_decode(wchar_t* str) { - TCHAR* s = str, *d = str; + wchar_t* s = str, *d = str; while (*s) { if (*s == '%') { @@ -41,7 +41,7 @@ static TCHAR* url_decode(TCHAR* str) int digit2 = SingleHexToDecimal(s[2]); if (digit2 != -1) { s += 3; - *d++ = (TCHAR)((digit1 << 4) | digit2); + *d++ = (wchar_t)((digit1 << 4) | digit2); continue; } } @@ -57,15 +57,15 @@ static INT_PTR ServiceParseAimLink(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; @@ -84,16 +84,16 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) open chatroom: aim:gochat?roomname=ROOM&exchange=NUM */ /* add a contact to the list */ - if (!_tcsnicmp(arg, L"addbuddy?", 9)) { - TCHAR *tok, *tok2; + if (!wcsnicmp(arg, L"addbuddy?", 9)) { + wchar_t *tok, *tok2; char *sn = NULL, *group = NULL; for (tok = arg + 8; tok != NULL; tok = tok2) { - tok2 = _tcschr(++tok, '&'); /* first token */ + tok2 = wcschr(++tok, '&'); /* first token */ if (tok2) *tok2 = 0; - if (!_tcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0) + if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0) sn = mir_t2a(url_decode(tok + 11)); - if (!_tcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0) + if (!wcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0) group = mir_utf8encodeT(url_decode(tok + 10)); /* group is currently ignored */ } if (sn == NULL) { @@ -111,16 +111,16 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) return 0; } /* send a message to a contact */ - else if (!_tcsnicmp(arg, L"goim?", 5)) { - TCHAR *tok, *tok2, *msg = NULL; + else if (!wcsnicmp(arg, L"goim?", 5)) { + wchar_t *tok, *tok2, *msg = NULL; char *sn = NULL; for (tok = arg + 4; tok != NULL; tok = tok2) { - tok2 = _tcschr(++tok, '&'); /* first token */ + tok2 = wcschr(++tok, '&'); /* first token */ if (tok2) *tok2 = 0; - if (!_tcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0) + if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0) sn = mir_t2a(url_decode(tok + 11)); - if (!_tcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0) + if (!wcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0) msg = url_decode(tok + 8); } if (sn == NULL) return 1; /* parse failed */ @@ -134,21 +134,21 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) } /* open a chatroom */ - else if (!_tcsnicmp(arg, L"gochat?", 7)) { - TCHAR *tok, *tok2; + else if (!wcsnicmp(arg, L"gochat?", 7)) { + wchar_t *tok, *tok2; char *rm = NULL; int exchange = 0; for (tok = arg + 6; tok != NULL; tok = tok2) { - tok2 = _tcschr(++tok, '&'); /* first token */ + tok2 = wcschr(++tok, '&'); /* first token */ if (tok2) *tok2 = 0; - if (!_tcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) { + if (!wcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) { rm = mir_t2a(url_decode(tok + 9)); for (char *ch = rm; *ch; ++ch) if (*ch == '+') *ch = ' '; } - if (!_tcsnicmp(tok, L"exchange=", 9)) - exchange = _ttoi(tok + 9); + if (!wcsnicmp(tok, L"exchange=", 9)) + exchange = _wtoi(tok + 9); } if (rm == NULL || exchange <= 0) { mir_free(rm); diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 03b4fa8ba3..8747508724 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -71,7 +71,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) { if (flags & TCHAR_POPUP) { - char* errmsg = mir_t2a((TCHAR*)msg); + char* errmsg = mir_t2a((wchar_t*)msg); debugLogA(errmsg); mir_free(errmsg); } @@ -79,8 +79,8 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) debugLogA(msg); } - TCHAR *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((TCHAR*)msg) : mir_a2t(msg); - _tcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE); + wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((wchar_t*)msg) : mir_a2t(msg); + wcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE); mir_free(msgt); if (!ServiceExists(MS_POPUP_ADDPOPUPT)) diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 67e1faa684..a198c04b63 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ #include "stdafx.h" -CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) : +CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : PROTO(aProtoName, aUserName), m_chat_rooms(5) { @@ -46,7 +46,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) : offline_contacts(); - TCHAR descr[MAX_PATH]; + wchar_t descr[MAX_PATH]; NETLIBUSER nlu = { 0 }; nlu.cbSize = sizeof(nlu); @@ -122,7 +122,7 @@ MCONTACT CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr) if (m_state != 1) return 0; - TCHAR *id = psr->id.t ? psr->id.t : psr->nick.t; + wchar_t *id = psr->id.w ? psr->id.w : psr->nick.w; char *sn = psr->flags & PSR_UNICODE ? mir_u2a((wchar_t*)id) : mir_strdup((char*)id); MCONTACT hContact = contact_from_sn(sn, true, (flags & PALF_TEMPORARY) != 0); mir_free(sn); @@ -132,7 +132,7 @@ MCONTACT CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const TCHAR*) +int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const wchar_t*) { //Not a real authrequest- only used b/c we don't know the group until now. if (m_state != 1) @@ -151,7 +151,7 @@ int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const TCHAR*) //////////////////////////////////////////////////////////////////////////////////////// // FileAllow - starts a file transfer -HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR *szPath) +HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *szPath) { file_transfer *ft = (file_transfer*)hTransfer; if (ft && m_ft_list.find_by_ft(ft)) { @@ -199,7 +199,7 @@ int __cdecl CAimProto::FileCancel(MCONTACT, HANDLE hTransfer) //////////////////////////////////////////////////////////////////////////////////////// // FileDeny - denies a file transfer -int __cdecl CAimProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szReason*/) +int __cdecl CAimProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t* /*szReason*/) { file_transfer *ft = (file_transfer*)hTransfer; if (!m_ft_list.find_by_ft(ft)) @@ -214,7 +214,7 @@ int __cdecl CAimProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szRea //////////////////////////////////////////////////////////////////////////////////////// // FileResume - processes file renaming etc -int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename) +int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename) { file_transfer *ft = (file_transfer*)hTransfer; if (!m_ft_list.find_by_ft(ft)) @@ -224,7 +224,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s case FILERESUME_RESUME: { struct _stati64 statbuf; - _tstati64(ft->pfts.tszCurrentFile, &statbuf); + _wstat64(ft->pfts.tszCurrentFile, &statbuf); ft->pfts.currentFileProgress = statbuf.st_size; } break; @@ -306,7 +306,7 @@ void __cdecl CAimProto::basic_search_ack_success(void *p) else { PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); - psr.id.t = (TCHAR*)sn; + psr.id.w = (wchar_t*)sn; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); } @@ -315,7 +315,7 @@ void __cdecl CAimProto::basic_search_ack_success(void *p) mir_free(p); } -HANDLE __cdecl CAimProto::SearchBasic(const TCHAR *szId) +HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) { if (m_state != 1) return 0; @@ -328,7 +328,7 @@ HANDLE __cdecl CAimProto::SearchBasic(const TCHAR *szId) //////////////////////////////////////////////////////////////////////////////////////// // SearchByEmail - searches the contact by its e-mail -HANDLE __cdecl CAimProto::SearchByEmail(const TCHAR *email) +HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email) { // Maximum email size should really be 320, but the char string is limited to 255. if (m_state != 1 || email == NULL || mir_tstrlen(email) >= 254) @@ -363,7 +363,7 @@ int __cdecl CAimProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles) +HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles) { if (m_state != 1) return 0; @@ -377,7 +377,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const TCHAR* szDescription int count = 0; while (ppszFiles[count] != NULL) { struct _stati64 statbuf; - if (_tstati64(ppszFiles[count++], &statbuf) == 0) { + if (_wstat64(ppszFiles[count++], &statbuf) == 0) { if (statbuf.st_mode & _S_IFDIR) { if (ft->pfts.totalFiles == 0) isDir = true; } @@ -593,7 +593,7 @@ int __cdecl CAimProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // SetAwayMsg - sets the away m_iStatus message -int __cdecl CAimProto::SetAwayMsg(int status, const TCHAR* msg) +int __cdecl CAimProto::SetAwayMsg(int status, const wchar_t* msg) { char **msgptr = get_status_msg_loc(status); if (msgptr == NULL) return 1; diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 7afb407100..79980483eb 100755 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -21,7 +21,7 @@ along with this program. If not, see . struct CAimProto : public PROTO { - CAimProto(const char*, const TCHAR*); + CAimProto(const char*, const wchar_t*); ~CAimProto(); //==================================================================================== @@ -30,28 +30,28 @@ struct CAimProto : public PROTO virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - 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 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 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 SetStatus( int iNewStatus ); virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact ); virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt ); - 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,7 +196,7 @@ struct CAimProto : public PROTO void avatar_request_handler(MCONTACT hContact, char* hash, unsigned char type); void avatar_retrieval_handler(const char* sn, const char* hash, const char* data, int data_len); - int get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext); + int get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext); ////////////////////////////////////////////////////////////////////////////////////// // away.cpp @@ -217,7 +217,7 @@ struct CAimProto : public PROTO void chat_register(void); void chat_start(const char* id, unsigned short exchange); - void chat_event(const char* id, const char* sn, int evt, const TCHAR* msg = NULL); + void chat_event(const char* id, const char* sn, int evt, const wchar_t* msg = NULL); void chat_leave(const char* id); chat_list_item* find_chat_by_cid(unsigned short cid); @@ -321,7 +321,7 @@ struct CAimProto : public PROTO int sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv); int receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv); - void report_file_error(TCHAR* fname); + void report_file_error(wchar_t* fname); void shutdown_file_transfers(void); ////////////////////////////////////////////////////////////////////////////////////// @@ -413,7 +413,7 @@ struct CAimProto : public PROTO void offline_contact(MCONTACT hContact, bool remove_settings); unsigned short get_default_port(void); - int open_contact_file(const char* sn, const TCHAR* file, const char* mode, TCHAR* &path, bool contact_dir); + int open_contact_file(const char* sn, const wchar_t* file, const char* mode, wchar_t* &path, bool contact_dir); void write_away_message(const char* sn, const char* msg, bool utf); void write_profile(const char* sn, const char* msg, bool utf); diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index fa297a5664..34bc6151e2 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -487,7 +487,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 char* msg_s = process_status_msg(msg, sn); db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s); - TCHAR* tszMsg = mir_utf8decodeT(msg_s); + wchar_t* tszMsg = mir_utf8decodeT(msg_s); ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg); mir_free(tszMsg); mir_free(msg); @@ -1247,18 +1247,18 @@ void CAimProto::snac_received_message(SNAC &snac, HANDLE hServerConn, unsigned s if (!descr_included) msg_buf = NULL; - TCHAR* filenameT = mir_utf8decodeT(filename); + wchar_t* filenameT = mir_utf8decodeT(filename); PROTORECVFILET pre = { 0 }; pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.descr.t = mir_utf8decodeT(msg_buf); - pre.files.t = &filenameT; + pre.descr.w = mir_utf8decodeT(msg_buf); + pre.files.w = &filenameT; pre.lParam = (LPARAM)ft; ProtoChainRecvFile(hContact, &pre); - mir_free(pre.descr.t); + mir_free(pre.descr.w); mir_free(filenameT); char cip[20]; @@ -1659,7 +1659,7 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018 position += TLV_HEADER_SIZE + tlv.len(); } if (new_mail && num_msgs) { - TCHAR msg[1024]; + wchar_t msg[1024]; int len = mir_sntprintf(msg, L"%S@%S (%d)\r\n%s ", sn, address, num_msgs, TranslateT("You've got mail! Checked at")); @@ -1733,10 +1733,10 @@ void CAimProto::snac_email_search_results(SNAC &snac)//family 0x000A while (offset < snac.len()) { // Loop through all the TLVs and pull out the buddy name TLV tlv(snac.val(offset)); offset += TLV_HEADER_SIZE; - psr.id.t = (TCHAR*)tlv.dup(); + psr.id.w = (wchar_t*)tlv.dup(); offset += tlv.len(); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr); - mir_free(psr.nick.t); + mir_free(psr.nick.w); } ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); } @@ -1834,7 +1834,7 @@ void CAimProto::snac_chat_joined_left_users(SNAC &snac, chat_list_item* item)//f void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//family 0x000E { if (snac.subcmp(0x0006)) { - TCHAR* message = NULL; + wchar_t* message = NULL; char* sn = NULL; // unsigned long cookie = snac.ulong(0); diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index c4be0f3401..c108139a3e 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -392,14 +392,14 @@ INT_PTR CAimProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam) { - TCHAR* buf = (TCHAR*)wParam; + wchar_t* buf = (wchar_t*)wParam; size_t size = (size_t)lParam; if (buf == NULL || size <= 0) return -1; PROTO_AVATAR_INFORMATION ai = { 0 }; if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS) { - _tcsncpy_s(buf, size, ai.filename, _TRUNCATE); + wcsncpy_s(buf, size, ai.filename, _TRUNCATE); return 0; } @@ -408,7 +408,7 @@ INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) { - TCHAR *szFileName = (TCHAR*)lParam; + wchar_t *szFileName = (wchar_t*)lParam; if (m_state != 1) return 1; @@ -461,10 +461,10 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) avatar_up_req *req = new avatar_up_req(data, size, data1, size1); ForkThread(&CAimProto::avatar_upload_thread, req); - TCHAR tFileName[MAX_PATH]; - TCHAR *ext = _tcsrchr(szFileName, '.'); + wchar_t tFileName[MAX_PATH]; + wchar_t *ext = wcsrchr(szFileName, '.'); get_avatar_filename(NULL, tFileName, _countof(tFileName), ext); - int fileId = _topen(tFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); + int fileId = _wopen(tFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); if (fileId < 0) { char errmsg[512]; mir_snprintf(errmsg, "Cannot store avatar. File '%s' could not be created/overwritten", tFileName); diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 134011214f..ab6c8a80ad 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -179,19 +179,19 @@ int CAimProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) switch (m_pd_mode) { case 1: - Menu_ModifyItem(m_hBlockContextMenuItem, LPGENT("&Block")); + Menu_ModifyItem(m_hBlockContextMenuItem, LPGENW("&Block")); break; case 2: - Menu_ModifyItem(m_hBlockContextMenuItem, LPGENT("&Unblock")); + Menu_ModifyItem(m_hBlockContextMenuItem, LPGENW("&Unblock")); break; case 3: - Menu_ModifyItem(m_hBlockContextMenuItem, m_allow_list.find_id(id) ? LPGENT("&Block") : LPGENT("&Unblock")); + Menu_ModifyItem(m_hBlockContextMenuItem, m_allow_list.find_id(id) ? LPGENW("&Block") : LPGENW("&Unblock")); break; case 4: - Menu_ModifyItem(m_hBlockContextMenuItem, m_block_list.find_id(id) ? LPGENT("&Unblock") : LPGENT("&Block")); + Menu_ModifyItem(m_hBlockContextMenuItem, m_block_list.find_id(id) ? LPGENW("&Unblock") : LPGENW("&Block")); break; default: diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 2b906bc355..ee833e6eee 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -190,7 +190,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv; if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv)) { html_decode(dbv.pszVal); - TCHAR *txt = mir_utf8decodeT(dbv.pszVal); + wchar_t *txt = mir_utf8decodeT(dbv.pszVal); SetDlgItemText(hwndDlg, IDC_PROFILE, txt); mir_free(txt); db_free(&dbv); @@ -685,15 +685,15 @@ int CAimProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.position = -1900000000; odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR; odp.hInstance = hInstance; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); - odp.ptszTab = LPGENT("Profile"); + odp.pwszTab = LPGENW("Profile"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO); odp.pfnDlgProc = userinfo_dialog; UserInfo_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Admin"); + odp.pwszTab = LPGENW("Admin"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADMIN); odp.pfnDlgProc = admin_dialog; UserInfo_AddPage(wParam, &odp); @@ -1058,17 +1058,17 @@ int CAimProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; 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_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - odp.ptszTab = LPGENT("Basic"); + odp.pwszTab = LPGENW("Basic"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_AIM); odp.pfnDlgProc = options_dialog; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Privacy"); + odp.pwszTab = LPGENW("Privacy"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_PRIVACY); odp.pfnDlgProc = privacy_dialog; Options_AddPage(wParam, &odp); @@ -1267,7 +1267,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, chat_list_item 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); char *sn = mir_t2a(buf); @@ -1364,7 +1364,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (LOWORD(wParam)) { case IDC_ADDSCR: if (param->ppro->m_state == 1) { - TCHAR sn[64]; + wchar_t sn[64]; GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn)); CLCINFOITEM cii = { 0 }; diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index b5e23b21aa..247d8bd3fa 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -363,7 +363,7 @@ void create_group(const char *group) { if (mir_strcmp(group, AIM_DEFAULT_GROUP) == 0) return; - TCHAR* szGroupName = mir_utf8decodeT(group); + wchar_t* szGroupName = mir_utf8decodeT(group); Clist_GroupCreate(0, szGroupName); mir_free(szGroupName); } @@ -529,21 +529,21 @@ int CAimProto::deleteGroupId(MCONTACT hContact, int i) ///////////////////////////////////////////////////////////////////////////////////////// -int CAimProto::open_contact_file(const char*, const TCHAR* file, const char*, TCHAR* &path, bool contact_dir) +int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, wchar_t* &path, bool contact_dir) { - path = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR)); + path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t)); int pos = mir_sntprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_userdata%"), m_szModuleName); if (contact_dir) pos += mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%S", m_szModuleName); - if (_taccess(path, 0)) + if (_waccess(path, 0)) CreateDirectoryTreeT(path); mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%s", file); - int fid = _topen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD); + int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD); if (fid < 0) { - TCHAR errmsg[512]; + wchar_t errmsg[512]; mir_sntprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL)); ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP); } @@ -552,7 +552,7 @@ int CAimProto::open_contact_file(const char*, const TCHAR* file, const char*, TC void CAimProto::write_away_message(const char* sn, const char* msg, bool utf) { - TCHAR* path; + wchar_t* path; int fid = open_contact_file(sn, L"away.html", "wb", path, 1); if (fid >= 0) { if (utf) _write(fid, "\xEF\xBB\xBF", 3); @@ -570,7 +570,7 @@ void CAimProto::write_away_message(const char* sn, const char* msg, bool utf) void CAimProto::write_profile(const char* sn, const char* msg, bool utf) { - TCHAR* path; + wchar_t* path; int fid = open_contact_file(sn, L"profile.html", "wb", path, 1); if (fid >= 0) { if (utf) _write(fid, "\xEF\xBB\xBF", 3); @@ -604,10 +604,10 @@ unsigned long aim_oft_checksum_chunk(unsigned long dwChecksum, const unsigned ch return checksum << 16; } -unsigned int aim_oft_checksum_file(TCHAR *filename, unsigned __int64 size) +unsigned int aim_oft_checksum_file(wchar_t *filename, unsigned __int64 size) { unsigned long checksum = 0xffff0000; - int fid = _topen(filename, _O_RDONLY | _O_BINARY, _S_IREAD); + int fid = _wopen(filename, _O_RDONLY | _O_BINARY, _S_IREAD); if (fid >= 0) { unsigned __int64 sz = _filelengthi64(fid); if (size > sz) size = sz; diff --git a/protocols/AimOscar/src/utility.h b/protocols/AimOscar/src/utility.h index 6b8404ea00..17d50af9e1 100755 --- a/protocols/AimOscar/src/utility.h +++ b/protocols/AimOscar/src/utility.h @@ -22,7 +22,7 @@ along with this program. If not, see . char *normalize_name(const char *s); char* trim_str(char* s); void create_group(const char *group); -unsigned int aim_oft_checksum_file(TCHAR *filename, unsigned __int64 size = -1); +unsigned int aim_oft_checksum_file(wchar_t *filename, unsigned __int64 size = -1); char* long_ip_to_char_ip(unsigned long host, char* ip); unsigned long char_ip_to_long_ip(char* ip); unsigned short get_random(void); -- cgit v1.2.3