mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Make gif's decoder.restart_frame ! not !?
This commit is contained in:
1 parent
20c474b32a
commit
19ddd4450f
3 files changed
+11
-12
No files matched your search
@@ -31,6 +31,8 @@ type funk struct {
|
||||
|
||||
astFunc *a.Func
|
||||
cName string
|
||||
returnsStatus bool
|
||||
|
||||
varList []*a.Var
|
||||
varResumables map[t.ID]bool
|
||||
derivedVars map[t.ID]struct{}
|
||||
@@ -175,6 +177,9 @@ func (g *gen) gatherFuncImpl(_ *buffer, n *a.Func) error {
|
||||
g.currFunk = funk{
|
||||
astFunc: n,
|
||||
cName: g.funcCName(n),
|
||||
|
||||
returnsStatus: n.Effect().Optional() ||
|
||||
((n.Out() != nil) && n.Out().IsStatus()),
|
||||
}
|
||||
|
||||
if err := g.findVars(); err != nil {
|
||||
@@ -225,7 +230,7 @@ func (g *gen) writeFuncImplPrologue(b *buffer) error {
|
||||
out := g.currFunk.astFunc.Out()
|
||||
|
||||
b.writes("if (!self) { return ")
|
||||
if g.currFunk.astFunc.Effect().Optional() {
|
||||
if g.currFunk.returnsStatus {
|
||||
b.writes("wuffs_base__error__bad_receiver")
|
||||
} else if err := g.writeOutParamZeroValue(b, out); err != nil {
|
||||
return err
|
||||
@@ -233,7 +238,7 @@ func (g *gen) writeFuncImplPrologue(b *buffer) error {
|
||||
b.writes(";}")
|
||||
|
||||
b.writes("if (self->private_impl.magic != WUFFS_BASE__MAGIC) { return ")
|
||||
if g.currFunk.astFunc.Effect().Optional() {
|
||||
if g.currFunk.returnsStatus {
|
||||
b.writes("(self->private_impl.magic == WUFFS_BASE__DISABLED) " +
|
||||
"? wuffs_base__error__disabled_by_previous_error " +
|
||||
": wuffs_base__error__check_wuffs_version_missing")
|
||||
|
||||
@@ -7807,11 +7807,9 @@ wuffs_gif__decoder__restart_frame(wuffs_gif__decoder* self,
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
if (self->private_impl.f_call_sequence == 0) {
|
||||
status = wuffs_base__error__bad_call_sequence;
|
||||
goto exit;
|
||||
return wuffs_base__error__bad_call_sequence;
|
||||
}
|
||||
self->private_impl.f_end_of_data = false;
|
||||
self->private_impl.f_restarted = true;
|
||||
@@ -7819,12 +7817,7 @@ wuffs_gif__decoder__restart_frame(wuffs_gif__decoder* self,
|
||||
self->private_impl.f_num_decoded_frame_configs_value = a_index;
|
||||
self->private_impl.f_num_decoded_frames_value = a_index;
|
||||
wuffs_gif__decoder__reset_gc(self);
|
||||
goto exit;
|
||||
exit:
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// -------- func gif.decoder.decode_frame_config
|
||||
|
||||
@@ -188,7 +188,7 @@ pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
max_incl:this.width as base.u64)
|
||||
}
|
||||
|
||||
pub func decoder.restart_frame!?(index base.u64, io_position base.u64) {
|
||||
pub func decoder.restart_frame!(index base.u64, io_position base.u64) base.status {
|
||||
if this.call_sequence == 0 {
|
||||
return base."?bad call sequence"
|
||||
}
|
||||
@@ -198,6 +198,7 @@ pub func decoder.restart_frame!?(index base.u64, io_position base.u64) {
|
||||
this.num_decoded_frame_configs_value = args.index
|
||||
this.num_decoded_frames_value = args.index
|
||||
this.reset_gc!()
|
||||
return ok
|
||||
}
|
||||
|
||||
pub func decoder.decode_frame_config!??(dst nptr base.frame_config, src base.io_reader) {
|
||||
|
||||
Reference in new issue
Block a user