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/TrafficCounter/src/TrafficCounter.cpp | 56 +++++++++++++-------------- plugins/TrafficCounter/src/misc.cpp | 44 ++++++++++----------- plugins/TrafficCounter/src/misc.h | 10 ++--- plugins/TrafficCounter/src/options.cpp | 24 ++++++------ plugins/TrafficCounter/src/opttree.cpp | 28 +++++++------- plugins/TrafficCounter/src/opttree.h | 2 +- plugins/TrafficCounter/src/statistics.cpp | 8 ++-- plugins/TrafficCounter/src/stdafx.h | 6 +-- plugins/TrafficCounter/src/vars.cpp | 12 +++--- 9 files changed, 95 insertions(+), 95 deletions(-) (limited to 'plugins/TrafficCounter/src') diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 3dea6dd19d..9619347bc3 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -34,7 +34,7 @@ CLIST_INTERFACE *pcli; int hLangpack = 0; // Поддержка плагинозависимого перевода. BOOL bPopupExists = FALSE, bVariablesExists = FALSE, bTooltipExists = FALSE; -static TCHAR tszFormat[] = +static wchar_t tszFormat[] = _T("{I4}\x0D\x0A\x0A\ {R65}?tc_GetTraffic(%extratext%,now,sent,d)\x0D\x0A\x0A\ {R115}?tc_GetTraffic(%extratext%,now,received,d)\x0D\x0A\x0A\ @@ -42,7 +42,7 @@ _T("{I4}\x0D\x0A\x0A\ {L180}?if3(?tc_GetTime(%extratext%,now,hh:mm:ss),)\x0D\x0A\x0A\ {L230}?if3(?tc_GetTime(%extratext%,total,d hh:mm),)"); -TCHAR* TRAFFIC_COUNTER_WINDOW_CLASS = L"TrafficCounterWnd"; +wchar_t* TRAFFIC_COUNTER_WINDOW_CLASS = L"TrafficCounterWnd"; /*-------------------------------------------------------------------------------------------------------------------*/ //TRAFFIC COUNTER @@ -64,8 +64,8 @@ char Traffic_PopupTimeoutValue; unsigned short int Traffic_LineHeight; // -TCHAR Traffic_CounterFormat[512]; -TCHAR Traffic_TooltipFormat[512]; +wchar_t Traffic_CounterFormat[512]; +wchar_t Traffic_TooltipFormat[512]; // HANDLE Traffic_FrameID = NULL; @@ -245,8 +245,8 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) //register traffic font TrafficFontID.cbSize = sizeof(FontIDT); - mir_tstrcpy(TrafficFontID.group, LPGENT("Traffic counter")); - mir_tstrcpy(TrafficFontID.name, LPGENT("Font")); + mir_tstrcpy(TrafficFontID.group, LPGENW("Traffic counter")); + mir_tstrcpy(TrafficFontID.name, LPGENW("Font")); mir_strcpy(TrafficFontID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP); mir_strcpy(TrafficFontID.prefix, "Font"); TrafficFontID.flags = FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE; @@ -260,8 +260,8 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) // Регистрируем цвет фона TrafficBackgroundColorID.cbSize = sizeof(ColourIDT); - mir_tstrcpy(TrafficBackgroundColorID.group, LPGENT("Traffic counter")); - mir_tstrcpy(TrafficBackgroundColorID.name, LPGENT("Font")); + mir_tstrcpy(TrafficBackgroundColorID.group, LPGENW("Traffic counter")); + mir_tstrcpy(TrafficBackgroundColorID.name, LPGENW("Font")); mir_strcpy(TrafficBackgroundColorID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP); mir_strcpy(TrafficBackgroundColorID.setting, "FontBkColor"); TrafficBackgroundColorID.defcolour = GetSysColor(COLOR_BTNFACE); @@ -485,14 +485,14 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Следующие позиции строятся от правого края. // Общее время. if (unOptions.DrawTotalTimeCounter) { - TCHAR bu[32]; + wchar_t bu[32]; GetDurationFormatM(ProtoList[i].Total.Timer, L"h:mm:ss", bu, 32); TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent); } // Текущее время. if (unOptions.DrawCurrentTimeCounter) { - TCHAR bu[32]; + wchar_t bu[32]; GetDurationFormatM(ProtoList[i].Session.Timer, L"h:mm:ss", bu, 32); rect.right -= 50; @@ -501,7 +501,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Изображаем общий трафик. if (unOptions.DrawTotalTraffic) { - TCHAR bu[32]; + wchar_t bu[32]; GetFormattedTraffic(ProtoList[i].TotalSentTraffic + ProtoList[i].TotalRecvTraffic, 3, bu, 32); rect.right -= 100; @@ -513,7 +513,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Изображаем текущий трафик. if (unOptions.DrawCurrentTraffic) { - TCHAR bu[32]; + wchar_t bu[32]; GetFormattedTraffic(ProtoList[i].CurrentRecvTraffic + ProtoList[i].CurrentSentTraffic, 3, bu, 32); rect.right -= 150; @@ -539,7 +539,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Выводим текст // Изображаем имя if (unOptions.DrawProtoName) { - TCHAR *bu = mir_a2t("Summary"); + wchar_t *bu = mir_a2t("Summary"); rect.left += dx; TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent); @@ -548,14 +548,14 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Общее время. if (unOptions.DrawTotalTimeCounter) { - TCHAR bu[32]; + wchar_t bu[32]; GetDurationFormatM(OverallInfo.Total.Timer, L"h:mm:ss", bu, 32); TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent); } // Текущее время. if (unOptions.DrawCurrentTimeCounter) { - TCHAR bu[32]; + wchar_t bu[32]; GetDurationFormatM(OverallInfo.Session.Timer, L"h:mm:ss", bu, 32); rect.right -= 50; @@ -564,7 +564,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Изображаем общий трафик. if (unOptions.DrawTotalTraffic) { - TCHAR bu[32]; + wchar_t bu[32]; GetFormattedTraffic(SummaryTotal, 3, bu, 32); rect.right -= 100; @@ -573,7 +573,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Изображаем текущий трафик. if (unOptions.DrawCurrentTraffic) { - TCHAR bu[32]; + wchar_t bu[32]; GetFormattedTraffic(SummarySession, 3, bu, 32); rect.right -= 150; @@ -594,7 +594,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Выводим текст // Изображаем имя if (unOptions.DrawProtoName) { - TCHAR *bu = mir_a2t("Overall"); + wchar_t *bu = mir_a2t("Overall"); rect.left += dx; TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent); @@ -604,7 +604,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Следующие позиции строятся от правого края. // Изображаем общий трафик. if (unOptions.DrawTotalTraffic) { - TCHAR bu[32]; + wchar_t bu[32]; GetFormattedTraffic(OverallInfo.TotalSentTraffic + OverallInfo.TotalRecvTraffic, 3, bu, 32); rect.right -= 100; @@ -613,7 +613,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Изображаем текущий трафик. if (unOptions.DrawCurrentTraffic) { - TCHAR bu[32]; + wchar_t bu[32]; GetFormattedTraffic(OverallInfo.CurrentRecvTraffic + OverallInfo.CurrentSentTraffic, 3, bu, 32); rect.right -= 150; @@ -630,13 +630,13 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) WORD ItemsNumber, RowsNumber; // Готовим список строк для Variables и иконок. - TCHAR **ExtraText = (TCHAR**)mir_alloc(sizeof(TCHAR*)); + wchar_t **ExtraText = (wchar_t**)mir_alloc(sizeof(wchar_t*)); HICON *ahIcon = (HICON*)mir_alloc(sizeof(HICON)); RowsNumber = 0; // Цикл по аккаунтам. for (int i = 0; i < NumberOfAccounts; i++) { if (ProtoList[i].Visible && ProtoList[i].Enabled) { - ExtraText = (TCHAR**)mir_realloc(ExtraText, sizeof(TCHAR*) * (RowsNumber + 1)); + ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1)); ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1)); ExtraText[RowsNumber] = mir_a2t(ProtoList[i].name); @@ -645,14 +645,14 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) } // Ещё 2 особых элемента. if (unOptions.ShowSummary) { - ExtraText = (TCHAR**)mir_realloc(ExtraText, sizeof(TCHAR*) * (RowsNumber + 1)); + ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1)); ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1)); ExtraText[RowsNumber] = mir_a2t("summary"); ahIcon[RowsNumber++] = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); } if (unOptions.ShowOverall) { - ExtraText = (TCHAR**)mir_realloc(ExtraText, sizeof(TCHAR*) * (RowsNumber + 1)); + ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1)); ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1)); ExtraText[RowsNumber] = mir_a2t("overall"); @@ -661,7 +661,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Рисуем свой счётчик для каждого из выбранных протоколов for (int i = 0; i < RowsNumber; i++) { - TCHAR *buf = variables_parse(Traffic_CounterFormat, ExtraText[i], NULL); + wchar_t *buf = variables_parse(Traffic_CounterFormat, ExtraText[i], NULL); if (ItemsNumber = GetRowItems(buf, &ItemsList)) { // Рисуем текст. for (int dx = 0; dx < ItemsNumber; dx++) { @@ -943,7 +943,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP case TIMER_TOOLTIP: { - TCHAR *TooltipText; + wchar_t *TooltipText; CLCINFOTIP ti = { 0 }; RECT rt; @@ -1064,7 +1064,7 @@ void NotifyOnSend(void) memset(&ppd, 0, sizeof(ppd)); ppd.lchContact = NULL; ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - _tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME); + wcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME); mir_sntprintf(ppd.lptzText, TranslateT("%d kilobytes sent"), notify_send_size = OverallInfo.CurrentSentTraffic >> 10); ppd.colorBack = Traffic_PopupBkColor; ppd.colorText = Traffic_PopupFontColor; @@ -1080,7 +1080,7 @@ void NotifyOnRecv(void) memset(&ppd, 0, sizeof(ppd)); ppd.lchContact = NULL; ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - _tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME); + wcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME); mir_sntprintf(ppd.lptzText, TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10); ppd.colorBack = Traffic_PopupBkColor; ppd.colorText = Traffic_PopupFontColor; diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index 5c23fd4541..398feaab96 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -25,13 +25,13 @@ InputString - RowItemsList - список найденных элементов. Возвращаемое значение - количество элементов в списках. */ -WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList) +WORD GetRowItems(wchar_t *InputString, RowItemInfo **RowItemsList) { - TCHAR *begin, *end; + wchar_t *begin, *end; WORD c = 0; // Ищем слева открывающую скобку. - begin = _tcschr(InputString, '{'); + begin = wcschr(InputString, '{'); // Если скобка найдена... if (begin) { // Выделяем память под указатели @@ -41,31 +41,31 @@ WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList) do { // Сразу вслед за ней ищем закрывающую. - end = _tcschr(begin, '}'); + end = wcschr(begin, '}'); // Выделяем память под указатели *RowItemsList = (RowItemInfo*)mir_realloc(*RowItemsList, sizeof(RowItemInfo) * (c + 1)); // Разбираем тег. - _stscanf(begin + 1, L"%c%hd", + swscanf(begin + 1, L"%c%hd", &((*RowItemsList)[c].Alignment), &((*RowItemsList)[c].Interval)); // Ищем далее открывающую скобку - это конец строки, соответствующей тегу. - begin = _tcschr(end, '{'); + begin = wcschr(end, '{'); if (begin) { // Выделяем память под строку. - (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * (begin - end)); + (*RowItemsList)[c].String = (wchar_t*)mir_alloc(sizeof(wchar_t) * (begin - end)); // Копируем строку. - _tcsncpy((*RowItemsList)[c].String, end + 1, begin - end - 1); + wcsncpy((*RowItemsList)[c].String, end + 1, begin - end - 1); (*RowItemsList)[c].String[begin - end - 1] = 0; } else { // Выделяем память под строку. - (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * mir_tstrlen(end)); + (*RowItemsList)[c].String = (wchar_t*)mir_alloc(sizeof(wchar_t) * mir_tstrlen(end)); // Копируем строку. - _tcsncpy((*RowItemsList)[c].String, end + 1, mir_tstrlen(end)); + wcsncpy((*RowItemsList)[c].String, end + 1, mir_tstrlen(end)); } c++; @@ -118,12 +118,12 @@ Buffer - Size - размер буфера. Возвращаемое значение: требуемый размер буфера. */ -size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size) +size_t GetFormattedTraffic(DWORD Value, BYTE Unit, wchar_t *Buffer, size_t Size) { - TCHAR Str1[32], szUnit[4] = { ' ', 0 }; + wchar_t Str1[32], szUnit[4] = { ' ', 0 }; DWORD Divider; NUMBERFMT nf = { 0, 1, 3, L",", L" ", 0 }; - TCHAR *Res; // Промежуточный результат. + wchar_t *Res; // Промежуточный результат. switch (Unit) { case 0: //bytes @@ -152,7 +152,7 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size) size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0); if (!l) return 0; l += mir_tstrlen(szUnit) + 1; - Res = (TCHAR*)malloc(l * sizeof(TCHAR)); + Res = (wchar_t*)malloc(l * sizeof(wchar_t)); if (!Res) return 0; GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, Res, (int)l); mir_tstrcat(Res, szUnit); @@ -174,26 +174,26 @@ Format: Buffer: адрес буфера, куда функция помещает результат. Size - размер буфера. */ -size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, size_t Size) +size_t GetDurationFormatM(DWORD Duration, wchar_t *Format, wchar_t *Buffer, size_t Size) { size_t Length; DWORD q; WORD TokenIndex, FormatIndex; - TCHAR Token[256], // Аккумулятор. + wchar_t Token[256], // Аккумулятор. *Res; // Промежуточный результат. - Res = (TCHAR*)malloc(sizeof(TCHAR)); // Выделяем чуть-чуть памяти под результат, но это только начало. - //SecureZeroMemory(Res, sizeof(TCHAR)); + Res = (wchar_t*)malloc(sizeof(wchar_t)); // Выделяем чуть-чуть памяти под результат, но это только начало. + //SecureZeroMemory(Res, sizeof(wchar_t)); Res[0] = 0; for (FormatIndex = 0; Format[FormatIndex];) { // Ищем токены. Считается, что токен - только буквы. TokenIndex = 0; - q = _istalpha(Format[FormatIndex]); + q = iswalpha(Format[FormatIndex]); // Копируем символы в аккумулятор до смены флага. do { Token[TokenIndex++] = Format[FormatIndex++]; - } while (q == _istalpha(Format[FormatIndex])); + } while (q == iswalpha(Format[FormatIndex])); Token[TokenIndex] = 0; // Что получили в аккумуляторе? @@ -235,12 +235,12 @@ size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, size_t S // Добавим памяти, если нужно. Length = mir_tstrlen(Res) + mir_tstrlen(Token) + 1; - Res = (TCHAR*)realloc(Res, Length * sizeof(TCHAR)); + Res = (wchar_t*)realloc(Res, Length * sizeof(wchar_t)); mir_tstrcat(Res, Token); } if (Size && Buffer) { - _tcsncpy(Buffer, Res, Size); + wcsncpy(Buffer, Res, Size); Length = mir_tstrlen(Buffer); } else Length = mir_tstrlen(Res) + 1; diff --git a/plugins/TrafficCounter/src/misc.h b/plugins/TrafficCounter/src/misc.h index 0f4b418bdc..d0d784e6cf 100644 --- a/plugins/TrafficCounter/src/misc.h +++ b/plugins/TrafficCounter/src/misc.h @@ -1,8 +1,8 @@ typedef struct { - TCHAR Alignment; // Выравнивание. L - к левой границе, R - к правой. + wchar_t Alignment; // Выравнивание. L - к левой границе, R - к правой. WORD Interval; // Расстояние, на которое граница строки отстоит от левого края фрейма. - TCHAR *String; // Собственно строка. + wchar_t *String; // Собственно строка. } RowItemInfo; /* Функция разбирает строку и возвращает список тегов и соответствующих им строк. @@ -10,7 +10,7 @@ typedef struct InputString - строка для разбора; RowItemsList - список найденных элементов. Возвращаемое значение - количество элементов в списках. */ -WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList); +WORD GetRowItems(wchar_t *InputString, RowItemInfo **RowItemsList); /* Функция возвращает количество дней в указанном месяце указанного года. */ BYTE DaysInMonth(BYTE Month, WORD Year); @@ -25,8 +25,8 @@ BYTE DayOfWeek(BYTE Day, BYTE Month, WORD Year); Buffer - адрес строки для записи результата; Size - размер буфера. Возвращаемое значение: требуемый размер буфера. */ -size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size); +size_t GetFormattedTraffic(DWORD Value, BYTE Unit, wchar_t *Buffer, size_t Size); -size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, size_t Size); +size_t GetDurationFormatM(DWORD Duration, wchar_t *Format, wchar_t *Buffer, size_t Size); signed short int TimeCompare(SYSTEMTIME st1, SYSTEMTIME st2); \ No newline at end of file diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 81fc55b629..02bfd9d5d5 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -126,15 +126,15 @@ static INT_PTR CALLBACK DlgProcPopupsTraffic(HWND hwndDlg, UINT msg, WPARAM wPar static OPTTREE_OPTION options[] = { - {0, LPGENT("Display") L"/" LPGENT("Icon"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoIcon"}, - {0, LPGENT("Display") L"/" LPGENT("Account name"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoName"}, - {0, LPGENT("Display") L"/" LPGENT("Current traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTraffic"}, - {0, LPGENT("Display") L"/" LPGENT("Total traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTraffic"}, - {0, LPGENT("Display") L"/" LPGENT("Current online"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTime"}, - {0, LPGENT("Display") L"/" LPGENT("Total online"),OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTime"}, - {0, LPGENT("General") L"/" LPGENT("Draw frame as skin element"), OPTTREE_CHECK, 1, NULL, "DrawFrmAsSkin"}, - {0, LPGENT("General") L"/" LPGENT("Show tooltip in traffic window"), OPTTREE_CHECK, 1, NULL, "ShowTooltip"}, - {0, LPGENT("General") L"/" LPGENT("\"Toggle traffic counter\" in main menu"), OPTTREE_CHECK, 1, NULL, "ShowMainMenuItem"}, + {0, LPGENW("Display") L"/" LPGENW("Icon"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoIcon"}, + {0, LPGENW("Display") L"/" LPGENW("Account name"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoName"}, + {0, LPGENW("Display") L"/" LPGENW("Current traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTraffic"}, + {0, LPGENW("Display") L"/" LPGENW("Total traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTraffic"}, + {0, LPGENW("Display") L"/" LPGENW("Current online"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTime"}, + {0, LPGENW("Display") L"/" LPGENW("Total online"),OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTime"}, + {0, LPGENW("General") L"/" LPGENW("Draw frame as skin element"), OPTTREE_CHECK, 1, NULL, "DrawFrmAsSkin"}, + {0, LPGENW("General") L"/" LPGENW("Show tooltip in traffic window"), OPTTREE_CHECK, 1, NULL, "ShowTooltip"}, + {0, LPGENW("General") L"/" LPGENW("\"Toggle traffic counter\" in main menu"), OPTTREE_CHECK, 1, NULL, "ShowMainMenuItem"}, // Резервируем место под активные и видимые протоколы // Максимум 16 позиций видимых и 16 активных {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL}, @@ -169,8 +169,8 @@ static OPTTREE_OPTION options[] = {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL}, {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL}, {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL}, - {0, LPGENT("Visible accounts")L"/" LPGENT("Summary traffic for visible accounts"), OPTTREE_CHECK, 1, NULL, "ShowSummary"}, - {0, LPGENT("Visible accounts")L"/" LPGENT("Overall traffic"), OPTTREE_CHECK, 1, NULL, "ShowOverall"}, + {0, LPGENW("Visible accounts")L"/" LPGENW("Summary traffic for visible accounts"), OPTTREE_CHECK, 1, NULL, "ShowSummary"}, + {0, LPGENW("Visible accounts")L"/" LPGENW("Overall traffic"), OPTTREE_CHECK, 1, NULL, "ShowOverall"}, }; static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, options[i].szSettingName = (char*)mir_alloc(1 + mir_strlen(ProtoList[j].name)); mir_strcpy(options[i].szSettingName, ProtoList[j].name); size_t l = 20 + mir_tstrlen(ProtoList[j].tszAccountName); - options[i].szOptionName = (TCHAR*)mir_alloc(sizeof(TCHAR) * l); + options[i].szOptionName = (wchar_t*)mir_alloc(sizeof(wchar_t) * l); mir_sntprintf(options[i].szOptionName, l, L"Visible accounts/%s", ProtoList[j].tszAccountName); options[i].dwFlag = (ProtoList[j++].Enabled ? 1 : OPTTREE_INVISIBLE) | OPTTREE_NOTRANSLATE; } diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp index 09447b2c85..337fca2806 100644 --- a/plugins/TrafficCounter/src/opttree.cpp +++ b/plugins/TrafficCounter/src/opttree.cpp @@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name); -HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconIndex); +HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wchar_t *name); +HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconIndex); static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) { - TCHAR buf[128]; + wchar_t buf[128]; TVITEM tvi = {0}; tvi.mask = TVIF_HANDLE|TVIF_TEXT; @@ -72,10 +72,10 @@ void OptTree_Translate(HWND hwndTree) } } -HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name) +HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wchar_t *name) { TVITEM tvi = {0}; - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; if (hItem) tvi.hItem = TreeView_GetChild(hwndTree, hItem); @@ -101,11 +101,11 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA return NULL; } -HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconIndex) +HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconIndex) { - TCHAR itemName[1024]; + wchar_t itemName[1024]; - TCHAR* sectionName; + wchar_t* sectionName; int sectionLevel = 0; HTREEITEM hSection = NULL, result = NULL; @@ -115,10 +115,10 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconInd while (sectionName) { // allow multi-level tree - TCHAR* pItemName = sectionName; + wchar_t* pItemName = sectionName; HTREEITEM hItem; - if (sectionName = _tcschr(sectionName, '/')) + if (sectionName = wcschr(sectionName, '/')) { // one level deeper *sectionName = 0; @@ -169,7 +169,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, case WM_INITDIALOG: { int indx; - TCHAR itemName[1024]; + wchar_t itemName[1024]; HIMAGELIST hImgLst; TreeView_SelectItem(hwndTree, NULL); @@ -188,7 +188,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, /* build options tree. based on code from IcoLib */ for (indx = 0; indx < optionCount; indx++) { - TCHAR* sectionName; + wchar_t* sectionName; int sectionLevel = 0; HTREEITEM hSection = NULL; @@ -202,10 +202,10 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, while (sectionName) { // allow multi-level tree - TCHAR* pItemName = sectionName; + wchar_t* pItemName = sectionName; HTREEITEM hItem; - if (sectionName = _tcschr(sectionName, '/')) + if (sectionName = wcschr(sectionName, '/')) { // one level deeper *sectionName = 0; diff --git a/plugins/TrafficCounter/src/opttree.h b/plugins/TrafficCounter/src/opttree.h index de3a8ddbbb..8c80b599eb 100644 --- a/plugins/TrafficCounter/src/opttree.h +++ b/plugins/TrafficCounter/src/opttree.h @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { int iconIndex; - TCHAR *szOptionName; + wchar_t *szOptionName; int groupId; DWORD dwFlag; HTREEITEM hItem; diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index 709d7e3724..cb0f7e3f6d 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -174,7 +174,7 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SYSTEMTIME st = { 0 }; DWORD Index, Value; double vartime; - TCHAR szBufW[64]; + wchar_t szBufW[64]; BYTE EldestAcc; if (!(pdi->item.mask & LVIF_TEXT)) return 0; @@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA break; case 4: // Время { - TCHAR *Fmt[5] = { L"m:ss", L"h:mm:ss", L"h:mm:ss", L"d hh:mm:ss", L"d hh:mm:ss" }; + wchar_t *Fmt[5] = { L"m:ss", L"h:mm:ss", L"h:mm:ss", L"d hh:mm:ss", L"d hh:mm:ss" }; GetDurationFormatM(Value, Fmt[unOptions.Stat_Tab], pdi->item.pszText, 32); } break; @@ -297,7 +297,7 @@ void Stat_ReadFile(BYTE n) { LARGE_INTEGER Size; DWORD BytesRead; - TCHAR FileName[MAX_PATH], *pszPath; + wchar_t FileName[MAX_PATH], *pszPath; SYSTEMTIME stNow; pszPath = Utils_ReplaceVarsT(L"%miranda_userdata%\\statistics"); @@ -350,7 +350,7 @@ void Stat_Show(HWND hwndDialog) void Stat_UpdateTotalTraffic(HWND hwndDialog, DWORD Incoming, DWORD Outgoing) { - TCHAR tmp[32]; + wchar_t tmp[32]; GetFormattedTraffic(Incoming, unOptions.Stat_Units, tmp, 32); SetDlgItemText(hwndDialog, IDC_STATIC_DNL, tmp); diff --git a/plugins/TrafficCounter/src/stdafx.h b/plugins/TrafficCounter/src/stdafx.h index abeb7badd6..2868dc3b87 100644 --- a/plugins/TrafficCounter/src/stdafx.h +++ b/plugins/TrafficCounter/src/stdafx.h @@ -107,7 +107,7 @@ typedef struct // дата которой соответствует началу статистики данного аккаунта. // 0.1.1.6 - TCHAR *tszAccountName; // Человеческое имя аккаунта для использования в графическом интерфейсе. + wchar_t *tszAccountName; // Человеческое имя аккаунта для использования в графическом интерфейсе. } PROTOLIST; //--------------------------------------------------------------------------------------------- @@ -155,8 +155,8 @@ extern char Traffic_PopupTimeoutDefault; extern char Traffic_PopupTimeoutValue; extern char Traffic_AdditionSpace; -extern TCHAR Traffic_CounterFormat[512]; -extern TCHAR Traffic_TooltipFormat[512]; +extern wchar_t Traffic_CounterFormat[512]; +extern wchar_t Traffic_TooltipFormat[512]; extern BOOL bPopupExists, bVariablesExists, bTooltipExists; diff --git a/plugins/TrafficCounter/src/vars.cpp b/plugins/TrafficCounter/src/vars.cpp index 62da3f32f7..64a71c71b5 100644 --- a/plugins/TrafficCounter/src/vars.cpp +++ b/plugins/TrafficCounter/src/vars.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static TCHAR* GetTraffic(ARGUMENTSINFO *ai) +static wchar_t* GetTraffic(ARGUMENTSINFO *ai) { DWORD tmp, tmpsn = 0, tmprn = 0, tmpst = 0, tmprt = 0; BYTE ed; @@ -54,7 +54,7 @@ static TCHAR* GetTraffic(ARGUMENTSINFO *ai) for (tmp = ed = 0; ed < NumberOfAccounts; ed++) { if (!ProtoList[ed].name) continue; - TCHAR *buf = mir_a2t(ProtoList[ed].name); + wchar_t *buf = mir_a2t(ProtoList[ed].name); if (!mir_tstrcmp(buf, ai->targv[1])) { tmpsn = ProtoList[ed].CurrentSentTraffic; @@ -101,7 +101,7 @@ static TCHAR* GetTraffic(ARGUMENTSINFO *ai) // Получаем форматированную строку и возвращаем указатель на неё. // Сначала узнаем размер буфера. size_t l = GetFormattedTraffic(tmp, ed, NULL, 0); - TCHAR *res = (TCHAR*)mir_alloc(l * sizeof(TCHAR)); + wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t)); if (!res) return NULL; if (GetFormattedTraffic(tmp, ed, res, l)) return res; @@ -110,7 +110,7 @@ static TCHAR* GetTraffic(ARGUMENTSINFO *ai) return NULL; } -static TCHAR* GetTime(ARGUMENTSINFO *ai) +static wchar_t* GetTime(ARGUMENTSINFO *ai) { BYTE ed, flag; DWORD Duration; @@ -120,7 +120,7 @@ static TCHAR* GetTime(ARGUMENTSINFO *ai) // Ищем индекс протокола, переданного первым аргументом for (flag = ed = 0; ed < NumberOfAccounts; ed++) { - TCHAR *buf; + wchar_t *buf; if (!ProtoList[ed].name) continue; buf = mir_a2t(ProtoList[ed].name); if (!mir_tstrcmp(buf, ai->targv[1])) @@ -150,7 +150,7 @@ static TCHAR* GetTime(ARGUMENTSINFO *ai) // Получаем форматированную строку и возвращаем указатель на неё. // Сначала узнаем размер буфера. size_t l = GetDurationFormatM(Duration, ai->targv[3], NULL, 0); - TCHAR *res = (TCHAR*)mir_alloc(l * sizeof(TCHAR)); + wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t)); if (!res) return NULL; GetDurationFormatM(Duration, ai->targv[3], res, l); -- cgit v1.2.3