Remove some obsolete bounds[0] checks

This commit is contained in:
Nigel Tao committed 2018-04-28 10:04:11 +10:00
1 parent d3342e7b4a
commit 6b2f7815da
2 files changed
+10 -15

No files matched your search

+3 -3
View File
@@ -168,8 +168,8 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
if isInSrc(g.tm, n, t.IDSinceMark, 0) { if isInSrc(g.tm, n, t.IDSinceMark, 0) {
b.printf("((wuffs_base__slice_u8){ "+ b.printf("((wuffs_base__slice_u8){ "+
".ptr = %ssrc.private_impl.bounds[0], "+ ".ptr = %ssrc.private_impl.bounds[0], "+
".len = %ssrc.private_impl.bounds[0] ? (size_t)(%srptr_src - %ssrc.private_impl.bounds[0]) : 0, })", ".len = %srptr_src - %ssrc.private_impl.bounds[0], })",
aPrefix, aPrefix, bPrefix, aPrefix) aPrefix, bPrefix, aPrefix)
return nil return nil
} }
// TODO: io_reader.is_marked, not just io_writer.is_marked? // TODO: io_reader.is_marked, not just io_writer.is_marked?
@@ -349,7 +349,7 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
// TODO: don't hard-code v_r or b_rptr_src. // TODO: don't hard-code v_r or b_rptr_src.
b.printf("((wuffs_base__slice_u8){ " + b.printf("((wuffs_base__slice_u8){ " +
".ptr = v_r.private_impl.bounds[0], " + ".ptr = v_r.private_impl.bounds[0], " +
".len = v_r.private_impl.bounds[0] ? (size_t)(b_rptr_src - v_r.private_impl.bounds[0]) : 0, })") ".len = b_rptr_src - v_r.private_impl.bounds[0], })")
return nil return nil
} }
if isThatMethod(g.tm, n, g.tm.ByName("initialize"), 5) { if isThatMethod(g.tm, n, g.tm.ByName("initialize"), 5) {
+7 -12
View File
@@ -2988,23 +2988,18 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
if (v_block_size < if (v_block_size <
((uint64_t)(((wuffs_base__slice_u8){ ((uint64_t)(((wuffs_base__slice_u8){
.ptr = v_r.private_impl.bounds[0], .ptr = v_r.private_impl.bounds[0],
.len = v_r.private_impl.bounds[0] .len = b_rptr_src - v_r.private_impl.bounds[0],
? (size_t)(b_rptr_src -
v_r.private_impl.bounds[0])
: 0,
}) })
.len))) { .len))) {
status = WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_LIMITED_READ; status = WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_LIMITED_READ;
goto exit; goto exit;
} }
v_block_size -= ((uint64_t)( v_block_size -=
((wuffs_base__slice_u8){ ((uint64_t)(((wuffs_base__slice_u8){
.ptr = v_r.private_impl.bounds[0], .ptr = v_r.private_impl.bounds[0],
.len = v_r.private_impl.bounds[0] .len = b_rptr_src - v_r.private_impl.bounds[0],
? (size_t)(b_rptr_src - v_r.private_impl.bounds[0]) })
: 0, .len));
})
.len));
if ((v_block_size == 0) && (v_z == WUFFS_GIF__SUSPENSION_SHORT_READ)) { if ((v_block_size == 0) && (v_z == WUFFS_GIF__SUSPENSION_SHORT_READ)) {
goto label_1_break; goto label_1_break;
} }