projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c9669e9
)
Fix unescape_string removing all backslashes
author
ShadowNinja
<shadowninja@minetest.net>
Thu, 15 Jan 2015 21:14:40 +0000
(16:14 -0500)
committer
ShadowNinja
<shadowninja@minetest.net>
Thu, 15 Jan 2015 21:16:41 +0000
(16:16 -0500)
src/util/string.h
patch
|
blob
|
history
diff --git
a/src/util/string.h
b/src/util/string.h
index 3cb0f7bec15af0e51940cdcf7faf33e082b5fa51..fa298bfaa9f926699127bee36e63ec94cb23da39 100644
(file)
--- a/
src/util/string.h
+++ b/
src/util/string.h
@@
-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>
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;
for (size_t i = 0; i < s.length(); i++) {
- if (s[i] != '\\')
- res += s[i];
+ if (s[i] == '\\')
+ i++;
+ if (i >= s.length())
+ break;
+ res += s[i];
}
return res;