diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2024-05-17 17:49:32 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2024-05-23 10:29:28 +0200 |
commit | 9d1956031ed326e3d377800530993dcd2571f99a (patch) | |
tree | 35ea7666a2e17d0f32eed9af2ff9ec2a74e30ce4 /desktop | |
parent | a4ec8307e342bd83e287b197ffac822ac7e9f599 (diff) |
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.meeks@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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()); |