summaryrefslogtreecommitdiff
path: root/third_party/libtiff/tif_fax3.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_fax3.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_fax3.c')
-rw-r--r--third_party/libtiff/tif_fax3.c63
1 files changed, 40 insertions, 23 deletions
diff --git a/third_party/libtiff/tif_fax3.c b/third_party/libtiff/tif_fax3.c
index bbe72555be..16bb4d36f0 100644
--- a/third_party/libtiff/tif_fax3.c
+++ b/third_party/libtiff/tif_fax3.c
@@ -1,4 +1,4 @@
-/* $Id: tif_fax3.c,v 1.75 2015-08-30 20:49:55 erouault Exp $ */
+/* $Id: tif_fax3.c,v 1.78 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@@ -644,7 +644,8 @@ putspan(TIFF* tif, int32 span, const tableentry* tab)
while (span >= 2624) {
const tableentry* te = &tab[63 + (2560>>6)];
- code = te->code, length = te->length;
+ code = te->code;
+ length = te->length;
#ifdef FAX3_DEBUG
DEBUG_PRINT("MakeUp", te->runlen);
#endif
@@ -654,14 +655,16 @@ putspan(TIFF* tif, int32 span, const tableentry* tab)
if (span >= 64) {
const tableentry* te = &tab[63 + (span>>6)];
assert(te->runlen == 64*(span>>6));
- code = te->code, length = te->length;
+ code = te->code;
+ length = te->length;
#ifdef FAX3_DEBUG
DEBUG_PRINT("MakeUp", te->runlen);
#endif
_PutBits(tif, code, length);
span -= te->runlen;
}
- code = tab[span].code, length = tab[span].length;
+ code = tab[span].code;
+ length = tab[span].length;
#ifdef FAX3_DEBUG
DEBUG_PRINT(" Term", tab[span].runlen);
#endif
@@ -697,14 +700,16 @@ Fax3PutEOL(TIFF* tif)
align = sp->bit + (8 - align);
else
align = sp->bit - align;
- code = 0;
tparm=align;
_PutBits(tif, 0, tparm);
}
}
- code = EOL, length = 12;
- if (is2DEncoding(sp))
- code = (code<<1) | (sp->tag == G3_1D), length++;
+ code = EOL;
+ length = 12;
+ if (is2DEncoding(sp)) {
+ code = (code<<1) | (sp->tag == G3_1D);
+ length++;
+ }
_PutBits(tif, code, length);
sp->data = data;
@@ -815,7 +820,7 @@ find0span(unsigned char* bp, int32 bs, int32 be)
/*
* Check partial byte on lhs.
*/
- if (bits > 0 && (n = (bs & 7))) {
+ if (bits > 0 && (n = (bs & 7)) != 0) {
span = zeroruns[(*bp << n) & 0xff];
if (span > 8-n) /* table value too generous */
span = 8-n;
@@ -835,12 +840,14 @@ find0span(unsigned char* bp, int32 bs, int32 be)
while (!isAligned(bp, long)) {
if (*bp != 0x00)
return (span + zeroruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
lp = (long*) bp;
while ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) {
- span += 8*sizeof (long), bits -= 8*sizeof (long);
+ span += 8*sizeof (long);
+ bits -= 8*sizeof (long);
lp++;
}
bp = (unsigned char*) lp;
@@ -851,7 +858,8 @@ find0span(unsigned char* bp, int32 bs, int32 be)
while (bits >= 8) {
if (*bp != 0x00) /* end of run */
return (span + zeroruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
/*
@@ -874,7 +882,7 @@ find1span(unsigned char* bp, int32 bs, int32 be)
/*
* Check partial byte on lhs.
*/
- if (bits > 0 && (n = (bs & 7))) {
+ if (bits > 0 && (n = (bs & 7)) != 0) {
span = oneruns[(*bp << n) & 0xff];
if (span > 8-n) /* table value too generous */
span = 8-n;
@@ -894,12 +902,14 @@ find1span(unsigned char* bp, int32 bs, int32 be)
while (!isAligned(bp, long)) {
if (*bp != 0xff)
return (span + oneruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
lp = (long*) bp;
while ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) {
- span += 8*sizeof (long), bits -= 8*sizeof (long);
+ span += 8*sizeof (long);
+ bits -= 8*sizeof (long);
lp++;
}
bp = (unsigned char*) lp;
@@ -910,7 +920,8 @@ find1span(unsigned char* bp, int32 bs, int32 be)
while (bits >= 8) {
if (*bp != 0xff) /* end of run */
return (span + oneruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
/*
@@ -1094,8 +1105,10 @@ Fax3Close(TIFF* tif)
unsigned int length = 12;
int i;
- if (is2DEncoding(sp))
- code = (code<<1) | (sp->tag == G3_1D), length++;
+ if (is2DEncoding(sp)) {
+ code = (code<<1) | (sp->tag == G3_1D);
+ length++;
+ }
for (i = 0; i < 6; i++)
Fax3PutBits(tif, code, length);
Fax3FlushBits(tif, sp);
@@ -1182,7 +1195,7 @@ Fax3VSetField(TIFF* tif, uint32 tag, va_list ap)
return (*sp->vsetparent)(tif, tag, ap);
}
- if ((fip = TIFFFieldWithTag(tif, tag)))
+ if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
TIFFSetFieldBit(tif, fip->field_bit);
else
return 0;
@@ -1241,10 +1254,14 @@ Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
} else {
fprintf(fd, " Group 3 Options:");
- if (sp->groupoptions & GROUP3OPT_2DENCODING)
- fprintf(fd, "%s2-d encoding", sep), sep = "+";
- if (sp->groupoptions & GROUP3OPT_FILLBITS)
- fprintf(fd, "%sEOL padding", sep), sep = "+";
+ if (sp->groupoptions & GROUP3OPT_2DENCODING) {
+ fprintf(fd, "%s2-d encoding", sep);
+ sep = "+";
+ }
+ if (sp->groupoptions & GROUP3OPT_FILLBITS) {
+ fprintf(fd, "%sEOL padding", sep);
+ sep = "+";
+ }
if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED)
fprintf(fd, "%suncompressed data", sep);
}