[Libreoffice-commits] core.git: tools/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 28 12:27:26 UTC 2020


 tools/source/misc/json_writer.cxx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit 6002ff0354c95c3dffbf4f933833695f3f47b73b
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 25 12:55:49 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Dec 28 13:26:46 2020 +0100

    tools: json: fix missing escaped chars
    
    When client side tries to show the "Macro Security Warning"
    message dialog, it fails to parse the JSON objects
    
    Change-Id: Id73c291ddd9cf739d63d69f06094eacb7b43a2f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108287
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx
index 1246f0578fca..a50e2ada967f 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -140,6 +140,27 @@ void JsonWriter::writeEscapedOUString(const OUString& rPropVal)
             *mPos = static_cast<char>(ch);
             ++mPos;
         }
+        else if (ch == '\n')
+        {
+            *mPos = '\\';
+            ++mPos;
+            *mPos = 'n';
+            ++mPos;
+        }
+        else if (ch == '\r')
+        {
+            *mPos = '\\';
+            ++mPos;
+            *mPos = 'r';
+            ++mPos;
+        }
+        else if (ch == '\f')
+        {
+            *mPos = '\\';
+            ++mPos;
+            *mPos = 'f';
+            ++mPos;
+        }
         else if (ch <= 0x7F)
         {
             *mPos = static_cast<char>(ch);


More information about the Libreoffice-commits mailing list