# HG changeset patch # User kostya # Date 1229927971 0 # Node ID 898722eb4fd26f76abd761bcd9fb2238c25a72e1 # Parent b8d72c9851c7a7470544b5e0b77bb52bfc57aaa5 Calculate line size variable correctly for lower bitdepths and use it for raw data copying diff -r b8d72c9851c7 -r 898722eb4fd2 tiff.c --- a/tiff.c Mon Dec 22 06:36:10 2008 +0000 +++ b/tiff.c Mon Dec 22 06:39:31 2008 +0000 @@ -74,7 +74,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){ int c, line, pixels, code; const uint8_t *ssrc = src; - int width = s->width * (s->bpp / 8); + int width = s->width * s->bpp >> 3; #ifdef CONFIG_ZLIB uint8_t *zbuf; unsigned long outlen; @@ -109,8 +109,8 @@ } switch(s->compr){ case TIFF_RAW: - memcpy(dst, src, s->width * (s->bpp / 8)); - src += s->width * (s->bpp / 8); + memcpy(dst, src, width); + src += width; break; case TIFF_PACKBITS: for(pixels = 0; pixels < width;){