summaryrefslogtreecommitdiff
path: root/third_party/libtiff/tif_jpeg.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_jpeg.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_jpeg.c')
-rw-r--r--third_party/libtiff/tif_jpeg.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/third_party/libtiff/tif_jpeg.c b/third_party/libtiff/tif_jpeg.c
index 6659909299..abd0b0aa2f 100644
--- a/third_party/libtiff/tif_jpeg.c
+++ b/third_party/libtiff/tif_jpeg.c
@@ -1,4 +1,4 @@
-/* $Id: tif_jpeg.c,v 1.119 2015-08-15 20:13:07 bfriesen Exp $ */
+/* $Id: tif_jpeg.c,v 1.123 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@@ -58,7 +58,7 @@ int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode );
Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is
not defined. Unfortunately, the MinGW and Borland compilers include
a typedef for INT32, which causes a conflict. MSVC does not include
- a conficting typedef given the headers which are included.
+ a conflicting typedef given the headers which are included.
*/
#if defined(__BORLANDC__) || defined(__MINGW32__)
# define XMD_H 1
@@ -945,7 +945,7 @@ JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 s
else
{
uint16 m;
- m=skiplength-data->bufferbytesleft;
+ m=(uint16)(skiplength-data->bufferbytesleft);
if (m<=data->filebytesleft)
{
data->bufferbytesleft=0;
@@ -1291,7 +1291,7 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
if( line_work_buf != NULL )
{
/*
- * In the MK1 case, we aways read into a 16bit
+ * In the MK1 case, we always read into a 16bit
* buffer, and then pack down to 12bit or 8bit.
* In 6B case we only read into 16 bit buffer
* for 12bit data, which we need to repack.
@@ -1311,10 +1311,10 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
((unsigned char *) buf) + iPair * 3;
JSAMPLE *in_ptr = line_work_buf + iPair * 2;
- out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
- out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
- | ((in_ptr[1] & 0xf00) >> 8);
- out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
+ out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
+ out_ptr[1] = (unsigned char)(((in_ptr[0] & 0xf) << 4)
+ | ((in_ptr[1] & 0xf00) >> 8));
+ out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
}
}
else if( sp->cinfo.d.data_precision == 8 )
@@ -1375,7 +1375,7 @@ JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
(void) s;
/* data is expected to be read in multiples of a scanline */
- if ( (nrows = sp->cinfo.d.image_height) ) {
+ if ( (nrows = sp->cinfo.d.image_height) != 0 ) {
/* Cb,Cr both have sampling factors 1, so this is correct */
JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;
@@ -1475,10 +1475,10 @@ JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
{
unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3;
JSAMPLE *in_ptr = (JSAMPLE *) (tmpbuf + iPair * 2);
- out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
- out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
- | ((in_ptr[1] & 0xf00) >> 8);
- out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
+ out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
+ out_ptr[1] = (unsigned char)(((in_ptr[0] & 0xf) << 4)
+ | ((in_ptr[1] & 0xf00) >> 8));
+ out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
}
}
}
@@ -1901,7 +1901,7 @@ JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
if( sp->cinfo.c.data_precision == 12 )
{
- line16_count = (sp->bytesperline * 2) / 3;
+ line16_count = (int)((sp->bytesperline * 2) / 3);
line16 = (short *) _TIFFmalloc(sizeof(short) * line16_count);
if (!line16)
{
@@ -2146,8 +2146,7 @@ JPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
/* XXX */
return (0);
}
- _TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*),
- (long) v32);
+ _TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*), v32);
sp->jpegtables_length = v32;
TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
break;
@@ -2176,7 +2175,7 @@ JPEGVSetField(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);