Rename z variable to status, in Wuffs code

This commit is contained in:
Nigel Tao committed 2018-12-28 15:52:34 +11:00
1 parent 489fec4437
commit ce96837b40
5 files changed
+41 -41

No files matched your search

+5 -5
View File
@@ -122,16 +122,16 @@ pub struct decoder?(
)
pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
var z base.status
var status base.status
var written slice base.u8
var n_copied base.u64
var already_full base.u32[..0x8000]
while true {
args.dst.set_mark!()
z =? this.decode_blocks!??(dst:args.dst, src:args.src)
if not z.is_suspension() {
return z
status =? this.decode_blocks!??(dst:args.dst, src:args.src)
if not status.is_suspension() {
return status
}
// TODO: should "since_mark" be "since_mark!", as the return value lets
// you modify the state of args.dst, so future mutations (via the
@@ -174,7 +174,7 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
this.history_index = (this.history_index & 0x7FFF) + ((n_copied & 0x7FFF) as base.u32) + already_full
}
}
yield z
yield status
}
}
+6 -6
View File
@@ -665,7 +665,7 @@ pri func decoder.decode_id_part2!??(dst ptr base.pixel_buffer, src base.io_reade
var n_compressed base.u64
var compressed slice base.u8
var r base.io_reader
var z base.status
var status base.status
var uncompressed slice base.u8
need_block_size = true
@@ -716,7 +716,7 @@ pri func decoder.decode_id_part2!??(dst ptr base.pixel_buffer, src base.io_reade
return "?internal error: inconsistent ri/wi"
}
io_bind (io:r, data:this.compressed[this.compressed_ri:this.compressed_wi]) {
z =? this.lzw.decode!??(dst:this.util.null_io_writer(), src:r)
status =? this.lzw.decode!??(dst:this.util.null_io_writer(), src:r)
this.compressed_ri ~sat+= r.since_mark().length()
}
@@ -725,7 +725,7 @@ pri func decoder.decode_id_part2!??(dst ptr base.pixel_buffer, src base.io_reade
this.copy_to_image_buffer!?(pb:args.dst, src:uncompressed)
}
if z.is_ok() {
if status.is_ok() {
this.previous_lzw_decode_ended_abruptly = false
// Skip any trailing blocks.
@@ -735,12 +735,12 @@ pri func decoder.decode_id_part2!??(dst ptr base.pixel_buffer, src base.io_reade
}
break:outer
} else if z == base."$short read" {
} else if status == base."$short read" {
continue:outer
} else if z == base."$short write" {
} else if status == base."$short write" {
continue:inner
}
return z
return status
}
}
+4 -4
View File
@@ -36,7 +36,7 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
var xlen base.u16
var checksum_got base.u32
var decoded_length_got base.u32
var z base.status
var status base.status
var checksum_want base.u32
var decoded_length_want base.u32
@@ -100,15 +100,15 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
// Decode and checksum the DEFLATE-encoded payload.
while true {
args.dst.set_mark!()
z =? this.flate.decode!??(dst:args.dst, src:args.src)
status =? this.flate.decode!??(dst:args.dst, src:args.src)
if not this.ignore_checksum {
checksum_got = this.checksum.update!(x:args.dst.since_mark())
decoded_length_got ~mod+= ((args.dst.since_mark().length() & 0xFFFFFFFF) as base.u32)
}
if z.is_ok() {
if status.is_ok() {
break
}
yield z
yield status
}
checksum_want = args.src.read_u32le!??()
decoded_length_want = args.src.read_u32le!??()
+4 -4
View File
@@ -35,7 +35,7 @@ pub func decoder.set_ignore_checksum!(ic base.bool) {
pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
var x base.u16
var checksum_got base.u32
var z base.status
var status base.status
var checksum_want base.u32
x = args.src.read_u16be!??()
@@ -55,14 +55,14 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
// Decode and checksum the DEFLATE-encoded payload.
while true {
args.dst.set_mark!()
z =? this.flate.decode!??(dst:args.dst, src:args.src)
status =? this.flate.decode!??(dst:args.dst, src:args.src)
if not this.ignore_checksum {
checksum_got = this.checksum.update!(x:args.dst.since_mark())
}
if z.is_ok() {
if status.is_ok() {
break
}
yield z
yield status
}
checksum_want = args.src.read_u32be!??()
if (not this.ignore_checksum) and (checksum_got != checksum_want) {