[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - tools/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 06:36:37 UTC 2021


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

New commits:
commit aa9ade7274197aa8f7b6990cc2094ad162d8a9e3
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 25 12:55:49 2020 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Feb 24 07:36:01 2021 +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>
    (cherry picked from commit 6002ff0354c95c3dffbf4f933833695f3f47b73b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111418
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx
index d1e1997320a1..9319db2799bc 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -152,6 +152,27 @@ void JsonWriter::put(const char* pPropName, 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