summaryrefslogtreecommitdiff
path: root/plugins/Quotes/src/CreateFilePath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Quotes/src/CreateFilePath.cpp')
-rw-r--r--plugins/Quotes/src/CreateFilePath.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/plugins/Quotes/src/CreateFilePath.cpp b/plugins/Quotes/src/CreateFilePath.cpp
index 5f1ea74ef7..e02cb91cd3 100644
--- a/plugins/Quotes/src/CreateFilePath.cpp
+++ b/plugins/Quotes/src/CreateFilePath.cpp
@@ -1,25 +1,19 @@
#include "StdAfx.h"
-namespace
+static TCHAR InvalidSymbols[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('"'), _T('<'), _T('>'), _T('|') };
+
+TCHAR replace_invalid_symbol(TCHAR chr)
{
- TCHAR replace_invalid_symbol(TCHAR chr)
- {
- TCHAR InvaliSymbols[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('"'), _T('<'), _T('>'), _T('|') };
- for (int i = 0; i < sizeof(InvaliSymbols) / sizeof(InvaliSymbols[0]); ++i)
- {
- if (chr == InvaliSymbols[i])
- {
- return _T('_');
- }
- }
+ for (int i = 0; i < _countof(InvalidSymbols); ++i)
+ if (chr == InvalidSymbols[i])
+ return _T('_');
- return chr;
- }
+ return chr;
+}
- void prepare_name(tstring& rsName)
- {
- std::transform(rsName.begin(), rsName.end(), rsName.begin(), boost::bind(replace_invalid_symbol, _1));
- }
+void prepare_name(tstring& rsName)
+{
+ std::transform(rsName.begin(), rsName.end(), rsName.begin(), boost::bind(replace_invalid_symbol, _1));
}
tstring CreateFilePath(const tstring& rsName)
@@ -29,9 +23,7 @@ tstring CreateFilePath(const tstring& rsName)
TCHAR* p = _tcsrchr(szPath, _T('\\'));
if (p)
- {
*p = 0;
- }
tstring s(rsName);
prepare_name(s);