Reactos

[LIBTIFF] Update to version 4.0.10. CORE-15854

+1395 -240
+2
dll/3rdparty/libtiff/CMakeLists.txt
··· 47 47 tif_tile.c 48 48 tif_version.c 49 49 tif_warning.c 50 + #tif_webp.c 50 51 tif_win32.c 51 52 tif_write.c 52 53 tif_zip.c 54 + #tif_zstd.c 53 55 precomp.h) 54 56 55 57 add_library(libtiff SHARED ${SOURCE} libtiff.def)
-2
dll/3rdparty/libtiff/mkg3states.c
··· 1 - /* "$Id: mkg3states.c,v 1.12 2015-06-21 01:09:09 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1991-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_aux.c
··· 1 - /* $Id: tif_aux.c,v 1.31 2017-11-17 20:21:00 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1991-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_close.c
··· 1 - /* $Id: tif_close.c,v 1.21 2016-01-23 21:20:34 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+8 -2
dll/3rdparty/libtiff/tif_codec.c
··· 1 - /* $Id: tif_codec.c,v 1.17 2015-08-19 02:31:04 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 73 71 #ifndef LZMA_SUPPORT 74 72 #define TIFFInitLZMA NotConfigured 75 73 #endif 74 + #ifndef ZSTD_SUPPORT 75 + #define TIFFInitZSTD NotConfigured 76 + #endif 77 + #ifndef WEBP_SUPPORT 78 + #define TIFFInitWebP NotConfigured 79 + #endif 76 80 77 81 /* 78 82 * Compression schemes statically built into the library. ··· 100 104 { "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog }, 101 105 { "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog }, 102 106 { "LZMA", COMPRESSION_LZMA, TIFFInitLZMA }, 107 + { "ZSTD", COMPRESSION_ZSTD, TIFFInitZSTD }, 108 + { "WEBP", COMPRESSION_WEBP, TIFFInitWebP }, 103 109 { NULL, 0, NULL } 104 110 }; 105 111
+1 -3
dll/3rdparty/libtiff/tif_color.c
··· 1 - /* $Id: tif_color.c,v 1.24 2017-05-29 10:12:54 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 168 166 } 169 167 170 168 /* 171 - * Convert color value from the YCbCr space to CIE XYZ. 169 + * Convert color value from the YCbCr space to RGB. 172 170 * The colorspace conversion algorithm comes from the IJG v5a code; 173 171 * see below for more information on how it works. 174 172 */
-2
dll/3rdparty/libtiff/tif_compress.c
··· 1 - /* $Id: tif_compress.c,v 1.25 2016-10-25 20:04:22 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+15 -14
dll/3rdparty/libtiff/tif_dir.c
··· 1 - /* $Id: tif_dir.c,v 1.131 2017-07-11 21:38:04 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 863 861 const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY); 864 862 if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */ 865 863 return 0; 864 + 865 + /* 866 + * We want to force the custom code to be used for custom 867 + * fields even if the tag happens to match a well known 868 + * one - important for reinterpreted handling of standard 869 + * tag values in custom directories (i.e. EXIF) 870 + */ 871 + if (fip->field_bit == FIELD_CUSTOM) { 872 + standard_tag = 0; 873 + } 866 874 867 - if( tag == TIFFTAG_NUMBEROFINKS ) 875 + if( standard_tag == TIFFTAG_NUMBEROFINKS ) 868 876 { 869 877 int i; 870 878 for (i = 0; i < td->td_customValueCount; i++) { 871 879 uint16 val; 872 880 TIFFTagValue *tv = td->td_customValues + i; 873 - if (tv->info->field_tag != tag) 881 + if (tv->info->field_tag != standard_tag) 874 882 continue; 875 883 if( tv->value == NULL ) 876 884 return 0; ··· 891 899 } 892 900 return 0; 893 901 } 894 - 895 - /* 896 - * We want to force the custom code to be used for custom 897 - * fields even if the tag happens to match a well known 898 - * one - important for reinterpreted handling of standard 899 - * tag values in custom directories (i.e. EXIF) 900 - */ 901 - if (fip->field_bit == FIELD_CUSTOM) { 902 - standard_tag = 0; 903 - } 904 902 905 903 switch (standard_tag) { 906 904 case TIFFTAG_SUBFILETYPE: ··· 1067 1065 if (td->td_samplesperpixel - td->td_extrasamples > 1) { 1068 1066 *va_arg(ap, uint16**) = td->td_transferfunction[1]; 1069 1067 *va_arg(ap, uint16**) = td->td_transferfunction[2]; 1068 + } else { 1069 + *va_arg(ap, uint16**) = NULL; 1070 + *va_arg(ap, uint16**) = NULL; 1070 1071 } 1071 1072 break; 1072 1073 case TIFFTAG_REFERENCEBLACKWHITE:
+14 -3
dll/3rdparty/libtiff/tif_dirinfo.c
··· 1 - /* $Id: tif_dirinfo.c,v 1.127 2017-06-01 12:44:04 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 979 977 case TIFFTAG_CONSECUTIVEBADFAXLINES: 980 978 case TIFFTAG_GROUP3OPTIONS: 981 979 case TIFFTAG_GROUP4OPTIONS: 980 + /* LERC */ 981 + case TIFFTAG_LERC_PARAMETERS: 982 982 break; 983 983 default: 984 984 return 1; ··· 1054 1054 if (tag == TIFFTAG_PREDICTOR) 1055 1055 return 1; 1056 1056 break; 1057 - 1057 + case COMPRESSION_ZSTD: 1058 + if (tag == TIFFTAG_PREDICTOR) 1059 + return 1; 1060 + break; 1061 + case COMPRESSION_LERC: 1062 + if (tag == TIFFTAG_LERC_PARAMETERS) 1063 + return 1; 1064 + break; 1065 + case COMPRESSION_WEBP: 1066 + if (tag == TIFFTAG_PREDICTOR) 1067 + return 1; 1068 + break; 1058 1069 } 1059 1070 return 0; 1060 1071 }
+94 -23
dll/3rdparty/libtiff/tif_dirread.c
··· 1 - /* $Id: tif_dirread.c,v 1.218 2017-09-09 21:44:42 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 167 165 static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*); 168 166 static void ChopUpSingleUncompressedStrip(TIFF*); 169 167 static uint64 TIFFReadUInt64(const uint8 *value); 168 + static int _TIFFGetMaxColorChannels(uint16 photometric); 170 169 171 170 static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount ); 172 171 ··· 776 775 static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc( 777 776 TIFF* tif, uint64 offset, tmsize_t size, void** pdest) 778 777 { 779 - #if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8 778 + #if SIZEOF_SIZE_T == 8 780 779 tmsize_t threshold = INITIAL_THRESHOLD; 781 780 #endif 782 781 tmsize_t already_read = 0; ··· 797 796 void* new_dest; 798 797 tmsize_t bytes_read; 799 798 tmsize_t to_read = size - already_read; 800 - #if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8 799 + #if SIZEOF_SIZE_T == 8 801 800 if( to_read >= threshold && threshold < MAX_THRESHOLD ) 802 801 { 803 802 to_read = threshold; ··· 3507 3506 } 3508 3507 3509 3508 /* 3509 + * Return the maximum number of color channels specified for a given photometric 3510 + * type. 0 is returned if photometric type isn't supported or no default value 3511 + * is defined by the specification. 3512 + */ 3513 + static int _TIFFGetMaxColorChannels( uint16 photometric ) 3514 + { 3515 + switch (photometric) { 3516 + case PHOTOMETRIC_PALETTE: 3517 + case PHOTOMETRIC_MINISWHITE: 3518 + case PHOTOMETRIC_MINISBLACK: 3519 + return 1; 3520 + case PHOTOMETRIC_YCBCR: 3521 + case PHOTOMETRIC_RGB: 3522 + case PHOTOMETRIC_CIELAB: 3523 + case PHOTOMETRIC_LOGLUV: 3524 + case PHOTOMETRIC_ITULAB: 3525 + case PHOTOMETRIC_ICCLAB: 3526 + return 3; 3527 + case PHOTOMETRIC_SEPARATED: 3528 + case PHOTOMETRIC_MASK: 3529 + return 4; 3530 + case PHOTOMETRIC_LOGL: 3531 + case PHOTOMETRIC_CFA: 3532 + default: 3533 + return 0; 3534 + } 3535 + } 3536 + 3537 + /* 3510 3538 * Read the next TIFF directory from a file and convert it to the internal 3511 3539 * format. We read directories sequentially. 3512 3540 */ ··· 3522 3550 uint32 fii=FAILED_FII; 3523 3551 toff_t nextdiroff; 3524 3552 int bitspersample_read = FALSE; 3553 + int color_channels; 3525 3554 3526 3555 tif->tif_diroff=tif->tif_nextdiroff; 3527 3556 if (!TIFFCheckDirOffset(tif,tif->tif_nextdiroff)) ··· 4026 4055 } 4027 4056 } 4028 4057 } 4058 + 4059 + /* 4060 + * Make sure all non-color channels are extrasamples. 4061 + * If it's not the case, define them as such. 4062 + */ 4063 + color_channels = _TIFFGetMaxColorChannels(tif->tif_dir.td_photometric); 4064 + if (color_channels && tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples > color_channels) { 4065 + uint16 old_extrasamples; 4066 + uint16 *new_sampleinfo; 4067 + 4068 + TIFFWarningExt(tif->tif_clientdata,module, "Sum of Photometric type-related " 4069 + "color channels and ExtraSamples doesn't match SamplesPerPixel. " 4070 + "Defining non-color channels as ExtraSamples."); 4071 + 4072 + old_extrasamples = tif->tif_dir.td_extrasamples; 4073 + tif->tif_dir.td_extrasamples = (uint16) (tif->tif_dir.td_samplesperpixel - color_channels); 4074 + 4075 + // sampleinfo should contain information relative to these new extra samples 4076 + new_sampleinfo = (uint16*) _TIFFcalloc(tif->tif_dir.td_extrasamples, sizeof(uint16)); 4077 + if (!new_sampleinfo) { 4078 + TIFFErrorExt(tif->tif_clientdata, module, "Failed to allocate memory for " 4079 + "temporary new sampleinfo array (%d 16 bit elements)", 4080 + tif->tif_dir.td_extrasamples); 4081 + goto bad; 4082 + } 4083 + 4084 + memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16)); 4085 + _TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples); 4086 + _TIFFfree(new_sampleinfo); 4087 + } 4088 + 4029 4089 /* 4030 4090 * Verify Palette image has a Colormap. 4031 4091 */ ··· 4881 4941 err=TIFFReadDirEntryByteArray(tif,dp,&data); 4882 4942 if (err==TIFFReadDirEntryErrOk) 4883 4943 { 4884 - uint8* ma; 4885 - uint32 mb; 4944 + uint32 mb = 0; 4886 4945 int n; 4887 - ma=data; 4888 - mb=0; 4889 - while (mb<(uint32)dp->tdir_count) 4946 + if (data != NULL) 4890 4947 { 4891 - if (*ma==0) 4892 - break; 4893 - ma++; 4894 - mb++; 4948 + uint8* ma = data; 4949 + while (mb<(uint32)dp->tdir_count) 4950 + { 4951 + if (*ma==0) 4952 + break; 4953 + ma++; 4954 + mb++; 4955 + } 4895 4956 } 4896 4957 if (mb+1<(uint32)dp->tdir_count) 4897 4958 TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" contains null byte in value; value incorrectly truncated during reading due to implementation limitations",fip->field_name); ··· 5141 5202 if (err==TIFFReadDirEntryErrOk) 5142 5203 { 5143 5204 int m; 5144 - if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) 5145 - { 5146 - TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); 5147 - data[dp->tdir_count-1] = '\0'; 5148 - } 5205 + if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) 5206 + { 5207 + TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); 5208 + data[dp->tdir_count-1] = '\0'; 5209 + } 5149 5210 m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); 5150 5211 if (data!=0) 5151 5212 _TIFFfree(data); ··· 5318 5379 if (err==TIFFReadDirEntryErrOk) 5319 5380 { 5320 5381 int m; 5321 - if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) 5322 - { 5323 - TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); 5324 - data[dp->tdir_count-1] = '\0'; 5325 - } 5382 + if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) 5383 + { 5384 + TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); 5385 + data[dp->tdir_count-1] = '\0'; 5386 + } 5326 5387 m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); 5327 5388 if (data!=0) 5328 5389 _TIFFfree(data); ··· 5697 5758 nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip); 5698 5759 if( nstrips == 0 ) 5699 5760 return; 5761 + 5762 + /* If we are going to allocate a lot of memory, make sure that the */ 5763 + /* file is as big as needed */ 5764 + if( tif->tif_mode == O_RDONLY && 5765 + nstrips > 1000000 && 5766 + (offset >= TIFFGetFileSize(tif) || 5767 + stripbytes > (TIFFGetFileSize(tif) - offset) / (nstrips - 1)) ) 5768 + { 5769 + return; 5770 + } 5700 5771 5701 5772 newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), 5702 5773 "for chopped \"StripByteCounts\" array");
+5 -4
dll/3rdparty/libtiff/tif_dirwrite.c
··· 1 - /* $Id: tif_dirwrite.c,v 1.89 2017-08-23 13:33:42 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 697 695 } 698 696 break; 699 697 default: 700 - assert(0); /* we should never get here */ 701 - break; 698 + TIFFErrorExt(tif->tif_clientdata,module, 699 + "Cannot write tag %d (%s)", 700 + TIFFFieldTag(o), 701 + o->field_name ? o->field_name : "unknown"); 702 + goto bad; 702 703 } 703 704 } 704 705 }
-2
dll/3rdparty/libtiff/tif_dumpmode.c
··· 1 - /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.15 2015-12-12 18:04:26 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_error.c
··· 1 - /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.6 2017-07-04 12:54:42 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_extension.c
··· 1 - /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.8 2015-12-06 11:13:43 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_fax3.c
··· 1 - /* $Id: tif_fax3.c,v 1.81 2017-06-18 10:31:50 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1990-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_flush.c
··· 1 - /* $Id: tif_flush.c,v 1.9 2010-03-31 06:40:10 fwarmerdam Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_getimage.c
··· 1 - /* $Id: tif_getimage.c,v 1.114 2017-11-17 20:21:00 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1991-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+27 -9
dll/3rdparty/libtiff/tif_jbig.c
··· 1 - /* $Id: tif_jbig.c,v 1.16 2017-06-26 15:20:00 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 32 30 * 33 31 */ 34 32 35 - #include <precomp.h> 33 + #include "tiffiop.h" 36 34 37 35 #ifdef JBIG_SUPPORT 38 36 #include "jbig.h" ··· 53 51 struct jbg_dec_state decoder; 54 52 int decodeStatus = 0; 55 53 unsigned char* pImage = NULL; 56 - (void) size, (void) s; 54 + unsigned long decodedSize; 55 + (void) s; 57 56 58 57 if (isFillOrder(tif, tif->tif_dir.td_fillorder)) 59 58 { 60 - TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdatasize); 59 + TIFFReverseBits(tif->tif_rawcp, tif->tif_rawcc); 61 60 } 62 61 63 62 jbg_dec_init(&decoder); 64 63 65 64 #if defined(HAVE_JBG_NEWLEN) 66 - jbg_newlen(tif->tif_rawdata, (size_t)tif->tif_rawdatasize); 65 + jbg_newlen(tif->tif_rawcp, (size_t)tif->tif_rawcc); 67 66 /* 68 67 * I do not check the return status of jbg_newlen because even if this 69 68 * function fails it does not necessarily mean that decoding the image ··· 76 75 */ 77 76 #endif /* HAVE_JBG_NEWLEN */ 78 77 79 - decodeStatus = jbg_dec_in(&decoder, (unsigned char*)tif->tif_rawdata, 80 - (size_t)tif->tif_rawdatasize, NULL); 78 + decodeStatus = jbg_dec_in(&decoder, (unsigned char*)tif->tif_rawcp, 79 + (size_t)tif->tif_rawcc, NULL); 81 80 if (JBG_EOK != decodeStatus) 82 81 { 83 82 /* ··· 98 97 return 0; 99 98 } 100 99 100 + decodedSize = jbg_dec_getsize(&decoder); 101 + if( (tmsize_t)decodedSize < size ) 102 + { 103 + TIFFWarningExt(tif->tif_clientdata, "JBIG", 104 + "Only decoded %lu bytes, whereas %lu requested", 105 + decodedSize, (unsigned long)size); 106 + } 107 + else if( (tmsize_t)decodedSize > size ) 108 + { 109 + TIFFErrorExt(tif->tif_clientdata, "JBIG", 110 + "Decoded %lu bytes, whereas %lu were requested", 111 + decodedSize, (unsigned long)size); 112 + jbg_dec_free(&decoder); 113 + return 0; 114 + } 101 115 pImage = jbg_dec_getimage(&decoder, 0); 102 - _TIFFmemcpy(buffer, pImage, jbg_dec_getsize(&decoder)); 116 + _TIFFmemcpy(buffer, pImage, decodedSize); 103 117 jbg_dec_free(&decoder); 118 + 119 + tif->tif_rawcp += tif->tif_rawcc; 120 + tif->tif_rawcc = 0; 121 + 104 122 return 1; 105 123 } 106 124
+3 -4
dll/3rdparty/libtiff/tif_jpeg.c
··· 1 - /* $Id: tif_jpeg.c,v 1.134 2017-10-17 19:04:47 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1994-1997 Sam Leffler 5 3 * Copyright (c) 1994-1997 Silicon Graphics, Inc. ··· 27 25 #define WIN32_LEAN_AND_MEAN 28 26 #define VC_EXTRALEAN 29 27 30 - #include <precomp.h> 28 + #include "tiffiop.h" 29 + #include <stdlib.h> 31 30 32 31 #ifdef JPEG_SUPPORT 33 32 ··· 75 74 "JPEGLib: JPEG parameter struct mismatch: library thinks size is 432, 76 75 caller expects 464" 77 76 78 - For such users we wil fix the problem here. See install.doc file from 77 + For such users we will fix the problem here. See install.doc file from 79 78 the JPEG library distribution for details. 80 79 */ 81 80
+6 -6
dll/3rdparty/libtiff/tif_luv.c
··· 1 - /* $Id: tif_luv.c,v 1.49 2017-07-24 12:47:30 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1997 Greg Ward Larson 5 3 * Copyright (c) 1997 Silicon Graphics, Inc. ··· 215 213 bp = (unsigned char*) tif->tif_rawcp; 216 214 cc = tif->tif_rawcc; 217 215 /* get each byte string */ 218 - for (shft = 2*8; (shft -= 8) >= 0; ) { 216 + for (shft = 8; shft >= 0; shft -=8) { 219 217 for (i = 0; i < npixels && cc > 0; ) { 220 218 if (*bp >= 128) { /* run */ 221 219 if( cc < 2 ) ··· 349 347 bp = (unsigned char*) tif->tif_rawcp; 350 348 cc = tif->tif_rawcc; 351 349 /* get each byte string */ 352 - for (shft = 4*8; (shft -= 8) >= 0; ) { 350 + for (shft = 24; shft >= 0; shft -=8) { 353 351 for (i = 0; i < npixels && cc > 0; ) { 354 352 if (*bp >= 128) { /* run */ 355 353 if( cc < 2 ) ··· 467 465 /* compress each byte string */ 468 466 op = tif->tif_rawcp; 469 467 occ = tif->tif_rawdatasize - tif->tif_rawcc; 470 - for (shft = 2*8; (shft -= 8) >= 0; ) 468 + for (shft = 8; shft >= 0; shft -=8) { 471 469 for (i = 0; i < npixels; i += rc) { 472 470 if (occ < 4) { 473 471 tif->tif_rawcp = op; ··· 522 520 } else 523 521 rc = 0; 524 522 } 523 + } 525 524 tif->tif_rawcp = op; 526 525 tif->tif_rawcc = tif->tif_rawdatasize - occ; 527 526 ··· 618 617 /* compress each byte string */ 619 618 op = tif->tif_rawcp; 620 619 occ = tif->tif_rawdatasize - tif->tif_rawcc; 621 - for (shft = 4*8; (shft -= 8) >= 0; ) 620 + for (shft = 24; shft >= 0; shft -=8) { 622 621 for (i = 0; i < npixels; i += rc) { 623 622 if (occ < 4) { 624 623 tif->tif_rawcp = op; ··· 673 672 } else 674 673 rc = 0; 675 674 } 675 + } 676 676 tif->tif_rawcp = op; 677 677 tif->tif_rawcc = tif->tif_rawdatasize - occ; 678 678
+8 -3
dll/3rdparty/libtiff/tif_lzma.c
··· 1 - /* $Id: tif_lzma.c,v 1.6 2016-09-17 09:18:59 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 2010, Andrey Kiselev <dron@ak4719.spb.edu> 5 3 * ··· 250 248 { 251 249 static const char module[] = "LZMAPreEncode"; 252 250 LZMAState *sp = EncoderState(tif); 251 + lzma_ret ret; 253 252 254 253 (void) s; 255 254 assert(sp != NULL); ··· 263 262 "Liblzma cannot deal with buffers this size"); 264 263 return 0; 265 264 } 266 - return (lzma_stream_encoder(&sp->stream, sp->filters, sp->check) == LZMA_OK); 265 + ret = lzma_stream_encoder(&sp->stream, sp->filters, sp->check); 266 + if (ret != LZMA_OK) { 267 + TIFFErrorExt(tif->tif_clientdata, module, 268 + "Error in lzma_stream_encoder(): %s", LZMAStrerror(ret)); 269 + return 0; 270 + } 271 + return 1; 267 272 } 268 273 269 274 /*
+22 -10
dll/3rdparty/libtiff/tif_lzw.c
··· 1 - /* $Id: tif_lzw.c,v 1.57 2017-07-11 10:54:29 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 135 133 long dec_restart; /* restart count */ 136 134 #ifdef LZW_CHECKEOS 137 135 uint64 dec_bitsleft; /* available bits in raw data */ 136 + tmsize_t old_tif_rawcc; /* value of tif_rawcc at the end of the previous TIFLZWDecode() call */ 138 137 #endif 139 138 decodeFunc dec_decode; /* regular or backwards compatible */ 140 139 code_t* dec_codep; /* current recognized code */ ··· 320 319 sp->dec_nbitsmask = MAXCODE(BITS_MIN); 321 320 #ifdef LZW_CHECKEOS 322 321 sp->dec_bitsleft = 0; 322 + sp->old_tif_rawcc = 0; 323 323 #endif 324 324 sp->dec_free_entp = sp->dec_codetab + CODE_FIRST; 325 325 /* ··· 427 427 428 428 bp = (unsigned char *)tif->tif_rawcp; 429 429 #ifdef LZW_CHECKEOS 430 - sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3); 430 + sp->dec_bitsleft += (((uint64)tif->tif_rawcc - sp->old_tif_rawcc) << 3); 431 431 #endif 432 432 nbits = sp->lzw_nbits; 433 433 nextdata = sp->lzw_nextdata; ··· 555 555 556 556 tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp ); 557 557 tif->tif_rawcp = (uint8*) bp; 558 + #ifdef LZW_CHECKEOS 559 + sp->old_tif_rawcc = tif->tif_rawcc; 560 + #endif 558 561 sp->lzw_nbits = (unsigned short) nbits; 559 562 sp->lzw_nextdata = nextdata; 560 563 sp->lzw_nextbits = nextbits; ··· 604 607 char *tp; 605 608 unsigned char *bp; 606 609 int code, nbits; 610 + int len; 607 611 long nextbits, nextdata, nbitsmask; 608 612 code_t *codep, *free_entp, *maxcodep, *oldcodep; 609 613 ··· 657 661 658 662 bp = (unsigned char *)tif->tif_rawcp; 659 663 #ifdef LZW_CHECKEOS 660 - sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3); 664 + sp->dec_bitsleft += (((uint64)tif->tif_rawcc - sp->old_tif_rawcc) << 3); 661 665 #endif 662 666 nbits = sp->lzw_nbits; 663 667 nextdata = sp->lzw_nextdata; ··· 755 759 } while (--occ); 756 760 break; 757 761 } 758 - assert(occ >= codep->length); 759 - op += codep->length; 760 - occ -= codep->length; 761 - tp = op; 762 + len = codep->length; 763 + tp = op + len; 762 764 do { 763 - *--tp = codep->value; 764 - } while( (codep = codep->next) != NULL ); 765 + int t; 766 + --tp; 767 + t = codep->value; 768 + codep = codep->next; 769 + *tp = (char)t; 770 + } while (codep && tp > op); 771 + assert(occ >= len); 772 + op += len; 773 + occ -= len; 765 774 } else { 766 775 *op++ = (char)code; 767 776 occ--; ··· 770 779 771 780 tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp ); 772 781 tif->tif_rawcp = (uint8*) bp; 782 + #ifdef LZW_CHECKEOS 783 + sp->old_tif_rawcc = tif->tif_rawcc; 784 + #endif 773 785 sp->lzw_nbits = (unsigned short)nbits; 774 786 sp->lzw_nextdata = nextdata; 775 787 sp->lzw_nextbits = nextbits;
-2
dll/3rdparty/libtiff/tif_next.c
··· 1 - /* $Id: tif_next.c,v 1.19 2016-09-04 21:32:56 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+1 -4
dll/3rdparty/libtiff/tif_ojpeg.c
··· 1 - /* $Id: tif_ojpeg.c,v 1.69 2017-04-27 17:29:26 erouault Exp $ */ 2 - 3 1 /* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0 4 2 specification is now totally obsolete and deprecated for new applications and 5 3 images. This file was was created solely in order to read unconverted images ··· 123 121 #define WIN32_LEAN_AND_MEAN 124 122 #define VC_EXTRALEAN 125 123 126 - #include <precomp.h> 127 - 124 + #include "tiffiop.h" 128 125 #ifdef OJPEG_SUPPORT 129 126 130 127 /* Configuration defines here are:
-2
dll/3rdparty/libtiff/tif_open.c
··· 1 - /* $Id: tif_open.c,v 1.48 2016-11-20 22:29:47 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_packbits.c
··· 1 - /* $Id: tif_packbits.c,v 1.26 2017-05-14 02:26:07 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_pixarlog.c
··· 1 - /* $Id: tif_pixarlog.c,v 1.54 2017-07-10 10:40:28 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1996-1997 Sam Leffler 5 3 * Copyright (c) 1996 Pixar
-2
dll/3rdparty/libtiff/tif_predict.c
··· 1 - /* $Id: tif_predict.c,v 1.44 2017-06-18 10:31:50 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+5 -7
dll/3rdparty/libtiff/tif_print.c
··· 1 - /* $Id: tif_print.c,v 1.65 2016-11-20 22:31:22 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 547 545 uint16 i; 548 546 fprintf(fd, " %2ld: %5u", 549 547 l, td->td_transferfunction[0][l]); 550 - for (i = 1; i < td->td_samplesperpixel; i++) 548 + for (i = 1; i < td->td_samplesperpixel - td->td_extrasamples && i < 3; i++) 551 549 fprintf(fd, " %5u", 552 550 td->td_transferfunction[i][l]); 553 551 fputc('\n', fd); ··· 668 666 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) 669 667 fprintf(fd, " %3lu: [%8I64u, %8I64u]\n", 670 668 (unsigned long) s, 671 - (unsigned __int64) td->td_stripoffset[s], 672 - (unsigned __int64) td->td_stripbytecount[s]); 669 + td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0, 670 + td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0); 673 671 #else 674 672 fprintf(fd, " %3lu: [%8llu, %8llu]\n", 675 673 (unsigned long) s, 676 - (unsigned long long) td->td_stripoffset[s], 677 - (unsigned long long) td->td_stripbytecount[s]); 674 + td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0, 675 + td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0); 678 676 #endif 679 677 } 680 678 }
+9 -4
dll/3rdparty/libtiff/tif_read.c
··· 1 - /* $Id: tif_read.c,v 1.66 2017-11-17 20:21:00 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 58 56 int is_strip, uint32 strip_or_tile, 59 57 const char* module ) 60 58 { 61 - #if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8 59 + #if SIZEOF_SIZE_T == 8 62 60 tmsize_t threshold = INITIAL_THRESHOLD; 63 61 #endif 64 62 tmsize_t already_read = 0; ··· 73 71 { 74 72 tmsize_t bytes_read; 75 73 tmsize_t to_read = size - already_read; 76 - #if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8 74 + #if SIZEOF_SIZE_T == 8 77 75 if( to_read >= threshold && threshold < MAX_THRESHOLD && 78 76 already_read + to_read + rawdata_offset > tif->tif_rawdatasize ) 79 77 { ··· 348 346 return 0; 349 347 whole_strip = tif->tif_dir.td_stripbytecount[strip] < 10 350 348 || isMapped(tif); 349 + if( td->td_compression == COMPRESSION_LERC || 350 + td->td_compression == COMPRESSION_JBIG ) 351 + { 352 + /* Ideally plugins should have a way to declare they don't support 353 + * chunk strip */ 354 + whole_strip = 1; 355 + } 351 356 #else 352 357 whole_strip = 1; 353 358 #endif
+6 -2
dll/3rdparty/libtiff/tif_stream.cxx
··· 1 - /* $Id: tif_stream.cxx,v 1.13 2015-05-28 01:50:22 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1996 Sam Leffler 5 3 * Copyright (c) 1991-1996 Silicon Graphics, Inc. ··· 375 373 _tiffosSizeProc, 376 374 _tiffDummyMapProc, 377 375 _tiffDummyUnmapProc); 376 + if (!tif) { 377 + delete data; 378 + } 378 379 } else { 379 380 tiffis_data *data = new tiffis_data; 380 381 data->stream = reinterpret_cast<istream *>(fd); ··· 389 390 _tiffisSizeProc, 390 391 _tiffDummyMapProc, 391 392 _tiffDummyUnmapProc); 393 + if (!tif) { 394 + delete data; 395 + } 392 396 } 393 397 394 398 return (tif);
-2
dll/3rdparty/libtiff/tif_strip.c
··· 1 - /* $Id: tif_strip.c,v 1.38 2016-12-03 11:02:15 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1991-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_swab.c
··· 1 - /* $Id: tif_swab.c,v 1.15 2017-06-08 16:39:50 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_thunder.c
··· 1 - /* $Id: tif_thunder.c,v 1.13 2016-09-04 21:32:56 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_tile.c
··· 1 - /* $Id: tif_tile.c,v 1.24 2015-06-07 22:35:40 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1991-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_unix.c
··· 1 - /* $Id: tif_unix.c,v 1.28 2017-01-11 19:02:49 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-1
dll/3rdparty/libtiff/tif_version.c
··· 1 - /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_version.c,v 1.3 2010-03-10 18:56:49 bfriesen Exp $ */ 2 1 /* 3 2 * Copyright (c) 1992-1997 Sam Leffler 4 3 * Copyright (c) 1992-1997 Silicon Graphics, Inc.
-2
dll/3rdparty/libtiff/tif_warning.c
··· 1 - /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_warning.c,v 1.4 2017-07-04 12:54:42 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+684
dll/3rdparty/libtiff/tif_webp.c
··· 1 + /* 2 + * Copyright (c) 2018, Mapbox 3 + * Author: <norman.barker at mapbox.com> 4 + * 5 + * Permission to use, copy, modify, distribute, and sell this software and 6 + * its documentation for any purpose is hereby granted without fee, provided 7 + * that (i) the above copyright notices and this permission notice appear in 8 + * all copies of the software and related documentation, and (ii) the names of 9 + * Sam Leffler and Silicon Graphics may not be used in any advertising or 10 + * publicity relating to the software without the specific, prior written 11 + * permission of Sam Leffler and Silicon Graphics. 12 + * 13 + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 14 + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 15 + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 16 + * 17 + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 18 + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 19 + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 20 + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 21 + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 22 + * OF THIS SOFTWARE. 23 + */ 24 + 25 + #include "tiffiop.h" 26 + #ifdef WEBP_SUPPORT 27 + /* 28 + * TIFF Library. 29 + * 30 + * WEBP Compression Support 31 + * 32 + */ 33 + 34 + #include "webp/decode.h" 35 + #include "webp/encode.h" 36 + 37 + #include <stdio.h> 38 + 39 + #define LSTATE_INIT_DECODE 0x01 40 + #define LSTATE_INIT_ENCODE 0x02 41 + /* 42 + * State block for each open TIFF 43 + * file using WEBP compression/decompression. 44 + */ 45 + typedef struct { 46 + uint16 nSamples; /* number of samples per pixel */ 47 + 48 + int lossless; /* lossy/lossless compression */ 49 + int quality_level; /* compression level */ 50 + WebPPicture sPicture; /* WebP Picture */ 51 + WebPConfig sEncoderConfig; /* WebP encoder config */ 52 + uint8* pBuffer; /* buffer to hold raw data on encoding */ 53 + unsigned int buffer_offset; /* current offset into the buffer */ 54 + unsigned int buffer_size; 55 + 56 + WebPIDecoder* psDecoder; /* WebPIDecoder */ 57 + WebPDecBuffer sDecBuffer; /* Decoder buffer */ 58 + int last_y; /* Last row decoded */ 59 + 60 + int state; /* state flags */ 61 + 62 + TIFFVGetMethod vgetparent; /* super-class method */ 63 + TIFFVSetMethod vsetparent; /* super-class method */ 64 + } WebPState; 65 + 66 + #define LState(tif) ((WebPState*) (tif)->tif_data) 67 + #define DecoderState(tif) LState(tif) 68 + #define EncoderState(tif) LState(tif) 69 + 70 + static int TWebPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s); 71 + static int TWebPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s); 72 + 73 + static 74 + int TWebPDatasetWriter(const uint8_t* data, size_t data_size, 75 + const WebPPicture* const picture) 76 + { 77 + static const char module[] = "TWebPDatasetWriter"; 78 + TIFF* tif = (TIFF*)(picture->custom_ptr); 79 + 80 + if ( (tif->tif_rawcc + (tmsize_t)data_size) > tif->tif_rawdatasize ) { 81 + TIFFErrorExt(tif->tif_clientdata, module, 82 + "Buffer too small by " TIFF_SIZE_FORMAT " bytes.", 83 + (size_t) (tif->tif_rawcc + data_size - tif->tif_rawdatasize)); 84 + return 0; 85 + } else { 86 + _TIFFmemcpy(tif->tif_rawcp, data, data_size); 87 + tif->tif_rawcc += data_size; 88 + tif->tif_rawcp += data_size; 89 + return 1; 90 + } 91 + } 92 + 93 + /* 94 + * Encode a chunk of pixels. 95 + */ 96 + static int 97 + TWebPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) 98 + { 99 + static const char module[] = "TWebPEncode"; 100 + WebPState *sp = EncoderState(tif); 101 + (void) s; 102 + 103 + assert(sp != NULL); 104 + assert(sp->state == LSTATE_INIT_ENCODE); 105 + 106 + if( (uint64)sp->buffer_offset + 107 + (uint64)cc > sp->buffer_size ) 108 + { 109 + TIFFErrorExt(tif->tif_clientdata, module, 110 + "Too many bytes to be written"); 111 + return 0; 112 + } 113 + 114 + memcpy(sp->pBuffer + sp->buffer_offset, 115 + bp, cc); 116 + sp->buffer_offset += (unsigned)cc; 117 + 118 + return 1; 119 + 120 + } 121 + 122 + static int 123 + TWebPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) 124 + { 125 + static const char module[] = "WebPDecode"; 126 + VP8StatusCode status = VP8_STATUS_OK; 127 + WebPState *sp = DecoderState(tif); 128 + (void) s; 129 + 130 + assert(sp != NULL); 131 + assert(sp->state == LSTATE_INIT_DECODE); 132 + 133 + if (occ % sp->sDecBuffer.u.RGBA.stride) 134 + { 135 + TIFFErrorExt(tif->tif_clientdata, module, 136 + "Fractional scanlines cannot be read"); 137 + return 0; 138 + } 139 + 140 + status = WebPIAppend(sp->psDecoder, tif->tif_rawcp, tif->tif_rawcc); 141 + 142 + if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) { 143 + if (status == VP8_STATUS_INVALID_PARAM) { 144 + TIFFErrorExt(tif->tif_clientdata, module, 145 + "Invalid parameter used."); 146 + } else if (status == VP8_STATUS_OUT_OF_MEMORY) { 147 + TIFFErrorExt(tif->tif_clientdata, module, 148 + "Out of memory."); 149 + } else { 150 + TIFFErrorExt(tif->tif_clientdata, module, 151 + "Unrecognized error."); 152 + } 153 + return 0; 154 + } else { 155 + int current_y, stride; 156 + uint8_t* buf; 157 + 158 + /* Returns the RGB/A image decoded so far */ 159 + buf = WebPIDecGetRGB(sp->psDecoder, &current_y, NULL, NULL, &stride); 160 + 161 + if ((buf != NULL) && 162 + (occ <= stride * (current_y - sp->last_y))) { 163 + memcpy(op, 164 + buf + (sp->last_y * stride), 165 + occ); 166 + 167 + tif->tif_rawcp += tif->tif_rawcc; 168 + tif->tif_rawcc = 0; 169 + sp->last_y += occ / sp->sDecBuffer.u.RGBA.stride; 170 + return 1; 171 + } else { 172 + TIFFErrorExt(tif->tif_clientdata, module, "Unable to decode WebP data."); 173 + return 0; 174 + } 175 + } 176 + } 177 + 178 + static int 179 + TWebPFixupTags(TIFF* tif) 180 + { 181 + (void) tif; 182 + if (tif->tif_dir.td_planarconfig != PLANARCONFIG_CONTIG) { 183 + static const char module[] = "TWebPFixupTags"; 184 + TIFFErrorExt(tif->tif_clientdata, module, 185 + "TIFF WEBP requires data to be stored contiguously in RGB e.g. RGBRGBRGB " 186 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 187 + "or RGBARGBARGBA" 188 + #endif 189 + ); 190 + return 0; 191 + } 192 + return 1; 193 + } 194 + 195 + static int 196 + TWebPSetupDecode(TIFF* tif) 197 + { 198 + static const char module[] = "WebPSetupDecode"; 199 + uint16 nBitsPerSample = tif->tif_dir.td_bitspersample; 200 + uint16 sampleFormat = tif->tif_dir.td_sampleformat; 201 + 202 + WebPState* sp = DecoderState(tif); 203 + assert(sp != NULL); 204 + 205 + sp->nSamples = tif->tif_dir.td_samplesperpixel; 206 + 207 + /* check band count */ 208 + if ( sp->nSamples != 3 209 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 210 + && sp->nSamples != 4 211 + #endif 212 + ) 213 + { 214 + TIFFErrorExt(tif->tif_clientdata, module, 215 + "WEBP driver doesn't support %d bands. Must be 3 (RGB) " 216 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 217 + "or 4 (RGBA) " 218 + #endif 219 + "bands.", 220 + sp->nSamples ); 221 + return 0; 222 + } 223 + 224 + /* check bits per sample and data type */ 225 + if ((nBitsPerSample != 8) && (sampleFormat != 1)) { 226 + TIFFErrorExt(tif->tif_clientdata, module, 227 + "WEBP driver requires 8 bit unsigned data"); 228 + return 0; 229 + } 230 + 231 + /* if we were last encoding, terminate this mode */ 232 + if (sp->state & LSTATE_INIT_ENCODE) { 233 + WebPPictureFree(&sp->sPicture); 234 + if (sp->pBuffer != NULL) { 235 + _TIFFfree(sp->pBuffer); 236 + sp->pBuffer = NULL; 237 + } 238 + sp->buffer_offset = 0; 239 + sp->state = 0; 240 + } 241 + 242 + sp->state |= LSTATE_INIT_DECODE; 243 + 244 + return 1; 245 + } 246 + 247 + /* 248 + * Setup state for decoding a strip. 249 + */ 250 + static int 251 + TWebPPreDecode(TIFF* tif, uint16 s) 252 + { 253 + static const char module[] = "TWebPPreDecode"; 254 + uint32 segment_width, segment_height; 255 + WebPState* sp = DecoderState(tif); 256 + TIFFDirectory* td = &tif->tif_dir; 257 + (void) s; 258 + assert(sp != NULL); 259 + 260 + if (isTiled(tif)) { 261 + segment_width = td->td_tilewidth; 262 + segment_height = td->td_tilelength; 263 + } else { 264 + segment_width = td->td_imagewidth; 265 + segment_height = td->td_imagelength - tif->tif_row; 266 + if (segment_height > td->td_rowsperstrip) 267 + segment_height = td->td_rowsperstrip; 268 + } 269 + 270 + if( (sp->state & LSTATE_INIT_DECODE) == 0 ) 271 + tif->tif_setupdecode(tif); 272 + 273 + if (sp->psDecoder != NULL) { 274 + WebPIDelete(sp->psDecoder); 275 + WebPFreeDecBuffer(&sp->sDecBuffer); 276 + sp->psDecoder = NULL; 277 + } 278 + 279 + sp->last_y = 0; 280 + 281 + WebPInitDecBuffer(&sp->sDecBuffer); 282 + 283 + sp->sDecBuffer.is_external_memory = 0; 284 + sp->sDecBuffer.width = segment_width; 285 + sp->sDecBuffer.height = segment_height; 286 + sp->sDecBuffer.u.RGBA.stride = segment_width * sp->nSamples; 287 + sp->sDecBuffer.u.RGBA.size = segment_width * sp->nSamples * segment_height; 288 + 289 + if (sp->nSamples > 3) { 290 + sp->sDecBuffer.colorspace = MODE_RGBA; 291 + } else { 292 + sp->sDecBuffer.colorspace = MODE_RGB; 293 + } 294 + 295 + sp->psDecoder = WebPINewDecoder(&sp->sDecBuffer); 296 + 297 + if (sp->psDecoder == NULL) { 298 + TIFFErrorExt(tif->tif_clientdata, module, 299 + "Unable to allocate WebP decoder."); 300 + return 0; 301 + } 302 + 303 + return 1; 304 + } 305 + 306 + static int 307 + TWebPSetupEncode(TIFF* tif) 308 + { 309 + static const char module[] = "WebPSetupEncode"; 310 + uint16 nBitsPerSample = tif->tif_dir.td_bitspersample; 311 + uint16 sampleFormat = tif->tif_dir.td_sampleformat; 312 + 313 + WebPState* sp = EncoderState(tif); 314 + assert(sp != NULL); 315 + 316 + sp->nSamples = tif->tif_dir.td_samplesperpixel; 317 + 318 + /* check band count */ 319 + if ( sp->nSamples != 3 320 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 321 + && sp->nSamples != 4 322 + #endif 323 + ) 324 + { 325 + TIFFErrorExt(tif->tif_clientdata, module, 326 + "WEBP driver doesn't support %d bands. Must be 3 (RGB) " 327 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 328 + "or 4 (RGBA) " 329 + #endif 330 + "bands.", 331 + sp->nSamples ); 332 + return 0; 333 + } 334 + 335 + /* check bits per sample and data type */ 336 + if ((nBitsPerSample != 8) && (sampleFormat != 1)) { 337 + TIFFErrorExt(tif->tif_clientdata, module, 338 + "WEBP driver requires 8 bit unsigned data"); 339 + return 0; 340 + } 341 + 342 + if (sp->state & LSTATE_INIT_DECODE) { 343 + WebPIDelete(sp->psDecoder); 344 + WebPFreeDecBuffer(&sp->sDecBuffer); 345 + sp->psDecoder = NULL; 346 + sp->last_y = 0; 347 + sp->state = 0; 348 + } 349 + 350 + sp->state |= LSTATE_INIT_ENCODE; 351 + 352 + if (!WebPConfigInitInternal(&sp->sEncoderConfig, WEBP_PRESET_DEFAULT, 353 + sp->quality_level, 354 + WEBP_ENCODER_ABI_VERSION)) { 355 + TIFFErrorExt(tif->tif_clientdata, module, 356 + "Error creating WebP encoder configuration."); 357 + return 0; 358 + } 359 + 360 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 361 + sp->sEncoderConfig.lossless = sp->lossless; 362 + #endif 363 + 364 + if (!WebPValidateConfig(&sp->sEncoderConfig)) { 365 + TIFFErrorExt(tif->tif_clientdata, module, 366 + "Error with WebP encoder configuration."); 367 + return 0; 368 + } 369 + 370 + if (!WebPPictureInit(&sp->sPicture)) { 371 + TIFFErrorExt(tif->tif_clientdata, module, 372 + "Error initializing WebP picture."); 373 + return 0; 374 + } 375 + 376 + return 1; 377 + } 378 + 379 + /* 380 + * Reset encoding state at the start of a strip. 381 + */ 382 + static int 383 + TWebPPreEncode(TIFF* tif, uint16 s) 384 + { 385 + static const char module[] = "TWebPPreEncode"; 386 + uint32 segment_width, segment_height; 387 + WebPState *sp = EncoderState(tif); 388 + TIFFDirectory* td = &tif->tif_dir; 389 + 390 + (void) s; 391 + 392 + assert(sp != NULL); 393 + if( sp->state != LSTATE_INIT_ENCODE ) 394 + tif->tif_setupencode(tif); 395 + 396 + /* 397 + * Set encoding parameters for this strip/tile. 398 + */ 399 + if (isTiled(tif)) { 400 + segment_width = td->td_tilewidth; 401 + segment_height = td->td_tilelength; 402 + } else { 403 + segment_width = td->td_imagewidth; 404 + segment_height = td->td_imagelength - tif->tif_row; 405 + if (segment_height > td->td_rowsperstrip) 406 + segment_height = td->td_rowsperstrip; 407 + } 408 + 409 + if( segment_width > 16383 || segment_height > 16383 ) { 410 + TIFFErrorExt(tif->tif_clientdata, module, 411 + "WEBP maximum image dimensions are 16383 x 16383."); 412 + return 0; 413 + } 414 + 415 + /* set up buffer for raw data */ 416 + /* given above check and that nSamples <= 4, buffer_size is <= 1 GB */ 417 + sp->buffer_size = segment_width * segment_height * sp->nSamples; 418 + sp->pBuffer = _TIFFmalloc(sp->buffer_size); 419 + if( !sp->pBuffer) { 420 + TIFFErrorExt(tif->tif_clientdata, module, "Cannot allocate buffer"); 421 + return 0; 422 + } 423 + sp->buffer_offset = 0; 424 + 425 + sp->sPicture.width = segment_width; 426 + sp->sPicture.height = segment_height; 427 + sp->sPicture.writer = TWebPDatasetWriter; 428 + sp->sPicture.custom_ptr = tif; 429 + 430 + return 1; 431 + } 432 + 433 + /* 434 + * Finish off an encoded strip by flushing it. 435 + */ 436 + static int 437 + TWebPPostEncode(TIFF* tif) 438 + { 439 + static const char module[] = "WebPPostEncode"; 440 + int64_t stride; 441 + WebPState *sp = EncoderState(tif); 442 + assert(sp != NULL); 443 + 444 + assert(sp->state == LSTATE_INIT_ENCODE); 445 + 446 + stride = (int64_t)sp->sPicture.width * sp->nSamples; 447 + 448 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 449 + if (sp->nSamples == 4) { 450 + if (!WebPPictureImportRGBA(&sp->sPicture, sp->pBuffer, (int)stride)) { 451 + TIFFErrorExt(tif->tif_clientdata, module, 452 + "WebPPictureImportRGBA() failed" ); 453 + return 0; 454 + } 455 + } 456 + else 457 + #endif 458 + if (!WebPPictureImportRGB(&sp->sPicture, sp->pBuffer, (int)stride)) { 459 + TIFFErrorExt(tif->tif_clientdata, module, 460 + "WebPPictureImportRGB() failed"); 461 + return 0; 462 + } 463 + 464 + if (!WebPEncode(&sp->sEncoderConfig, &sp->sPicture)) { 465 + 466 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 467 + const char* pszErrorMsg = NULL; 468 + switch(sp->sPicture.error_code) { 469 + case VP8_ENC_ERROR_OUT_OF_MEMORY: 470 + pszErrorMsg = "Out of memory"; break; 471 + case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY: 472 + pszErrorMsg = "Out of memory while flushing bits"; break; 473 + case VP8_ENC_ERROR_NULL_PARAMETER: 474 + pszErrorMsg = "A pointer parameter is NULL"; break; 475 + case VP8_ENC_ERROR_INVALID_CONFIGURATION: 476 + pszErrorMsg = "Configuration is invalid"; break; 477 + case VP8_ENC_ERROR_BAD_DIMENSION: 478 + pszErrorMsg = "Picture has invalid width/height"; break; 479 + case VP8_ENC_ERROR_PARTITION0_OVERFLOW: 480 + pszErrorMsg = "Partition is bigger than 512k. Try using less " 481 + "SEGMENTS, or increase PARTITION_LIMIT value"; 482 + break; 483 + case VP8_ENC_ERROR_PARTITION_OVERFLOW: 484 + pszErrorMsg = "Partition is bigger than 16M"; 485 + break; 486 + case VP8_ENC_ERROR_BAD_WRITE: 487 + pszErrorMsg = "Error while fludshing bytes"; break; 488 + case VP8_ENC_ERROR_FILE_TOO_BIG: 489 + pszErrorMsg = "File is bigger than 4G"; break; 490 + case VP8_ENC_ERROR_USER_ABORT: 491 + pszErrorMsg = "User interrupted"; 492 + break; 493 + default: 494 + TIFFErrorExt(tif->tif_clientdata, module, 495 + "WebPEncode returned an unknown error code: %d", 496 + sp->sPicture.error_code); 497 + pszErrorMsg = "Unknown WebP error type."; 498 + break; 499 + } 500 + TIFFErrorExt(tif->tif_clientdata, module, 501 + "WebPEncode() failed : %s", pszErrorMsg); 502 + #else 503 + TIFFErrorExt(tif->tif_clientdata, module, 504 + "Error in WebPEncode()"); 505 + #endif 506 + return 0; 507 + } 508 + 509 + sp->sPicture.custom_ptr = NULL; 510 + 511 + if (!TIFFFlushData1(tif)) 512 + { 513 + TIFFErrorExt(tif->tif_clientdata, module, 514 + "Error flushing TIFF WebP encoder."); 515 + return 0; 516 + } 517 + 518 + return 1; 519 + } 520 + 521 + static void 522 + TWebPCleanup(TIFF* tif) 523 + { 524 + WebPState* sp = LState(tif); 525 + 526 + assert(sp != 0); 527 + 528 + tif->tif_tagmethods.vgetfield = sp->vgetparent; 529 + tif->tif_tagmethods.vsetfield = sp->vsetparent; 530 + 531 + if (sp->state & LSTATE_INIT_ENCODE) { 532 + WebPPictureFree(&sp->sPicture); 533 + } 534 + 535 + if (sp->psDecoder != NULL) { 536 + WebPIDelete(sp->psDecoder); 537 + WebPFreeDecBuffer(&sp->sDecBuffer); 538 + sp->psDecoder = NULL; 539 + sp->last_y = 0; 540 + } 541 + 542 + if (sp->pBuffer != NULL) { 543 + _TIFFfree(sp->pBuffer); 544 + sp->pBuffer = NULL; 545 + } 546 + 547 + if (tif->tif_data) { 548 + _TIFFfree(tif->tif_data); 549 + tif->tif_data = NULL; 550 + } 551 + 552 + _TIFFSetDefaultCompressionState(tif); 553 + } 554 + 555 + static int 556 + TWebPVSetField(TIFF* tif, uint32 tag, va_list ap) 557 + { 558 + static const char module[] = "WebPVSetField"; 559 + WebPState* sp = LState(tif); 560 + 561 + switch (tag) { 562 + case TIFFTAG_WEBP_LEVEL: 563 + sp->quality_level = (int) va_arg(ap, int); 564 + if( sp->quality_level <= 0 || 565 + sp->quality_level > 100.0f ) { 566 + TIFFWarningExt(tif->tif_clientdata, module, 567 + "WEBP_LEVEL should be between 1 and 100"); 568 + } 569 + return 1; 570 + case TIFFTAG_WEBP_LOSSLESS: 571 + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 572 + sp->lossless = va_arg(ap, int); 573 + return 1; 574 + #else 575 + TIFFErrorExt(tif->tif_clientdata, module, 576 + "Need to upgrade WEBP driver, this version doesn't support " 577 + "lossless compression."); 578 + return 0; 579 + #endif 580 + default: 581 + return (*sp->vsetparent)(tif, tag, ap); 582 + } 583 + /*NOTREACHED*/ 584 + } 585 + 586 + static int 587 + TWebPVGetField(TIFF* tif, uint32 tag, va_list ap) 588 + { 589 + WebPState* sp = LState(tif); 590 + 591 + switch (tag) { 592 + case TIFFTAG_WEBP_LEVEL: 593 + *va_arg(ap, int*) = sp->quality_level; 594 + break; 595 + case TIFFTAG_WEBP_LOSSLESS: 596 + *va_arg(ap, int*) = sp->lossless; 597 + break; 598 + default: 599 + return (*sp->vgetparent)(tif, tag, ap); 600 + } 601 + return 1; 602 + } 603 + 604 + static const TIFFField TWebPFields[] = { 605 + { TIFFTAG_WEBP_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, 606 + TIFF_SETGET_UNDEFINED, 607 + FIELD_PSEUDO, TRUE, FALSE, "WEBP quality", NULL }, 608 + { TIFFTAG_WEBP_LOSSLESS, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, 609 + TIFF_SETGET_UNDEFINED, 610 + FIELD_PSEUDO, TRUE, FALSE, "WEBP lossless/lossy", NULL 611 + }, 612 + }; 613 + 614 + int 615 + TIFFInitWebP(TIFF* tif, int scheme) 616 + { 617 + static const char module[] = "TIFFInitWebP"; 618 + WebPState* sp; 619 + 620 + assert( scheme == COMPRESSION_WEBP ); 621 + 622 + /* 623 + * Merge codec-specific tag information. 624 + */ 625 + if ( !_TIFFMergeFields(tif, TWebPFields, TIFFArrayCount(TWebPFields)) ) { 626 + TIFFErrorExt(tif->tif_clientdata, module, 627 + "Merging WebP codec-specific tags failed"); 628 + return 0; 629 + } 630 + 631 + /* 632 + * Allocate state block so tag methods have storage to record values. 633 + */ 634 + tif->tif_data = (uint8*) _TIFFmalloc(sizeof(WebPState)); 635 + if (tif->tif_data == NULL) 636 + goto bad; 637 + sp = LState(tif); 638 + 639 + /* 640 + * Override parent get/set field methods. 641 + */ 642 + sp->vgetparent = tif->tif_tagmethods.vgetfield; 643 + tif->tif_tagmethods.vgetfield = TWebPVGetField; /* hook for codec tags */ 644 + sp->vsetparent = tif->tif_tagmethods.vsetfield; 645 + tif->tif_tagmethods.vsetfield = TWebPVSetField; /* hook for codec tags */ 646 + 647 + /* Default values for codec-specific fields */ 648 + sp->quality_level = 75.0f; /* default comp. level */ 649 + sp->lossless = 0; /* default to false */ 650 + sp->state = 0; 651 + sp->nSamples = 0; 652 + sp->psDecoder = NULL; 653 + sp->last_y = 0; 654 + 655 + sp->buffer_offset = 0; 656 + sp->pBuffer = NULL; 657 + 658 + /* 659 + * Install codec methods. 660 + * Notes: 661 + * encoderow is not supported 662 + */ 663 + tif->tif_fixuptags = TWebPFixupTags; 664 + tif->tif_setupdecode = TWebPSetupDecode; 665 + tif->tif_predecode = TWebPPreDecode; 666 + tif->tif_decoderow = TWebPDecode; 667 + tif->tif_decodestrip = TWebPDecode; 668 + tif->tif_decodetile = TWebPDecode; 669 + tif->tif_setupencode = TWebPSetupEncode; 670 + tif->tif_preencode = TWebPPreEncode; 671 + tif->tif_postencode = TWebPPostEncode; 672 + tif->tif_encoderow = TWebPEncode; 673 + tif->tif_encodestrip = TWebPEncode; 674 + tif->tif_encodetile = TWebPEncode; 675 + tif->tif_cleanup = TWebPCleanup; 676 + 677 + return 1; 678 + bad: 679 + TIFFErrorExt(tif->tif_clientdata, module, 680 + "No space for WebP state block"); 681 + return 0; 682 + } 683 + 684 + #endif /* WEBP_SUPPORT */
-41
dll/3rdparty/libtiff/tif_win32.c
··· 1 - /* $Id: tif_win32.c,v 1.42 2017-01-11 19:02:49 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 411 409 static void 412 410 Win32WarningHandler(const char* module, const char* fmt, va_list ap) 413 411 { 414 - #ifndef TIF_PLATFORM_CONSOLE 415 - LPTSTR szTitle; 416 - LPTSTR szTmp; 417 - LPCTSTR szTitleText = "%s Warning"; 418 - LPCTSTR szDefaultModule = "LIBTIFF"; 419 - LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module; 420 - SIZE_T nBufSize = (strlen(szTmpModule) + 421 - strlen(szTitleText) + strlen(fmt) + 256)*sizeof(char); 422 - 423 - if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, nBufSize)) == NULL) 424 - return; 425 - sprintf(szTitle, szTitleText, szTmpModule); 426 - szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char); 427 - vsnprintf(szTmp, nBufSize-(strlen(szTitle)+2)*sizeof(char), fmt, ap); 428 - MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION); 429 - LocalFree(szTitle); 430 - 431 - return; 432 - #else 433 412 if (module != NULL) 434 413 fprintf(stderr, "%s: ", module); 435 414 fprintf(stderr, "Warning, "); 436 415 vfprintf(stderr, fmt, ap); 437 416 fprintf(stderr, ".\n"); 438 - #endif 439 417 } 440 418 TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler; 441 419 442 420 static void 443 421 Win32ErrorHandler(const char* module, const char* fmt, va_list ap) 444 422 { 445 - #ifndef TIF_PLATFORM_CONSOLE 446 - LPTSTR szTitle; 447 - LPTSTR szTmp; 448 - LPCTSTR szTitleText = "%s Error"; 449 - LPCTSTR szDefaultModule = "LIBTIFF"; 450 - LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module; 451 - SIZE_T nBufSize = (strlen(szTmpModule) + 452 - strlen(szTitleText) + strlen(fmt) + 256)*sizeof(char); 453 - 454 - if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, nBufSize)) == NULL) 455 - return; 456 - sprintf(szTitle, szTitleText, szTmpModule); 457 - szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char); 458 - vsnprintf(szTmp, nBufSize-(strlen(szTitle)+2)*sizeof(char), fmt, ap); 459 - MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION); 460 - LocalFree(szTitle); 461 - return; 462 - #else 463 423 if (module != NULL) 464 424 fprintf(stderr, "%s: ", module); 465 425 vfprintf(stderr, fmt, ap); 466 426 fprintf(stderr, ".\n"); 467 - #endif 468 427 } 469 428 TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler; 470 429
+4 -4
dll/3rdparty/libtiff/tif_write.c
··· 1 - /* $Id: tif_write.c,v 1.46 2016-12-03 21:57:44 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 541 539 if (td->td_planarconfig == PLANARCONFIG_SEPARATE) 542 540 td->td_stripsperimage /= td->td_samplesperpixel; 543 541 td->td_stripoffset = (uint64 *) 544 - _TIFFmalloc(td->td_nstrips * sizeof (uint64)); 542 + _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64), 543 + "for \"StripOffsets\" array"); 545 544 td->td_stripbytecount = (uint64 *) 546 - _TIFFmalloc(td->td_nstrips * sizeof (uint64)); 545 + _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64), 546 + "for \"StripByteCounts\" array"); 547 547 if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL) 548 548 return (0); 549 549 /*
-2
dll/3rdparty/libtiff/tif_zip.c
··· 1 - /* $Id: tif_zip.c,v 1.37 2017-05-10 15:21:16 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1995-1997 Sam Leffler 5 3 * Copyright (c) 1995-1997 Silicon Graphics, Inc.
+440
dll/3rdparty/libtiff/tif_zstd.c
··· 1 + /* 2 + * Copyright (c) 2017, Planet Labs 3 + * Author: <even.rouault at spatialys.com> 4 + * 5 + * Permission to use, copy, modify, distribute, and sell this software and 6 + * its documentation for any purpose is hereby granted without fee, provided 7 + * that (i) the above copyright notices and this permission notice appear in 8 + * all copies of the software and related documentation, and (ii) the names of 9 + * Sam Leffler and Silicon Graphics may not be used in any advertising or 10 + * publicity relating to the software without the specific, prior written 11 + * permission of Sam Leffler and Silicon Graphics. 12 + * 13 + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 14 + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 15 + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 16 + * 17 + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 18 + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 19 + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 20 + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 21 + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 22 + * OF THIS SOFTWARE. 23 + */ 24 + 25 + #include "tiffiop.h" 26 + #ifdef ZSTD_SUPPORT 27 + /* 28 + * TIFF Library. 29 + * 30 + * ZSTD Compression Support 31 + * 32 + */ 33 + 34 + #include "tif_predict.h" 35 + #include "zstd.h" 36 + 37 + #include <stdio.h> 38 + 39 + /* 40 + * State block for each open TIFF file using ZSTD compression/decompression. 41 + */ 42 + typedef struct { 43 + TIFFPredictorState predict; 44 + ZSTD_DStream* dstream; 45 + ZSTD_CStream* cstream; 46 + int compression_level; /* compression level */ 47 + ZSTD_outBuffer out_buffer; 48 + int state; /* state flags */ 49 + #define LSTATE_INIT_DECODE 0x01 50 + #define LSTATE_INIT_ENCODE 0x02 51 + 52 + TIFFVGetMethod vgetparent; /* super-class method */ 53 + TIFFVSetMethod vsetparent; /* super-class method */ 54 + } ZSTDState; 55 + 56 + #define LState(tif) ((ZSTDState*) (tif)->tif_data) 57 + #define DecoderState(tif) LState(tif) 58 + #define EncoderState(tif) LState(tif) 59 + 60 + static int ZSTDEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s); 61 + static int ZSTDDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s); 62 + 63 + static int 64 + ZSTDFixupTags(TIFF* tif) 65 + { 66 + (void) tif; 67 + return 1; 68 + } 69 + 70 + static int 71 + ZSTDSetupDecode(TIFF* tif) 72 + { 73 + ZSTDState* sp = DecoderState(tif); 74 + 75 + assert(sp != NULL); 76 + 77 + /* if we were last encoding, terminate this mode */ 78 + if (sp->state & LSTATE_INIT_ENCODE) { 79 + ZSTD_freeCStream(sp->cstream); 80 + sp->cstream = NULL; 81 + sp->state = 0; 82 + } 83 + 84 + sp->state |= LSTATE_INIT_DECODE; 85 + return 1; 86 + } 87 + 88 + /* 89 + * Setup state for decoding a strip. 90 + */ 91 + static int 92 + ZSTDPreDecode(TIFF* tif, uint16 s) 93 + { 94 + static const char module[] = "ZSTDPreDecode"; 95 + ZSTDState* sp = DecoderState(tif); 96 + size_t zstd_ret; 97 + 98 + (void) s; 99 + assert(sp != NULL); 100 + 101 + if( (sp->state & LSTATE_INIT_DECODE) == 0 ) 102 + tif->tif_setupdecode(tif); 103 + 104 + if( sp->dstream ) 105 + { 106 + ZSTD_freeDStream(sp->dstream); 107 + sp->dstream = NULL; 108 + } 109 + 110 + sp->dstream = ZSTD_createDStream(); 111 + if( sp->dstream == NULL ) { 112 + TIFFErrorExt(tif->tif_clientdata, module, 113 + "Cannot allocate decompression stream"); 114 + return 0; 115 + } 116 + zstd_ret = ZSTD_initDStream(sp->dstream); 117 + if( ZSTD_isError(zstd_ret) ) { 118 + TIFFErrorExt(tif->tif_clientdata, module, 119 + "Error in ZSTD_initDStream(): %s", 120 + ZSTD_getErrorName(zstd_ret)); 121 + return 0; 122 + } 123 + 124 + return 1; 125 + } 126 + 127 + static int 128 + ZSTDDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) 129 + { 130 + static const char module[] = "ZSTDDecode"; 131 + ZSTDState* sp = DecoderState(tif); 132 + ZSTD_inBuffer in_buffer; 133 + ZSTD_outBuffer out_buffer; 134 + size_t zstd_ret; 135 + 136 + (void) s; 137 + assert(sp != NULL); 138 + assert(sp->state == LSTATE_INIT_DECODE); 139 + 140 + in_buffer.src = tif->tif_rawcp; 141 + in_buffer.size = (size_t) tif->tif_rawcc; 142 + in_buffer.pos = 0; 143 + 144 + out_buffer.dst = op; 145 + out_buffer.size = (size_t) occ; 146 + out_buffer.pos = 0; 147 + 148 + do { 149 + zstd_ret = ZSTD_decompressStream(sp->dstream, &out_buffer, 150 + &in_buffer); 151 + if( ZSTD_isError(zstd_ret) ) { 152 + TIFFErrorExt(tif->tif_clientdata, module, 153 + "Error in ZSTD_decompressStream(): %s", 154 + ZSTD_getErrorName(zstd_ret)); 155 + return 0; 156 + } 157 + } while( zstd_ret != 0 && 158 + in_buffer.pos < in_buffer.size && 159 + out_buffer.pos < out_buffer.size ); 160 + 161 + if (out_buffer.pos < (size_t)occ) { 162 + TIFFErrorExt(tif->tif_clientdata, module, 163 + "Not enough data at scanline %lu (short %lu bytes)", 164 + (unsigned long) tif->tif_row, 165 + (unsigned long) (size_t)occ - out_buffer.pos); 166 + return 0; 167 + } 168 + 169 + tif->tif_rawcp += in_buffer.pos; 170 + tif->tif_rawcc -= in_buffer.pos; 171 + 172 + return 1; 173 + } 174 + 175 + static int 176 + ZSTDSetupEncode(TIFF* tif) 177 + { 178 + ZSTDState* sp = EncoderState(tif); 179 + 180 + assert(sp != NULL); 181 + if (sp->state & LSTATE_INIT_DECODE) { 182 + ZSTD_freeDStream(sp->dstream); 183 + sp->dstream = NULL; 184 + sp->state = 0; 185 + } 186 + 187 + sp->state |= LSTATE_INIT_ENCODE; 188 + return 1; 189 + } 190 + 191 + /* 192 + * Reset encoding state at the start of a strip. 193 + */ 194 + static int 195 + ZSTDPreEncode(TIFF* tif, uint16 s) 196 + { 197 + static const char module[] = "ZSTDPreEncode"; 198 + ZSTDState *sp = EncoderState(tif); 199 + size_t zstd_ret; 200 + 201 + (void) s; 202 + assert(sp != NULL); 203 + if( sp->state != LSTATE_INIT_ENCODE ) 204 + tif->tif_setupencode(tif); 205 + 206 + if (sp->cstream) { 207 + ZSTD_freeCStream(sp->cstream); 208 + sp->cstream = NULL; 209 + } 210 + sp->cstream = ZSTD_createCStream(); 211 + if( sp->cstream == NULL ) { 212 + TIFFErrorExt(tif->tif_clientdata, module, 213 + "Cannot allocate compression stream"); 214 + return 0; 215 + } 216 + 217 + zstd_ret = ZSTD_initCStream(sp->cstream, sp->compression_level); 218 + if( ZSTD_isError(zstd_ret) ) { 219 + TIFFErrorExt(tif->tif_clientdata, module, 220 + "Error in ZSTD_initCStream(): %s", 221 + ZSTD_getErrorName(zstd_ret)); 222 + return 0; 223 + } 224 + 225 + sp->out_buffer.dst = tif->tif_rawdata; 226 + sp->out_buffer.size = (size_t)tif->tif_rawdatasize; 227 + sp->out_buffer.pos = 0; 228 + 229 + return 1; 230 + } 231 + 232 + /* 233 + * Encode a chunk of pixels. 234 + */ 235 + static int 236 + ZSTDEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) 237 + { 238 + static const char module[] = "ZSTDEncode"; 239 + ZSTDState *sp = EncoderState(tif); 240 + ZSTD_inBuffer in_buffer; 241 + size_t zstd_ret; 242 + 243 + assert(sp != NULL); 244 + assert(sp->state == LSTATE_INIT_ENCODE); 245 + 246 + (void) s; 247 + 248 + in_buffer.src = bp; 249 + in_buffer.size = (size_t)cc; 250 + in_buffer.pos = 0; 251 + 252 + do { 253 + zstd_ret = ZSTD_compressStream(sp->cstream, &sp->out_buffer, 254 + &in_buffer); 255 + if( ZSTD_isError(zstd_ret) ) { 256 + TIFFErrorExt(tif->tif_clientdata, module, 257 + "Error in ZSTD_compressStream(): %s", 258 + ZSTD_getErrorName(zstd_ret)); 259 + return 0; 260 + } 261 + if( sp->out_buffer.pos == sp->out_buffer.size ) { 262 + tif->tif_rawcc = tif->tif_rawdatasize; 263 + TIFFFlushData1(tif); 264 + sp->out_buffer.dst = tif->tif_rawcp; 265 + sp->out_buffer.pos = 0; 266 + } 267 + } while( in_buffer.pos < in_buffer.size ); 268 + 269 + return 1; 270 + } 271 + 272 + /* 273 + * Finish off an encoded strip by flushing it. 274 + */ 275 + static int 276 + ZSTDPostEncode(TIFF* tif) 277 + { 278 + static const char module[] = "ZSTDPostEncode"; 279 + ZSTDState *sp = EncoderState(tif); 280 + size_t zstd_ret; 281 + 282 + do { 283 + zstd_ret = ZSTD_endStream(sp->cstream, &sp->out_buffer); 284 + if( ZSTD_isError(zstd_ret) ) { 285 + TIFFErrorExt(tif->tif_clientdata, module, 286 + "Error in ZSTD_endStream(): %s", 287 + ZSTD_getErrorName(zstd_ret)); 288 + return 0; 289 + } 290 + if( sp->out_buffer.pos > 0 ) { 291 + tif->tif_rawcc = sp->out_buffer.pos; 292 + TIFFFlushData1(tif); 293 + sp->out_buffer.dst = tif->tif_rawcp; 294 + sp->out_buffer.pos = 0; 295 + } 296 + } while (zstd_ret != 0); 297 + return 1; 298 + } 299 + 300 + static void 301 + ZSTDCleanup(TIFF* tif) 302 + { 303 + ZSTDState* sp = LState(tif); 304 + 305 + assert(sp != 0); 306 + 307 + (void)TIFFPredictorCleanup(tif); 308 + 309 + tif->tif_tagmethods.vgetfield = sp->vgetparent; 310 + tif->tif_tagmethods.vsetfield = sp->vsetparent; 311 + 312 + if (sp->dstream) { 313 + ZSTD_freeDStream(sp->dstream); 314 + sp->dstream = NULL; 315 + } 316 + if (sp->cstream) { 317 + ZSTD_freeCStream(sp->cstream); 318 + sp->cstream = NULL; 319 + } 320 + _TIFFfree(sp); 321 + tif->tif_data = NULL; 322 + 323 + _TIFFSetDefaultCompressionState(tif); 324 + } 325 + 326 + static int 327 + ZSTDVSetField(TIFF* tif, uint32 tag, va_list ap) 328 + { 329 + static const char module[] = "ZSTDVSetField"; 330 + ZSTDState* sp = LState(tif); 331 + 332 + switch (tag) { 333 + case TIFFTAG_ZSTD_LEVEL: 334 + sp->compression_level = (int) va_arg(ap, int); 335 + if( sp->compression_level <= 0 || 336 + sp->compression_level > ZSTD_maxCLevel() ) 337 + { 338 + TIFFWarningExt(tif->tif_clientdata, module, 339 + "ZSTD_LEVEL should be between 1 and %d", 340 + ZSTD_maxCLevel()); 341 + } 342 + return 1; 343 + default: 344 + return (*sp->vsetparent)(tif, tag, ap); 345 + } 346 + /*NOTREACHED*/ 347 + } 348 + 349 + static int 350 + ZSTDVGetField(TIFF* tif, uint32 tag, va_list ap) 351 + { 352 + ZSTDState* sp = LState(tif); 353 + 354 + switch (tag) { 355 + case TIFFTAG_ZSTD_LEVEL: 356 + *va_arg(ap, int*) = sp->compression_level; 357 + break; 358 + default: 359 + return (*sp->vgetparent)(tif, tag, ap); 360 + } 361 + return 1; 362 + } 363 + 364 + static const TIFFField ZSTDFields[] = { 365 + { TIFFTAG_ZSTD_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, 366 + TIFF_SETGET_UNDEFINED, 367 + FIELD_PSEUDO, TRUE, FALSE, "ZSTD compression_level", NULL }, 368 + }; 369 + 370 + int 371 + TIFFInitZSTD(TIFF* tif, int scheme) 372 + { 373 + static const char module[] = "TIFFInitZSTD"; 374 + ZSTDState* sp; 375 + 376 + assert( scheme == COMPRESSION_ZSTD ); 377 + 378 + /* 379 + * Merge codec-specific tag information. 380 + */ 381 + if (!_TIFFMergeFields(tif, ZSTDFields, TIFFArrayCount(ZSTDFields))) { 382 + TIFFErrorExt(tif->tif_clientdata, module, 383 + "Merging ZSTD codec-specific tags failed"); 384 + return 0; 385 + } 386 + 387 + /* 388 + * Allocate state block so tag methods have storage to record values. 389 + */ 390 + tif->tif_data = (uint8*) _TIFFmalloc(sizeof(ZSTDState)); 391 + if (tif->tif_data == NULL) 392 + goto bad; 393 + sp = LState(tif); 394 + 395 + /* 396 + * Override parent get/set field methods. 397 + */ 398 + sp->vgetparent = tif->tif_tagmethods.vgetfield; 399 + tif->tif_tagmethods.vgetfield = ZSTDVGetField; /* hook for codec tags */ 400 + sp->vsetparent = tif->tif_tagmethods.vsetfield; 401 + tif->tif_tagmethods.vsetfield = ZSTDVSetField; /* hook for codec tags */ 402 + 403 + /* Default values for codec-specific fields */ 404 + sp->compression_level = 9; /* default comp. level */ 405 + sp->state = 0; 406 + sp->dstream = 0; 407 + sp->cstream = 0; 408 + sp->out_buffer.dst = NULL; 409 + sp->out_buffer.size = 0; 410 + sp->out_buffer.pos = 0; 411 + 412 + /* 413 + * Install codec methods. 414 + */ 415 + tif->tif_fixuptags = ZSTDFixupTags; 416 + tif->tif_setupdecode = ZSTDSetupDecode; 417 + tif->tif_predecode = ZSTDPreDecode; 418 + tif->tif_decoderow = ZSTDDecode; 419 + tif->tif_decodestrip = ZSTDDecode; 420 + tif->tif_decodetile = ZSTDDecode; 421 + tif->tif_setupencode = ZSTDSetupEncode; 422 + tif->tif_preencode = ZSTDPreEncode; 423 + tif->tif_postencode = ZSTDPostEncode; 424 + tif->tif_encoderow = ZSTDEncode; 425 + tif->tif_encodestrip = ZSTDEncode; 426 + tif->tif_encodetile = ZSTDEncode; 427 + tif->tif_cleanup = ZSTDCleanup; 428 + /* 429 + * Setup predictor setup. 430 + */ 431 + (void) TIFFPredictorInit(tif); 432 + return 1; 433 + bad: 434 + TIFFErrorExt(tif->tif_clientdata, module, 435 + "No space for ZSTD state block"); 436 + return 0; 437 + } 438 + #endif /* ZSTD_SUPPORT */ 439 + 440 + /* vim: set ts=8 sts=8 sw=8 noet: */
+1 -1
media/doc/3rd Party Files.txt
··· 83 83 Website: http://www.ijg.org/ 84 84 85 85 Title: libtiff 86 - Used Version: 4.0.9 86 + Used Version: 4.0.10 87 87 Website: http://www.simplesystems.org/libtiff/ 88 88 89 89 Title: mbed TLS
-2
sdk/include/reactos/libs/libtiff/t4.h
··· 1 - /* $Id: t4.h,v 1.3 2010-03-10 18:56:48 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-2
sdk/include/reactos/libs/libtiff/tif_config.wince.h
··· 1 - /* $Id: tif_config.wince.h,v 1.3 2010-03-10 18:56:48 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * TIFF library configuration header for Windows CE platform. 5 3 */
+4 -2
sdk/include/reactos/libs/libtiff/tif_dir.h
··· 1 - /* $Id: tif_dir.h,v 1.55 2017-06-01 12:44:04 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 26 24 27 25 #ifndef _TIFFDIR_ 28 26 #define _TIFFDIR_ 27 + 28 + #include "tiff.h" 29 + #include "tiffio.h" 30 + 29 31 /* 30 32 * ``Library-private'' Directory-related Definitions. 31 33 */
-2
sdk/include/reactos/libs/libtiff/tif_fax3.h
··· 1 - /* $Id: tif_fax3.h,v 1.13 2016-12-14 18:36:27 faxguy Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1990-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+4 -2
sdk/include/reactos/libs/libtiff/tif_predict.h
··· 1 - /* $Id: tif_predict.h,v 1.9 2016-10-31 17:24:26 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1995-1997 Sam Leffler 5 3 * Copyright (c) 1995-1997 Silicon Graphics, Inc. ··· 26 24 27 25 #ifndef _TIFFPREDICT_ 28 26 #define _TIFFPREDICT_ 27 + 28 + #include "tiffio.h" 29 + #include "tiffiop.h" 30 + 29 31 /* 30 32 * ``Library-private'' Support for the Predictor Tag 31 33 */
+16 -2
sdk/include/reactos/libs/libtiff/tiff.h
··· 1 - /* $Id: tiff.h,v 1.70 2016-01-23 21:20:34 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 189 187 #define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */ 190 188 #define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */ 191 189 #define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */ 190 + #define COMPRESSION_LERC 34887 /* ESRI Lerc codec: https://github.com/Esri/lerc */ 191 + /* compression codes 34887-34889 are reserved for ESRI */ 192 192 #define COMPRESSION_LZMA 34925 /* LZMA2 */ 193 + #define COMPRESSION_ZSTD 50000 /* ZSTD: WARNING not registered in Adobe-maintained registry */ 194 + #define COMPRESSION_WEBP 50001 /* WEBP: WARNING not registered in Adobe-maintained registry */ 193 195 #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ 194 196 #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ 195 197 #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ ··· 450 452 /* tag 34929 is a private tag registered to FedEx */ 451 453 #define TIFFTAG_FEDEX_EDR 34929 /* unknown use */ 452 454 #define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */ 455 + /* tags 50674 to 50677 are reserved for ESRI */ 456 + #define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */ 453 457 /* Adobe Digital Negative (DNG) format tags */ 454 458 #define TIFFTAG_DNGVERSION 50706 /* &DNG version number */ 455 459 #define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */ ··· 603 607 #define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */ 604 608 #define PERSAMPLE_MERGED 0 /* present as a single value */ 605 609 #define PERSAMPLE_MULTI 1 /* present as multiple values */ 610 + #define TIFFTAG_ZSTD_LEVEL 65564 /* ZSTD compression level */ 611 + #define TIFFTAG_LERC_VERSION 65565 /* LERC version */ 612 + #define LERC_VERSION_2_4 4 613 + #define TIFFTAG_LERC_ADD_COMPRESSION 65566 /* LERC additional compression */ 614 + #define LERC_ADD_COMPRESSION_NONE 0 615 + #define LERC_ADD_COMPRESSION_DEFLATE 1 616 + #define LERC_ADD_COMPRESSION_ZSTD 2 617 + #define TIFFTAG_LERC_MAXZERROR 65567 /* LERC maximum error */ 618 + #define TIFFTAG_WEBP_LEVEL 65568 /* WebP compression level: WARNING not registered in Adobe-maintained registry */ 619 + #define TIFFTAG_WEBP_LOSSLESS 65569 /* WebP lossless/lossy : WARNING not registered in Adobe-maintained registry */ 606 620 607 621 /* 608 622 * EXIF tags
-9
sdk/include/reactos/libs/libtiff/tiffconf.h
··· 7 7 #ifndef _TIFFCONF_ 8 8 #define _TIFFCONF_ 9 9 10 - /* Define to 1 if the system has the type `int16'. */ 11 - /* #undef HAVE_INT16 */ 12 - 13 - /* Define to 1 if the system has the type `int32'. */ 14 - /* #undef HAVE_INT32 */ 15 - 16 - /* Define to 1 if the system has the type `int8'. */ 17 - /* #undef HAVE_INT8 */ 18 - 19 10 /* The size of a `int', as computed by sizeof. */ 20 11 #define SIZEOF_INT 4 21 12
-9
sdk/include/reactos/libs/libtiff/tiffconf.vc.h
··· 7 7 #ifndef _TIFFCONF_ 8 8 #define _TIFFCONF_ 9 9 10 - /* Define to 1 if the system has the type `int16'. */ 11 - /* #undef HAVE_INT16 */ 12 - 13 - /* Define to 1 if the system has the type `int32'. */ 14 - /* #undef HAVE_INT32 */ 15 - 16 - /* Define to 1 if the system has the type `int8'. */ 17 - /* #undef HAVE_INT8 */ 18 - 19 10 /* The size of a `int', as computed by sizeof. */ 20 11 #define SIZEOF_INT 4 21 12
-11
sdk/include/reactos/libs/libtiff/tiffconf.wince.h
··· 1 - /* $Id: tiffconf.wince.h,v 1.3 2010-03-10 18:56:49 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Windows CE platform tiffconf.wince.h 5 3 * Created by Mateusz Loskot (mateusz@loskot.net) ··· 26 24 27 25 #ifndef _TIFFCONF_ 28 26 #define _TIFFCONF_ 29 - 30 - /* Define to 1 if the system has the type `int16'. */ 31 - /* #undef HAVE_INT16 */ 32 - 33 - /* Define to 1 if the system has the type `int32'. */ 34 - /* #undef HAVE_INT32 */ 35 - 36 - /* Define to 1 if the system has the type `int8'. */ 37 - /* #undef HAVE_INT8 */ 38 27 39 28 /* The size of a `int', as computed by sizeof. */ 40 29 #define SIZEOF_INT 4
+1 -3
sdk/include/reactos/libs/libtiff/tiffio.h
··· 1 - /* $Id: tiffio.h,v 1.94 2017-01-11 19:02:49 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 52 50 * promoted type (i.e. one of int, unsigned int, pointer, 53 51 * or double) and because we defined pseudo-tags that are 54 52 * outside the range of legal Aldus-assigned tags. 55 - * NB: tsize_t is int32 and not uint32 because some functions 53 + * NB: tsize_t is signed and not unsigned because some functions 56 54 * return -1. 57 55 * NB: toff_t is not off_t for many reasons; TIFFs max out at 58 56 * 32-bit file offsets, and BigTIFF maxes out at 64-bit
+1 -2
sdk/include/reactos/libs/libtiff/tiffio.hxx
··· 1 - /* $Id: tiffio.hxx,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 33 31 34 32 #include <iostream> 35 33 #include "tiff.h" 34 + #include "tiffio.h" 36 35 37 36 extern TIFF* TIFFStreamOpen(const char*, std::ostream *); 38 37 extern TIFF* TIFFStreamOpen(const char*, std::istream *);
+12 -3
sdk/include/reactos/libs/libtiff/tiffiop.h
··· 1 - /* $Id: tiffiop.h,v 1.95 2017-09-07 14:02:52 erouault Exp $ */ 2 - 3 1 /* 4 2 * Copyright (c) 1988-1997 Sam Leffler 5 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. ··· 72 70 #endif 73 71 74 72 #define streq(a,b) (strcmp(a,b) == 0) 73 + #define strneq(a,b,n) (strncmp(a,b,n) == 0) 75 74 76 75 #ifndef TRUE 77 76 #define TRUE 1 ··· 314 313 #define _TIFF_off_t off_t 315 314 #endif 316 315 317 - #if __clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ >= 8) 316 + #if defined(__has_attribute) && defined(__clang__) 317 + #if __has_attribute(no_sanitize) 318 318 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow"))) 319 + #else 320 + #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW 321 + #endif 319 322 #else 320 323 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW 321 324 #endif ··· 423 426 #endif 424 427 #ifdef LZMA_SUPPORT 425 428 extern int TIFFInitLZMA(TIFF*, int); 429 + #endif 430 + #ifdef ZSTD_SUPPORT 431 + extern int TIFFInitZSTD(TIFF*, int); 432 + #endif 433 + #ifdef WEBP_SUPPORT 434 + extern int TIFFInitWebP(TIFF*, int); 426 435 #endif 427 436 #ifdef VMS 428 437 extern const TIFFCodec _TIFFBuiltinCODECS[];
+2 -2
sdk/include/reactos/libs/libtiff/tiffvers.h
··· 1 - #define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.9\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." 1 + #define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.10\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." 2 2 /* 3 3 * This define can be used in code that requires 4 4 * compilation-related definitions specific to a ··· 6 6 * version checking should be done based on the 7 7 * string returned by TIFFGetVersion. 8 8 */ 9 - #define TIFFLIB_VERSION 20171118 9 + #define TIFFLIB_VERSION 20181110