diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2020-11-05 23:04:37 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2020-11-05 23:04:37 +0100 |
commit | a4e999eec5ad08eb663f94fef0e9590daf1e5b5f (patch) | |
tree | 76878bff2230b18932c9fa126bce8ec4c904439c /storage/connect/json.cpp | |
parent | addb28f62dc205e61c70e6ca8ef8547bfa44c50a (diff) | |
download | mariadb-git-a4e999eec5ad08eb663f94fef0e9590daf1e5b5f.tar.gz |
Try to fix failing tests
Diffstat (limited to 'storage/connect/json.cpp')
-rw-r--r-- | storage/connect/json.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 11553e2f0dd..1006c9c9de1 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -1053,7 +1053,7 @@ PSZ JOBJECT::GetText(PGLOBAL g, PSZ text) return text; if (!text) { - text = (char*)PlugSubAlloc(g, NULL, 512); // TODO: get size + text = (PSZ)malloc(1024); // TODO: get size text[0] = 0; n = 1; } else @@ -1079,10 +1079,14 @@ PSZ JOBJECT::GetText(PGLOBAL g, PSZ text) } else for (PJPR jp = First; jp; jp = jp->Next) jp->Val->GetText(g, text); - //if (n) - // PlugSubAlloc(g, NULL, strlen(text) + 1); + if (n) { + PSZ txt = (PSZ)PlugSubAlloc(g, NULL, strlen(text)); + strcpy(txt, text + 1); // Remove leading blank + free(text); + text = txt; + } // endif n - return text + n; + return text; } // end of GetText; /***********************************************************************/ @@ -1290,7 +1294,7 @@ PSZ JARRAY::GetText(PGLOBAL g, PSZ text) PJVAL jp; if (!text) { - text = (char*)PlugSubAlloc(g, NULL, 512); + text = (char*)malloc(1024); // Should be large enough text[0] = 0; n = 1; } else @@ -1299,10 +1303,14 @@ PSZ JARRAY::GetText(PGLOBAL g, PSZ text) for (jp = First; jp; jp = jp->Next) jp->GetText(g, text); - //if (n) - // PlugSubAlloc(g, NULL, strlen(text) + 1); + if (n) { + PSZ txt = (PSZ)PlugSubAlloc(g, NULL, strlen(text)); + strcpy(txt, text + 1); // Remove leading blank + free(text); + text = txt; + } // endif n - return text + n; + return text; } // end of GetText; /***********************************************************************/ |