Fix unescape_string removing all backslashes

master
ShadowNinja 2015-01-15 16:14:40 -05:00
parent c9669e90bb
commit 77e20a0c21
1 changed files with 6 additions and 4 deletions

View File

@ -398,8 +398,7 @@ inline std::string wrap_rows(const std::string &from,
/** /**
* Removes all backslashes from a string that had been escaped (FormSpec strings) * Removes backslashes from an escaped string (FormSpec strings)
*
*/ */
template <typename T> template <typename T>
inline std::basic_string<T> unescape_string(std::basic_string<T> &s) inline std::basic_string<T> unescape_string(std::basic_string<T> &s)
@ -407,8 +406,11 @@ inline std::basic_string<T> unescape_string(std::basic_string<T> &s)
std::basic_string<T> res; std::basic_string<T> res;
for (size_t i = 0; i < s.length(); i++) { for (size_t i = 0; i < s.length(); i++) {
if (s[i] != '\\') if (s[i] == '\\')
res += s[i]; i++;
if (i >= s.length())
break;
res += s[i];
} }
return res; return res;