mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 17:01:35 +01:00
1 parent
5aeb98c701
commit
dd861416ff
3 files changed
+27
-20
No files matched your search
@@ -244,7 +244,13 @@ func (g *gen) writeFuncImplPrologue(b *buffer) error {
|
|||||||
}
|
}
|
||||||
b.writes(";}")
|
b.writes(";}")
|
||||||
|
|
||||||
b.writes("if (self->private_impl.magic != WUFFS_BASE__MAGIC) { return ")
|
if g.currFunk.astFunc.Effect().Pure() {
|
||||||
|
b.writes("if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&")
|
||||||
|
b.writes(" (self->private_impl.magic != WUFFS_BASE__DISABLED)) {")
|
||||||
|
} else {
|
||||||
|
b.writes("if (self->private_impl.magic != WUFFS_BASE__MAGIC) {")
|
||||||
|
}
|
||||||
|
b.writes("return ")
|
||||||
if g.currFunk.returnsStatus {
|
if g.currFunk.returnsStatus {
|
||||||
b.writes("(self->private_impl.magic == WUFFS_BASE__DISABLED) " +
|
b.writes("(self->private_impl.magic == WUFFS_BASE__DISABLED) " +
|
||||||
"? wuffs_base__error__disabled_by_previous_error " +
|
"? wuffs_base__error__disabled_by_previous_error " +
|
||||||
|
|||||||
@@ -6339,7 +6339,8 @@ wuffs_deflate__decoder__workbuf_len(const wuffs_deflate__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8155,7 +8156,8 @@ wuffs_lzw__decoder__workbuf_len(const wuffs_lzw__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8811,7 +8813,8 @@ wuffs_gif__decoder__num_animation_loops(const wuffs_gif__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8828,7 +8831,8 @@ wuffs_gif__decoder__num_decoded_frame_configs(const wuffs_gif__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8842,7 +8846,8 @@ wuffs_gif__decoder__num_decoded_frames(const wuffs_gif__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8856,7 +8861,8 @@ wuffs_gif__decoder__frame_dirty_rect(const wuffs_gif__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__rect_ie_u32){0});
|
return ((wuffs_base__rect_ie_u32){0});
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return ((wuffs_base__rect_ie_u32){0});
|
return ((wuffs_base__rect_ie_u32){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8876,7 +8882,8 @@ wuffs_gif__decoder__workbuf_len(const wuffs_gif__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10925,7 +10932,8 @@ wuffs_gzip__decoder__workbuf_len(const wuffs_gzip__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11410,7 +11418,8 @@ wuffs_zlib__decoder__workbuf_len(const wuffs_zlib__decoder* self) {
|
|||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
|
||||||
|
(self->private_impl.magic != WUFFS_BASE__DISABLED)) {
|
||||||
return ((wuffs_base__range_ii_u64){0});
|
return ((wuffs_base__range_ii_u64){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-10
@@ -1032,16 +1032,8 @@ const char* test_wuffs_gif_decode_not_enough_data() {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: want_dirty_rect_is_empty should probably be false, not true. It's
|
|
||||||
// true because the error sets the decoder state (specifically, the
|
|
||||||
// private_impl.magic field) to WUFFS_BASE__DISABLED, so that
|
|
||||||
// frame_dirty_rect returns the zero value (an empty rect).
|
|
||||||
//
|
|
||||||
// Perhaps "not enough data" should be a warning, not an error??
|
|
||||||
//
|
|
||||||
// Ditto for the "too much data" test.
|
|
||||||
return do_test_wuffs_gif_decode_expecting(
|
return do_test_wuffs_gif_decode_expecting(
|
||||||
src, wuffs_base__error__not_enough_data, true);
|
src, wuffs_base__error__not_enough_data, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* test_wuffs_gif_decode_too_much_data() {
|
const char* test_wuffs_gif_decode_too_much_data() {
|
||||||
@@ -1058,7 +1050,7 @@ const char* test_wuffs_gif_decode_too_much_data() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return do_test_wuffs_gif_decode_expecting(
|
return do_test_wuffs_gif_decode_expecting(
|
||||||
src, wuffs_base__error__too_much_data, true);
|
src, wuffs_base__error__too_much_data, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* test_wuffs_gif_frame_dirty_rect() {
|
const char* test_wuffs_gif_frame_dirty_rect() {
|
||||||
|
|||||||
Reference in new issue
Block a user