summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Correct CMake testingcmake-testRoger Leigh2022-01-233-155/+134
| | | | | | | | * Use functions rather than macros to avoid problems with variables in conditions (since macro arguments are not variables) * Conditionally add to file lists and test program lists based upon the configuration options (e.g. JPEG and old-JPEG availability) * Sync tests, files and option usage with current automake usage
* Fix Segmentation fault printing GPS directory if Altitude tag is present ↵Su Laus2021-11-263-1/+4
| | | | (tif_print.c/tiffinfo.c)
* test/rational_precision2double.c: add missing curly braces to fix ↵Even Rouault2021-09-061-1/+2
| | | | -Werror=misleading-indentation
* tif_dirwrite.c: Fix TIFFRewriteDirectory discarding directoriesFacundo Tuesca2021-09-051-15/+100
| | | | | | | | | | | | | | This fixes a bug caused by the `tif_lastdiroff` optimization when rewriting directories. Rewriting the Nth directory temporarily zeroes the pointer to it (located in the N-1th directory) and relies on `TIFFLinkDirectory` traversing the whole directory list to find the zeroed pointer and linking the rewritten directory to it. Since `TIFFLinkDirectory` skips the traversal when `tif_lastdiroff` is set, this change unsets it to force the full traversal when rewriting a directory. A test to catch this particular issue is also added.
* test_directory.c: fix compiler warningsEven Rouault2021-09-011-1/+8
|
* Add field to keep track of last written directoryFacundo Tuesca2021-08-283-2/+247
| | | | | | | | | | | | | | This adds a new `tif_lastdiroff` field to the TIFF data structure and uses it to store the offset of the last written directory. Appending a new directory required traversing the whole file to find the last directory. By keeping track of its offset in this new field, the search is no longer necessary. Since this offset is only stored in-memory, the first directory append after opening a file will have to transverse the whole directory list. Subsequent calls will have access to the last offset, avoiding the transversal.
* Fix build with CMake 3.10Kai Pastor2021-07-041-12/+12
|
* Fix high-impact Coverity issues (resource leaks).Roger Leigh2021-03-071-2/+12
| | | | | | The issues are in the tests and tiffcrop, not the core library. Real issues, but not high risk. Use to test if Coverity integration is performing properly on merge.
* libport: Adjust header and library to only define and link if requiredRoger Leigh2021-02-081-24/+36
| | | | | | | | | | | * Make libport an OBJECT library when in use, otherwise a dummy INTERFACE library * libport.h will work if getopt is present or not present. If present, will fall back to <unistd.h>, else will define symbols * Add generated libport_config.h to define HAVE_GETOPT and HAVE_UNISTD_H * dummy.c no longer needed with CMake * libtiff/libtiffxx no longer link with libport
* cmake: Remove unnecessary extra_dist usageRoger Leigh2021-02-081-5/+0
| | | | | Only makes sense in the context of Automake. Was carried over for reference while porting, but is not needed.
* custom_dir_EXIF_231: Remove case statement fallthroughRoger Leigh2021-02-061-98/+124
|
* custom_dir_EXIF_231: Correct use of strncpyRoger Leigh2021-02-061-1/+2
|
* Correct include orderRoger Leigh2021-02-061-2/+1
|
* ascii_tag: Use PRI format flags and remove unnecessary castsRoger Leigh2021-01-271-4/+4
|
* check_tag: Use PRI format flags and remove unnecessary castsRoger Leigh2021-01-271-12/+12
|
* custom_dir_EXIF_231: Use PRI format flags and remove unnecessary castsRoger Leigh2021-01-271-2/+2
|
* short_tag: Use PRI format flags and remove unnecessary castsRoger Leigh2021-01-271-4/+4
|
* strip_rw: Use PRI format flags and remove unnecessary castsRoger Leigh2021-01-271-15/+15
|
* Use standard C99 integer typesRoger Leigh2021-01-2112-117/+116
|
* cmake: Use target_include_directories correctlyRoger Leigh2021-01-071-5/+1
|
* Merge branch 'codespell' into 'master'Roger Leigh2021-01-022-3/+3
|\ | | | | | | | | Fix spelling mistakes. See merge request libtiff/libtiff!183
| * Fix spelling mistakes.Kurt Schwehr2020-12-312-3/+3
| | | | | | | | | | | | | | Found with: codespell --version 1.17.1
* | custom_dir_EXIF_231.c: dos2unix and codespellKurt Schwehr2020-12-311-1398/+1397
|/ | | | additonal, Varable, greather, alwasy
* test: add testdeflatelaststripextradata.shEven Rouault2020-10-166-3/+53
|
* Fix compiler warnings about unused variables when assert() expands to nothingEven Rouault2020-10-121-3/+10
|
* Also pass --shared-memory to raw_decode.Attila Oláh2020-09-241-0/+3
| | | | | This is needed when building for Emscripten with *both* WEBP and JPEG support.
* Set the --shared-memory linker flag for Emscripten builds.Attila Oláh2020-09-241-0/+15
| | | | | | This is only needed when building with WEBP support, which uses atomics, therefore the linker needs the --shared-memory flag. The flag cannot be added globally because not all executables link against libwebp.
* CMake: Skip custom_dir_EXIF_231 test on shared builds to avoid issues on WindowsEven Rouault2020-03-071-0/+2
|
* Merge branch 'EXIF231_GPS_upgrade' into 'master'Even Rouault2020-03-073-1/+1406
|\ | | | | | | | | EXIF 2.32 and GPS TIFF-tags and functionality upgraded. See merge request libtiff/libtiff!91
| * EXIF 2.32 and GPS tags and functionality upgraded.Su_Laus2020-03-073-1/+1406
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Existing EXIF field definition of tags is upgraded to EXIF version 2.3.2 - EXIF-GPS structure, tags and access functions are added as special CustomDirectory (like it was done for EXIF). - Test program custom_dir_EXIF_231.c added to test writing/reading of EXID IFD and GPS IFD tags and to highlight some quirks of IFD-handling and peculiarities of reading/writing the different data types. - Reading error for FileSource and SceneType tags corrected. - EXIF_GPS_upgrade rebased onto c8c5309b765ef4ff097d2aaffbdb8f403db8967d (Merge branch 'Rational2DoublePrecision_correction' into 'master') and adapted: - tif_dirinfo.c: All rational tags set to TIFF_SETGET_FLOAT but only the GPSTAG_ tags set to TIFF_SETGET_DOUBLE. - custom_dir_EXIF_231.c: Editorials amended and gcc warnigs fixed. - CMakeLists.txt: add_test(NAME "custom_dir_EXIF_231" COMMAND "custom_dir_EXIF_231") added.
* | ppm2tiff: Add test for 16bpc PPMThomas Bernard2020-03-075-2/+10
| |
* | Merge branch 'fax-test' into 'master'Even Rouault2020-03-065-4/+33
|\ \ | | | | | | | | | | | | add test for fax4 decoding See merge request libtiff/libtiff!114
| * | add test for fax4 decodingThomas Bernard2020-03-055-4/+33
| |/ | | | | | | | | | | This will check for regression on #46 https://gitlab.com/libtiff/libtiff/issues/46 http://bugzilla.maptools.org/show_bug.cgi?id=2434
* | make tests pass under FreeBSD.Thomas Bernard2020-03-054-4/+5
|/ | | | | | | the -I option for the GNU diff and the FreeBSD diff behaves differently regarding escaping the ( ) and | By using two -I option, we avoid using such charracters.
* tif_dirwrite.c: bugfix DoubleToSrational(), which returns plain signed ↵Su_Laus2020-02-291-2/+3
| | | | | | | interger values always as unsigned rationals. Add a test into rational_precision2double.c for "-1.0" and some editorials in tif_dirwrite.c. (code is related to 6df997c786928757caea0dd68d26ea5f098f49df changes).
* rational_precision2double.c: fix many warnings, and do not build it on CMake ↵Even Rouault2020-02-272-28/+13
| | | | on shared lib builds
* Merge branch 'Rational2DoublePrecision' into 'master'Even Rouault2020-02-273-1/+996
|\ | | | | | | | | Rational with Double Precision Upgrade See merge request libtiff/libtiff!100
| * Rational with Double Precision UpgradeSu_Laus2020-02-273-1/+996
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, custom rational tags (TIFF_RATIONAL with field_bit=FIELD_CUSTOM) are defined as TIFF_SETGET_DOUBLE but for the reading interface and LibTiff internally they are stored ALLWAYS as floating point SINGLE precision. Double precision custom rational tags are not supported by LibTiff. For the GPS tags in WGS84 a higher accuracy / precision is needed. Therefore, this upgrade is made, keeping the old interface for the already defined tags and allowing a double precision definition, as well as calculating rationals with higher accuracy / precision. This higher accuracy can be used for newly defined tags like that in EXIF/GPS. Refer also to the very old Bugzilla issue 2542 (#69) A test file rational_precision2double.c is added, which shows prevention of the old interface to the already defined custom rational tags with the standard library as well as with the upgraded library. Also TIFFTAG_XRESOLUTION, TIFFTAG_YRESOLUTION, TIFFTAG_XPOSITION, TIFFTAG_YPOSITION amended from TIFF_SETGET_DOUBLE to TIFF_SETGET_FLOAT and testcase inserted in rational_precision2double.c
* | test: add test for single-strip OJPEG file without RowsPerStrip tag (like in ↵Even Rouault2020-01-074-4/+15
| | | | | | | | CR2 files)
* | OJPEG: fix broken sanity check added in 4.1.0, and add two OJPEG test filesEven Rouault2019-11-1116-4/+97
| |
* | test/: add missing generated .sh filesEven Rouault2019-11-1129-3/+182
| |
* | Fax2tiff.sh needs to remove its output file in advance. Syntax changes so ↵Bob Friesenhahn2019-11-031-1/+2
|/ | | | that bash is not required.
* make TIFF_SSIZE_T the same bitwidth as TIFF_SIZE_TThomas Bernard2019-05-311-1/+1
| | | | | it was previously the same bitwidth as unsigned char * Pointers can be larger than size_t.
* Add test to check that libtiff types have the correct sizeThomas Bernard2019-05-313-2/+67
| | | | | | | | | | | | | | | | in configure/CMakeList.txt : - TIFF_INT8_T/TIFF_UINT8_T is signed/unsigned char sizeof(char)==1 in C standard - TIFF_INT16_T/TIFF_UINT16_T is signed/unsigned short sizeof(short)>=2 in C standard - TIFF_INT32_T/TIFF_UINT32_T is defined so its sizeof() is 4 - TIFF_INT64_T/TIFF_UINT64_T is defined so its sizeof() is 8 - TIFF_SIZE_T is defined so it has same sizeof() than size_t - TIFF_SSIZE_T is defined so it has same sizeof() than unsigned char *
* Merge branch 'defer_strile_writing' into 'master'Even Rouault2019-05-293-0/+245
|\ | | | | | | | | Add TIFFDeferStrileArrayWriting() and TIFFForceStrileArrayWriting() See merge request libtiff/libtiff!82
| * Add TIFFDeferStrileArrayWriting() and TIFFForceStrileArrayWriting()Even Rouault2019-05-253-0/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Those advanced writing functions must be used in a particular sequence to make their intended effect. Their aim is to control when/where the [Strip/Tile][Offsets/ByteCounts] arrays are written into the file. The purpose of this is to generate 'cloud-optimized geotiff' files where the first KB of the file only contain the IFD entries without the potentially large strile arrays. Those are written afterwards. The typical sequence of calls is: TIFFOpen() [ TIFFCreateDirectory(tif) ] Set fields with calls to TIFFSetField(tif, ...) TIFFDeferStrileArrayWriting(tif) TIFFWriteCheck(tif, ...) TIFFWriteDirectory(tif) ... potentially create other directories and come back to the above directory TIFFForceStrileArrayWriting(tif): emit the arrays at the end of file See test/defer_strile_writing.c for a practical example.
* | Add TIFFReadFromUserBuffer()Even Rouault2019-05-231-10/+64
|/ | | | | | | This function replaces the use of TIFFReadEncodedStrip()/TIFFReadEncodedTile() when the user can provide the buffer for the input data, for example when he wants to avoid libtiff to read the strile offset/count values from the [Strip|Tile][Offsets/ByteCounts] array.
* test/defer_strile_loading.c: fix warning with Visual C++Even Rouault2019-05-221-1/+2
|
* Merge branch 'ondemand_strile_offbytecount_loading' into 'master'Even Rouault2019-05-213-1/+262
|\ | | | | | | | | Make defer strile offset/bytecount loading available at runtime See merge request libtiff/libtiff!79
| * Make defer strile offset/bytecount loading available at runtimeEven Rouault2019-05-103-1/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and add per-strile offset/bytecount loading capabilities. Part of this commit makes the behaviour that was previously met when libtiff was compiled with -DDEFER_STRILE_LOAD available for default builds when specifying the new 'D' (Deferred) TIFFOpen() flag. In that mode, the [Tile/Strip][ByteCounts/Offsets] arrays are only loaded when first accessed. This can speed-up the opening of files stored on the network when just metadata retrieval is needed. This mode has been used for years by the GDAL library when compiled with its embeded libtiff copy. To avoid potential out-of-tree code (typically codecs) that would use the td_stripbytecount and td_stripoffset array inconditionnaly assuming they have been loaded, those have been suffixed with _p (for protected). The use of the new functions mentionned below is then recommended. Another addition of this commit is the capability of loading only the values of the offset/bytecount of the strile of interest instead of the whole array. This is enabled with the new 'O' (Ondemand) flag of TIFFOpen() (which implies 'D'). That behaviour has also been used by GDAL, which hacked into the td_stripoffset/td_stripbytecount arrays directly. The new code added in the _TIFFFetchStrileValue() and _TIFFPartialReadStripArray() internal functions is mostly a port of what was in GDAL GTiff driver previously. Related to that, the public TIFFGetStrileOffset[WithErr]() and TIFFGetStrileByteCount[WithErr]() functions have been added to API. They are of particular interest when using sparse files (with offset == bytecount == 0) and you want to detect if a strile is present or not without decompressing the data, or updating an existing sparse file. They will also be used to enable a future enhancement where client code can entirely skip bytecount loading in some situtations A new test/defer_strile_loading.c test has been added to test the above capabilities.