};
struct LZWState {
- uint8_t *pbuf, *ebuf;
+ const uint8_t *pbuf, *ebuf;
int bbits;
unsigned int bbuf;
s->bbits += 8;
s->bs--;
}
- c = s->bbuf & s->curmask;
+ c = s->bbuf;
s->bbuf >>= s->cursize;
} else { // TIFF
while (s->bbits < s->cursize) {
s->bbuf = (s->bbuf << 8) | (*s->pbuf++);
s->bbits += 8;
}
- c = (s->bbuf >> (s->bbits - s->cursize)) & s->curmask;
+ c = s->bbuf >> (s->bbits - s->cursize);
}
s->bbits -= s->cursize;
- return c;
+ return c & s->curmask;
}
-uint8_t* ff_lzw_cur_ptr(LZWState *p)
+const uint8_t* ff_lzw_cur_ptr(LZWState *p)
{
return ((struct LZWState*)p)->pbuf;
}
* @param buf_size input data size
* @param mode decoder working mode - either GIF or TIFF
*/
-int ff_lzw_decode_init(LZWState *p, int csize, uint8_t *buf, int buf_size, int mode)
+int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
{
struct LZWState *s = (struct LZWState *)p;