diff options
Diffstat (limited to 'src/Remember.cc')
-rw-r--r-- | src/Remember.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/Remember.cc b/src/Remember.cc index 80de7ae..f70217e 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -224,19 +224,24 @@ void Application::reset() { | |||
224 | namespace { | 224 | namespace { |
225 | 225 | ||
226 | // replace special chars like ( ) and [ ] with \( \) and \[ \] | 226 | // replace special chars like ( ) and [ ] with \( \) and \[ \] |
227 | static string escapeRememberChars(string str) { | 227 | string escapeRememberChars(const string& str) { |
228 | if (str.empty()) | 228 | if (str.empty()) |
229 | return str; | 229 | return str; |
230 | 230 | ||
231 | str = FbTk::StringUtil::replaceString(str, "(", "\\("); | 231 | string escaped_str; |
232 | str = FbTk::StringUtil::replaceString(str, ")", "\\)"); | 232 | escaped_str.reserve(str.capacity()); |
233 | str = FbTk::StringUtil::replaceString(str, "[", "\\["); | 233 | |
234 | str = FbTk::StringUtil::replaceString(str, "]", "\\]"); | 234 | string::const_iterator i; |
235 | return str; | 235 | for (i = str.begin(); i != str.end(); i++) { |
236 | } | 236 | switch (*i) { |
237 | case '(': case ')': case '[': case ']': | ||
238 | escaped_str += '\\'; | ||
239 | default: | ||
240 | escaped_str += *i; | ||
241 | } | ||
242 | } | ||
237 | 243 | ||
238 | bool getuint(const char *val, unsigned int &ret) { | 244 | return escaped_str; |
239 | return (sscanf(val, "%u", &ret) == 1); | ||
240 | } | 245 | } |
241 | 246 | ||
242 | class RememberMenuItem : public FbTk::MenuItem { | 247 | class RememberMenuItem : public FbTk::MenuItem { |