summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/CurrencyRates/src/CreateFilePath.cpp20
-rw-r--r--plugins/CurrencyRates/src/DBUtils.cpp7
-rw-r--r--plugins/CurrencyRates/src/DBUtils.h2
-rw-r--r--plugins/CurrencyRates/src/ModuleInfo.cpp4
-rw-r--r--plugins/CurrencyRates/src/SettingsDlg.cpp4
-rw-r--r--plugins/CurrencyRates/src/stdafx.h2
6 files changed, 13 insertions, 26 deletions
diff --git a/plugins/CurrencyRates/src/CreateFilePath.cpp b/plugins/CurrencyRates/src/CreateFilePath.cpp
index 18a8896e9d..71490432a9 100644
--- a/plugins/CurrencyRates/src/CreateFilePath.cpp
+++ b/plugins/CurrencyRates/src/CreateFilePath.cpp
@@ -1,22 +1,6 @@
#include "StdAfx.h"
-static wchar_t InvalidSymbols[] = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
-
-static wchar_t replace_invalid_symbol(wchar_t chr)
-{
- for (int i = 0; i < _countof(InvalidSymbols); ++i)
- if (chr == InvalidSymbols[i])
- return '_';
-
- return chr;
-}
-
-void prepare_name(tstring& rsName)
-{
- std::transform(rsName.begin(), rsName.end(), rsName.begin(), boost::bind(replace_invalid_symbol, _1));
-}
-
-tstring CreateFilePath(const tstring& rsName)
+tstring CreateFilePath(const tstring &rsName)
{
wchar_t szPath[_MAX_PATH];
::GetModuleFileName(g_plugin.getInst(), szPath, _MAX_PATH);
@@ -26,7 +10,7 @@ tstring CreateFilePath(const tstring& rsName)
*p = 0;
tstring s(rsName);
- prepare_name(s);
+ FixInvalidChars(s);
tostringstream o;
o << szPath << L"\\CurrencyRates\\" << s;
return o.str();
diff --git a/plugins/CurrencyRates/src/DBUtils.cpp b/plugins/CurrencyRates/src/DBUtils.cpp
index fa3df0c528..20189c0f3f 100644
--- a/plugins/CurrencyRates/src/DBUtils.cpp
+++ b/plugins/CurrencyRates/src/DBUtils.cpp
@@ -34,3 +34,10 @@ bool CurrencyRates_DBReadDouble(MCONTACT hContact, const char *szModule, const c
db_free(&dbv);
return bResult;
}
+
+void FixInvalidChars(tstring &s)
+{
+ for (auto &c : s)
+ if (wcschr(L"\\/:*?\"<>|", c))
+ c = '_';
+}
diff --git a/plugins/CurrencyRates/src/DBUtils.h b/plugins/CurrencyRates/src/DBUtils.h
index a38a3725b1..e479fc0114 100644
--- a/plugins/CurrencyRates/src/DBUtils.h
+++ b/plugins/CurrencyRates/src/DBUtils.h
@@ -1,6 +1,8 @@
#ifndef __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
#define __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
+void FixInvalidChars(tstring &s);
+
std::wstring GetNodeText(const TiXmlElement*);
std::wstring CurrencyRates_DBGetStringW(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t* pszDefValue = nullptr);
diff --git a/plugins/CurrencyRates/src/ModuleInfo.cpp b/plugins/CurrencyRates/src/ModuleInfo.cpp
index 069f902238..5e0504cdfc 100644
--- a/plugins/CurrencyRates/src/ModuleInfo.cpp
+++ b/plugins/CurrencyRates/src/ModuleInfo.cpp
@@ -25,10 +25,8 @@ MWindowList CModuleInfo::GetWindowList(const std::string& rsKey, bool bAllocateI
void CModuleInfo::OnMirandaShutdown()
{
- BOOST_FOREACH(THandles::value_type p, g_ahWindowLists)
- {
+ for (auto &p : g_ahWindowLists)
WindowList_Broadcast(p.second, WM_CLOSE, 0, 0);
- }
}
CModuleInfo::TCurrencyRatesProvidersPtr CModuleInfo::GetCurrencyRateProvidersPtr()
diff --git a/plugins/CurrencyRates/src/SettingsDlg.cpp b/plugins/CurrencyRates/src/SettingsDlg.cpp
index 7ac0a52361..ef81b22a41 100644
--- a/plugins/CurrencyRates/src/SettingsDlg.cpp
+++ b/plugins/CurrencyRates/src/SettingsDlg.cpp
@@ -964,9 +964,7 @@ tstring GenerateLogFileName(const tstring &rsLogFilePattern, const tstring &rsCu
tstring::size_type n = sPath.find(g_pszVariableCurrencyRateName);
if (tstring::npos != n) {
tstring s = rsCurrencyRateSymbol;
- for (auto &c : s)
- if (wcschr(L"\\/:*?\"<>|", c))
- c = '_';
+ FixInvalidChars(s);
sPath.replace(n, _countof(g_pszVariableCurrencyRateName)-1, s.c_str());
}
}
diff --git a/plugins/CurrencyRates/src/stdafx.h b/plugins/CurrencyRates/src/stdafx.h
index 362e0d63e8..a3c13386fe 100644
--- a/plugins/CurrencyRates/src/stdafx.h
+++ b/plugins/CurrencyRates/src/stdafx.h
@@ -37,9 +37,7 @@
#include <m_CurrencyRates.h>
#include <m_toptoolbar.h>
-#include <boost\bind.hpp>
#include <boost\scoped_ptr.hpp>
-#include <boost\foreach.hpp>
#include <boost\date_time\posix_time\posix_time.hpp>
#include <boost\date_time\c_local_time_adjustor.hpp>