From e2c5725968ca4f136c0a597862c31afc3589f956 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Thu, 27 Oct 2016 12:08:39 +0200 Subject: [PATCH] json: workaround for const char* storage Convert produced data into normal JSON string. Zero-string converted to null. Signed-off-by: Sergey Linev --- io/io/src/TBufferJSON.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/io/io/src/TBufferJSON.cxx b/io/io/src/TBufferJSON.cxx index 818448d13b75e..e464b4e05f706 100644 --- a/io/io/src/TBufferJSON.cxx +++ b/io/io/src/TBufferJSON.cxx @@ -1389,13 +1389,17 @@ void TBufferJSON::PerformPostProcessing(TJSONStackObj *stack, const char *typname = elem->IsBase() ? elem->GetName() : elem->GetTypeName(); Bool_t isTObject = (elem->GetType() == TStreamerInfo::kTObject) || (strcmp("TObject", typname) == 0); + Bool_t isCharStar = elem->GetType() == TStreamerInfo::kCharStar; Bool_t isTString = elem->GetType() == TStreamerInfo::kTString; Bool_t isSTLstring = elem->GetType() == TStreamerInfo::kSTLstring; Bool_t isOffsetPArray = (elem->GetType() > TStreamerInfo::kOffsetP) && (elem->GetType() < TStreamerInfo::kOffsetP + 20); Bool_t isTArray = (strncmp("TArray", typname, 6) == 0); - if (isTString || isSTLstring) { + if (isCharStar) { + stack->fValues.Delete(); + if (fValue == "0") fValue = "null"; + } else if (isTString || isSTLstring) { // just remove all kind of string length information if (gDebug > 3)