diff --git a/build-all.sh b/build-all.sh index 41e85727..ff45d826 100755 --- a/build-all.sh +++ b/build-all.sh @@ -61,3 +61,13 @@ for f in fuzz/c/std/*_fuzzer.c; do echo Building $f gcc -DWUFFS_CONFIG__FUZZLIB_MAIN $f -o ${f%.c}.out done + +# If you wanted to build a release edition now, do something like: +# wuffs genrelease -version=0.0.0-manualtest + +# Even if we don't build the release editions, check that they compile with +# -Wall -Werror. +for f in release/c/wuffs-*/*.c; do + gcc -c -Wall -Werror -std=c99 $f -o /dev/null + g++ -c -std=c++11 $f -o /dev/null +done diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index 03bc7337..d35b11d1 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -1568,6 +1568,7 @@ typedef struct { } c_decode_ae[1]; struct { uint32_t coro_susp_point; + uint8_t v_c; uint8_t v_flags; uint64_t scratch; } c_decode_gc[1]; @@ -3414,6 +3415,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_gc( wuffs_base__io_reader a_src) { wuffs_base__status status = WUFFS_BASE__STATUS_OK; + uint8_t v_c; uint8_t v_flags; uint8_t* ioptr_src = NULL; @@ -3434,6 +3436,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_gc( uint32_t coro_susp_point = self->private_impl.c_decode_gc[0].coro_susp_point; if (coro_susp_point) { + v_c = self->private_impl.c_decode_gc[0].v_c; v_flags = self->private_impl.c_decode_gc[0].v_flags; } else { } @@ -3444,12 +3447,15 @@ static wuffs_base__status wuffs_gif__decoder__decode_gc( status = WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL; goto exit; } - WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1); - if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { - goto short_read_src; + { + WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1); + if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { + goto short_read_src; + } + uint8_t t_0 = *ioptr_src++; + v_c = t_0; } - uint8_t t_0 = *ioptr_src++; - if (t_0 != 4) { + if (v_c != 4) { status = WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL; goto exit; } @@ -3506,12 +3512,15 @@ static wuffs_base__status wuffs_gif__decoder__decode_gc( uint8_t t_4 = *ioptr_src++; self->private_impl.f_gc_transparent_index = t_4; } - WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6); - if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { - goto short_read_src; + { + WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6); + if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { + goto short_read_src; + } + uint8_t t_5 = *ioptr_src++; + v_c = t_5; } - uint8_t t_5 = *ioptr_src++; - if (t_5 != 0) { + if (v_c != 0) { status = WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL; goto exit; } @@ -3526,6 +3535,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_gc( goto suspend; suspend: self->private_impl.c_decode_gc[0].coro_susp_point = coro_susp_point; + self->private_impl.c_decode_gc[0].v_c = v_c; self->private_impl.c_decode_gc[0].v_flags = v_flags; goto exit; diff --git a/gen/c/std/gzip.c b/gen/c/std/gzip.c index 8b96454b..cbbdd08e 100644 --- a/gen/c/std/gzip.c +++ b/gen/c/std/gzip.c @@ -1643,8 +1643,8 @@ typedef struct { struct { uint32_t coro_susp_point; - uint8_t v_flags; uint8_t v_c; + uint8_t v_flags; uint16_t v_xlen; uint32_t v_checksum_got; uint32_t v_decoded_length_got; @@ -2423,8 +2423,8 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, } wuffs_base__status status = WUFFS_BASE__STATUS_OK; - uint8_t v_flags; uint8_t v_c; + uint8_t v_flags; uint16_t v_xlen; uint32_t v_checksum_got; uint32_t v_decoded_length_got; @@ -2468,8 +2468,8 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point; if (coro_susp_point) { - v_flags = self->private_impl.c_decode[0].v_flags; v_c = self->private_impl.c_decode[0].v_c; + v_flags = self->private_impl.c_decode[0].v_flags; v_xlen = self->private_impl.c_decode[0].v_xlen; v_checksum_got = self->private_impl.c_decode[0].v_checksum_got; v_decoded_length_got = self->private_impl.c_decode[0].v_decoded_length_got; @@ -2482,30 +2482,39 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, switch (coro_susp_point) { WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0; - WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1); - if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { - goto short_read_src; + { + WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1); + if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { + goto short_read_src; + } + uint8_t t_0 = *ioptr_src++; + v_c = t_0; } - uint8_t t_0 = *ioptr_src++; - if (t_0 != 31) { + if (v_c != 31) { status = WUFFS_GZIP__ERROR_BAD_HEADER; goto exit; } - WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2); - if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { - goto short_read_src; + { + WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2); + if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { + goto short_read_src; + } + uint8_t t_1 = *ioptr_src++; + v_c = t_1; } - uint8_t t_1 = *ioptr_src++; - if (t_1 != 139) { + if (v_c != 139) { status = WUFFS_GZIP__ERROR_BAD_HEADER; goto exit; } - WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3); - if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { - goto short_read_src; + { + WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3); + if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { + goto short_read_src; + } + uint8_t t_2 = *ioptr_src++; + v_c = t_2; } - uint8_t t_2 = *ioptr_src++; - if (t_2 != 8) { + if (v_c != 8) { status = WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD; goto exit; } @@ -2526,7 +2535,6 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, goto short_read_src; } ioptr_src += self->private_impl.c_decode[0].scratch; - v_c = 0; if ((v_flags & 4) != 0) { { WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7); @@ -2729,8 +2737,8 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, goto suspend; suspend: self->private_impl.c_decode[0].coro_susp_point = coro_susp_point; - self->private_impl.c_decode[0].v_flags = v_flags; self->private_impl.c_decode[0].v_c = v_c; + self->private_impl.c_decode[0].v_flags = v_flags; self->private_impl.c_decode[0].v_xlen = v_xlen; self->private_impl.c_decode[0].v_checksum_got = v_checksum_got; self->private_impl.c_decode[0].v_decoded_length_got = v_decoded_length_got; diff --git a/gen/h/std/gif.h b/gen/h/std/gif.h index 1770dfb7..3b7ab4d3 100644 --- a/gen/h/std/gif.h +++ b/gen/h/std/gif.h @@ -1568,6 +1568,7 @@ typedef struct { } c_decode_ae[1]; struct { uint32_t coro_susp_point; + uint8_t v_c; uint8_t v_flags; uint64_t scratch; } c_decode_gc[1]; diff --git a/gen/h/std/gzip.h b/gen/h/std/gzip.h index 087bb5a3..49432b7c 100644 --- a/gen/h/std/gzip.h +++ b/gen/h/std/gzip.h @@ -1643,8 +1643,8 @@ typedef struct { struct { uint32_t coro_susp_point; - uint8_t v_flags; uint8_t v_c; + uint8_t v_flags; uint16_t v_xlen; uint32_t v_checksum_got; uint32_t v_decoded_length_got; diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index 8d60559a..d4f630f8 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -353,7 +353,8 @@ pri func decoder.decode_gc?(src base.io_reader)() { if this.seen_graphic_control { return error "bad graphic control" } - if in.src.read_u8?() != 4 { + var c base.u8 = in.src.read_u8?() + if c != 4 { return error "bad graphic control" } @@ -382,7 +383,8 @@ pri func decoder.decode_gc?(src base.io_reader)() { this.gc_duration = (in.src.read_u16le?() as base.u64) * 7056000 this.gc_transparent_index = in.src.read_u8?() - if in.src.read_u8?() != 0 { + c = in.src.read_u8?() + if c != 0 { return error "bad graphic control" } this.seen_graphic_control = true diff --git a/std/gzip/decode_gzip.wuffs b/std/gzip/decode_gzip.wuffs index 9b7b2aa8..321308cc 100644 --- a/std/gzip/decode_gzip.wuffs +++ b/std/gzip/decode_gzip.wuffs @@ -34,19 +34,21 @@ pub func decoder.set_ignore_checksum!(ic base.bool)() { pub func decoder.decode?(dst base.io_writer, src base.io_reader)() { // Read the header. - if in.src.read_u8?() != 0x1F { + var c base.u8 = in.src.read_u8?() + if c != 0x1F { return error "bad header" } - if in.src.read_u8?() != 0x8B { + c = in.src.read_u8?() + if c != 0x8B { return error "bad header" } - if in.src.read_u8?() != 0x08 { + c = in.src.read_u8?() + if c != 0x08 { return error "bad compression method" } var flags base.u8 = in.src.read_u8?() // TODO: API for returning the header's MTIME field. in.src.skip32?(n:6) - var c base.u8 // Handle FEXTRA. if (flags & 0x04) != 0 {