mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
Rename some std/lzw methods
This commit is contained in:
1 parent
7a02605144
commit
9311f7a694
3 files changed
+29
-30
No files matched your search
@@ -2565,7 +2565,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
|||||||
wuffs_base__io_reader a_src);
|
wuffs_base__io_reader a_src);
|
||||||
|
|
||||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__slice_u8 //
|
WUFFS_BASE__MAYBE_STATIC wuffs_base__slice_u8 //
|
||||||
wuffs_lzw__decoder__take_all(wuffs_lzw__decoder* self);
|
wuffs_lzw__decoder__flush(wuffs_lzw__decoder* self);
|
||||||
|
|
||||||
// ---------------- Struct Definitions
|
// ---------------- Struct Definitions
|
||||||
|
|
||||||
@@ -2609,7 +2609,7 @@ struct wuffs_lzw__decoder__struct {
|
|||||||
struct {
|
struct {
|
||||||
uint32_t coro_susp_point;
|
uint32_t coro_susp_point;
|
||||||
uint32_t v_i;
|
uint32_t v_i;
|
||||||
} c_flush[1];
|
} c_auto_flush[1];
|
||||||
} private_impl;
|
} private_impl;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -2631,8 +2631,8 @@ struct wuffs_lzw__decoder__struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline wuffs_base__slice_u8 //
|
inline wuffs_base__slice_u8 //
|
||||||
take_all() {
|
flush() {
|
||||||
return wuffs_lzw__decoder__take_all(this);
|
return wuffs_lzw__decoder__flush(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
@@ -7039,8 +7039,8 @@ const char* wuffs_lzw__error__internal_error_inconsistent_i_o =
|
|||||||
// ---------------- Private Function Prototypes
|
// ---------------- Private Function Prototypes
|
||||||
|
|
||||||
static wuffs_base__status //
|
static wuffs_base__status //
|
||||||
wuffs_lzw__decoder__flush(wuffs_lzw__decoder* self,
|
wuffs_lzw__decoder__auto_flush(wuffs_lzw__decoder* self,
|
||||||
wuffs_base__io_writer a_dst);
|
wuffs_base__io_writer a_dst);
|
||||||
|
|
||||||
// ---------------- Initializer Implementations
|
// ---------------- Initializer Implementations
|
||||||
|
|
||||||
@@ -7196,7 +7196,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
|||||||
if (v_j > 0) {
|
if (v_j > 0) {
|
||||||
self->private_impl.f_flush_j = v_j;
|
self->private_impl.f_flush_j = v_j;
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||||
status = wuffs_lzw__decoder__flush(self, a_dst);
|
status = wuffs_lzw__decoder__auto_flush(self, a_dst);
|
||||||
if (status) {
|
if (status) {
|
||||||
goto suspend;
|
goto suspend;
|
||||||
}
|
}
|
||||||
@@ -7318,7 +7318,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
|||||||
v_bits = ((v_bits)&WUFFS_BASE__LOW_BITS_MASK__U32(v_n_bits));
|
v_bits = ((v_bits)&WUFFS_BASE__LOW_BITS_MASK__U32(v_n_bits));
|
||||||
self->private_impl.f_flush_j = v_j;
|
self->private_impl.f_flush_j = v_j;
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||||
status = wuffs_lzw__decoder__flush(self, a_dst);
|
status = wuffs_lzw__decoder__auto_flush(self, a_dst);
|
||||||
if (status) {
|
if (status) {
|
||||||
goto suspend;
|
goto suspend;
|
||||||
}
|
}
|
||||||
@@ -7339,7 +7339,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
|||||||
v_bits = ((v_bits)&WUFFS_BASE__LOW_BITS_MASK__U32(v_n_bits));
|
v_bits = ((v_bits)&WUFFS_BASE__LOW_BITS_MASK__U32(v_n_bits));
|
||||||
self->private_impl.f_flush_j = v_j;
|
self->private_impl.f_flush_j = v_j;
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||||
status = wuffs_lzw__decoder__flush(self, a_dst);
|
status = wuffs_lzw__decoder__auto_flush(self, a_dst);
|
||||||
if (status) {
|
if (status) {
|
||||||
goto suspend;
|
goto suspend;
|
||||||
}
|
}
|
||||||
@@ -7377,11 +7377,11 @@ exit:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- func lzw.decoder.flush
|
// -------- func lzw.decoder.auto_flush
|
||||||
|
|
||||||
static wuffs_base__status //
|
static wuffs_base__status //
|
||||||
wuffs_lzw__decoder__flush(wuffs_lzw__decoder* self,
|
wuffs_lzw__decoder__auto_flush(wuffs_lzw__decoder* self,
|
||||||
wuffs_base__io_writer a_dst) {
|
wuffs_base__io_writer a_dst) {
|
||||||
wuffs_base__status status = NULL;
|
wuffs_base__status status = NULL;
|
||||||
|
|
||||||
uint32_t v_i;
|
uint32_t v_i;
|
||||||
@@ -7408,9 +7408,9 @@ wuffs_lzw__decoder__flush(wuffs_lzw__decoder* self,
|
|||||||
io1_a_dst = a_dst.private_impl.limit;
|
io1_a_dst = a_dst.private_impl.limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t coro_susp_point = self->private_impl.c_flush[0].coro_susp_point;
|
uint32_t coro_susp_point = self->private_impl.c_auto_flush[0].coro_susp_point;
|
||||||
if (coro_susp_point) {
|
if (coro_susp_point) {
|
||||||
v_i = self->private_impl.c_flush[0].v_i;
|
v_i = self->private_impl.c_auto_flush[0].v_i;
|
||||||
v_s = ((wuffs_base__slice_u8){});
|
v_s = ((wuffs_base__slice_u8){});
|
||||||
v_n = 0;
|
v_n = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -7443,14 +7443,14 @@ wuffs_lzw__decoder__flush(wuffs_lzw__decoder* self,
|
|||||||
|
|
||||||
goto ok;
|
goto ok;
|
||||||
ok:
|
ok:
|
||||||
self->private_impl.c_flush[0].coro_susp_point = 0;
|
self->private_impl.c_auto_flush[0].coro_susp_point = 0;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto suspend;
|
goto suspend;
|
||||||
suspend:
|
suspend:
|
||||||
self->private_impl.c_flush[0].coro_susp_point = coro_susp_point;
|
self->private_impl.c_auto_flush[0].coro_susp_point = coro_susp_point;
|
||||||
self->private_impl.c_flush[0].v_i = v_i;
|
self->private_impl.c_auto_flush[0].v_i = v_i;
|
||||||
|
|
||||||
goto exit;
|
goto exit;
|
||||||
exit:
|
exit:
|
||||||
@@ -7462,10 +7462,10 @@ exit:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- func lzw.decoder.take_all
|
// -------- func lzw.decoder.flush
|
||||||
|
|
||||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__slice_u8 //
|
WUFFS_BASE__MAYBE_STATIC wuffs_base__slice_u8 //
|
||||||
wuffs_lzw__decoder__take_all(wuffs_lzw__decoder* self) {
|
wuffs_lzw__decoder__flush(wuffs_lzw__decoder* self) {
|
||||||
if (!self) {
|
if (!self) {
|
||||||
return ((wuffs_base__slice_u8){});
|
return ((wuffs_base__slice_u8){});
|
||||||
}
|
}
|
||||||
@@ -9516,8 +9516,7 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
|
|||||||
iop_v_r = o_0_iop_v_r;
|
iop_v_r = o_0_iop_v_r;
|
||||||
io1_v_r = o_0_io1_v_r;
|
io1_v_r = o_0_io1_v_r;
|
||||||
}
|
}
|
||||||
v_uncompressed =
|
v_uncompressed = wuffs_lzw__decoder__flush(&self->private_impl.f_lzw);
|
||||||
wuffs_lzw__decoder__take_all(&self->private_impl.f_lzw);
|
|
||||||
if (((uint64_t)(v_uncompressed.len)) > 0) {
|
if (((uint64_t)(v_uncompressed.len)) > 0) {
|
||||||
status = wuffs_gif__decoder__copy_to_image_buffer(self, a_dst,
|
status = wuffs_gif__decoder__copy_to_image_buffer(self, a_dst,
|
||||||
v_uncompressed);
|
v_uncompressed);
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
|
|||||||
this.compressed_ri ~sat+= r.since_mark().length()
|
this.compressed_ri ~sat+= r.since_mark().length()
|
||||||
}
|
}
|
||||||
|
|
||||||
var uncompressed slice base.u8 = this.lzw.take_all!()
|
var uncompressed slice base.u8 = this.lzw.flush!()
|
||||||
if uncompressed.length() > 0 {
|
if uncompressed.length() > 0 {
|
||||||
this.copy_to_image_buffer!?(pb:args.dst, src:uncompressed)
|
this.copy_to_image_buffer!?(pb:args.dst, src:uncompressed)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
|||||||
{
|
{
|
||||||
if j > 0 {
|
if j > 0 {
|
||||||
this.flush_j = j
|
this.flush_j = j
|
||||||
this.flush!??(dst:args.dst)
|
this.auto_flush!??(dst:args.dst)
|
||||||
j = 0
|
j = 0
|
||||||
} else {
|
} else {
|
||||||
yield base."$short read"
|
yield base."$short read"
|
||||||
@@ -228,7 +228,7 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
|||||||
bits = bits.low_bits(n:n_bits)
|
bits = bits.low_bits(n:n_bits)
|
||||||
|
|
||||||
this.flush_j = j
|
this.flush_j = j
|
||||||
this.flush!??(dst:args.dst)
|
this.auto_flush!??(dst:args.dst)
|
||||||
j = 0
|
j = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,11 +246,11 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
|||||||
bits = bits.low_bits(n:n_bits)
|
bits = bits.low_bits(n:n_bits)
|
||||||
|
|
||||||
this.flush_j = j
|
this.flush_j = j
|
||||||
this.flush!??(dst:args.dst)
|
this.auto_flush!??(dst:args.dst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pri func decoder.flush!??(dst base.io_writer) {
|
pri func decoder.auto_flush!??(dst base.io_writer) {
|
||||||
var i base.u32[..8191]
|
var i base.u32[..8191]
|
||||||
while this.flush_j > 0 {
|
while this.flush_j > 0 {
|
||||||
if i > this.flush_j {
|
if i > this.flush_j {
|
||||||
@@ -266,11 +266,11 @@ pri func decoder.flush!??(dst base.io_writer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: enforce that take_all is only valid to call if decode was always
|
// TODO: enforce that flush is only valid to call if decode was always passed a
|
||||||
// passed a 0-length dst base.io_writer? The (non-obvious) hard part is to
|
// 0-length dst base.io_writer? The (non-obvious) hard part is to enforce that
|
||||||
// enforce that without regressing benchmarks.
|
// without regressing benchmarks.
|
||||||
|
|
||||||
pub func decoder.take_all!() slice base.u8 {
|
pub func decoder.flush!() slice base.u8 {
|
||||||
var s slice base.u8 = this.output[:this.flush_j]
|
var s slice base.u8 = this.output[:this.flush_j]
|
||||||
this.flush_j = 0
|
this.flush_j = 0
|
||||||
return s
|
return s
|
||||||
|
|||||||
Reference in new issue
Block a user