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/DbEditorPP/src/copymodule.cpp | 2 +- plugins/DbEditorPP/src/deletemodule.cpp | 8 ++-- plugins/DbEditorPP/src/exportimport.cpp | 38 +++++++-------- plugins/DbEditorPP/src/findwindow.cpp | 32 ++++++------- plugins/DbEditorPP/src/main.cpp | 18 +++---- plugins/DbEditorPP/src/main_window.cpp | 6 +-- plugins/DbEditorPP/src/moduletree.cpp | 18 +++---- plugins/DbEditorPP/src/renamemodule.cpp | 2 +- plugins/DbEditorPP/src/settinglist.cpp | 84 ++++++++++++++++----------------- plugins/DbEditorPP/src/settingsdlg.cpp | 16 +++---- plugins/DbEditorPP/src/stdafx.h | 12 ++--- plugins/DbEditorPP/src/watchedvars.cpp | 14 +++--- 12 files changed, 124 insertions(+), 126 deletions(-) (limited to 'plugins/DbEditorPP') diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 424b43837f..042719fe53 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -27,7 +27,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); { mac = (ModuleAndContact *)lParam; - TCHAR name[NAME_SIZE], msg[MSG_SIZE]; + wchar_t name[NAME_SIZE], msg[MSG_SIZE]; mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module)); SetWindowText(hwnd, msg); diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 4905fedd10..5bb46feefb 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -9,7 +9,7 @@ int deleteModule(MCONTACT hContact, const char *module, int confirm) return 0; if (confirm && db_get_b(NULL, modname, "WarnOnDelete", 1)) { - TCHAR text[MSG_SIZE]; + wchar_t text[MSG_SIZE]; mir_sntprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module)); if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO) return 0; @@ -75,11 +75,11 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { case WM_INITDIALOG: - SetWindowText(hwnd, LPGENT("Delete module from database... Loading")); + SetWindowText(hwnd, LPGENW("Delete module from database... Loading")); EnableWindow(GetDlgItem(hwnd, IDC_CONTACTS), 0); EnableWindow(GetDlgItem(hwnd, IDOK), 0); - SetDlgItemText(hwnd, IDC_INFOTEXT, LPGENT("Delete module from database")); - SetDlgItemText(hwnd, CHK_COPY2ALL, LPGENT("Delete from all contacts (including Settings)")); + SetDlgItemText(hwnd, IDC_INFOTEXT, LPGENW("Delete module from database")); + SetDlgItemText(hwnd, CHK_COPY2ALL, LPGENW("Delete from all contacts (including Settings)")); EnableWindow(GetDlgItem(hwnd, CHK_COPY2ALL), 0); CheckDlgButton(hwnd, CHK_COPY2ALL, BST_CHECKED); TranslateDialogDefault(hwnd); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index ec10e43f29..40b0fd405a 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -1,15 +1,15 @@ #include "stdafx.h" -TCHAR *GetFilter() +wchar_t *GetFilter() { - static TCHAR filter[MAX_PATH]; + static wchar_t filter[MAX_PATH]; mir_sntprintf(filter, L"%s%c*.ini%c%s%c*.*%c", TranslateT("INI Files"), 0, 0, TranslateT("All Files"), 0, 0); return filter; } -int Openfile(TCHAR *outputFile, const char *module, int maxlen) +int Openfile(wchar_t *outputFile, const char *module, int maxlen) { - TCHAR filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; if (module) { int n = 0; @@ -17,13 +17,13 @@ int Openfile(TCHAR *outputFile, const char *module, int maxlen) while (filename[n]) { switch (filename[n]) { - case _T('*'): - case _T(':'): - case _T('/'): - case _T('?'): - case _T('|'): - case _T('\\'): - filename[n] = _T('_'); + case '*': + case ':': + case '/': + case '?': + case '|': + case '\\': + filename[n] = '_'; break; } n++; @@ -148,10 +148,10 @@ void exportDB(MCONTACT hContact, const char *module) if (!EnumModules(&modlist)) return; - TCHAR fileName[MAX_PATH]; + wchar_t fileName[MAX_PATH]; if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? NULL : module, MAX_PATH)) { - FILE *file = _tfopen(fileName, L"wt"); + FILE *file = _wfopen(fileName, L"wt"); if (!file) { msg(TranslateT("Couldn't open file for writing")); return; @@ -427,7 +427,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwnd); SendDlgItemMessage(hwnd, IDC_TEXT, EM_LIMITTEXT, (WPARAM)0x7FFFFFFF, 0); - TCHAR name[NAME_SIZE], msg[MSG_SIZE]; + wchar_t name[NAME_SIZE], msg[MSG_SIZE]; GetContactName((MCONTACT)lParam, NULL, name, _countof(name)); @@ -446,7 +446,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); if (length) { - TCHAR *data = (TCHAR*)mir_alloc((length + 1)*sizeof(TCHAR)); + wchar_t *data = (wchar_t*)mir_alloc((length + 1)*sizeof(wchar_t)); GetDlgItemText(hwnd, IDC_TEXT, data, length + 1); importSettings(hContact, T2Utf(data)); mir_free(data); @@ -463,7 +463,7 @@ void ImportSettingsMenuItem(MCONTACT hContact) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_IMPORT), hwnd2mainWindow, ImportDlgProc, hContact); } -int Openfile2Import(TCHAR *outputFiles, int maxlen) +int Openfile2Import(wchar_t *outputFiles, int maxlen) { OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); @@ -486,9 +486,9 @@ BOOL Exists(LPCTSTR strName) void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) { - TCHAR szFileNames[MAX_PATH * 10]; - TCHAR szPath[MAX_PATH] = { 0 }; - TCHAR szFile[MAX_PATH]; + wchar_t szFileNames[MAX_PATH * 10]; + wchar_t szPath[MAX_PATH] = { 0 }; + wchar_t szFile[MAX_PATH]; DWORD offset = 0; diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index 0f07fb1934..3769825cd9 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -37,18 +37,18 @@ static int lastColumn = -1; typedef struct { HWND hwnd; // hwnd to item list - TCHAR* search; // text to find - TCHAR* replace; // text to replace + wchar_t* search; // text to find + wchar_t* replace; // text to replace int options; // or'd about items } FindInfo; ColumnsSettings csResultList[] = { - { LPGENT("Result"), 0, "Search0width", 100 }, - { LPGENT("Contact"), 1, "Search1width", 100 }, - { LPGENT("Module"), 2, "Search2width", 100 }, - { LPGENT("Setting"), 3, "Search3width", 100 }, - { LPGENT("Value"), 4, "Search4width", 150 }, + { LPGENW("Result"), 0, "Search0width", 100 }, + { LPGENW("Contact"), 1, "Search1width", 100 }, + { LPGENW("Module"), 2, "Search2width", 100 }, + { LPGENW("Setting"), 3, "Search3width", 100 }, + { LPGENW("Value"), 4, "Search4width", 150 }, {0} }; @@ -95,8 +95,8 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (GetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA)) // stop the search SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 0); else { - TCHAR text[FLD_SIZE]; - TCHAR replace[FLD_SIZE] = {0}; + wchar_t text[FLD_SIZE]; + wchar_t replace[FLD_SIZE] = {0}; if (!GetDlgItemText(hwnd, IDC_TEXT, text, _countof(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break; @@ -225,10 +225,10 @@ void newFindWindow() { CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIND), hwnd2mainWindow, FindWindowDlgProc); } -void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *setting, TCHAR* value, int type) +void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *setting, wchar_t* value, int type) { - TCHAR name[NAME_SIZE]; - TCHAR* mode; + wchar_t name[NAME_SIZE]; + wchar_t* mode; if (type & F_REPLACED) mode = TranslateT("Replaced"); @@ -429,7 +429,7 @@ void __cdecl FindSettings(LPVOID param) // check in settings value if (fi->options & F_SETVAL) { - TCHAR *value = NULL; + wchar_t *value = NULL; switch(dbv.type) { @@ -437,7 +437,7 @@ void __cdecl FindSettings(LPVOID param) case DBVT_WORD: case DBVT_DWORD: if ((fi->options & F_NUMSRCH) && numsearch == getNumericValue(&dbv)) { - TCHAR *val = fi->search; + wchar_t *val = fi->search; int flag = F_SETVAL; if (fi->options & F_NUMREPL) { @@ -468,7 +468,7 @@ void __cdecl FindSettings(LPVOID param) if (FindMatchT(value, fi->search, fi->options)) { foundCount++; ptrT ptr; - TCHAR *newValue = value; + wchar_t *newValue = value; int flag = F_SETVAL; if (fi->replace) { @@ -567,7 +567,7 @@ void __cdecl FindSettings(LPVOID param) } // for(module) } - TCHAR msg[MSG_SIZE]; + wchar_t msg[MSG_SIZE]; mir_sntprintf(msg, TranslateT("Finished. Items found: %d / replaced: %d / deleted: %d"), foundCount, replaceCount, deleteCount); SendDlgItemMessage(hwndParent, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)msg); diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index b914c6a216..442237c4f6 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -113,7 +113,7 @@ int ModulesLoaded(WPARAM, LPARAM) // Register menu item CMenuItem mi; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 1900000001); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Database"), 1900000001); SET_UID(mi, 0xe298849c, 0x1a8c, 0x4fc7, 0xa0, 0xf4, 0x78, 0x18, 0xf, 0xe2, 0xf7, 0xc9); mi.position = 1900000001; @@ -135,7 +135,7 @@ int ModulesLoaded(WPARAM, LPARAM) hkd.dwFlags = HKD_TCHAR; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; - hkd.ptszDescription = LPGENT("Open Database Editor"); + hkd.ptszDescription = LPGENW("Open Database Editor"); hkd.ptszSection = text; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); @@ -265,7 +265,7 @@ int WriteBlobFromString(MCONTACT hContact, const char *szModule, const char *szS return res; } -TCHAR *DBVType(BYTE type) +wchar_t *DBVType(BYTE type) { switch (type) { case DBVT_BYTE: return L"BYTE"; @@ -312,14 +312,14 @@ int setNumericValue(MCONTACT hContact, const char *module, const char *setting, return 0; } -int IsRealUnicode(TCHAR *value) +int IsRealUnicode(wchar_t *value) { BOOL nonascii = 0; WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, NULL, 0, NULL, &nonascii); return nonascii; } -int setTextValue(MCONTACT hContact, const char *module, const char *setting, TCHAR *value, int type) +int setTextValue(MCONTACT hContact, const char *module, const char *setting, wchar_t *value, int type) { #ifdef _UNICODE if (type == DBVT_UTF8 || type == DBVT_WCHAR) @@ -415,7 +415,7 @@ int GetValueW(MCONTACT hContact, const char *module, const char *setting, WCHAR return 0; } -int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxlen) +int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int maxlen) { if (!value) return 0; @@ -427,7 +427,7 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle char *szProto = (char*)proto; char tmp[FLD_SIZE]; - TCHAR name[NAME_SIZE]; name[0] = 0; + wchar_t name[NAME_SIZE]; name[0] = 0; if (hContact && (!proto || !proto[0])) if (!db_get_static(hContact, "Protocol", "p", tmp, _countof(tmp))) @@ -555,8 +555,8 @@ INT_PTR CALLBACK ColumnsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam) { ColumnsSortParams params = *(ColumnsSortParams *)myParam; const int maxSize = 1024; - TCHAR text1[maxSize]; - TCHAR text2[maxSize]; + wchar_t text1[maxSize]; + wchar_t text2[maxSize]; ListView_GetItemText(params.hList, lParam1, params.column, text1, _countof(text1)); ListView_GetItemText(params.hList, lParam2, params.column, text2, _countof(text2)); diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 84248d6a5e..7351297335 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -112,7 +112,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_KEYUP: if (wParam == VK_DELETE || wParam == VK_F2 || wParam == VK_F5 || wParam == VK_F3) { TVITEM tvi; - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT; tvi.hItem = TreeView_GetSelection(hwnd); tvi.pszText = text; @@ -129,7 +129,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR } else if ((mtis->type == CONTACT) && hContact) { if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) { - TCHAR str[MSG_SIZE]; + wchar_t str[MSG_SIZE]; mir_sntprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text); if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO) break; @@ -193,7 +193,7 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd, UINT msg, WPARAM wPar INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - TCHAR text[256]; + wchar_t text[256]; switch (msg) { case WM_INITDIALOG: diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index cea9dc8bf1..00fce5eb74 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -46,7 +46,7 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec tvi.item.cChildren = 1; char szProto[FLD_SIZE]; - TCHAR name[NAME_SIZE]; + wchar_t name[NAME_SIZE]; for (MCONTACT hContact = db_find_first(); hContact && hwnd2mainWindow; hContact = db_find_next(hContact)) { @@ -105,7 +105,7 @@ void doItems(ModuleSettingLL* modlist, int count) { HWND hwnd = GetParent(hwnd2Tree); //!!! - TCHAR percent[128], title[96]; + wchar_t percent[128], title[96]; mir_sntprintf(title, TranslateT("Loading modules...")); TVITEM item = { 0 }; @@ -152,7 +152,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) { TVITEM item; HTREEITEM lastItem; - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; if (!TreeView_GetCount(hwnd2Tree)) return 0; @@ -231,7 +231,7 @@ http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?t TVITEM item; HTREEITEM lastItem, prelastItem; BOOL Result = 0; - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; if (!TreeView_GetCount(hwnd2Tree)) return Result; @@ -325,7 +325,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) switch ((INT_PTR)param) { case 1: // restore after rebuild if (HTREEITEM item = TreeView_GetSelection(hwnd2Tree)) { - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; TVITEM tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT; tvi.pszText = text; @@ -503,7 +503,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h { LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam; TVITEM tvi = { 0 }; - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; MCONTACT hContact; tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT; tvi.hItem = pnmtv->itemNew.hItem; @@ -584,7 +584,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h case TVN_ENDLABELEDIT: LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam; TVITEM tvi = { 0 }; - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; ModuleTreeInfoStruct *mtis; tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_PARAM; tvi.hItem = ptvdi->item.hItem; @@ -626,7 +626,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t TVITEM tvi = { 0 }; HMENU hMenu, hSubMenu; int menuNumber; - TCHAR text[FLD_SIZE]; + wchar_t text[FLD_SIZE]; tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT; tvi.hItem = hti.hItem; @@ -718,7 +718,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t case MENU_DELETE_CONTACT: if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) { - TCHAR str[MSG_SIZE]; + wchar_t str[MSG_SIZE]; mir_sntprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text); if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO) break; diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index d2addc9fc3..bb713adadd 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -30,7 +30,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); - TCHAR msg[MSG_SIZE], name[NAME_SIZE]; + wchar_t msg[MSG_SIZE], name[NAME_SIZE]; GetContactName((MCONTACT)lParam, NULL, name, _countof(name)); mir_sntprintf(msg, TranslateT("Add module to \"%s\""), name); diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 863cfc8869..329b363edc 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -9,11 +9,11 @@ static int lastColumn = -1; struct ColumnsSettings csSettingList[] = { - { LPGENT("Name"), 0, "Column0width", 180 }, - { LPGENT("Value"), 1, "Column1width", 250 }, - { LPGENT("Type"), 2, "Column2width", 60 }, - { LPGENT("Size"), 3, "Column3width", 80 }, - { LPGENT("#"), 4, "Column4width", 30 }, + { LPGENW("Name"), 0, "Column0width", 180 }, + { LPGENW("Value"), 1, "Column1width", 250 }, + { LPGENW("Type"), 2, "Column2width", 60 }, + { LPGENW("Size"), 3, "Column3width", 80 }, + { LPGENW("#"), 4, "Column4width", 30 }, { 0 } }; @@ -49,7 +49,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i int res = 0; DWORD val = 0; - TCHAR tmp[16]; + wchar_t tmp[16]; ptrT value; switch (dbv.type) { @@ -74,7 +74,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i value = mir_a2t(dbv.pszVal); if (mir_tstrlen(value) < 11) - val = _tcstoul(value, NULL, NULL); + val = wcstoul(value, NULL, NULL); } switch (toType) { @@ -132,7 +132,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s if (!count) return; if (db_get_b(NULL, modname, "WarnOnDelete", 1)) { - TCHAR text[MSG_SIZE]; + wchar_t text[MSG_SIZE]; mir_sntprintf(text, TranslateT("Are you sure you want to delete setting(s): %d?"), count); if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO) return; @@ -206,7 +206,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident return; } - TCHAR data[32]; + wchar_t data[32]; int length; switch (dbv->type) { @@ -295,7 +295,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident void addListHandle(MCONTACT hContact) { - TCHAR name[NAME_SIZE], data[32]; + wchar_t name[NAME_SIZE], data[32]; LVITEM lvi = { 0 }; lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM; lvi.lParam = hContact; @@ -475,7 +475,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM return 0; } - TCHAR *value = (TCHAR*)mir_alloc(len*sizeof(TCHAR)); + wchar_t *value = (wchar_t*)mir_alloc(len*sizeof(wchar_t)); GetWindowText(hwnd, value, len); @@ -508,51 +508,51 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM } switch (value[0]) { - case _T('b'): - case _T('B'): - val = _tcstoul(&value[1], NULL, 0); - if (!val || value[1] == _T('0')) { + case 'b': + case 'B': + val = wcstoul(&value[1], NULL, 0); + if (!val || value[1] == '0') { res = !db_set_b(info.hContact, info.module, info.setting, (BYTE)val); } else res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type); break; - case _T('w'): - case _T('W'): - val = _tcstoul(&value[1], NULL, 0); - if (!val || value[1] == _T('0')) + case 'w': + case 'W': + val = wcstoul(&value[1], NULL, 0); + if (!val || value[1] == '0') res = !db_set_w(info.hContact, info.module, info.setting, (WORD)val); else res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type); break; - case _T('d'): - case _T('D'): - val = _tcstoul(&value[1], NULL, 0); - if (!val || value[1] == _T('0')) + case 'd': + case 'D': + val = wcstoul(&value[1], NULL, 0); + if (!val || value[1] == '0') res = !db_set_dw(info.hContact, info.module, info.setting, val); else res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type); break; - case _T('0'): + case '0': i = 1; // fall through - case _T('1'): - case _T('2'): - case _T('3'): - case _T('4'): - case _T('5'): - case _T('6'): - case _T('7'): - case _T('8'): - case _T('9'): - case _T('-'): - case _T('x'): - case _T('X'): - if (value[i] == _T('x') || value[i] == _T('X')) - val = _tcstoul(&value[i + 1], NULL, 16); + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + case 'x': + case 'X': + if (value[i] == 'x' || value[i] == 'X') + val = wcstoul(&value[i + 1], NULL, 16); else - val = _tcstoul(value, NULL, 10); + val = wcstoul(value, NULL, 10); switch (dbv.type) { case DBVT_BYTE: @@ -567,8 +567,8 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM break; } break; - case _T('\"'): - case _T('\''): + case '\"': + case '\'': { size_t nlen = mir_tstrlen(value); int sh = 0; @@ -638,7 +638,7 @@ void EditLabel(int item, int subitem) if (!subitem) info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0); else { - TCHAR *str = NULL, value[16] = { 0 }; + wchar_t *str = NULL, value[16] = { 0 }; switch (dbv.type) { case DBVT_ASCIIZ: diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp index b712386a5b..ed13f64227 100644 --- a/plugins/DbEditorPP/src/settingsdlg.cpp +++ b/plugins/DbEditorPP/src/settingsdlg.cpp @@ -130,7 +130,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault(hwnd); { - TCHAR text[MSG_SIZE]; + wchar_t text[MSG_SIZE]; mir_sntprintf(text, dbsetting->setting?TranslateT("Edit setting (%s)"):TranslateT("New setting (%s)"), DBVType(dbsetting->dbv.type)); SetWindowText(hwnd, text); } @@ -157,21 +157,21 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case CHK_DECIMAL: CheckRadioButton(hwnd, CHK_HEX, CHK_DECIMAL, LOWORD(wParam)); { - TCHAR *setting, text[32]; + wchar_t *setting, text[32]; int settingLength, tmp; settingLength = GetWindowTextLength(GetDlgItem(hwnd, IDC_SETTINGVALUE)); if (settingLength) { - setting = (TCHAR*)mir_alloc((settingLength+1)*sizeof(TCHAR)); + setting = (wchar_t*)mir_alloc((settingLength+1)*sizeof(wchar_t)); GetDlgItemText(hwnd, IDC_SETTINGVALUE, setting, settingLength + 1); if (LOWORD(wParam) == CHK_DECIMAL && IsDlgButtonChecked(hwnd, CHK_DECIMAL)) { - _stscanf(setting, L"%X", &tmp); + swscanf(setting, L"%X", &tmp); mir_sntprintf(text, L"%u", tmp); } else { - _stscanf(setting, L"%u", &tmp); + swscanf(setting, L"%u", &tmp); mir_sntprintf(text, L"%X", tmp); } SetDlgItemText(hwnd, IDC_SETTINGVALUE, text); @@ -188,7 +188,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l { struct DBsetting *dbsetting = (struct DBsetting*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - TCHAR settingname[FLD_SIZE]; + wchar_t settingname[FLD_SIZE]; GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, _countof(settingname)); if (settingname[0]) @@ -221,7 +221,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break; int len = GetWindowTextLength(GetDlgItem(hwnd, valueID))+1; - TCHAR *value = (TCHAR*)mir_alloc(len*sizeof(TCHAR)); + wchar_t *value = (wchar_t*)mir_alloc(len*sizeof(wchar_t)); GetDlgItemText(hwnd, valueID, value, len); _T2A setting(settingname); @@ -235,7 +235,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case DBVT_BYTE: case DBVT_WORD: case DBVT_DWORD: - res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, _tcstoul(value, NULL, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type); + res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, NULL, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type); break; case DBVT_ASCIIZ: case DBVT_UTF8: diff --git a/plugins/DbEditorPP/src/stdafx.h b/plugins/DbEditorPP/src/stdafx.h index 8533d5942c..f573d1739c 100644 --- a/plugins/DbEditorPP/src/stdafx.h +++ b/plugins/DbEditorPP/src/stdafx.h @@ -4,8 +4,6 @@ // Includes //===================================================== -#include - #include #include #include @@ -134,7 +132,7 @@ struct ModuleSettingLL }; struct ColumnsSettings { - TCHAR *name; + wchar_t *name; int index; char *dbname; int defsize; @@ -203,14 +201,14 @@ extern bool g_bUsePopups; //main char *StringFromBlob(BYTE *blob, WORD len); int WriteBlobFromString(MCONTACT hContact, const char *module, const char *setting, const char *value, int len); -TCHAR *DBVType(BYTE type); +wchar_t *DBVType(BYTE type); DWORD getNumericValue(DBVARIANT *dbv); int setNumericValue(MCONTACT hContact, const char *module, const char *setting, DWORD value, int type); -int IsRealUnicode(TCHAR *value); -int setTextValue(MCONTACT hContact, const char *module, const char *setting, TCHAR *value, int type); +int IsRealUnicode(wchar_t *value); +int setTextValue(MCONTACT hContact, const char *module, const char *setting, wchar_t *value, int type); int GetValueA(MCONTACT hContact, const char *module, const char *setting, char *value, int length); int GetValueW(MCONTACT hContact, const char *module, const char *setting, WCHAR *value, int length); -int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxlen); +int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int maxlen); int ApplyProtoFilter(MCONTACT hContact); void loadListSettings(HWND hwnd, ColumnsSettings *cs); void saveListSettings(HWND hwnd, ColumnsSettings *cs); diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index a5ca3e7c0e..3c8ce19c50 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -7,11 +7,11 @@ static WatchListArrayStruct WatchListArray = {0}; static int lastColumn = -1; ColumnsSettings csWatchList[] = { - { LPGENT("Contact"), 0, "Watch0width", 100 }, - { LPGENT("Module"), 1, "Watch1width", 100 }, - { LPGENT("Setting"), 2, "Watch2width", 100 }, - { LPGENT("Value"), 3, "Watch3width", 200 }, - { LPGENT("Type"), 4, "Watch4width", 75 }, + { LPGENW("Contact"), 0, "Watch0width", 100 }, + { LPGENW("Module"), 1, "Watch1width", 100 }, + { LPGENW("Setting"), 2, "Watch2width", 100 }, + { LPGENW("Value"), 3, "Watch3width", 200 }, + { LPGENW("Type"), 4, "Watch4width", 75 }, {0} }; @@ -109,7 +109,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) if (db_get_s(lParam->hContact, lParam->module, lParam->setting, &(lParam->dbv), 0)) return; - TCHAR data[32], tmp[16], name[NAME_SIZE]; + wchar_t data[32], tmp[16], name[NAME_SIZE]; GetContactName(lParam->hContact, NULL, name, _countof(name)); lvItem.pszText = name; @@ -352,7 +352,7 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) COLORREF colorText = db_get_dw(NULL, modname, "PopupTextColour", RGB(0, 0, 0)); int timeout = db_get_b(NULL, modname, "PopupDelay", 3); - TCHAR name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE]; + wchar_t name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE]; GetContactName(hContact, NULL, name, _countof(name)); // 2nd line -- cgit v1.2.3