Tweak json decode_trailer whitespace_length var

This commit is contained in:
Nigel Tao committed 2022-01-25 20:36:10 +11:00
1 parent ad46513ded
commit b374b2b34f
2 files changed
+2 -12

No files matched your search

+1 -6
View File
@@ -34423,23 +34423,21 @@ wuffs_json__decoder__decode_trailer(
if (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(1);
v_whitespace_length = 0;
goto label__outer__continue;
}
v_whitespace_length = 0;
while (true) {
if (((uint64_t)(io2_a_src - iop_a_src)) <= 0) {
if (v_whitespace_length > 0) {
*iop_a_dst++ = wuffs_base__make_token(
(((uint64_t)(0)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(v_whitespace_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
v_whitespace_length = 0;
}
if (a_src && a_src->meta.closed) {
goto label__outer__break;
}
status = wuffs_base__make_status(wuffs_base__suspension__short_read);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(2);
v_whitespace_length = 0;
goto label__outer__continue;
}
v_c = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
@@ -34448,7 +34446,6 @@ wuffs_json__decoder__decode_trailer(
*iop_a_dst++ = wuffs_base__make_token(
(((uint64_t)(0)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(v_whitespace_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
v_whitespace_length = 0;
}
if (self->private_impl.f_trailer_stop > 0) {
status = wuffs_base__make_status(wuffs_json__error__bad_input);
@@ -34472,7 +34469,6 @@ wuffs_json__decoder__decode_trailer(
goto suspend;
}
v_c = 0;
v_whitespace_length = 0;
if (self->private_impl.f_comment_type > 0) {
goto label__outer__continue;
}
@@ -34484,7 +34480,6 @@ wuffs_json__decoder__decode_trailer(
*iop_a_dst++ = wuffs_base__make_token(
(((uint64_t)(0)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)((v_whitespace_length + 1))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
v_whitespace_length = 0;
if (v_c == self->private_impl.f_trailer_stop) {
status = wuffs_base__make_status(NULL);
goto ok;
+1 -6
View File
@@ -1688,10 +1688,10 @@ pri func decoder.decode_trailer?(dst: base.token_writer, src: base.io_reader) {
while.outer true {
if args.dst.length() <= 0 {
yield? base."$short write"
whitespace_length = 0
continue.outer
}
whitespace_length = 0
while.inner true,
pre args.dst.length() > 0,
{
@@ -1699,13 +1699,11 @@ pri func decoder.decode_trailer?(dst: base.token_writer, src: base.io_reader) {
if whitespace_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0, value_minor: 0, continued: 0, length: whitespace_length)
whitespace_length = 0
}
if args.src.is_closed() {
break.outer
}
yield? base."$short read"
whitespace_length = 0
continue.outer
}
@@ -1714,14 +1712,12 @@ pri func decoder.decode_trailer?(dst: base.token_writer, src: base.io_reader) {
if whitespace_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0, value_minor: 0, continued: 0, length: whitespace_length)
whitespace_length = 0
}
if this.trailer_stop > 0 {
return "#bad input"
}
this.decode_comment?(dst: args.dst, src: args.src)
c = 0
whitespace_length = 0
if this.comment_type > 0 {
continue.outer
}
@@ -1732,7 +1728,6 @@ pri func decoder.decode_trailer?(dst: base.token_writer, src: base.io_reader) {
if (whitespace_length >= 0xFFFE) or (c == this.trailer_stop) {
args.dst.write_simple_token_fast!(
value_major: 0, value_minor: 0, continued: 0, length: whitespace_length + 1)
whitespace_length = 0
if c == this.trailer_stop {
return ok
}