Change status "?foo" to just "?foo"

This commit is contained in:
Nigel Tao committed 2018-11-24 12:36:42 +11:00
1 parent 5f9d007b1c
commit 875362ea07
14 files changed
+136 -152

No files matched your search

+16 -16
View File
@@ -21,7 +21,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
// correctness and performance.
if (this.n_bits >= 8) or ((this.bits >> this.n_bits) != 0) {
return status "?internal error: inconsistent n_bits"
return "?internal error: inconsistent n_bits"
}
var bits base.u32 = this.bits
@@ -119,7 +119,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
var redir_top base.u32[..0xFFFF] = (table_entry >> 8) & 0xFFFF
var redir_mask base.u32[..0x7FFF] = ((1 as base.u32) << ((table_entry >> 4) & 0x0F)) - 1
if (redir_top + (bits & redir_mask)) >= 1234 {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
table_entry = this.huffs[0][redir_top + (bits & redir_mask)]
table_entry_n_bits = table_entry & 0x0F
@@ -137,20 +137,20 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
this.end_of_block = true
break:loop
} else if (table_entry >> 28) != 0 {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
} else if (table_entry >> 27) != 0 {
return status "?bad Huffman code"
return "?bad Huffman code"
} else {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
// Once again, redundant but explicit assertions.
assert args.src.available() >= 8
} else if (table_entry >> 27) != 0 {
return status "?bad Huffman code"
return "?bad Huffman code"
} else {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
// length = base_number + extra_bits.
@@ -182,7 +182,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
assert args.src.available() >= 6
}
if length > 258 {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
// Ensure that we have at least 15 bits of input.
@@ -230,7 +230,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
redir_top = (table_entry >> 8) & 0xFFFF
redir_mask = ((1 as base.u32) << ((table_entry >> 4) & 0x0F)) - 1
if (redir_top + (bits & redir_mask)) >= 1234 {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
table_entry = this.huffs[1][redir_top + (bits & redir_mask)]
table_entry_n_bits = table_entry & 0x0F
@@ -243,9 +243,9 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
// For H-D, all symbols should be base_number + extra_bits.
if (table_entry >> 24) != 0x40 {
if (table_entry >> 24) == 0x08 {
return status "?bad Huffman code"
return "?bad Huffman code"
}
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
// dist_minus_1 = base_number_minus_1 + extra_bits.
@@ -299,7 +299,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
hlen = hdist
// TODO: this if check should be redundant.
if length > 258 {
return status "?internal error: inconsistent Huffman decoder state"
return "?internal error: inconsistent Huffman decoder state"
}
} else {
hlen = length
@@ -307,7 +307,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
assert length <= 258
}
if this.history_index < hdist {
return status "?bad distance"
return "?bad distance"
}
// Re-purpose the hdist variable as the this.history index to
// start copying from.
@@ -346,7 +346,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
}
if ((dist_minus_1 + 1) as base.u64) > args.dst.since_mark().length() {
return status "?internal error: inconsistent distance"
return "?internal error: inconsistent distance"
}
}
// Once again, redundant but explicit assertions.
@@ -382,7 +382,7 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
if args.src.can_undo_byte() {
args.src.undo_byte!()
} else {
return status "?internal error: inconsistent I/O"
return "?internal error: inconsistent I/O"
}
}
@@ -390,6 +390,6 @@ pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader)
this.n_bits = n_bits
if (this.n_bits >= 8) or ((this.bits >> this.n_bits) != 0) {
return status "?internal error: inconsistent n_bits"
return "?internal error: inconsistent n_bits"
}
}