mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-01 17:57:25 +00:00
Allow GenerateText() to indicate failure to encode flatbuffer to JSON (i.e., non-UTF-8 string data)
This commit is contained in:
parent
f0d91fa143
commit
94d5643f97
4 changed files with 119 additions and 52 deletions
|
|
@ -46,7 +46,10 @@ int main(int /*argc*/, const char * /*argv*/[]) {
|
|||
// to ensure it is correct, we now generate text back from the binary,
|
||||
// and compare the two:
|
||||
std::string jsongen;
|
||||
GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
|
||||
if (!GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen)) {
|
||||
printf("Couldn't serialize parsed data to JSON!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (jsongen != jsonfile) {
|
||||
printf("%s----------------\n%s", jsongen.c_str(), jsonfile.c_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue