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 --- plugins/AVS/src/acc.cpp | 6 +++--- plugins/AVS/src/acc.h | 4 ++-- plugins/AVS/src/cache.cpp | 8 +++---- plugins/AVS/src/image_utils.cpp | 10 ++++----- plugins/AVS/src/image_utils.h | 6 +++--- plugins/AVS/src/main.cpp | 10 ++++----- plugins/AVS/src/options.cpp | 18 ++++++++-------- plugins/AVS/src/poll.cpp | 2 +- plugins/AVS/src/services.cpp | 46 ++++++++++++++++++++--------------------- plugins/AVS/src/stdafx.h | 12 +++++------ plugins/AVS/src/utils.cpp | 22 ++++++++++---------- 11 files changed, 72 insertions(+), 72 deletions(-) (limited to 'plugins/AVS/src') diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 6fc63c6838..96935ace4f 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -43,7 +43,7 @@ typedef struct COLORREF bkgColor; COLORREF avatarBorderColor; int avatarRoundCornerRadius; - TCHAR noAvatarText[128]; + wchar_t noAvatarText[128]; BOOL respectHidden; BOOL resizeIfSmaller; BOOL fAero; @@ -347,7 +347,7 @@ static void NotifyAvatarChange(HWND hwnd) SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&pshn); } -static void DrawText(HDC hdc, HFONT hFont, const RECT &rc, const TCHAR *text) +static void DrawText(HDC hdc, HFONT hFont, const RECT &rc, const wchar_t *text) { HGDIOBJ oldFont = SelectObject(hdc, hFont); @@ -469,7 +469,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return TRUE; case AVATAR_SETNOAVATARTEXT: - mir_tstrncpy(data->noAvatarText, TranslateTS((TCHAR*)lParam), _countof(data->noAvatarText)); + mir_tstrncpy(data->noAvatarText, TranslateTS((wchar_t*)lParam), _countof(data->noAvatarText)); Invalidate(hwnd); return TRUE; diff --git a/plugins/AVS/src/acc.h b/plugins/AVS/src/acc.h index 356a09dea3..9917156385 100644 --- a/plugins/AVS/src/acc.h +++ b/plugins/AVS/src/acc.h @@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. #ifndef __ACC_H__ # define __ACC_H__ -static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath); -INT_PTR avSetMyAvatar(char *szProto, TCHAR *tszPath); +static INT_PTR avSetAvatar(MCONTACT hContact, wchar_t *tszPath); +INT_PTR avSetMyAvatar(char *szProto, wchar_t *tszPath); int LoadACC(); diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 5c0d9fcef4..c4702ae89c 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -129,7 +129,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) cacn.cbSize = sizeof(CONTACTAVATARCHANGEDNOTIFICATION); cacn.hContact = hContact; cacn.format = node->pa_format; - _tcsncpy_s(cacn.filename, node->szFilename, _TRUNCATE); + wcsncpy_s(cacn.filename, node->szFilename, _TRUNCATE); // Get hash char *szProto = GetContactProto(hContact); @@ -137,12 +137,12 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) DBVARIANT dbv = { 0 }; if (!db_get_s(hContact, szProto, "AvatarHash", &dbv)) { if (dbv.type == DBVT_TCHAR) - _tcsncpy_s(cacn.hash, dbv.ptszVal, _TRUNCATE); + wcsncpy_s(cacn.hash, dbv.ptszVal, _TRUNCATE); else if (dbv.type == DBVT_ASCIIZ) - _tcsncpy_s(cacn.hash, _A2T(dbv.pszVal), _TRUNCATE); + wcsncpy_s(cacn.hash, _A2T(dbv.pszVal), _TRUNCATE); else if (dbv.type == DBVT_BLOB) { ptrA szHash(mir_base64_encode(dbv.pbVal, dbv.cpbVal)); - _tcsncpy_s(cacn.hash, _A2T(szHash), _TRUNCATE); + wcsncpy_s(cacn.hash, _A2T(szHash), _TRUNCATE); } db_free(&dbv); } diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index c478f8bd3e..61c548c96b 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -159,7 +159,7 @@ void SetHIMETRICtoDP(HDC hdc, SIZE* sz) sz->cy = pt.y; } -HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const TCHAR *ptszFilename) +HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename) { if (fei == NULL) return 0; @@ -203,14 +203,14 @@ static HWND hwndClui = 0; // PNG and BMP will be saved as 32bit images, jpg as 24bit with default quality (75) // returns 1 on success, 0 on failure -int BmpFilterSaveBitmap(HBITMAP hBmp, const TCHAR *ptszFile, int flags) +int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags) { if (fei == NULL) return -1; - TCHAR tszFilename[MAX_PATH]; + wchar_t tszFilename[MAX_PATH]; if (!PathToAbsoluteT(ptszFile, tszFilename)) - _tcsncpy_s(tszFilename, ptszFile, _TRUNCATE); + wcsncpy_s(tszFilename, ptszFile, _TRUNCATE); if (mir_tstrlen(tszFilename) <= 4) return -1; @@ -551,7 +551,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) ///////////////////////////////////////////////////////////////////////////////////////// // Other utils -int SaveAvatar(const char *protocol, const TCHAR *tszFileName) +int SaveAvatar(const char *protocol, const wchar_t *tszFileName) { INT_PTR result = CallProtoService(protocol, PS_SETMYAVATAR, 0, (LPARAM)tszFileName); if (result == CALLSERVICE_NOTFOUND) diff --git a/plugins/AVS/src/image_utils.h b/plugins/AVS/src/image_utils.h index b61f05b883..cf4529321e 100644 --- a/plugins/AVS/src/image_utils.h +++ b/plugins/AVS/src/image_utils.h @@ -1,8 +1,8 @@ #ifndef __IMAGE_UTILS_H__ # define __IMAGE_UTILS_H__ -HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const TCHAR *ptszFilename); -int BmpFilterSaveBitmap(HBITMAP hBmp, const TCHAR *ptszFile, int flags); +HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename); +int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags); HBITMAP CopyBitmapTo32(HBITMAP hBitmap); @@ -11,6 +11,6 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap); HBITMAP MakeGrayscale(HBITMAP hBitmap); DWORD GetImgHash(HBITMAP hBitmap); -int SaveAvatar(const char* protocol, const TCHAR* tszFileName); +int SaveAvatar(const char* protocol, const wchar_t* tszFileName); #endif // __IMAGE_UTILS_H__ diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 8a9bc4170a..516d6a204b 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -32,7 +32,7 @@ bool g_shutDown = false; int hLangpack; -TCHAR g_szDataPath[MAX_PATH]; // user datae path (read at startup only) +wchar_t g_szDataPath[MAX_PATH]; // user datae path (read at startup only) BOOL g_AvatarHistoryAvail = FALSE; HWND hwndSetMyAvatar = 0; @@ -144,7 +144,7 @@ static void LoadProtoInfo(PROTOCOLDESCRIPTOR *proto) char protoName[MAX_PATH]; mir_snprintf(protoName, "Global avatar for %s accounts", proto->szName); - TCHAR protoNameTmp[MAX_PATH]; + wchar_t protoNameTmp[MAX_PATH]; mir_sntprintf(protoNameTmp, TranslateT("Global avatar for %s accounts"), _A2T(proto->szName)); protoPicCacheEntry *pce = new protoPicCacheEntry; if (CreateAvatarInCache(0, pce, protoName) != 1) @@ -322,7 +322,7 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm static int ModulesLoaded(WPARAM, LPARAM) { - TCHAR szEventName[100]; + wchar_t szEventName[100]; mir_sntprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId()); hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName); @@ -381,8 +381,8 @@ static int LoadAvatarModule() InitServices(); InitPolls(); - _tcsncpy_s(g_szDataPath, _countof(g_szDataPath), VARST(L"%miranda_userdata%\\"), _TRUNCATE); - _tcslwr(g_szDataPath); + wcsncpy_s(g_szDataPath, _countof(g_szDataPath), VARST(L"%miranda_userdata%\\"), _TRUNCATE); + wcslwr(g_szDataPath); return 0; } diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 2a438acebe..7254543bb3 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -99,7 +99,7 @@ static void RemoveProtoPic(const char *szProto) static void SetProtoPic(char *szProto) { - TCHAR FileName[MAX_PATH], filter[256]; + wchar_t FileName[MAX_PATH], filter[256]; Bitmap_GetFilter(filter, _countof(filter)); OPENFILENAME ofn = { 0 }; @@ -116,10 +116,10 @@ static void SetProtoPic(char *szProto) if (!GetOpenFileName(&ofn)) return; - if (_taccess(FileName, 4) == -1) + if (_waccess(FileName, 4) == -1) return; - TCHAR szNewPath[MAX_PATH]; + wchar_t szNewPath[MAX_PATH]; PathToRelativeT(FileName, szNewPath, g_szDataPath); db_set_ts(NULL, PPICT_MODULE, szProto, szNewPath); @@ -387,7 +387,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar DBVARIANT dbv; if (!db_get_ts(NULL, PPICT_MODULE, g_selectedProto, &dbv)) { if (!PathIsAbsoluteT(VARST(dbv.ptszVal))) { - TCHAR szFinalPath[MAX_PATH]; + wchar_t szFinalPath[MAX_PATH]; mir_sntprintf(szFinalPath, L"%%miranda_path%%\\%s", dbv.ptszVal); SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, szFinalPath); } @@ -488,7 +488,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA TranslateDialogDefault(hwndDlg); if (hContact) { - TCHAR szTitle[512]; + wchar_t szTitle[512]; mir_sntprintf(szTitle, TranslateT("Set avatar options for %s"), pcli->pfnGetContactDisplayName(hContact, 0)); SetWindowText(hwndDlg, szTitle); } @@ -660,7 +660,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case DM_SETAVATARNAME: { - TCHAR szFinalName[MAX_PATH]; + wchar_t szFinalName[MAX_PATH]; DBVARIANT dbv = { 0 }; BYTE is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); @@ -744,7 +744,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa HWND protopic = GetDlgItem(hwndDlg, IDC_PROTOPIC); SendMessage(protopic, AVATAR_SETCONTACT, 0, (LPARAM)hContact); SendMessage(protopic, AVATAR_SETAVATARBORDERCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNSHADOW)); - SendMessage(protopic, AVATAR_SETNOAVATARTEXT, 0, (LPARAM)LPGENT("Contact has no avatar")); + SendMessage(protopic, AVATAR_SETNOAVATARTEXT, 0, (LPARAM)LPGENW("Contact has no avatar")); SendMessage(protopic, AVATAR_RESPECTHIDDEN, 0, (LPARAM)FALSE); SendMessage(protopic, AVATAR_SETRESIZEIFSMALLER, 0, (LPARAM)FALSE); } @@ -986,7 +986,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP { HWND protopic = GetDlgItem(hwndDlg, IDC_PROTOPIC); SendMessage(protopic, AVATAR_SETAVATARBORDERCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNSHADOW)); - SendMessage(protopic, AVATAR_SETNOAVATARTEXT, 0, (LPARAM)LPGENT("No avatar")); + SendMessage(protopic, AVATAR_SETNOAVATARTEXT, 0, (LPARAM)LPGENW("No avatar")); SendMessage(protopic, AVATAR_SETRESIZEIFSMALLER, 0, (LPARAM)FALSE); HWND hwndList = GetDlgItem(hwndDlg, IDC_PROTOCOLS); @@ -1082,7 +1082,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP char description[256]; CallProtoService(proto, PS_GETNAME, _countof(description), (LPARAM)description); - TCHAR *descr = mir_a2t(description); + wchar_t *descr = mir_a2t(description); if (MessageBox(hwndDlg, TranslateT("Are you sure you want to remove your avatar?"), descr, MB_YESNO) == IDYES) avSetMyAvatar(proto, L""); mir_free(descr); diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index a713a71935..226bb12278 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -44,7 +44,7 @@ static void RequestThread(void *vParam); extern HANDLE hShutdownEvent; extern int DeleteAvatar(MCONTACT hContact); -extern void MakePathRelative(MCONTACT hContact, TCHAR *path); +extern void MakePathRelative(MCONTACT hContact, wchar_t *path); int Proto_GetDelayAfterFail(const char *proto); BOOL Proto_IsFetchingWhenProtoNotVisibleAllowed(const char *proto); BOOL Proto_IsFetchingWhenContactOfflineAllowed(const char *proto); diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 058f377e99..79a21f3b8a 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -115,10 +115,10 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return FALSE; } -static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath) +static INT_PTR avSetAvatar(MCONTACT hContact, wchar_t *tszPath) { - TCHAR FileName[MAX_PATH]; - TCHAR *szFinalName; + wchar_t FileName[MAX_PATH]; + wchar_t *szFinalName; BYTE locking_request; if (hContact == NULL || fei == NULL) @@ -127,7 +127,7 @@ static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath) int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); if (tszPath == NULL) { - TCHAR filter[256]; + wchar_t filter[256]; Bitmap_GetFilter(filter, _countof(filter)); OPENFILENAME ofn = { 0 }; @@ -155,11 +155,11 @@ static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath) else szFinalName = tszPath; // filename is now set, check it and perform all needed action - if (_taccess(szFinalName, 4) == -1) + if (_waccess(szFinalName, 4) == -1) return 0; // file exists... - TCHAR szBackupName[MAX_PATH]; + wchar_t szBackupName[MAX_PATH]; PathToRelativeT(szFinalName, szBackupName, g_szDataPath); db_set_ts(hContact, "ContactPhoto", "Backup", szBackupName); @@ -179,7 +179,7 @@ INT_PTR SetAvatar(WPARAM wParam, LPARAM lParam) INT_PTR SetAvatarW(WPARAM wParam, LPARAM lParam) { - return avSetAvatar(wParam, (TCHAR*)lParam); + return avSetAvatar(wParam, (wchar_t*)lParam); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -333,12 +333,12 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM struct SaveProtocolData { DWORD max_size; - TCHAR image_file_name[MAX_PATH]; + wchar_t image_file_name[MAX_PATH]; BOOL saved; BOOL need_smaller_size; int width; int height; - TCHAR temp_file[MAX_PATH]; + wchar_t temp_file[MAX_PATH]; HBITMAP hBmpProto; }; @@ -369,7 +369,7 @@ void SaveImage(SaveProtocolData &d, char *protocol, int format) else d.saved = TRUE; } -static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, TCHAR *originalFilename, int originalFormat, BOOL square, BOOL grow) +static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilename, int originalFormat, BOOL square, BOOL grow) { if (!ProtoServiceExists(protocol, PS_SETMYAVATAR)) return -1; @@ -491,10 +491,10 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, TCHAR *originalFilenam return ret; } -static int InternalSetMyAvatar(char *protocol, TCHAR *szFinalName, SetMyAvatarHookData &data, BOOL allAcceptXML, BOOL allAcceptSWF) +static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatarHookData &data, BOOL allAcceptXML, BOOL allAcceptSWF) { int format = ProtoGetAvatarFormat(szFinalName); - if (format == PA_FORMAT_UNKNOWN || _taccess(szFinalName, 4) == -1) + if (format == PA_FORMAT_UNKNOWN || _waccess(szFinalName, 4) == -1) return -3; // file exists... @@ -547,14 +547,14 @@ static int InternalSetMyAvatar(char *protocol, TCHAR *szFinalName, SetMyAvatarHo db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1); else { // Copy avatar file to store as global one - TCHAR globalFile[1024]; + wchar_t globalFile[1024]; BOOL saved = TRUE; if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) { mir_sntprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar"); CreateDirectory(globalFile, NULL); } - TCHAR *ext = _tcsrchr(szFinalName, _T('.')); // Can't be NULL here + wchar_t *ext = wcsrchr(szFinalName, '.'); // Can't be NULL here if (format == PA_FORMAT_XML || format == PA_FORMAT_SWF) { mir_sntprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext); CopyFile(szFinalName, globalFile, FALSE); @@ -588,7 +588,7 @@ static int InternalSetMyAvatar(char *protocol, TCHAR *szFinalName, SetMyAvatarHo } if (saved) { - TCHAR relFile[1024]; + wchar_t relFile[1024]; if (PathToRelativeT(globalFile, relFile, g_szDataPath)) db_set_ts(NULL, AVS_MODULE, "GlobalUserAvatarFile", relFile); else @@ -608,10 +608,10 @@ static int InternalSetMyAvatar(char *protocol, TCHAR *szFinalName, SetMyAvatarHo return ret; } -INT_PTR avSetMyAvatar(char* protocol, TCHAR* tszPath) +INT_PTR avSetMyAvatar(char* protocol, wchar_t* tszPath) { - TCHAR FileName[MAX_PATH]; - TCHAR *szFinalName = NULL; + wchar_t FileName[MAX_PATH]; + wchar_t *szFinalName = NULL; BOOL allAcceptXML; BOOL allAcceptSWF; @@ -664,7 +664,7 @@ INT_PTR avSetMyAvatar(char* protocol, TCHAR* tszPath) CMString filter; FilterGetStrings(filter, allAcceptXML, allAcceptSWF); - TCHAR inipath[1024]; + wchar_t inipath[1024]; FoldersGetCustomPathT(hMyAvatarsFolder, inipath, _countof(inipath), L"."); OPENFILENAME ofn = { 0 }; @@ -683,11 +683,11 @@ INT_PTR avSetMyAvatar(char* protocol, TCHAR* tszPath) ofn.lpstrDefExt = L""; ofn.hInstance = g_hInst; - TCHAR title[256]; + wchar_t title[256]; if (protocol == NULL) mir_sntprintf(title, TranslateT("Set my avatar")); else { - TCHAR* prototmp = mir_a2t(protocol); + wchar_t* prototmp = mir_a2t(protocol); mir_sntprintf(title, TranslateT("Set my avatar for %s"), prototmp); mir_free(prototmp); } @@ -698,7 +698,7 @@ INT_PTR avSetMyAvatar(char* protocol, TCHAR* tszPath) szFinalName = FileName; } - else szFinalName = (TCHAR*)tszPath; + else szFinalName = (wchar_t*)tszPath; // filename is now set, check it and perform all needed action if (szFinalName[0] == '\0') @@ -714,7 +714,7 @@ static INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) static INT_PTR SetMyAvatarW(WPARAM wParam, LPARAM lParam) { - return avSetMyAvatar((char*)wParam, (TCHAR*)lParam); + return avSetMyAvatar((char*)wParam, (wchar_t*)lParam); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index adf9f0db73..0a5beda25a 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -85,7 +85,7 @@ struct protoPicCacheEntry : public avatarCacheEntry, public MZeroedObject void clear(); char* szProtoname; - TCHAR* tszAccName; + wchar_t* tszAccName; }; extern OBJLIST g_ProtoPictures, g_MyAvatars; @@ -109,7 +109,7 @@ extern FI_INTERFACE *fei; void mir_sleep(int time); extern bool g_shutDown; -extern TCHAR g_szDataPath[]; // user datae path (read at startup only) +extern wchar_t g_szDataPath[]; // user datae path (read at startup only) extern BOOL g_AvatarHistoryAvail; extern HWND hwndSetMyAvatar; @@ -120,11 +120,11 @@ extern HANDLE hGlobalAvatarFolder; extern HANDLE hLoaderEvent, hShutdownEvent; extern HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged; -int GetFileHash(TCHAR* filename); -DWORD GetFileSize(TCHAR *szFilename); +int GetFileHash(wchar_t* filename); +DWORD GetFileSize(wchar_t *szFilename); void MakePathRelative(MCONTACT hContact); -void MakePathRelative(MCONTACT hContact, TCHAR *dest); -void MyPathToAbsolute(const TCHAR *ptszPath, TCHAR *ptszDest); +void MakePathRelative(MCONTACT hContact, wchar_t *dest); +void MyPathToAbsolute(const wchar_t *ptszPath, wchar_t *ptszDest); HBITMAP LoadPNG(struct avatarCacheEntry *ace, char *szFilename); diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 4e7603c396..c46fff6a58 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -28,7 +28,7 @@ void mir_sleep(int time) ///////////////////////////////////////////////////////////////////////////////////////// // substitutes variables and passes our own data path as base -void MyPathToAbsolute(const TCHAR *ptszPath, TCHAR *ptszDest) +void MyPathToAbsolute(const wchar_t *ptszPath, wchar_t *ptszDest) { PathToAbsoluteT(VARST(ptszPath), ptszDest, g_szDataPath); } @@ -37,9 +37,9 @@ void MyPathToAbsolute(const TCHAR *ptszPath, TCHAR *ptszDest) // convert the avatar image path to a relative one... // given: contact handle, path to image -void MakePathRelative(MCONTACT hContact, TCHAR *path) +void MakePathRelative(MCONTACT hContact, wchar_t *path) { - TCHAR szFinalPath[MAX_PATH]; + wchar_t szFinalPath[MAX_PATH]; szFinalPath[0] = '\0'; size_t result = PathToRelativeT(path, szFinalPath, g_szDataPath); @@ -68,7 +68,7 @@ void MakePathRelative(MCONTACT hContact) int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) { ptrT tszValue; - TCHAR tszFilename[MAX_PATH]; tszFilename[0] = 0; + wchar_t tszFilename[MAX_PATH]; tszFilename[0] = 0; ace->hbmPic = 0; ace->dwFlags = 0; @@ -139,8 +139,8 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) if (mir_tstrlen(tszFilename) < 4) return -1; - _tcsncpy_s(tszFilename, VARST(tszFilename), _TRUNCATE); - if (_taccess(tszFilename, 4) == -1) + wcsncpy_s(tszFilename, VARST(tszFilename), _TRUNCATE); + if (_waccess(tszFilename, 4) == -1) return -2; BOOL isTransparentImage = 0; @@ -149,7 +149,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) ace->bmHeight = 0; ace->bmWidth = 0; ace->lpDIBSection = NULL; - _tcsncpy(ace->szFilename, tszFilename, MAX_PATH); + wcsncpy(ace->szFilename, tszFilename, MAX_PATH); ace->szFilename[MAX_PATH - 1] = 0; if (ace->hbmPic == 0) return -1; @@ -230,7 +230,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) #define TOPBIT (1 << (WIDTH - 1)) /* MSB */ #define WIDTH 32 -int GetFileHash(TCHAR* filename) +int GetFileHash(wchar_t* filename) { HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -435,7 +435,7 @@ void DeleteGlobalUserAvatar() if (db_get_ts(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv)) return; - TCHAR szFilename[MAX_PATH]; + wchar_t szFilename[MAX_PATH]; MyPathToAbsolute(dbv.ptszVal, szFilename); db_free(&dbv); @@ -457,8 +457,8 @@ void SetIgnoreNotify(char *protocol, BOOL ignore) /////////////////////////////////////////////////////////////////////////////////////////////////////// -DWORD GetFileSize(TCHAR *szFilename) +DWORD GetFileSize(wchar_t *szFilename) { struct _stat info; - return (_tstat(szFilename, &info) == -1) ? 0 : info.st_size; + return (_wstat(szFilename, &info) == -1) ? 0 : info.st_size; } -- cgit v1.2.3