summaryrefslogtreecommitdiff
path: root/third_party/libtiff/tif_packbits.c
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-03-20 15:46:06 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-21 13:12:16 +0000
commitcfb6f46473777e444c8124318aa78d33aae64459 (patch)
tree272d17a7ba02251fd6d62a90c431e5af169af85a /third_party/libtiff/tif_packbits.c
parent34a28b470a9a4d7c7edd04e9b6a1e02a7490e58b (diff)
downloadpdfium-cfb6f46473777e444c8124318aa78d33aae64459.tar.xz
Upgrade libtiff to 4.0.7.
Change-Id: If3f67767f738b7f23230ca8c37c9af2e31696e82 Reviewed-on: https://pdfium-review.googlesource.com/3117 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'third_party/libtiff/tif_packbits.c')
-rw-r--r--third_party/libtiff/tif_packbits.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/third_party/libtiff/tif_packbits.c b/third_party/libtiff/tif_packbits.c
index 9e77190131..d2a0165de9 100644
--- a/third_party/libtiff/tif_packbits.c
+++ b/third_party/libtiff/tif_packbits.c
@@ -1,4 +1,4 @@
-/* $Id: tif_packbits.c,v 1.22 2012-06-20 05:25:33 fwarmerdam Exp $ */
+/* $Id: tif_packbits.c,v 1.24 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -38,7 +38,8 @@ PackBitsPreEncode(TIFF* tif, uint16 s)
{
(void) s;
- if (!(tif->tif_data = (uint8*)_TIFFmalloc(sizeof(tmsize_t))))
+ tif->tif_data = (uint8*)_TIFFmalloc(sizeof(tmsize_t));
+ if (tif->tif_data == NULL)
return (0);
/*
* Calculate the scanline/tile-width size in bytes.
@@ -81,7 +82,9 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
/*
* Find the longest string of identical bytes.
*/
- b = *bp++, cc--, n = 1;
+ b = *bp++;
+ cc--;
+ n = 1;
for (; cc > 0 && b == *bp; cc--, bp++)
n++;
again:
@@ -222,7 +225,8 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
bp = (char*) tif->tif_rawcp;
cc = tif->tif_rawcc;
while (cc > 0 && occ > 0) {
- n = (long) *bp++, cc--;
+ n = (long) *bp++;
+ cc--;
/*
* Watch out for compilers that
* don't sign extend chars...
@@ -241,7 +245,8 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
n = (long)occ;
}
occ -= n;
- b = *bp++, cc--;
+ b = *bp++;
+ cc--;
while (n-- > 0)
*op++ = (uint8) b;
} else { /* copy next n+1 bytes literally */