diff options
author | George Hazan <george.hazan@gmail.com> | 2016-02-25 13:36:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-02-25 13:36:37 +0000 |
commit | 42095fb5cb7228f9dfb94965988029fd7f47b793 (patch) | |
tree | 6185ec5d7450fb474ed80b0ce95d0d1c0e0b26a8 /plugins/Quotes/src/CreateFilePath.cpp | |
parent | 8e891173c74ceaa0964f32be247f380fd5f8bcd1 (diff) |
Quotes: major code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16335 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes/src/CreateFilePath.cpp')
-rw-r--r-- | plugins/Quotes/src/CreateFilePath.cpp | 30 |
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);
|