diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/Console/src | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
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
Diffstat (limited to 'plugins/Console/src')
-rw-r--r-- | plugins/Console/src/Console.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 808decafdc..5c3d44da55 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -66,7 +66,7 @@ typedef struct { typedef struct {
char szModule[128];
- TCHAR szMsg[1];
+ wchar_t szMsg[1];
} DUMPMSG;
@@ -111,7 +111,7 @@ static HGENMENU hMenu = NULL; static void LoadSettings();
static void ShowConsole(int show);
static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam);
-static int Openfile(TCHAR *outputFile, int selection);
+static int Openfile(wchar_t *outputFile, int selection);
////////////////////////////////////////////////////////////////////////////////
@@ -165,7 +165,7 @@ static void ShowConsole(int show) RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
if (hMenu)
- Menu_ModifyItem(hMenu, show ? LPGENT("Hide Console") : LPGENT("Show Console"));
+ Menu_ModifyItem(hMenu, show ? LPGENW("Hide Console") : LPGENW("Show Console"));
if (hTTBButt)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, show ? TTBST_PUSHED : 0);
@@ -205,22 +205,22 @@ typedef struct UINT control;
UINT icon;
int type;
- TCHAR *tooltip;
+ wchar_t *tooltip;
} controlinfo;
static controlinfo ctrls[] =
{
// IDC_SCROLL & IDC_PAUSE must be first
- { IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, LPGENT("Scrolling (Ctrl+Q)") },
- { IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, LPGENT("Pause logging (Ctrl+P)") },
- { IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, LPGENT("Save log to file (Ctrl+S)") },
- { IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, LPGENT("Copy selected log (Ctrl+C)") },
- { IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, LPGENT("Delete selected (Del)") },
- { IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, LPGENT("Log options (Ctrl+O)") },
- { IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, LPGENT("Start logging in all tabs") },
- { IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, LPGENT("Pause logging in all tabs") },
- { IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, LPGENT("Close tab (Ctrl+W)") },
+ { IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, LPGENW("Scrolling (Ctrl+Q)") },
+ { IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, LPGENW("Pause logging (Ctrl+P)") },
+ { IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, LPGENW("Save log to file (Ctrl+S)") },
+ { IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, LPGENW("Copy selected log (Ctrl+C)") },
+ { IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, LPGENW("Delete selected (Del)") },
+ { IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, LPGENW("Log options (Ctrl+O)") },
+ { IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, LPGENW("Start logging in all tabs") },
+ { IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, LPGENW("Pause logging in all tabs") },
+ { IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, LPGENW("Close tab (Ctrl+W)") },
};
////////////////////////////////////////////////////////////////////////////////
@@ -372,23 +372,23 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP if (dat && !dat->Paused) {
LVITEM lvi = { 0 };
int last = 0x7fffffff;
- TCHAR szBreak;
+ wchar_t szBreak;
DWORD len, tmplen;
DWORD wraplen = gWrapLen;
- TCHAR *str = ((DUMPMSG *)lParam)->szMsg;
+ wchar_t *str = ((DUMPMSG *)lParam)->szMsg;
lvi.iItem = 0x7fffffff;
- str = _tcstok(str, L"\n");
+ str = wcstok(str, L"\n");
if (gIcons && str != NULL) {
lvi.mask = LVIF_TEXT | LVIF_IMAGE;
- if (_tcsstr(str, L"Data received")) {
+ if (wcsstr(str, L"Data received")) {
if (gSeparator) ListView_InsertItem(dat->hList, &lvi);
lvi.iImage = IMG_IN;
}
- else if (_tcsstr(str, L"Data sent")) {
+ else if (wcsstr(str, L"Data sent")) {
if (gSeparator) ListView_InsertItem(dat->hList, &lvi);
lvi.iImage = IMG_OUT;
}
@@ -423,7 +423,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP last = ListView_InsertItem(dat->hList, &lvi);
- str = _tcstok(NULL, L"\n");
+ str = wcstok(NULL, L"\n");
if (str) dat->newline = 1;
lvi.iImage = IMG_EMPTY;
@@ -477,8 +477,8 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP case IDC_COPY:
{
int idx = 0;
- TCHAR szText[128];
- TCHAR *src, *dst, *buf;
+ wchar_t szText[128];
+ wchar_t *src, *dst, *buf;
int flags = LVNI_BELOW;
int count = ListView_GetSelectedCount(dat->hList);
@@ -487,7 +487,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP else
count = ListView_GetItemCount(dat->hList);
- dst = buf = (TCHAR *)malloc((count * (sizeof(szText) + 1) + 1) * sizeof(TCHAR));
+ dst = buf = (wchar_t *)malloc((count * (sizeof(szText) + 1) + 1) * sizeof(wchar_t));
if (!buf) break;
while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) {
@@ -502,9 +502,9 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP if (dst - buf > 0 && OpenClipboard(hwndDlg)) {
EmptyClipboard();
- HGLOBAL hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst - buf + 1) * sizeof(TCHAR));
+ HGLOBAL hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst - buf + 1) * sizeof(wchar_t));
if (hClipboardData) {
- TCHAR *pchData = (TCHAR *)GlobalLock(hClipboardData);
+ wchar_t *pchData = (wchar_t *)GlobalLock(hClipboardData);
mir_tstrcpy(pchData, buf);
GlobalUnlock(hClipboardData);
SetClipboardData(CF_UNICODETEXT, hClipboardData);
@@ -541,21 +541,21 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP case IDC_SAVE:
{
- TCHAR szFile[MAX_PATH];
+ wchar_t szFile[MAX_PATH];
if (!Openfile(szFile, ListView_GetSelectedCount(dat->hList))) break;
- FILE *fp = _tfopen(szFile, L"wt");
+ FILE *fp = _wfopen(szFile, L"wt");
if (fp) {
int idx = 0;
- TCHAR szText[128];
+ wchar_t szText[128];
int flags = LVNI_BELOW;
if (ListView_GetSelectedCount(dat->hList))
flags |= LVNI_SELECTED;
while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) {
ListView_GetItemText(dat->hList, idx, 0, szText, _countof(szText));
- _ftprintf(fp, L"%s\n", szText);
+ fwprintf(fp, L"%s\n", szText);
}
fclose(fp);
}
@@ -608,9 +608,9 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam switch (message) {
case WM_INITDIALOG:
{
- TCHAR title[MAX_PATH];
- TCHAR name[MAX_PATH] = { 0 };
- TCHAR path[MAX_PATH] = { 0 };
+ wchar_t title[MAX_PATH];
+ wchar_t name[MAX_PATH] = { 0 };
+ wchar_t path[MAX_PATH] = { 0 };
hTabs = GetDlgItem(hwndDlg, IDC_TABS);
@@ -929,9 +929,9 @@ static int OnFastDump(WPARAM wParam, LPARAM lParam) LOGMSG *logMsg = (LOGMSG *)lParam;
DWORD headlen = (DWORD)mir_strlen(logMsg->pszHead);
DWORD msglen = (DWORD)mir_strlen(logMsg->pszMsg);
- DWORD len = (headlen + msglen + 1) * sizeof(TCHAR) + sizeof(DUMPMSG);
+ DWORD len = (headlen + msglen + 1) * sizeof(wchar_t) + sizeof(DUMPMSG);
DUMPMSG *dumpMsg = (DUMPMSG *)mir_alloc(len);
- TCHAR *str = dumpMsg->szMsg;
+ wchar_t *str = dumpMsg->szMsg;
char *szModule = (wParam) ? ((NETLIBUSER *)wParam)->szDescriptiveName : "[Core]";
mir_strncpy(dumpMsg->szModule, szModule, _countof(dumpMsg->szModule));
@@ -1096,8 +1096,8 @@ static int OnFontChange(WPARAM, LPARAM) FontIDT fid = { 0 };
fid.cbSize = sizeof(fid);
- mir_tstrncpy(fid.group, LPGENT("Console"), _countof(fid.group));
- mir_tstrncpy(fid.name, LPGENT("Text"), _countof(fid.name));
+ mir_tstrncpy(fid.group, LPGENW("Console"), _countof(fid.group));
+ mir_tstrncpy(fid.name, LPGENW("Text"), _countof(fid.name));
colLogFont = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&LogFont);
@@ -1120,12 +1120,12 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) FontIDT fid = { 0 };
fid.cbSize = sizeof(fid);
- mir_tstrncpy(fid.group, LPGENT("Console"), _countof(fid.group));
- mir_tstrncpy(fid.name, LPGENT("Text"), _countof(fid.name));
+ mir_tstrncpy(fid.group, LPGENW("Console"), _countof(fid.group));
+ mir_tstrncpy(fid.name, LPGENW("Text"), _countof(fid.name));
mir_strncpy(fid.dbSettingsGroup, "Console", _countof(fid.dbSettingsGroup));
mir_strncpy(fid.prefix, "ConsoleFont", _countof(fid.prefix));
- mir_tstrncpy(fid.backgroundGroup, LPGENT("Console"), _countof(fid.backgroundGroup));
- mir_tstrncpy(fid.backgroundName, LPGENT("Background"), _countof(fid.backgroundName));
+ mir_tstrncpy(fid.backgroundGroup, LPGENW("Console"), _countof(fid.backgroundGroup));
+ mir_tstrncpy(fid.backgroundName, LPGENW("Background"), _countof(fid.backgroundName));
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.colour = RGB(0, 0, 0);
@@ -1138,8 +1138,8 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) ColourIDT cid = { 0 };
cid.cbSize = sizeof(cid);
- mir_tstrncpy(cid.group, LPGENT("Console"), _countof(cid.group));
- mir_tstrncpy(cid.name, LPGENT("Background"), _countof(cid.name));
+ mir_tstrncpy(cid.group, LPGENW("Console"), _countof(cid.group));
+ mir_tstrncpy(cid.name, LPGENW("Background"), _countof(cid.name));
mir_strncpy(cid.dbSettingsGroup, "Console", _countof(cid.dbSettingsGroup));
mir_strncpy(cid.setting, "BgColor", _countof(cid.setting));
cid.defcolour = RGB(255, 255, 255);
@@ -1164,7 +1164,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) mi.flags = CMIF_TCHAR;
mi.hIcolibItem = hIcons[0];
mi.position = 1900000000;
- mi.name.t = (IsWindowVisible(hwndConsole)) ? LPGENT("Hide Console") : LPGENT("Show Console");
+ mi.name.w = (IsWindowVisible(hwndConsole)) ? LPGENW("Hide Console") : LPGENW("Show Console");
mi.pszService = MS_CONSOLE_SHOW_HIDE;
hMenu = Menu_AddMainMenuItem(&mi);
@@ -1258,21 +1258,21 @@ void ShutdownConsole(void) ////////////////////////////////////////////////////////////////////////////////
-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;
}
-static int Openfile(TCHAR *outputFile, int selection)
+static int Openfile(wchar_t *outputFile, int selection)
{
- TCHAR filename[MAX_PATH + 2] = L"";
- TCHAR *title;
+ wchar_t filename[MAX_PATH + 2] = L"";
+ wchar_t *title;
- TCHAR *filter, *tmp, *tmp1, *tmp2;
+ wchar_t *filter, *tmp, *tmp1, *tmp2;
tmp1 = TranslateT("Text Files (*.txt)");
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"*.TXT");
tmp = addstring(tmp, tmp2);
|