From 7fca729778afdbc18d21a389b7df8b0578e2cb99 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 28 Sep 2021 22:52:10 +0200 Subject: PackBitsDecode: remove hack for when char is unsigned. The function has a hack for platforms where char is unsigned. This is better replaced by making bp a int8_t* pointer, which is guaranteed to be signed. --- libtiff/tif_packbits.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libtiff/tif_packbits.c b/libtiff/tif_packbits.c index 76569ad7..b4568639 100644 --- a/libtiff/tif_packbits.c +++ b/libtiff/tif_packbits.c @@ -214,23 +214,17 @@ static int PackBitsDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s) { static const char module[] = "PackBitsDecode"; - char *bp; + int8_t *bp; tmsize_t cc; long n; int b; (void) s; - bp = (char*) tif->tif_rawcp; + bp = (int8_t*) tif->tif_rawcp; cc = tif->tif_rawcc; while (cc > 0 && occ > 0) { n = (long) *bp++; cc--; - /* - * Watch out for compilers that - * don't sign extend chars... - */ - if (n >= 128) - n -= 256; if (n < 0) { /* replicate next byte -n+1 times */ if (n == -128) /* nop */ continue; -- cgit v1.2.1