desktop/source/lib/init.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 457f24c004590a28d200fdda79bf468d363fff69
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri May 17 17:49:32 2024 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri May 17 20:42:26 2024 +0200

    lok: stop amazing waste of pretty-printed JSON sent over the API.
    
    before:
    
    INCOMING: commandvalues: {
        "commandName": ".uno:CharFontName",
        "commandValues": {
            "Albany AMT": [
                "6",
                "7",
                "8",
                "9",
                "10",
                "10.5",
                "11",
                "12",
    
            <truncated 199,811 chars>
    
    after:
    
    INCOMING: commandvalues: {"commandName":".uno:CharFontName","commandValues":
    {"Albany AMT":["6","7","8","9","10","10.5","11","12","13","14","15","16",
    "18","20","21","22","24","26","28","32","36","40","42","44","48","54",
    "60","66","72","80","88","96"],"Amiri":["6","7"
    
            <truncated 58,418 chars>
    
    A 3x size saving.
    
    Change-Id: I574b8bdf790078c61b7605137a47a531dee16f1e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167789
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 298d15b4ddf6..9608c5374da7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6013,7 +6013,7 @@ static char* getDocReadOnly(LibreOfficeKitDocument* pThis)
     aTree.put("success", pObjectShell->IsLoadReadonly());
 
     std::stringstream aStream;
-    boost::property_tree::write_json(aStream, aTree);
+    boost::property_tree::write_json(aStream, aTree, false /* pretty */);
     char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
     if (!pJson)
         return nullptr;
@@ -6072,7 +6072,7 @@ static char* getLanguages(const char* pCommand)
         addLocale(aValues, rLocale);
     aTree.add_child("commandValues", aValues);
     std::stringstream aStream;
-    boost::property_tree::write_json(aStream, aTree);
+    boost::property_tree::write_json(aStream, aTree, false /* pretty */);
     char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
     assert(pJson); // Don't handle OOM conditions
     strcpy(pJson, aStream.str().c_str());
@@ -6113,7 +6113,7 @@ static char* getFonts (const char* pCommand)
     }
     aTree.add_child("commandValues", aValues);
     std::stringstream aStream;
-    boost::property_tree::write_json(aStream, aTree);
+    boost::property_tree::write_json(aStream, aTree, false /* pretty */);
     char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
     assert(pJson); // Don't handle OOM conditions
     strcpy(pJson, aStream.str().c_str());
@@ -6148,7 +6148,7 @@ static char* getFontSubset (std::string_view aFontName)
 
     aTree.add_child("commandValues", aValues);
     std::stringstream aStream;
-    boost::property_tree::write_json(aStream, aTree);
+    boost::property_tree::write_json(aStream, aTree, false /* pretty */);
     char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
     assert(pJson); // Don't handle OOM conditions
     strcpy(pJson, aStream.str().c_str());
@@ -6271,7 +6271,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 
     aTree.add_child("commandValues", aValues);
     std::stringstream aStream;
-    boost::property_tree::write_json(aStream, aTree);
+    boost::property_tree::write_json(aStream, aTree, false /* pretty */);
     char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
     assert(pJson); // Don't handle OOM conditions
     strcpy(pJson, aStream.str().c_str());

Reply via email to