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/Quotes/src/CreateFilePath.cpp | 10 ++-- plugins/Quotes/src/Forex.cpp | 28 +++++------ plugins/Quotes/src/HTTPSession.cpp | 2 +- plugins/Quotes/src/ImportExport.cpp | 8 ++-- plugins/Quotes/src/Locale.cpp | 2 +- plugins/Quotes/src/Log.cpp | 2 +- plugins/Quotes/src/OptionDukasCopy.cpp | 2 +- plugins/Quotes/src/QuoteChart.cpp | 6 +-- plugins/Quotes/src/QuoteInfoDlg.cpp | 4 +- plugins/Quotes/src/QuotesProviderBase.cpp | 34 +++++++------- plugins/Quotes/src/QuotesProviderDukasCopy.cpp | 2 +- plugins/Quotes/src/QuotesProviderFinance.cpp | 2 +- plugins/Quotes/src/QuotesProviderGoogle.cpp | 2 +- plugins/Quotes/src/QuotesProviderGoogleFinance.cpp | 16 +++---- .../Quotes/src/QuotesProviderVisitorFormater.cpp | 54 +++++++++++----------- plugins/Quotes/src/QuotesProviderVisitorFormater.h | 4 +- .../Quotes/src/QuotesProviderVisitorTendency.cpp | 24 +++++----- plugins/Quotes/src/QuotesProviderVisitorTendency.h | 4 +- plugins/Quotes/src/QuotesProviderYahoo.cpp | 10 ++-- plugins/Quotes/src/SettingsDlg.cpp | 20 ++++---- plugins/Quotes/src/WinCtrlHelper.cpp | 2 +- plugins/Quotes/src/WinCtrlHelper.h | 2 +- plugins/Quotes/src/stdafx.h | 4 +- 23 files changed, 122 insertions(+), 122 deletions(-) (limited to 'plugins/Quotes') diff --git a/plugins/Quotes/src/CreateFilePath.cpp b/plugins/Quotes/src/CreateFilePath.cpp index 4e2c47a96c..6c73da75b0 100644 --- a/plugins/Quotes/src/CreateFilePath.cpp +++ b/plugins/Quotes/src/CreateFilePath.cpp @@ -1,12 +1,12 @@ #include "StdAfx.h" -static TCHAR InvalidSymbols[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('"'), _T('<'), _T('>'), _T('|') }; +static wchar_t InvalidSymbols[] = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' }; -static TCHAR replace_invalid_symbol(TCHAR chr) +static wchar_t replace_invalid_symbol(wchar_t chr) { for (int i = 0; i < _countof(InvalidSymbols); ++i) if (chr == InvalidSymbols[i]) - return _T('_'); + return '_'; return chr; } @@ -18,10 +18,10 @@ void prepare_name(tstring& rsName) tstring CreateFilePath(const tstring& rsName) { - TCHAR szPath[_MAX_PATH]; + wchar_t szPath[_MAX_PATH]; ::GetModuleFileName(g_hInstance, szPath, _MAX_PATH); - TCHAR* p = _tcsrchr(szPath, _T('\\')); + wchar_t* p = wcsrchr(szPath, '\\'); if (p) *p = 0; diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index b92535800b..5ce786b6b5 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -43,9 +43,9 @@ PLUGININFOEX Global_pluginInfo = void UpdateMenu(bool bAutoUpdate) { if (bAutoUpdate) // to enable auto-update - Menu_ModifyItem(g_hEnableDisableMenu, LPGENT("Auto Update Enabled"), Quotes_GetIconHandle(IDI_ICON_MAIN)); + Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Enabled"), Quotes_GetIconHandle(IDI_ICON_MAIN)); else // to disable auto-update - Menu_ModifyItem(g_hEnableDisableMenu, LPGENT("Auto Update Disabled"), Quotes_GetIconHandle(IDI_ICON_DISABLED)); + Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Disabled"), Quotes_GetIconHandle(IDI_ICON_DISABLED)); CallService(MS_TTB_SETBUTTONSTATE, reinterpret_cast(g_hTBButton), !bAutoUpdate ? TTBST_PUSHED : 0); } @@ -78,11 +78,11 @@ void InitMenu() { CMenuItem mi; mi.flags = CMIF_TCHAR; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Quotes"), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Quotes"), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "B474F556-22B6-42A1-A91E-22FE4F671388"); SET_UID(mi, 0x9de6716, 0x3591, 0x48c4, 0x9f, 0x64, 0x1b, 0xfd, 0xc6, 0xd1, 0x34, 0x97); - mi.name.t = LPGENT("Enable/Disable Auto Update"); + mi.name.w = LPGENW("Enable/Disable Auto Update"); mi.position = 10100001; mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = g_pszAutoUpdateCmd; @@ -91,7 +91,7 @@ void InitMenu() UpdateMenu(g_bAutoUpdate); SET_UID(mi, 0x91cbabf6, 0x5073, 0x4a78, 0x84, 0x8, 0x34, 0x61, 0xc1, 0x8a, 0x34, 0xd9); - mi.name.t = LPGENT("Refresh All Quotes\\Rates"); + mi.name.w = LPGENW("Refresh All Quotes\\Rates"); mi.position = 20100001; mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = "Quotes/RefreshAll"; @@ -99,7 +99,7 @@ void InitMenu() CreateServiceFunction(mi.pszService, QuotesMenu_RefreshAll); SET_UID(mi, 0x3663409c, 0xbd36, 0x473b, 0x9b, 0x4f, 0xff, 0x80, 0xf6, 0x2c, 0xdf, 0x9b); - mi.name.t = LPGENT("Currency Converter..."); + mi.name.w = LPGENW("Currency Converter..."); mi.position = 20100002; mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); mi.pszService = g_pszCurrencyConverter; @@ -107,7 +107,7 @@ void InitMenu() CreateServiceFunction(mi.pszService, QuotesMenu_CurrencyConverter); SET_UID(mi, 0x7cca4fd9, 0x903f, 0x4b7d, 0x93, 0x7a, 0x18, 0x63, 0x23, 0xd4, 0xa9, 0xa9); - mi.name.t = LPGENT("Export All Quotes"); + mi.name.w = LPGENW("Export All Quotes"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_EXPORT); mi.pszService = "Quotes/ExportAll"; mi.position = 20100003; @@ -115,7 +115,7 @@ void InitMenu() CreateServiceFunction(mi.pszService, QuotesMenu_ExportAll); SET_UID(mi, 0xa994d3b, 0x77c2, 0x4612, 0x8d, 0x5, 0x6a, 0xae, 0x8c, 0x21, 0xbd, 0xc9); - mi.name.t = LPGENT("Import All Quotes"); + mi.name.w = LPGENW("Import All Quotes"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_IMPORT); mi.pszService = "Quotes/ImportAll"; mi.position = 20100004; @@ -128,7 +128,7 @@ void InitMenu() Menu_ConfigureItem(mi.root, MCI_OPT_UID, "C259BE01-642C-461E-997D-0E756B2A3AD6"); SET_UID(mi, 0xb9812194, 0x3235, 0x4e76, 0xa3, 0xa4, 0x73, 0x32, 0x96, 0x1c, 0x1c, 0xf4); - mi.name.t = LPGENT("Refresh"); + mi.name.w = LPGENW("Refresh"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH); mi.pszService = "Quotes/RefreshContact"; g_hMenuRefresh = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); @@ -136,7 +136,7 @@ void InitMenu() CreateServiceFunction(mi.pszService, QuotesMenu_RefreshContact); SET_UID(mi, 0x19a16fa2, 0xf370, 0x4201, 0x92, 0x9, 0x25, 0xde, 0x4e, 0x55, 0xf9, 0x1a); - mi.name.t = LPGENT("Open Log File..."); + mi.name.w = LPGENW("Open Log File..."); mi.hIcolibItem = NULL; mi.pszService = "Quotes/OpenLogFile"; g_hMenuOpenLogFile = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); @@ -145,7 +145,7 @@ void InitMenu() #ifdef CHART_IMPLEMENT SET_UID(mi, 0x65da7256, 0x43a2, 0x4857, 0xac, 0x52, 0x1c, 0xb7, 0xff, 0xd7, 0x96, 0xfa); - mi.name.t = LPGENT("Chart..."); + mi.name.w = LPGENW("Chart..."); mi.popupPosition = 2; mi.hIcolibItem = NULL; mi.pszService = "Quotes/Chart"; @@ -154,7 +154,7 @@ void InitMenu() #endif SET_UID(mi, 0xac5fc17, 0x5640, 0x4f81, 0xa3, 0x44, 0x8c, 0xb6, 0x9a, 0x5c, 0x98, 0xf); - mi.name.t = LPGENT("Edit Settings..."); + mi.name.w = LPGENW("Edit Settings..."); mi.hIcolibItem = NULL; mi.pszService = "Quotes/EditSettings"; g_hMenuEditSettings = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); @@ -269,8 +269,8 @@ int QuotesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/) OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 910000000; odp.hInstance = g_hInstance; - odp.ptszTitle = _T(QUOTES_PROTOCOL_NAME); - odp.ptszGroup = LPGENT("Network"); + odp.pwszTitle = _T(QUOTES_PROTOCOL_NAME); + odp.pwszGroup = LPGENW("Network"); odp.hIcon = Quotes_LoadIconEx(IDI_ICON_MAIN); odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR; diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index ebe919e9f9..16583b071a 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -97,7 +97,7 @@ public: char* pResult = &*(apBuffer.begin()); int nIndex = find_header(pReply, "Content-Type"); if ((-1 != nIndex) && (NULL != strstr(_strlwr(pReply->headers[nIndex].szValue), "utf-8"))) { - TCHAR* p = mir_utf8decodeT(pResult); + wchar_t* p = mir_utf8decodeT(pResult); rsResponce = p; mir_free(p); } diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index 9e7d15d711..ca9e9440fa 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -164,15 +164,15 @@ LPCTSTR prepare_filter(LPTSTR pszBuffer, size_t cBuffer) } if (nLen < cBuffer) - *p = _T('\0'); + *p = '\0'; return pszBuffer; } bool show_open_file_dialog(bool bOpen, tstring& rsFile) { - TCHAR szBuffer[MAX_PATH]; - TCHAR szFilter[MAX_PATH]; + wchar_t szBuffer[MAX_PATH]; + wchar_t szFilter[MAX_PATH]; OPENFILENAME ofn; memset(&ofn, 0, sizeof(ofn)); @@ -189,7 +189,7 @@ bool show_open_file_dialog(bool bOpen, tstring& rsFile) ofn.nMaxFile = MAX_PATH; ofn.lpstrFile = szBuffer; - ofn.lpstrFile[0] = _T('\0'); + ofn.lpstrFile[0] = '\0'; if (bOpen) { if (FALSE == GetOpenFileName(&ofn)) diff --git a/plugins/Quotes/src/Locale.cpp b/plugins/Quotes/src/Locale.cpp index 07c9f1a105..ae79f71eb6 100644 --- a/plugins/Quotes/src/Locale.cpp +++ b/plugins/Quotes/src/Locale.cpp @@ -16,7 +16,7 @@ tstring get_int_registry_value(LPCTSTR pszValueName) DWORD dwSize = 0; lResult = ::RegQueryValueEx(hKey, pszValueName, nullptr, &dwType, nullptr, &dwSize); if ((ERROR_SUCCESS == lResult) && ((REG_SZ == dwType) || (REG_EXPAND_SZ == dwType))) { - std::vector aBuffer(dwSize); + std::vector aBuffer(dwSize); lResult = ::RegQueryValueEx(hKey, pszValueName, nullptr, nullptr, reinterpret_cast(&*aBuffer.begin()), &dwSize); if (ERROR_SUCCESS == lResult) std::copy(aBuffer.begin(), aBuffer.end(), std::back_inserter(sResult)); diff --git a/plugins/Quotes/src/Log.cpp b/plugins/Quotes/src/Log.cpp index 055fb22937..f3a038d2a7 100644 --- a/plugins/Quotes/src/Log.cpp +++ b/plugins/Quotes/src/Log.cpp @@ -24,7 +24,7 @@ namespace tofstream file(rsFileName.c_str(), std::ios::ate | std::ios::app); if (file.good()) { - TCHAR szTime[20]; + wchar_t szTime[20]; _tstrtime_s(szTime); file << szTime << L" ================================>\n" << rsMsg << L"\n\n"; } diff --git a/plugins/Quotes/src/OptionDukasCopy.cpp b/plugins/Quotes/src/OptionDukasCopy.cpp index f5506cada2..6a5b8b0fc6 100644 --- a/plugins/Quotes/src/OptionDukasCopy.cpp +++ b/plugins/Quotes/src/OptionDukasCopy.cpp @@ -314,6 +314,6 @@ void ShowDukasCopyPropPage(CQuotesProviderDukasCopy* pProvider, WPARAM wp, OPTIO odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_ECONOMIC_RATES); odp.pfnDlgProc = EconomicRatesDlgProc; - odp.ptszTab = const_cast(pi.m_sName.c_str()); + odp.pwszTab = const_cast(pi.m_sName.c_str()); Options_AddPage(wp, &odp); } diff --git a/plugins/Quotes/src/QuoteChart.cpp b/plugins/Quotes/src/QuoteChart.cpp index 47dca6bfce..25aa422995 100644 --- a/plugins/Quotes/src/QuoteChart.cpp +++ b/plugins/Quotes/src/QuoteChart.cpp @@ -47,7 +47,7 @@ bool read_log_file(MCONTACT hContact, TChart& rChart) line.imbue(loc); tstring sName; - std::getline(line, sName, _T('\t')); + std::getline(line, sName, '\t'); line >> oDateTime >> dRate; if ((false == line.fail()) && (true == line.eof())) { rChart.AddValue(oDateTime, dRate); @@ -205,8 +205,8 @@ INT_PTR CALLBACK ChartDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) ::SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(hContact)); - static LPCTSTR szSources[] = { LPGENT("Log File"), LPGENT("Miranda's History") }; - static LPCTSTR szFilters[] = { LPGENT("All"), LPGENT("Last Day"), LPGENT("Last Week"), LPGENT("Last Month"), LPGENT("Last Year"), LPGENT("User-Defined") }; + static LPCTSTR szSources[] = { LPGENW("Log File"), LPGENW("Miranda's History") }; + static LPCTSTR szFilters[] = { LPGENW("All"), LPGENW("Last Day"), LPGENW("Last Week"), LPGENW("Last Month"), LPGENW("Last Year"), LPGENW("User-Defined") }; for (int i = 0; i < sizeof(szSources) / sizeof(szSources[0]); ++i) { LPCTSTR p = TranslateTS(szSources[i]); diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index da74285271..ac9471c959 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -60,7 +60,7 @@ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WP time_t nFetchTime; if (true == get_fetch_time(nFetchTime, hContact)) { - TCHAR szTime[50] = { 0 }; + wchar_t szTime[50] = { 0 }; if (0 == _tctime_s(szTime, 50, &nFetchTime)) { ::SetDlgItemText(hdlg, IDC_EDIT_RATE_FETCH_TIME, szTime); } @@ -253,7 +253,7 @@ int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM) tstring sLogFileName; bool bThereIsLogFile = (true == get_log_file(hContact, sLogFileName)) - && (false == sLogFileName.empty()) && (0 == _taccess(sLogFileName.c_str(), 04)); + && (false == sLogFileName.empty()) && (0 == _waccess(sLogFileName.c_str(), 04)); if (true == bThereIsLogFile) { #ifdef CHART_IMPLEMENT Menu_EnableItem(g_hMenuChart, true); diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index b98dd35d51..263df84fac 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -263,7 +263,7 @@ public: bool bValid = true; int nCurValue = 0; for (tstring::const_iterator i = rsFrmt.begin(); i != rsFrmt.end() && bValid && nCurValue < NumValues;) { - TCHAR chr = *i; + wchar_t chr = *i; switch (chr) { default: if (false == std::isspace(chr)) @@ -272,10 +272,10 @@ public: ++i; break; - case _T('%'): + case '%': ++i; if (i != rsFrmt.end()) { - TCHAR t = *i; + wchar_t t = *i; ++i; CQuotesProviderVisitorTendency visitor(hContact, t); pProvider->Accept(visitor); @@ -291,15 +291,15 @@ public: } else bValid = false; break; - case _T('>'): + case '>': m_nComparison = Greater; ++i; break; - case _T('<'): + case '<': m_nComparison = Less; ++i; break; - case _T('='): + case '=': switch (m_nComparison) { default: bValid = false; @@ -372,22 +372,22 @@ tstring format_rate(const IQuotesProvider *pProvider, MCONTACT hContact, const t tstring sResult; for (tstring::const_iterator i = rsFrmt.begin(); i != rsFrmt.end();) { - TCHAR chr = *i; + wchar_t chr = *i; switch (chr) { default: sResult += chr; ++i; break; - case _T('\\'): + case '\\': ++i; if (i != rsFrmt.end()) { - TCHAR t = *i; + wchar_t t = *i; switch (t) { - case _T('%'): sResult += L"%"; break; - case _T('t'): sResult += L"\t"; break; - case _T('n'): sResult += L"\n"; break; - case _T('\\'): sResult += L"\\"; break; + case '%': sResult += L"%"; break; + case 't': sResult += L"\t"; break; + case 'n': sResult += L"\n"; break; + case '\\': sResult += L"\\"; break; default: sResult += chr; sResult += t; break; } ++i; @@ -395,7 +395,7 @@ tstring format_rate(const IQuotesProvider *pProvider, MCONTACT hContact, const t else sResult += chr; break; - case _T('%'): + case '%': ++i; if (i != rsFrmt.end()) { chr = *i; @@ -505,12 +505,12 @@ bool show_popup(const IQuotesProvider* pProvider, ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_DOWN); } - CQuotesProviderVisitorFormater visitor(hContact, _T('s'), 0); + CQuotesProviderVisitorFormater visitor(hContact, 's', 0); pProvider->Accept(visitor); const tstring& sTitle = visitor.GetResult(); mir_tstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME); { - ptrT ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact)); + ptrT ss(variables_parsedup((wchar_t*)rsFormat.c_str(), 0, hContact)); tstring sText = format_rate(pProvider, hContact, tstring(ss)); mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE); } @@ -572,7 +572,7 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons if (true == sSymbol.empty()) sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL); - oNick << std::setfill(_T(' ')) << std::setw(10) << std::left << sSymbol << std::setw(6) << std::right << dRate; + oNick << std::setfill(L' ') << std::setw(10) << std::left << sSymbol << std::setw(6) << std::right << dRate; } CTendency tendency; diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index e010f98577..8404c2b479 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -86,7 +86,7 @@ struct CEconomicRateInfo typedef std::vector TEconomicRates; typedef IHTMLNode::THTMLNodePtr THTMLNodePtr; -bool string2double(const TCHAR* pszText, double& rValue) +bool string2double(const wchar_t* pszText, double& rValue) { assert(pszText); try { diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index b200715fa5..9403611d54 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -260,6 +260,6 @@ void CQuotesProviderFinance::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_OPT_FINANCE); odp.pfnDlgProc = GoogleFinanceOptDlgProc; odp.dwInitParam = LPARAM(this); - odp.ptszTab = const_cast(GetInfo().m_sName.c_str()); + odp.pwszTab = const_cast(GetInfo().m_sName.c_str()); Options_AddPage(wp, &odp); } diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 096def469d..95e15ca85b 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -382,7 +382,7 @@ void CQuotesProviderGoogle::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_OPT_GOOGLE); odp.pfnDlgProc = GoogleOptDlgProc; - odp.ptszTab = const_cast(GetInfo().m_sName.c_str()); + odp.pwszTab = const_cast(GetInfo().m_sName.c_str()); Options_AddPage(wp, &odp); } diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index 8219497148..cfcda85e76 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -66,8 +66,8 @@ tstring get_var_value(const tstring& rsHTML, LPCTSTR pszVarName, size_t cVarName if (tstring::npos != n) { size_t cLengthHTML = rsHTML.size(); for (size_t i = n + cVarNameLength; i < cLengthHTML; ++i) { - TCHAR c = rsHTML[i]; - if (_T(';') == c) + wchar_t c = rsHTML[i]; + if (';' == c) break; sResult.push_back(c); @@ -87,8 +87,8 @@ tstring get_company_id(const tstring& rsHTML) if (tstring::npos != n) { size_t cLengthHTML = rsHTML.size(); for (size_t i = n + cVarNameLength; i < cLengthHTML; ++i) { - TCHAR c = rsHTML[i]; - if (_T(')') == c) + wchar_t c = rsHTML[i]; + if (')' == c) break; sResult.push_back(c); @@ -103,10 +103,10 @@ tstring get_company_name(const tstring& rsHTML) static size_t cVarNameLength = mir_tstrlen(pszVarName); tstring s = get_var_value(rsHTML, pszVarName, cVarNameLength); - if (s.size() > 0 && _T('\'') == s[0]) + if (s.size() > 0 && '\'' == s[0]) s.erase(s.begin()); - if (s.size() > 0 && _T('\'') == s[s.size() - 1]) + if (s.size() > 0 && '\'' == s[s.size() - 1]) s.erase(s.rbegin().base() - 1); return s; @@ -171,8 +171,8 @@ bool get_dif_value(const IHTMLNode::THTMLNodePtr& pNode, CGoogleInfo& rInfo, int // this value is in brackets and it has percentage sign. // Remove these symbols. for (tstring::iterator i = sDiff.begin(); i != sDiff.end();) { - TCHAR s = *i; - if (_T('(') == s || _T(')') == s || _T('%') == s) + wchar_t s = *i; + if ('(' == s || ')' == s || '%' == s) i = sDiff.erase(i); else ++i; diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp b/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp index 04d3fe7662..f421813bf7 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" -CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(MCONTACT hContact, TCHAR chr, int nWidth) +CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth) : m_hContact(hContact), m_chr(chr), m_nWidth(nWidth) @@ -18,23 +18,23 @@ const tstring& CQuotesProviderVisitorFormater::GetResult()const void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderDukasCopy&) { - if (_T('d') == m_chr || _T('D') == m_chr) + if ('d' == m_chr || 'D' == m_chr) m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION); } void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderGoogle&) { switch (m_chr) { - case _T('F'): + case 'F': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_FROM_DESCRIPTION); break; - case _T('f'): + case 'f': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_FROM_ID); break; - case _T('I'): + case 'I': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_TO_DESCRIPTION); break; - case _T('i'): + case 'i': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_TO_ID); break; } @@ -67,24 +67,24 @@ static tstring format_fetch_time(const CQuotesProviderBase&, MCONTACT hContact, void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderBase& rProvider) { switch (m_chr) { - case _T('%'): - case _T('\t'): - case _T('\\'): + case '%': + case '\t': + case '\\': m_sResult = m_chr; break; - case _T('S'): + case 'S': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_PROVIDER); break; - case _T('s'): + case 's': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_SYMBOL); break; - case _T('X'): + case 'X': m_sResult = format_fetch_time(rProvider, m_hContact, Quotes_GetTimeFormat(true)); break; - case _T('x'): + case 'x': m_sResult = format_fetch_time(rProvider, m_hContact, Quotes_GetDateFormat(true)); break; - case _T('t'): + case 't': { tstring sFrmt = Quotes_GetDateFormat(true); sFrmt += L" "; @@ -92,11 +92,11 @@ void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderBase& rProvider) m_sResult = format_fetch_time(rProvider, m_hContact, sFrmt); } break; - case _T('r'): - case _T('R'): + case 'r': + case 'R': FormatDoubleHelper(DB_STR_QUOTE_CURR_VALUE); break; - case _T('p'): + case 'p': FormatDoubleHelper(DB_STR_QUOTE_PREV_VALUE); break; } @@ -105,16 +105,16 @@ void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderBase& rProvider) void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderGoogleFinance&/* rProvider*/) { switch (m_chr) { - case _T('o'): + case 'o': FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_OPEN_VALUE); break; - case _T('d'): + case 'd': FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_DIFF, L"0"); break; - case _T('y'): + case 'y': FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE, L"0"); break; - case _T('n'): + case 'n': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION); break; } @@ -146,22 +146,22 @@ void CQuotesProviderVisitorFormater::FormatDoubleHelper(LPCSTR pszDbSet, void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderYahoo&) { switch (m_chr) { - case _T('o'): + case 'o': FormatDoubleHelper(DB_STR_YAHOO_OPEN_VALUE); break; - case _T('h'): + case 'h': FormatDoubleHelper(DB_STR_YAHOO_DAY_HIGH); break; - case _T('P'): + case 'P': FormatDoubleHelper(DB_STR_YAHOO_PREVIOUS_CLOSE); break; - case _T('c'): + case 'c': FormatDoubleHelper(DB_STR_YAHOO_CHANGE); break; - case _T('g'): + case 'g': FormatDoubleHelper(DB_STR_YAHOO_DAY_LOW); break; - case _T('n'): + case 'n': m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION); break; } diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormater.h b/plugins/Quotes/src/QuotesProviderVisitorFormater.h index 9ae3408d6a..0b03842a35 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormater.h +++ b/plugins/Quotes/src/QuotesProviderVisitorFormater.h @@ -4,7 +4,7 @@ class CQuotesProviderVisitorFormater : public CQuotesProviderVisitor { public: - CQuotesProviderVisitorFormater(MCONTACT hContact, TCHAR chr, int nWidth); + CQuotesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth); ~CQuotesProviderVisitorFormater(); const tstring& GetResult()const; @@ -22,7 +22,7 @@ private: private: MCONTACT m_hContact; - TCHAR m_chr; + wchar_t m_chr; tstring m_sResult; int m_nWidth; }; diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp index a4899909e1..1e6d4fe384 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(MCONTACT hContact, TCHAR chr) +CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(MCONTACT hContact, wchar_t chr) : m_hContact(hContact), m_chr(chr), m_bValid(false), m_dResult(0.0) { } @@ -8,11 +8,11 @@ CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(MCONTACT hContact void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase&) { switch (m_chr) { - case _T('r'): - case _T('R'): + case 'r': + case 'R': GetValue(DB_STR_QUOTE_CURR_VALUE); break; - case _T('p'): + case 'p': GetValue(DB_STR_QUOTE_PREV_VALUE); break; } @@ -21,13 +21,13 @@ void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase&) void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderGoogleFinance&) { switch (m_chr) { - case _T('o'): + case 'o': GetValue(DB_STR_GOOGLE_FINANCE_OPEN_VALUE); break; - case _T('d'): + case 'd': GetValue(DB_STR_GOOGLE_FINANCE_DIFF); break; - case _T('y'): + case 'y': GetValue(DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE); break; } @@ -36,19 +36,19 @@ void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderGoogleFinance&) void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderYahoo&) { switch (m_chr) { - case _T('o'): + case 'o': GetValue(DB_STR_YAHOO_OPEN_VALUE); break; - case _T('h'): + case 'h': GetValue(DB_STR_YAHOO_DAY_HIGH); break; - case _T('P'): + case 'P': GetValue(DB_STR_YAHOO_PREVIOUS_CLOSE); break; - case _T('c'): + case 'c': GetValue(DB_STR_YAHOO_CHANGE); break; - case _T('g'): + case 'g': GetValue(DB_STR_YAHOO_DAY_LOW); break; } diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.h b/plugins/Quotes/src/QuotesProviderVisitorTendency.h index 9f81605220..537f8bd0a6 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorTendency.h +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.h @@ -4,7 +4,7 @@ class CQuotesProviderVisitorTendency : public CQuotesProviderVisitor { public: - CQuotesProviderVisitorTendency(MCONTACT hContact, TCHAR chr); + CQuotesProviderVisitorTendency(MCONTACT hContact, wchar_t chr); bool IsValid()const{ return m_bValid; } double GetResult()const{ return m_dResult; } @@ -19,7 +19,7 @@ private: private: MCONTACT m_hContact; - TCHAR m_chr; + wchar_t m_chr; bool m_bValid; double m_dResult; }; diff --git a/plugins/Quotes/src/QuotesProviderYahoo.cpp b/plugins/Quotes/src/QuotesProviderYahoo.cpp index e590472834..cef09471c2 100644 --- a/plugins/Quotes/src/QuotesProviderYahoo.cpp +++ b/plugins/Quotes/src/QuotesProviderYahoo.cpp @@ -2,10 +2,10 @@ void remove_quotes(tstring& s) { - if (*s.begin() == _T('"')) + if (*s.begin() == '"') s.erase(s.begin()); - if (*s.rbegin() == _T('"')) { + if (*s.rbegin() == '"') { tstring::iterator i(s.begin()); std::advance(i, s.size() - 1); s.erase(i); @@ -14,12 +14,12 @@ void remove_quotes(tstring& s) void remove_end_of_line(tstring& s) { - if (*s.rbegin() == _T('\n')) { + if (*s.rbegin() == '\n') { tstring::iterator i(s.begin()); std::advance(i, s.size() - 1); s.erase(i); } - if (*s.rbegin() == _T('\r')) { + if (*s.rbegin() == '\r') { tstring::iterator i(s.begin()); std::advance(i, s.size() - 1); s.erase(i); @@ -83,7 +83,7 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) remove_end_of_line(sLine); TStrings asStrings; - for (tstring::size_type nPos = sLine.find(_T(',')); nPos != tstring::npos; nPos = sLine.find(_T(','))) { + for (tstring::size_type nPos = sLine.find(','); nPos != tstring::npos; nPos = sLine.find(',')) { tstring::iterator i(sLine.begin()); std::advance(i, nPos); tstring s(sLine.begin(), i); diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index ee548a211e..5e8b0f0751 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -82,25 +82,25 @@ void update_all_controls(HWND hDlg) ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), (bIsCheckedContactSpec&&bIsPopupServiceEnabled)); } -std::vector get_filter() +std::vector get_filter() { - std::vector aFilter; - LPCTSTR pszFilterParts[] = { LPGENT("Log Files (*.txt,*.log)"), L"*.txt;*.log", LPGENT("All files (*.*)"), L"*.*" }; + std::vector aFilter; + LPCTSTR pszFilterParts[] = { LPGENW("Log Files (*.txt,*.log)"), L"*.txt;*.log", LPGENW("All files (*.*)"), L"*.*" }; for (int i = 0; i < sizeof(pszFilterParts) / sizeof(pszFilterParts[0]); ++i) { tstring sPart = TranslateTS(pszFilterParts[i]); std::copy(sPart.begin(), sPart.end(), std::back_inserter(aFilter)); - aFilter.push_back(_T('\0')); + aFilter.push_back('\0'); } - aFilter.push_back(_T('\0')); + aFilter.push_back('\0'); return aFilter; } void select_log_file(HWND hDlg) { - std::vector aFileBuffer(_MAX_PATH * 2, _T('\0')); + std::vector aFileBuffer(_MAX_PATH * 2, '\0'); LPTSTR pszFile = &*aFileBuffer.begin(); - std::vector aFilterBuffer = get_filter(); + std::vector aFilterBuffer = get_filter(); LPCTSTR pszFilter = &*aFilterBuffer.begin(); OPENFILENAME ofn = { 0 }; @@ -957,7 +957,7 @@ bool ShowSettingsDlg(HWND hWndParent, CAdvProviderSettings* pAdvSettings) static void replace_invalid_char(tstring::value_type& rChar, tstring::value_type repl) { - static const TCHAR charInvalidSigns[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('\"'), _T('<'), _T('>'), _T('|') }; + static const wchar_t charInvalidSigns[] = { '\\', '/', ':', '*', '?', '\"', '<', '>', '|' }; for (int i = 0; i < sizeof(charInvalidSigns) / sizeof(charInvalidSigns[0]); ++i) { if (rChar == charInvalidSigns[i]) { @@ -976,13 +976,13 @@ tstring GenerateLogFileName(const tstring &rsLogFilePattern, const tstring &rsQu tstring::size_type n = sPath.find(g_pszVariableQuoteName); if (tstring::npos != n) { tstring s = rsQuoteSymbol; - std::for_each(s.begin(), s.end(), boost::bind(replace_invalid_char, _1, _T('_'))); + std::for_each(s.begin(), s.end(), boost::bind(replace_invalid_char, _1, '_')); sPath.replace(n, mir_tstrlen(g_pszVariableQuoteName), s.c_str()); } } if (nFlags & glfnResolveUserProfile) { - TCHAR *ptszParsedName = Utils_ReplaceVarsT(sPath.c_str()); + wchar_t *ptszParsedName = Utils_ReplaceVarsT(sPath.c_str()); if (ptszParsedName) { sPath = ptszParsedName; mir_free(ptszParsedName); diff --git a/plugins/Quotes/src/WinCtrlHelper.cpp b/plugins/Quotes/src/WinCtrlHelper.cpp index 18662cb0cd..78be2d2ced 100644 --- a/plugins/Quotes/src/WinCtrlHelper.cpp +++ b/plugins/Quotes/src/WinCtrlHelper.cpp @@ -15,7 +15,7 @@ static INT_PTR CALLBACK VariableListDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPAR std::for_each(raSpec.begin(), raSpec.end(), [&o](const CQuotesProviderVisitorFormatSpecificator::CFormatSpecificator& spec) { - o << spec.m_sSymbol << _T('\t') << spec.m_sDesc << L"\r\n"; + o << spec.m_sSymbol << '\t' << spec.m_sDesc << L"\r\n"; }); ::SetDlgItemText(hWnd, IDC_EDIT_VARIABLE, o.str().c_str()); } diff --git a/plugins/Quotes/src/WinCtrlHelper.h b/plugins/Quotes/src/WinCtrlHelper.h index 52e4521f24..1c5777d45d 100644 --- a/plugins/Quotes/src/WinCtrlHelper.h +++ b/plugins/Quotes/src/WinCtrlHelper.h @@ -7,7 +7,7 @@ inline tstring get_window_text(HWND hWnd) { int cBytes = ::GetWindowTextLength(hWnd); - std::vector aBuf(cBytes + 1); + std::vector aBuf(cBytes + 1); LPTSTR pBuffer = &*(aBuf.begin()); ::GetWindowText(hWnd, pBuffer, cBytes + 1); diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index bb38b5b290..d4c5d2ffc1 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -50,7 +50,7 @@ typedef std::wistream tistream; typedef boost::posix_time::wtime_input_facet ttime_input_facet; typedef boost::posix_time::wtime_facet ttime_facet; -inline std::string quotes_t2a(const TCHAR* t) +inline std::string quotes_t2a(const wchar_t* t) { std::string s; char* p = mir_t2a(t); @@ -64,7 +64,7 @@ inline std::string quotes_t2a(const TCHAR* t) inline tstring quotes_a2t(const char* s) { tstring t; - TCHAR* p = mir_a2t(s); + wchar_t* p = mir_a2t(s); if (p) { t = p; mir_free(p); -- cgit v1.2.3