summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2019-03-25 10:49:07 -0700
committerGitHub <noreply@github.com>2019-03-25 10:49:07 -0700
commita8a0bc73b981bd94509c180ad8cac36143c479ec (patch)
tree34409f1f9cfb3e4c857dfbfe19abf84840d644d7 /upb
parent0ca4edd7d981e96e989701f10bf469749b48b3ae (diff)
Allow bytes field to be longer than 16000 bytes (#157)
Diffstat (limited to 'upb')
-rw-r--r--upb/json/printer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/upb/json/printer.c b/upb/json/printer.c
index 26cc020..72f26b2 100644
--- a/upb/json/printer.c
+++ b/upb/json/printer.c
@@ -450,9 +450,14 @@ static size_t putbytes(void *closure, const void *handler_data, const char *str,
UPB_UNUSED(handler_data);
UPB_UNUSED(handle);
+ print_data(p, "\"", 1);
+
while (remaining > 2) {
- /* TODO(haberman): handle encoded lengths > sizeof(data) */
- UPB_ASSERT((limit - to) >= 4);
+ if (limit - to < 4) {
+ bytes = to - data;
+ putstring(p, data, bytes);
+ to = data;
+ }
to[0] = base64[from[0] >> 2];
to[1] = base64[((from[0] & 0x3) << 4) | (from[1] >> 4)];
@@ -484,7 +489,6 @@ static size_t putbytes(void *closure, const void *handler_data, const char *str,
}
bytes = to - data;
- print_data(p, "\"", 1);
putstring(p, data, bytes);
print_data(p, "\"", 1);
return len;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback