Change flate block_size from u8 to u64.

This commit is contained in:
Nigel Tao committed 2017-10-26 14:05:02 +11:00
1 parent c0c023e1cf
commit 51012a0cca
3 files changed
+7 -7

No files matched your search

+4 -4
View File
@@ -225,7 +225,7 @@ typedef struct {
uint32_t v_i; uint32_t v_i;
bool v_interlace; bool v_interlace;
uint8_t v_lw; uint8_t v_lw;
uint8_t v_block_size; uint64_t v_block_size;
uint64_t l_lzw_src; uint64_t l_lzw_src;
puffs_base__reader1 v_lzw_src; puffs_base__reader1 v_lzw_src;
} c_decode_id[1]; } c_decode_id[1];
@@ -1170,7 +1170,7 @@ puffs_gif__status puffs_gif__decoder__decode_id(puffs_gif__decoder* self,
uint32_t v_i; uint32_t v_i;
bool v_interlace; bool v_interlace;
uint8_t v_lw; uint8_t v_lw;
uint8_t v_block_size; uint64_t v_block_size;
uint64_t l_lzw_src; uint64_t l_lzw_src;
puffs_base__reader1 v_lzw_src; puffs_base__reader1 v_lzw_src;
@@ -1237,11 +1237,11 @@ puffs_gif__status puffs_gif__decoder__decode_id(puffs_gif__decoder* self,
goto short_read_src; goto short_read_src;
} }
uint8_t t_2 = *b_rptr_src++; uint8_t t_2 = *b_rptr_src++;
v_block_size = t_2; v_block_size = ((uint64_t)(t_2));
if (v_block_size == 0) { if (v_block_size == 0) {
goto label_0_break; goto label_0_break;
} }
l_lzw_src = ((uint64_t)(v_block_size)); l_lzw_src = v_block_size;
v_lzw_src = (puffs_base__reader1){.buf = a_src.buf, v_lzw_src = (puffs_base__reader1){.buf = a_src.buf,
.limit = (puffs_base__limit1){ .limit = (puffs_base__limit1){
.ptr_to_len = &l_lzw_src, .ptr_to_len = &l_lzw_src,
+1 -1
View File
@@ -225,7 +225,7 @@ typedef struct {
uint32_t v_i; uint32_t v_i;
bool v_interlace; bool v_interlace;
uint8_t v_lw; uint8_t v_lw;
uint8_t v_block_size; uint64_t v_block_size;
uint64_t l_lzw_src; uint64_t l_lzw_src;
puffs_base__reader1 v_lzw_src; puffs_base__reader1 v_lzw_src;
} c_decode_id[1]; } c_decode_id[1];
+2 -2
View File
@@ -156,14 +156,14 @@ pri func decoder.decode_id?(dst writer1, src reader1)() {
// TODO: pass the data blocks' payload to this.lzw. // TODO: pass the data blocks' payload to this.lzw.
while true { while true {
var block_size u8 = in.src.read_u8?() var block_size u64 = in.src.read_u8?() as u64
if block_size == 0 { if block_size == 0 {
break break
} }
// TODO: how should this reader1-typed variable (which is implemented // TODO: how should this reader1-typed variable (which is implemented
// by containing pointers) work across resume/suspend? We don't want to // by containing pointers) work across resume/suspend? We don't want to
// have a dangling pointer to an earlier src buffer. // have a dangling pointer to an earlier src buffer.
var lzw_src reader1 = limit (block_size as u64) in.src var lzw_src reader1 = limit (block_size) in.src
this.lzw.decode?(dst:in.dst, src:lzw_src) this.lzw.decode?(dst:in.dst, src:lzw_src)
} }
} }