From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AvatarHistory/src/AvatarDlg.cpp | 20 +++++++++--------- plugins/AvatarHistory/src/AvatarHistory.cpp | 12 +++++------ plugins/AvatarHistory/src/popup.cpp | 6 +++--- plugins/AvatarHistory/src/utils.cpp | 32 ++++++++++++++--------------- 4 files changed, 35 insertions(+), 35 deletions(-) (limited to 'plugins/AvatarHistory/src') diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 623d4a8c0e..ebd5c219a7 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -136,7 +136,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l wchar_t *displayName = pcli->pfnGetContactDisplayName(data->hContact, 0); if (displayName) { wchar_t title[MAX_PATH]; - mir_sntprintf(title, TranslateT("Avatar History for %s"), displayName); + mir_snwprintf(title, TranslateT("Avatar History for %s"), displayName); SetWindowText(hwnd, title); } @@ -356,8 +356,8 @@ int AddFileToList(wchar_t *path,wchar_t *lnk,wchar_t *filename, HWND list) { // Add to list ListEntry *le = new ListEntry(); - le->filename = mir_tstrdup(path); - le->filelink = mir_tstrdup(lnk); + le->filename = mir_wstrdup(path); + le->filelink = mir_wstrdup(lnk); wchar_t *p = wcschr(filename, '.'); if (p != NULL) @@ -374,7 +374,7 @@ int FillAvatarListFromFiles(HWND list, MCONTACT hContact) WIN32_FIND_DATA finddata; GetContactFolder(dir, hContact); - mir_sntprintf(path, L"%s\\*.*", dir); + mir_snwprintf(path, L"%s\\*.*", dir); HANDLE hFind = FindFirstFile(path, &finddata); if (hFind == INVALID_HANDLE_VALUE) @@ -384,7 +384,7 @@ int FillAvatarListFromFiles(HWND list, MCONTACT hContact) { if (finddata.cFileName[0] != '.') { - mir_sntprintf(path, L"%s\\%s", dir, finddata.cFileName); + mir_snwprintf(path, L"%s\\%s", dir, finddata.cFileName); max_pos = AddFileToList(path,finddata.cFileName,finddata.cFileName,list); } } @@ -401,7 +401,7 @@ int FillAvatarListFromFolder(HWND list, MCONTACT hContact) WIN32_FIND_DATA finddata; GetContactFolder(dir, hContact); - mir_sntprintf(path, L"%s\\*.lnk", dir); + mir_snwprintf(path, L"%s\\*.lnk", dir); HANDLE hFind = FindFirstFile(path, &finddata); if (hFind == INVALID_HANDLE_VALUE) @@ -412,7 +412,7 @@ int FillAvatarListFromFolder(HWND list, MCONTACT hContact) if (finddata.cFileName[0] != '.') { wchar_t lnk[MAX_PATH]; - mir_sntprintf(lnk, L"%s\\%s", dir, finddata.cFileName); + mir_snwprintf(lnk, L"%s\\%s", dir, finddata.cFileName); if (ResolveShortcut(lnk, path)) max_pos = AddFileToList(path,lnk,finddata.cFileName,list); } @@ -440,13 +440,13 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact) // Get file in disk wchar_t path[MAX_PATH]; - ptrT tszStoredPath(mir_utf8decodeT((char*)dbei.pBlob)); + ptrW tszStoredPath(mir_utf8decodeW((char*)dbei.pBlob)); PathToAbsoluteT(tszStoredPath, path); // Add to list ListEntry *le = new ListEntry(); le->hDbEvent = hDbEvent; - le->filename = mir_tstrdup(path); + le->filename = mir_wstrdup(path); max_pos = SendMessage(list,LB_ADDSTRING, 0, (LPARAM)date); SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM)le); } @@ -550,7 +550,7 @@ int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact) wchar_t title[MAX_PATH]; if (displayName) { - mir_sntprintf(title, TranslateT("Save Avatar for %s"), displayName); + mir_snwprintf(title, TranslateT("Save Avatar for %s"), displayName); ofn.lpstrTitle = title; } else diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 46547ae455..a678580bcc 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -120,7 +120,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam; if (avatar == NULL) { - if (!ret || !mir_tstrcmp(dbvOldHash.ptszVal, L"-")) { + if (!ret || !mir_wstrcmp(dbvOldHash.ptszVal, L"-")) { //avoid duplicate "removed avatar" notifications //do not notify on an empty profile ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Removed avatar, no avatar before... skipping")); @@ -136,7 +136,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) ShowPopup(hContact, NULL, opts.popup_removed); } else { - if (ret && !mir_tstrcmp(dbvOldHash.ptszVal, avatar->hash)) { + if (ret && !mir_wstrcmp(dbvOldHash.ptszVal, avatar->hash)) { // same avatar hash, skipping ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Hashes are the same... skipping")); db_free(&dbvOldHash); @@ -178,7 +178,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) wchar_t *file = GetCachedAvatar(proto, hash); if (file != NULL) { - mir_tstrncpy(history_filename, file, _countof(history_filename)); + mir_wstrncpy(history_filename, file, _countof(history_filename)); mir_free(file); } else { @@ -187,7 +187,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) else GetProtocolFolder(history_filename, proto); - mir_sntprintf(history_filename, + mir_snwprintf(history_filename, L"%s\\%s", history_filename, hash); if (CopyImageFile(avatar->filename, history_filename)) @@ -236,7 +236,7 @@ static int PreShutdown(WPARAM, LPARAM) static int ModulesLoaded(WPARAM, LPARAM) { - mir_sntprintf(basedir, L"%s\\Avatars History", profilePath); + mir_snwprintf(basedir, L"%s\\Avatars History", profilePath); hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"), PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\Avatars History"); @@ -344,7 +344,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar); if (CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0) - mir_tstrcpy(profilePath, L"."); // Failed, use current dir + mir_wstrcpy(profilePath, L"."); // Failed, use current dir SkinAddNewSoundExT("avatar_changed",LPGENW("Avatar History"),LPGENW("Contact changed avatar")); SkinAddNewSoundExT("avatar_removed",LPGENW("Avatar History"),LPGENW("Contact removed avatar")); diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index f936953b4b..165741a06e 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -105,13 +105,13 @@ void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *descrip ((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon; if (title != NULL) - mir_tstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName)); + mir_wstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName)); else if (hContact != NULL) - mir_tstrncpy(ppd.lptzContactName, (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0), + mir_wstrncpy(ppd.lptzContactName, (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0), _countof(ppd.lptzContactName)); if (description != NULL) - mir_tstrncpy(ppd.lptzText, description, _countof(ppd.lptzText)); + mir_wstrncpy(ppd.lptzText, description, _countof(ppd.lptzText)); if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) { diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 07ef4f9e97..e3c7bbe109 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -104,7 +104,7 @@ wchar_t* GetProtocolFolder(wchar_t *fn, char *proto) if (proto == NULL) proto = Translate("Unknown Protocol"); - mir_sntprintf(fn, MAX_PATH, L"%s\\%S", fn, proto); + mir_snwprintf(fn, MAX_PATH, L"%s\\%S", fn, proto); CreateDirectoryTreeT(fn); return fn; } @@ -115,15 +115,15 @@ wchar_t* GetContactFolder(wchar_t *fn, MCONTACT hContact) GetProtocolFolder(fn, proto); wchar_t uin[MAX_PATH]; - ptrT id(Contact_GetInfo(CNF_UNIQUEID, hContact, proto)); + ptrW id(Contact_GetInfo(CNF_UNIQUEID, hContact, proto)); wcsncpy_s(uin, (id == NULL) ? TranslateT("Unknown UIN") : id, _TRUNCATE); ConvertToFilename(uin, MAX_PATH); //added so that weather id's like "yw/CI0000" work - mir_sntprintf(fn, MAX_PATH, L"%s\\%s", fn, uin); + mir_snwprintf(fn, MAX_PATH, L"%s\\%s", fn, uin); CreateDirectoryTreeT(fn); #ifdef DBGPOPUPS wchar_t log[1024]; - mir_sntprintf(log, L"Path: %s\nProto: %S\nUIN: %s", fn, proto, uin); + mir_snwprintf(log, L"Path: %s\nProto: %S\nUIN: %s", fn, proto, uin); ShowPopup(hContact, L"AVH Debug: GetContactFolder", log); #endif @@ -136,7 +136,7 @@ wchar_t* GetOldStyleAvatarName(wchar_t *fn, MCONTACT hContact) SYSTEMTIME curtime; GetLocalTime(&curtime); - mir_sntprintf(fn, MAX_PATH, + mir_snwprintf(fn, MAX_PATH, L"%s\\%04d-%02d-%02d %02dh%02dm%02ds", fn, curtime.wYear, curtime.wMonth, curtime.wDay, curtime.wHour, curtime.wMinute, curtime.wSecond); @@ -150,7 +150,7 @@ void CreateOldStyleShortcut(MCONTACT hContact, wchar_t *history_filename) GetOldStyleAvatarName(shortcut, hContact); - mir_sntprintf(shortcut, L"%s.%s.lnk", shortcut, + mir_snwprintf(shortcut, L"%s.%s.lnk", shortcut, GetExtension(history_filename)); if (!CreateShortcut(history_filename, shortcut)) @@ -166,7 +166,7 @@ void CreateOldStyleShortcut(MCONTACT hContact, wchar_t *history_filename) BOOL CopyImageFile(wchar_t *old_file, wchar_t *new_file) { wchar_t *ext = GetExtension(old_file); - mir_sntprintf(new_file, MAX_PATH, L"%s.%s", new_file, ext); + mir_snwprintf(new_file, MAX_PATH, L"%s.%s", new_file, ext); return !CopyFile(old_file, new_file, TRUE); } @@ -180,7 +180,7 @@ wchar_t * GetCachedAvatar(char *proto, wchar_t *hash) else GetProtocolFolder(file, proto); - mir_sntprintf(search, L"%s\\%s.*", file, hash); + mir_snwprintf(search, L"%s\\%s.*", file, hash); WIN32_FIND_DATA finddata; HANDLE hFind = FindFirstFile(search, &finddata); @@ -189,16 +189,16 @@ wchar_t * GetCachedAvatar(char *proto, wchar_t *hash) do { - size_t len = mir_tstrlen(finddata.cFileName); + size_t len = mir_wstrlen(finddata.cFileName); if (len > 4 - && (!mir_tstrcmpi(&finddata.cFileName[len-4], L".png") - || !mir_tstrcmpi(&finddata.cFileName[len-4], L".bmp") - || !mir_tstrcmpi(&finddata.cFileName[len-4], L".gif") - || !mir_tstrcmpi(&finddata.cFileName[len-4], L".jpg") - || !mir_tstrcmpi(&finddata.cFileName[len-5], L".jpeg"))) + && (!mir_wstrcmpi(&finddata.cFileName[len-4], L".png") + || !mir_wstrcmpi(&finddata.cFileName[len-4], L".bmp") + || !mir_wstrcmpi(&finddata.cFileName[len-4], L".gif") + || !mir_wstrcmpi(&finddata.cFileName[len-4], L".jpg") + || !mir_wstrcmpi(&finddata.cFileName[len-5], L".jpeg"))) { - mir_sntprintf(file, L"%s\\%s", file, finddata.cFileName); - ret = mir_tstrdup(file); + mir_snwprintf(file, L"%s\\%s", file, finddata.cFileName); + ret = mir_wstrdup(file); break; } } while(FindNextFile(hFind, &finddata)); -- cgit v1.2.3