summaryrefslogtreecommitdiff
path: root/zen/json.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-02-02 11:44:31 -0500
committerB Stack <bgstack15@gmail.com>2021-02-02 11:44:31 -0500
commitd299ddd2f27a437f0fc0cb49abdfd6dd8e3d94f8 (patch)
tree4d7c950512836f473a6a8cbb521c61e800db6584 /zen/json.h
parentMerge branch '11.5' into 'master' (diff)
downloadFreeFileSync-d299ddd2f27a437f0fc0cb49abdfd6dd8e3d94f8.tar.gz
FreeFileSync-d299ddd2f27a437f0fc0cb49abdfd6dd8e3d94f8.tar.bz2
FreeFileSync-d299ddd2f27a437f0fc0cb49abdfd6dd8e3d94f8.zip
add upstream 11.6
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