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
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user