desktop/source/lib/init.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit 9d1956031ed326e3d377800530993dcd2571f99a Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri May 17 17:49:32 2024 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Thu May 23 10:29:28 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/+/167685 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Jenkins diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3b4b9f11a4d4..7730614d6a49 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5969,7 +5969,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; @@ -6028,7 +6028,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()); @@ -6069,7 +6069,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()); @@ -6104,7 +6104,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()); @@ -6227,7 +6227,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());