|
|
@ -59,13 +59,14 @@ static upb_StringView upbc_JsonEncode(const upbc_CodeGeneratorRequest* request, |
|
|
|
|
|
|
|
|
|
|
|
upb_DefPool* s = upb_DefPool_New(); |
|
|
|
upb_DefPool* s = upb_DefPool_New(); |
|
|
|
const upb_MessageDef* m = upbc_CodeGeneratorRequest_getmsgdef(s); |
|
|
|
const upb_MessageDef* m = upbc_CodeGeneratorRequest_getmsgdef(s); |
|
|
|
|
|
|
|
const int options = upb_JsonEncode_FormatEnumsAsIntegers; |
|
|
|
|
|
|
|
|
|
|
|
out.size = upb_JsonEncode(request, m, s, 0, NULL, 0, status); |
|
|
|
out.size = upb_JsonEncode(request, m, s, options, NULL, 0, status); |
|
|
|
if (!upb_Status_IsOk(status)) goto done; |
|
|
|
if (!upb_Status_IsOk(status)) goto done; |
|
|
|
|
|
|
|
|
|
|
|
char* data = (char*)upb_Arena_Malloc(arena, out.size + 1); |
|
|
|
char* data = (char*)upb_Arena_Malloc(arena, out.size + 1); |
|
|
|
|
|
|
|
|
|
|
|
(void)upb_JsonEncode(request, m, s, 0, data, out.size + 1, status); |
|
|
|
(void)upb_JsonEncode(request, m, s, options, data, out.size + 1, status); |
|
|
|
if (!upb_Status_IsOk(status)) goto done; |
|
|
|
if (!upb_Status_IsOk(status)) goto done; |
|
|
|
|
|
|
|
|
|
|
|
out.data = (const char*)data; |
|
|
|
out.data = (const char*)data; |
|
|
|