Skip to content

Commit

Permalink
Remove lzxd_stream.intel_curpos, just use offset
Browse files Browse the repository at this point in the history
  • Loading branch information
kyz committed Jan 8, 2020
1 parent 3e0fcb6 commit 6ccbb8d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion libmspack/mspack/lzx.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ struct lzxd_stream {
unsigned int block_remaining; /* uncompressed bytes still left to decode */

signed int intel_filesize; /* magic header value used for transform */
signed int intel_curpos; /* current offset in transform space */

unsigned char intel_started; /* has intel E8 decoding started? */
unsigned char block_type; /* type of the current block */
Expand Down
5 changes: 1 addition & 4 deletions libmspack/mspack/lzxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ struct lzxd_stream *lzxd_init(struct mspack_system *system,
lzx->frame = 0;
lzx->reset_interval = reset_interval;
lzx->intel_filesize = 0;
lzx->intel_curpos = 0;
lzx->intel_started = 0;
lzx->error = MSPACK_ERR_OK;
lzx->num_offsets = position_slots[window_bits - 15] << 3;
Expand Down Expand Up @@ -831,7 +830,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
{
unsigned char *data = &lzx->e8_buf[0];
unsigned char *dataend = &lzx->e8_buf[frame_size - 10];
signed int curpos = lzx->intel_curpos;
signed int curpos = (int) lzx->offset;
signed int filesize = lzx->intel_filesize;
signed int abs_off, rel_off;

Expand All @@ -852,11 +851,9 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
data += 4;
curpos += 5;
}
lzx->intel_curpos += frame_size;
}
else {
lzx->o_ptr = &lzx->window[lzx->frame_posn];
if (lzx->intel_filesize) lzx->intel_curpos += frame_size;
}
lzx->o_end = &lzx->o_ptr[frame_size];

Expand Down

0 comments on commit 6ccbb8d

Please sign in to comment.