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/DbChecker/src/main.cpp | 2 +- plugins/DbChecker/src/openerror.cpp | 2 +- plugins/DbChecker/src/progress.cpp | 6 ++--- plugins/DbChecker/src/selectdb.cpp | 48 ++++++++++++++++++------------------- plugins/DbChecker/src/stdafx.h | 10 ++++---- plugins/DbChecker/src/worker.cpp | 8 +++---- 6 files changed, 38 insertions(+), 38 deletions(-) (limited to 'plugins/DbChecker') diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index 54166a4afb..80ff103a0c 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -73,7 +73,7 @@ static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam) bLaunchMiranda = lParam != 0; bAutoExit = lParam == 2; bServiceMode = false; - _tcsncpy(opts.filename, (TCHAR*)wParam, _countof(opts.filename)); + wcsncpy(opts.filename, (wchar_t*)wParam, _countof(opts.filename)); return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc); } diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp index 49d4b88bf7..a5ea7c99a6 100644 --- a/plugins/DbChecker/src/openerror.cpp +++ b/plugins/DbChecker/src/openerror.cpp @@ -28,7 +28,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM switch (message) { case WM_INITDIALOG: { - TCHAR szError[256]; + wchar_t szError[256]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, opts.error, 0, szError, _countof(szError), NULL); SetDlgItemText(hdlg, IDC_ERRORTEXT, szError); } diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index 7d6edd8d75..e5dce00b3f 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -28,12 +28,12 @@ HANDLE hEventRun = NULL, hEventAbort = NULL; int errorCount; LRESULT wizardResult; -void AddToStatus(int flags, const TCHAR* fmt, ...) +void AddToStatus(int flags, const wchar_t* fmt, ...) { va_list vararg; va_start(vararg, fmt); - TCHAR str[256]; + wchar_t str[256]; mir_vsntprintf(str, _countof(str), fmt, vararg); va_end(vararg); @@ -120,7 +120,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM return TRUE; case WM_DRAWITEM: - TCHAR str[256]; + wchar_t str[256]; { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; int bold = 0; diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index 1f44e9913d..3b4cebdc58 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static bool CheckBroken(const TCHAR *ptszFullPath) +static bool CheckBroken(const wchar_t *ptszFullPath) { DATABASELINK *dblink = FindDatabasePlugin(ptszFullPath); if (dblink == NULL || dblink->CheckDB == NULL) @@ -30,7 +30,7 @@ static bool CheckBroken(const TCHAR *ptszFullPath) int OpenDatabase(HWND hdlg, INT iNextPage) { - TCHAR tszMsg[1024]; + wchar_t tszMsg[1024]; int error = 0; if (opts.dbChecker == NULL) { @@ -73,9 +73,9 @@ int OpenDatabase(HWND hdlg, INT iNextPage) return true; } -void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath) +void GetProfileDirectory(wchar_t* szMirandaDir, wchar_t* szPath, int cbPath) { - TCHAR szProfileDir[MAX_PATH], szExpandedProfileDir[MAX_PATH], szMirandaBootIni[MAX_PATH]; + wchar_t szProfileDir[MAX_PATH], szExpandedProfileDir[MAX_PATH], szMirandaBootIni[MAX_PATH]; mir_tstrcpy(szMirandaBootIni, szMirandaDir); mir_tstrcat(szMirandaBootIni, L"\\mirandaboot.ini"); @@ -88,57 +88,57 @@ void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath) szPath[mir_tstrlen(szPath) - 1] = 0; } -static int AddDatabaseToList(HWND hwndList, const TCHAR* filename, TCHAR* dir) +static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* dir) { LV_ITEM lvi; lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; for (lvi.iItem = ListView_GetItemCount(hwndList) - 1; lvi.iItem >= 0; lvi.iItem--) { ListView_GetItem(hwndList, &lvi); - if (!mir_tstrcmpi((TCHAR*)lvi.lParam, filename)) + if (!mir_tstrcmpi((wchar_t*)lvi.lParam, filename)) return lvi.iItem; } struct _stat st; - if (_tstat(filename, &st) == -1) + if (_wstat(filename, &st) == -1) return -1; DWORD totalSize = st.st_size; bool isBroken = CheckBroken(filename); - const TCHAR *pName = _tcsrchr(filename, '\\'); + const wchar_t *pName = wcsrchr(filename, '\\'); if (pName == NULL) pName = (LPTSTR)filename; else pName++; - TCHAR szName[MAX_PATH]; + wchar_t szName[MAX_PATH]; mir_sntprintf(szName, L"%s%s", dir, pName); - TCHAR *pDot = _tcsrchr(szName, '.'); + wchar_t *pDot = wcsrchr(szName, '.'); if (pDot != NULL && !mir_tstrcmpi(pDot, L".dat")) *pDot = 0; lvi.iItem = 0; lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE; lvi.iSubItem = 0; - lvi.lParam = (LPARAM)_tcsdup(filename); + lvi.lParam = (LPARAM)wcsdup(filename); lvi.pszText = szName; lvi.iImage = (isBroken) ? 1 : 0; int iNewItem = ListView_InsertItem(hwndList, &lvi); - TCHAR szSize[20]; + wchar_t szSize[20]; mir_sntprintf(szSize, L"%.2lf MB", totalSize / 1048576.0); ListView_SetItemText(hwndList, iNewItem, 1, szSize); return iNewItem; } -void FindAdd(HWND hdlg, TCHAR *szProfileDir, TCHAR *szPrefix) +void FindAdd(HWND hdlg, wchar_t *szProfileDir, wchar_t *szPrefix) { HANDLE hFind; WIN32_FIND_DATA fd; - TCHAR szSearchPath[MAX_PATH], szFilename[MAX_PATH]; + wchar_t szSearchPath[MAX_PATH], szFilename[MAX_PATH]; mir_tstrcpy(szSearchPath, szProfileDir); mir_tstrcat(szSearchPath, L"\\*.*"); @@ -150,14 +150,14 @@ void FindAdd(HWND hdlg, TCHAR *szProfileDir, TCHAR *szPrefix) continue; mir_sntprintf(szFilename, L"%s\\%s\\%s.dat", szProfileDir, fd.cFileName, fd.cFileName); - if (_taccess(szFilename, 0) == 0) + if (_waccess(szFilename, 0) == 0) AddDatabaseToList(GetDlgItem(hdlg, IDC_DBLIST), szFilename, szPrefix); } while (FindNextFile(hFind, &fd)); FindClose(hFind); } } -TCHAR *addstring(TCHAR *str, TCHAR *add) +wchar_t *addstring(wchar_t *str, wchar_t *add) { mir_tstrcpy(str, add); return str + mir_tstrlen(add) + 1; @@ -191,16 +191,16 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lvc.pszText = TranslateT("Total size"); ListView_InsertColumn(GetDlgItem(hdlg, IDC_DBLIST), 1, &lvc); - TCHAR szMirandaPath[MAX_PATH]; + wchar_t szMirandaPath[MAX_PATH]; GetModuleFileName(NULL, szMirandaPath, _countof(szMirandaPath)); - TCHAR *str2 = _tcsrchr(szMirandaPath, '\\'); + wchar_t *str2 = wcsrchr(szMirandaPath, '\\'); if (str2 != NULL) *str2 = 0; int i = 0; HKEY hKey; - TCHAR szProfileDir[MAX_PATH]; - TCHAR szMirandaProfiles[MAX_PATH]; + wchar_t szProfileDir[MAX_PATH]; + wchar_t szMirandaProfiles[MAX_PATH]; DWORD cbData = _countof(szMirandaPath); mir_tstrcpy(szMirandaProfiles, szMirandaPath); @@ -259,13 +259,13 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case IDC_OTHER: { OPENFILENAME ofn = { 0 }; - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; // L"Miranda Databases (*.dat)\0*.DAT\0All Files (*)\0*\0"; - TCHAR *filter, *tmp, *tmp1, *tmp2; + wchar_t *filter, *tmp, *tmp1, *tmp2; tmp1 = TranslateT("Miranda Databases (*.dat)"); tmp2 = TranslateT("All Files"); - filter = tmp = (TCHAR*)_alloca((mir_tstrlen(tmp1) + mir_tstrlen(tmp2) + 11)*sizeof(TCHAR)); + filter = tmp = (wchar_t*)_alloca((mir_tstrlen(tmp1) + mir_tstrlen(tmp2) + 11)*sizeof(wchar_t)); tmp = addstring(tmp, tmp1); tmp = addstring(tmp, L"*.DAT"); tmp = addstring(tmp, tmp2); @@ -312,7 +312,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM if (lvi.iItem == -1) break; lvi.mask = LVIF_PARAM; ListView_GetItem(GetDlgItem(hdlg, IDC_DBLIST), &lvi); - SetDlgItemText(hdlg, IDC_FILE, (TCHAR*)lvi.lParam); + SetDlgItemText(hdlg, IDC_FILE, (wchar_t*)lvi.lParam); SendMessage(hdlg, WM_COMMAND, MAKEWPARAM(IDC_FILE, EN_CHANGE), (LPARAM)GetDlgItem(hdlg, IDC_FILE)); } break; diff --git a/plugins/DbChecker/src/stdafx.h b/plugins/DbChecker/src/stdafx.h index c2235a6c4c..6f2f4b80c9 100644 --- a/plugins/DbChecker/src/stdafx.h +++ b/plugins/DbChecker/src/stdafx.h @@ -41,10 +41,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct DbToolOptions { - TCHAR filename[MAX_PATH]; - TCHAR workingFilename[MAX_PATH]; - TCHAR outputFilename[MAX_PATH]; - TCHAR backupFilename[MAX_PATH]; + wchar_t filename[MAX_PATH]; + wchar_t workingFilename[MAX_PATH]; + wchar_t outputFilename[MAX_PATH]; + wchar_t backupFilename[MAX_PATH]; DATABASELINK *dblink; MIDatabaseChecker* dbChecker; HANDLE hOutFile; @@ -74,6 +74,6 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM int OpenDatabase(HWND hdlg, INT iNextPage); #define STATUS_CLASSMASK 0x0f -void AddToStatus(int flags, const TCHAR* fmt, ...); +void AddToStatus(int flags, const wchar_t* fmt, ...); void SetProgressBar(int perThou); diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index 674088d9f5..92ab1cf497 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -41,9 +41,9 @@ static void Finalize(time_t& ts) } if (opts.bBackup) { - TCHAR dbPath[MAX_PATH], dbFile[MAX_PATH]; + wchar_t dbPath[MAX_PATH], dbFile[MAX_PATH]; mir_tstrcpy(dbPath, opts.filename); - TCHAR* str2 = _tcsrchr(dbPath, '\\'); + wchar_t* str2 = wcsrchr(dbPath, '\\'); if (str2 != NULL) { mir_tstrcpy(dbFile, str2 + 1); *str2 = 0; @@ -57,7 +57,7 @@ static void Finalize(time_t& ts) mir_sntprintf(opts.backupFilename, TranslateT("%s\\Backup of %s"), dbPath, dbFile); else mir_sntprintf(opts.backupFilename, TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile); - if (_taccess(opts.backupFilename, 0) == -1) break; + if (_waccess(opts.backupFilename, 0) == -1) break; } if (!MoveFile(opts.filename, opts.backupFilename)) @@ -87,7 +87,7 @@ void __cdecl WorkerThread(void *) } else { mir_tstrcpy(opts.outputFilename, opts.filename); - *_tcsrchr(opts.outputFilename, '.') = 0; + *wcsrchr(opts.outputFilename, '.') = 0; mir_tstrcat(opts.outputFilename, TranslateT(" (Output).dat")); opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (opts.hOutFile == INVALID_HANDLE_VALUE) { -- cgit v1.2.3