summaryrefslogtreecommitdiff
path: root/zen/json.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-02-02 21:49:34 +0000
committerB Stack <bgstack15@gmail.com>2021-02-02 21:49:34 +0000
commit26b8bd6eb07b78adad36049e03494a2931b231af (patch)
tree4d7c950512836f473a6a8cbb521c61e800db6584 /zen/json.h
parentMerge branch '11.5' into 'master' (diff)
parentadd upstream 11.6 (diff)
downloadFreeFileSync-26b8bd6eb07b78adad36049e03494a2931b231af.tar.gz
FreeFileSync-26b8bd6eb07b78adad36049e03494a2931b231af.tar.bz2
FreeFileSync-26b8bd6eb07b78adad36049e03494a2931b231af.zip
Merge branch '11.6' into 'master'11.6
add upstream 11.6 See merge request opensource-tracking/FreeFileSync!30
Diffstat (limited to 'zen/json.h')
-rw-r--r--zen/json.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/zen/json.h b/zen/json.h
index 82e5e271..a3740664 100644
--- a/zen/json.h
+++ b/zen/json.h
@@ -95,15 +95,15 @@ namespace json_impl
{
namespace
{
-std::string jsonEscape(const std::string& str)
+[[nodiscard]] std::string jsonEscape(const std::string& str)
{
std::string output;
for (const char c : str)
switch (c)
{
//*INDENT-OFF*
- case '"': output += "\\\""; break; //escaping mandatory
case '\\': output += "\\\\"; break; //
+ case '"': output += "\\\""; break; //escaping mandatory
case '\b': output += "\\b"; break; //
case '\f': output += "\\f"; break; //
@@ -128,7 +128,7 @@ std::string jsonEscape(const std::string& str)
}
-std::string jsonUnescape(const std::string& str)
+[[nodiscard]] std::string jsonUnescape(const std::string& str)
{
std::string output;
std::basic_string<impl::Char16> utf16Buf;
@@ -152,7 +152,6 @@ std::string jsonUnescape(const std::string& str)
for (auto it = str.begin(); it != str.end(); ++it)
{
const char c = *it;
-
if (c == '\\')
{
++it;
@@ -166,8 +165,8 @@ std::string jsonUnescape(const std::string& str)
switch (c2)
{
//*INDENT-OFF*
- case '"':
case '\\':
+ case '"':
case '/': writeOut(c2); break;
case 'b': writeOut('\b'); break;
case 'f': writeOut('\f'); break;
bgstack15