diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-03-19 13:53:45 +0100 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-08-13 11:28:25 +0200 |
commit | dc2ba49207af71193f1390d84bba4e15aeea0ce0 (patch) | |
tree | 79c2a51cb5fa2b87800b1113e0015a7108cd2eb3 /tiff/test | |
parent | Import Ghostscript 9.50 (diff) | |
download | ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.tar.gz ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.tar.bz2 ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.zip |
Import Ghostscript 9.52ghostscript-9.52
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'tiff/test')
32 files changed, 1312 insertions, 84 deletions
diff --git a/tiff/test/CMakeLists.txt b/tiff/test/CMakeLists.txt index 912be19c..a4216d56 100644 --- a/tiff/test/CMakeLists.txt +++ b/tiff/test/CMakeLists.txt @@ -35,6 +35,7 @@ set(TESTSCRIPTS ppm2tiff_pbm.sh ppm2tiff_pgm.sh ppm2tiff_ppm.sh + fax2tiff.sh tiffcp-g3.sh tiffcp-g3-1d.sh tiffcp-g3-1d-fill.sh @@ -44,6 +45,7 @@ set(TESTSCRIPTS tiffcp-logluv.sh tiffcp-thumbnail.sh tiffcp-lzw-compat.sh + tiffcp-lzw-scanline-decode.sh tiffdump.sh tiffinfo.sh tiffcp-split.sh @@ -120,7 +122,8 @@ set(TIFFIMAGES images/rgb-3c-16b.tiff images/rgb-3c-8b.tiff images/quad-tile.jpg.tiff - images/quad-lzw-compat.tiff) + images/quad-lzw-compat.tiff + images/lzw-single-strip.tiff) set(BMPIMAGES images/palette-1c-8b.bmp @@ -149,6 +152,7 @@ set(UNCOMPRESSEDIMAGES # files which are not currently used by the tests. set(IMAGES_EXTRA_DIST images/README.txt + images/miniswhite-1c-1b.g3 ${BMPIMAGES} ${GIFIMAGES} ${PNMIMAGES} @@ -184,6 +188,15 @@ endif() add_executable(custom_dir custom_dir.c) target_link_libraries(custom_dir tiff port) +add_executable(defer_strile_loading defer_strile_loading.c) +target_link_libraries(defer_strile_loading tiff port) + +add_executable(defer_strile_writing defer_strile_writing.c) +target_link_libraries(defer_strile_writing tiff port) + +add_executable(testtypes testtypes.c) +target_link_libraries(testtypes tiff port) + set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output") file(MAKE_DIRECTORY "${TEST_OUTPUT}") @@ -335,6 +348,7 @@ add_convert_test(tiffcp g32d "-c g3:2d" "images/miniswhite-1c-1b.ti add_convert_test(tiffcp g32dfill "-c g3:2d:fill" "images/miniswhite-1c-1b.tiff" FALSE) add_convert_test(tiffcp g4 "-c g4" "images/miniswhite-1c-1b.tiff" FALSE) add_convert_test(tiffcp none "-c none" "images/quad-lzw-compat.tiff" FALSE) +add_convert_test(tiffcp noner1 "-c none -r 1" "images/lzw-single-strip.tiff" FALSE) add_convert_test_multi(tiffcp tiffcp "" logluv "-c none" "-c sgilog" "" "images/logluv-3c-16b.tiff" FALSE) add_convert_test_multi(tiffcp thumbnail "" thumbnail "g3:1d" "" "" @@ -380,3 +394,7 @@ add_convert_tests(tiffcrop doubleflip "-F both" TIFFIMAGES TRU add_convert_tests(tiffcrop extract "-U px -E top -X 60 -Y 60" TIFFIMAGES TRUE) # Test extracting the first and fourth quarters from the left side. add_convert_tests(tiffcrop extractz14 "-E left -Z1:4,2:4" TIFFIMAGES TRUE) + +# test types +add_test(NAME "testtypes" + COMMAND "testtypes") diff --git a/tiff/test/Makefile.am b/tiff/test/Makefile.am index 2052487c..90c2f3d1 100644 --- a/tiff/test/Makefile.am +++ b/tiff/test/Makefile.am @@ -34,6 +34,7 @@ TESTS_ENVIRONMENT = \ MEMCHECK="$(MEMCHECK)" EXTRA_DIST = \ + $(REFFILES) \ $(TESTSCRIPTS) \ $(IMAGES_EXTRA_DIST) \ CMakeLists.txt \ @@ -63,6 +64,7 @@ endif # Executable programs which need to be built in order to support tests check_PROGRAMS = \ ascii_tag long_tag short_tag strip_rw rewrite custom_dir \ + defer_strile_loading defer_strile_writing testtypes \ $(JPEG_DEPENDENT_CHECK_PROG) # Test scripts to execute @@ -70,6 +72,7 @@ TESTSCRIPTS = \ ppm2tiff_pbm.sh \ ppm2tiff_pgm.sh \ ppm2tiff_ppm.sh \ + fax2tiff.sh \ tiffcp-g3.sh \ tiffcp-g3-1d.sh \ tiffcp-g3-1d-fill.sh \ @@ -79,6 +82,7 @@ TESTSCRIPTS = \ tiffcp-logluv.sh \ tiffcp-thumbnail.sh \ tiffcp-lzw-compat.sh \ + tiffcp-lzw-scanline-decode.sh \ tiffdump.sh \ tiffinfo.sh \ tiffcp-split.sh \ @@ -143,6 +147,14 @@ TESTSCRIPTS = \ tiff2rgba-rgb-3c-8b.sh \ $(JPEG_DEPENDENT_TESTSCRIPTS) +# This list should contain the references files +# from the 'refs' subdirectory +REFFILES = \ + refs/o-tiff2ps-EPS1.ps \ + refs/o-tiff2ps-PS1.ps \ + refs/o-tiff2ps-PS2.ps \ + refs/o-tiff2ps-PS3.ps + # This list should contain all of the TIFF files in the 'images' # subdirectory which are intended to be used as input images for # tests. All of these files should use the extension ".tiff". @@ -158,7 +170,8 @@ TIFFIMAGES = \ images/rgb-3c-16b.tiff \ images/rgb-3c-8b.tiff \ images/quad-tile.jpg.tiff \ - images/quad-lzw-compat.tiff + images/quad-lzw-compat.tiff \ + images/lzw-single-strip.tiff PNMIMAGES = \ images/minisblack-1c-8b.pgm \ @@ -170,6 +183,7 @@ PNMIMAGES = \ # files which are not currently used by the tests. IMAGES_EXTRA_DIST = \ images/README.txt \ + images/miniswhite-1c-1b.g3 \ $(PNMIMAGES) \ $(TIFFIMAGES) @@ -189,6 +203,10 @@ raw_decode_SOURCES = raw_decode.c raw_decode_LDADD = $(LIBTIFF) custom_dir_SOURCES = custom_dir.c custom_dir_LDADD = $(LIBTIFF) +defer_strile_loading_SOURCES = defer_strile_loading.c +defer_strile_loading_LDADD = $(LIBTIFF) +defer_strile_writing_SOURCES = defer_strile_writing.c +defer_strile_writing_LDADD = $(LIBTIFF) AM_CPPFLAGS = -I$(top_srcdir)/libtiff diff --git a/tiff/test/Makefile.in b/tiff/test/Makefile.in index 15c0147b..5a2f0607 100644 --- a/tiff/test/Makefile.in +++ b/tiff/test/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -117,7 +117,9 @@ TESTS = $(check_PROGRAMS) $(am__EXEEXT_3) XFAIL_TESTS = check_PROGRAMS = ascii_tag$(EXEEXT) long_tag$(EXEEXT) \ short_tag$(EXEEXT) strip_rw$(EXEEXT) rewrite$(EXEEXT) \ - custom_dir$(EXEEXT) $(am__EXEEXT_1) + custom_dir$(EXEEXT) defer_strile_loading$(EXEEXT) \ + defer_strile_writing$(EXEEXT) testtypes$(EXEEXT) \ + $(am__EXEEXT_1) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ @@ -128,7 +130,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \ $(top_builddir)/libtiff/tiffconf.h CONFIG_CLEAN_FILES = @@ -144,6 +146,12 @@ am__v_lt_1 = am_custom_dir_OBJECTS = custom_dir.$(OBJEXT) custom_dir_OBJECTS = $(am_custom_dir_OBJECTS) custom_dir_DEPENDENCIES = $(LIBTIFF) +am_defer_strile_loading_OBJECTS = defer_strile_loading.$(OBJEXT) +defer_strile_loading_OBJECTS = $(am_defer_strile_loading_OBJECTS) +defer_strile_loading_DEPENDENCIES = $(LIBTIFF) +am_defer_strile_writing_OBJECTS = defer_strile_writing.$(OBJEXT) +defer_strile_writing_OBJECTS = $(am_defer_strile_writing_OBJECTS) +defer_strile_writing_DEPENDENCIES = $(LIBTIFF) am_long_tag_OBJECTS = long_tag.$(OBJEXT) check_tag.$(OBJEXT) long_tag_OBJECTS = $(am_long_tag_OBJECTS) long_tag_DEPENDENCIES = $(LIBTIFF) @@ -160,6 +168,9 @@ am_strip_rw_OBJECTS = strip_rw.$(OBJEXT) strip.$(OBJEXT) \ test_arrays.$(OBJEXT) strip_rw_OBJECTS = $(am_strip_rw_OBJECTS) strip_rw_DEPENDENCIES = $(LIBTIFF) +testtypes_SOURCES = testtypes.c +testtypes_OBJECTS = testtypes.$(OBJEXT) +testtypes_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -174,7 +185,15 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/ascii_tag.Po \ + ./$(DEPDIR)/check_tag.Po ./$(DEPDIR)/custom_dir.Po \ + ./$(DEPDIR)/defer_strile_loading.Po \ + ./$(DEPDIR)/defer_strile_writing.Po ./$(DEPDIR)/long_tag.Po \ + ./$(DEPDIR)/raw_decode.Po ./$(DEPDIR)/rewrite_tag.Po \ + ./$(DEPDIR)/short_tag.Po ./$(DEPDIR)/strip.Po \ + ./$(DEPDIR)/strip_rw.Po ./$(DEPDIR)/test_arrays.Po \ + ./$(DEPDIR)/testtypes.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -195,11 +214,15 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(ascii_tag_SOURCES) $(custom_dir_SOURCES) \ - $(long_tag_SOURCES) $(raw_decode_SOURCES) $(rewrite_SOURCES) \ - $(short_tag_SOURCES) $(strip_rw_SOURCES) + $(defer_strile_loading_SOURCES) \ + $(defer_strile_writing_SOURCES) $(long_tag_SOURCES) \ + $(raw_decode_SOURCES) $(rewrite_SOURCES) $(short_tag_SOURCES) \ + $(strip_rw_SOURCES) testtypes.c DIST_SOURCES = $(ascii_tag_SOURCES) $(custom_dir_SOURCES) \ - $(long_tag_SOURCES) $(raw_decode_SOURCES) $(rewrite_SOURCES) \ - $(short_tag_SOURCES) $(strip_rw_SOURCES) + $(defer_strile_loading_SOURCES) \ + $(defer_strile_writing_SOURCES) $(long_tag_SOURCES) \ + $(raw_decode_SOURCES) $(rewrite_SOURCES) $(short_tag_SOURCES) \ + $(strip_rw_SOURCES) testtypes.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -411,12 +434,13 @@ RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck @HAVE_JPEG_TRUE@am__EXEEXT_2 = tiff2rgba-quad-tile.jpg.sh am__EXEEXT_3 = ppm2tiff_pbm.sh ppm2tiff_pgm.sh ppm2tiff_ppm.sh \ - tiffcp-g3.sh tiffcp-g3-1d.sh tiffcp-g3-1d-fill.sh \ + fax2tiff.sh tiffcp-g3.sh tiffcp-g3-1d.sh tiffcp-g3-1d-fill.sh \ tiffcp-g3-2d.sh tiffcp-g3-2d-fill.sh tiffcp-g4.sh \ tiffcp-logluv.sh tiffcp-thumbnail.sh tiffcp-lzw-compat.sh \ - tiffdump.sh tiffinfo.sh tiffcp-split.sh tiffcp-split-join.sh \ - tiff2ps-PS1.sh tiff2ps-PS2.sh tiff2ps-PS3.sh tiff2ps-EPS1.sh \ - tiff2pdf.sh tiffcrop-doubleflip-logluv-3c-16b.sh \ + tiffcp-lzw-scanline-decode.sh tiffdump.sh tiffinfo.sh \ + tiffcp-split.sh tiffcp-split-join.sh tiff2ps-PS1.sh \ + tiff2ps-PS2.sh tiff2ps-PS3.sh tiff2ps-EPS1.sh tiff2pdf.sh \ + tiffcrop-doubleflip-logluv-3c-16b.sh \ tiffcrop-doubleflip-minisblack-1c-16b.sh \ tiffcrop-doubleflip-minisblack-1c-8b.sh \ tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh \ @@ -479,7 +503,6 @@ TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ - $(top_srcdir)/config/mkinstalldirs \ $(top_srcdir)/config/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -640,6 +663,7 @@ TESTS_ENVIRONMENT = \ MEMCHECK="$(MEMCHECK)" EXTRA_DIST = \ + $(REFFILES) \ $(TESTSCRIPTS) \ $(IMAGES_EXTRA_DIST) \ CMakeLists.txt \ @@ -663,6 +687,7 @@ TESTSCRIPTS = \ ppm2tiff_pbm.sh \ ppm2tiff_pgm.sh \ ppm2tiff_ppm.sh \ + fax2tiff.sh \ tiffcp-g3.sh \ tiffcp-g3-1d.sh \ tiffcp-g3-1d-fill.sh \ @@ -672,6 +697,7 @@ TESTSCRIPTS = \ tiffcp-logluv.sh \ tiffcp-thumbnail.sh \ tiffcp-lzw-compat.sh \ + tiffcp-lzw-scanline-decode.sh \ tiffdump.sh \ tiffinfo.sh \ tiffcp-split.sh \ @@ -737,6 +763,15 @@ TESTSCRIPTS = \ $(JPEG_DEPENDENT_TESTSCRIPTS) +# This list should contain the references files +# from the 'refs' subdirectory +REFFILES = \ + refs/o-tiff2ps-EPS1.ps \ + refs/o-tiff2ps-PS1.ps \ + refs/o-tiff2ps-PS2.ps \ + refs/o-tiff2ps-PS3.ps + + # This list should contain all of the TIFF files in the 'images' # subdirectory which are intended to be used as input images for # tests. All of these files should use the extension ".tiff". @@ -752,7 +787,8 @@ TIFFIMAGES = \ images/rgb-3c-16b.tiff \ images/rgb-3c-8b.tiff \ images/quad-tile.jpg.tiff \ - images/quad-lzw-compat.tiff + images/quad-lzw-compat.tiff \ + images/lzw-single-strip.tiff PNMIMAGES = \ images/minisblack-1c-8b.pgm \ @@ -765,6 +801,7 @@ PNMIMAGES = \ # files which are not currently used by the tests. IMAGES_EXTRA_DIST = \ images/README.txt \ + images/miniswhite-1c-1b.g3 \ $(PNMIMAGES) \ $(TIFFIMAGES) @@ -783,6 +820,10 @@ raw_decode_SOURCES = raw_decode.c raw_decode_LDADD = $(LIBTIFF) custom_dir_SOURCES = custom_dir.c custom_dir_LDADD = $(LIBTIFF) +defer_strile_loading_SOURCES = defer_strile_loading.c +defer_strile_loading_LDADD = $(LIBTIFF) +defer_strile_writing_SOURCES = defer_strile_writing.c +defer_strile_writing_LDADD = $(LIBTIFF) AM_CPPFLAGS = -I$(top_srcdir)/libtiff all: all-am @@ -805,8 +846,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -835,6 +876,14 @@ custom_dir$(EXEEXT): $(custom_dir_OBJECTS) $(custom_dir_DEPENDENCIES) $(EXTRA_cu @rm -f custom_dir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(custom_dir_OBJECTS) $(custom_dir_LDADD) $(LIBS) +defer_strile_loading$(EXEEXT): $(defer_strile_loading_OBJECTS) $(defer_strile_loading_DEPENDENCIES) $(EXTRA_defer_strile_loading_DEPENDENCIES) + @rm -f defer_strile_loading$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(defer_strile_loading_OBJECTS) $(defer_strile_loading_LDADD) $(LIBS) + +defer_strile_writing$(EXEEXT): $(defer_strile_writing_OBJECTS) $(defer_strile_writing_DEPENDENCIES) $(EXTRA_defer_strile_writing_DEPENDENCIES) + @rm -f defer_strile_writing$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(defer_strile_writing_OBJECTS) $(defer_strile_writing_LDADD) $(LIBS) + long_tag$(EXEEXT): $(long_tag_OBJECTS) $(long_tag_DEPENDENCIES) $(EXTRA_long_tag_DEPENDENCIES) @rm -f long_tag$(EXEEXT) $(AM_V_CCLD)$(LINK) $(long_tag_OBJECTS) $(long_tag_LDADD) $(LIBS) @@ -855,22 +904,35 @@ strip_rw$(EXEEXT): $(strip_rw_OBJECTS) $(strip_rw_DEPENDENCIES) $(EXTRA_strip_rw @rm -f strip_rw$(EXEEXT) $(AM_V_CCLD)$(LINK) $(strip_rw_OBJECTS) $(strip_rw_LDADD) $(LIBS) +testtypes$(EXEEXT): $(testtypes_OBJECTS) $(testtypes_DEPENDENCIES) $(EXTRA_testtypes_DEPENDENCIES) + @rm -f testtypes$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(testtypes_OBJECTS) $(testtypes_LDADD) $(LIBS) + mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii_tag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/custom_dir.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_tag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw_decode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rewrite_tag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_tag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip_rw.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_arrays.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii_tag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/custom_dir.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defer_strile_loading.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defer_strile_writing.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_tag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw_decode.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rewrite_tag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_tag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip_rw.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_arrays.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtypes.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -1071,7 +1133,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) fi; \ $$success || exit 1 -check-TESTS: +check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @@ -1134,6 +1196,27 @@ custom_dir.log: custom_dir$(EXEEXT) --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +defer_strile_loading.log: defer_strile_loading$(EXEEXT) + @p='defer_strile_loading$(EXEEXT)'; \ + b='defer_strile_loading'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +defer_strile_writing.log: defer_strile_writing$(EXEEXT) + @p='defer_strile_writing$(EXEEXT)'; \ + b='defer_strile_writing'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +testtypes.log: testtypes$(EXEEXT) + @p='testtypes$(EXEEXT)'; \ + b='testtypes'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) raw_decode.log: raw_decode$(EXEEXT) @p='raw_decode$(EXEEXT)'; \ b='raw_decode'; \ @@ -1162,6 +1245,13 @@ ppm2tiff_ppm.sh.log: ppm2tiff_ppm.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +fax2tiff.sh.log: fax2tiff.sh + @p='fax2tiff.sh'; \ + b='fax2tiff.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tiffcp-g3.sh.log: tiffcp-g3.sh @p='tiffcp-g3.sh'; \ b='tiffcp-g3.sh'; \ @@ -1225,6 +1315,13 @@ tiffcp-lzw-compat.sh.log: tiffcp-lzw-compat.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tiffcp-lzw-scanline-decode.sh.log: tiffcp-lzw-scanline-decode.sh + @p='tiffcp-lzw-scanline-decode.sh'; \ + b='tiffcp-lzw-scanline-decode.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tiffdump.sh.log: tiffdump.sh @p='tiffdump.sh'; \ b='tiffdump.sh'; \ @@ -1681,7 +1778,10 @@ tiff2rgba-quad-tile.jpg.sh.log: tiff2rgba-quad-tile.jpg.sh @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -1757,7 +1857,19 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/ascii_tag.Po + -rm -f ./$(DEPDIR)/check_tag.Po + -rm -f ./$(DEPDIR)/custom_dir.Po + -rm -f ./$(DEPDIR)/defer_strile_loading.Po + -rm -f ./$(DEPDIR)/defer_strile_writing.Po + -rm -f ./$(DEPDIR)/long_tag.Po + -rm -f ./$(DEPDIR)/raw_decode.Po + -rm -f ./$(DEPDIR)/rewrite_tag.Po + -rm -f ./$(DEPDIR)/short_tag.Po + -rm -f ./$(DEPDIR)/strip.Po + -rm -f ./$(DEPDIR)/strip_rw.Po + -rm -f ./$(DEPDIR)/test_arrays.Po + -rm -f ./$(DEPDIR)/testtypes.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -1803,7 +1915,19 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/ascii_tag.Po + -rm -f ./$(DEPDIR)/check_tag.Po + -rm -f ./$(DEPDIR)/custom_dir.Po + -rm -f ./$(DEPDIR)/defer_strile_loading.Po + -rm -f ./$(DEPDIR)/defer_strile_writing.Po + -rm -f ./$(DEPDIR)/long_tag.Po + -rm -f ./$(DEPDIR)/raw_decode.Po + -rm -f ./$(DEPDIR)/rewrite_tag.Po + -rm -f ./$(DEPDIR)/short_tag.Po + -rm -f ./$(DEPDIR)/strip.Po + -rm -f ./$(DEPDIR)/strip_rw.Po + -rm -f ./$(DEPDIR)/test_arrays.Po + -rm -f ./$(DEPDIR)/testtypes.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1824,16 +1948,16 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am diff --git a/tiff/test/ascii_tag.c b/tiff/test/ascii_tag.c index 6337900b..9a56d31d 100644 --- a/tiff/test/ascii_tag.c +++ b/tiff/test/ascii_tag.c @@ -1,5 +1,3 @@ -/* $Id: ascii_tag.c,v 1.8 2013-12-17 14:41:57 bfriesen Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/check_tag.c b/tiff/test/check_tag.c index 43011800..5750d683 100644 --- a/tiff/test/check_tag.c +++ b/tiff/test/check_tag.c @@ -1,5 +1,3 @@ -/* $Id: check_tag.c,v 1.3 2008/04/15 14:19:37 dron Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/common.sh b/tiff/test/common.sh index 6b1380dd..5bebcd37 100644 --- a/tiff/test/common.sh +++ b/tiff/test/common.sh @@ -7,6 +7,7 @@ SRCDIR=`cd $SRCDIR && pwd` TOPSRCDIR=`cd $srcdir/.. && pwd` TOOLS=`cd ../tools && pwd` IMAGES="${SRCDIR}/images" +REFS="${SRCDIR}/refs" # Aliases for built tools FAX2PS=${TOOLS}/fax2ps @@ -41,6 +42,7 @@ IMG_RGB_3C_16B=${IMAGES}/rgb-3c-16b.tiff IMG_RGB_3C_8B=${IMAGES}/rgb-3c-8b.tiff IMG_MINISBLACK_2C_8B_ALPHA=${IMAGES}/minisblack-2c-8b-alpha.tiff IMG_QUAD_LZW_COMPAT=${IMAGES}/quad-lzw-compat.tiff +IMG_LZW_SINGLE_STROP=${IMAGES}/lzw-single-strip.tiff IMG_MINISWHITE_1C_1B_PBM=${IMAGES}/miniswhite-1c-1b.pbm IMG_MINISBLACK_1C_8B_PGM=${IMAGES}/minisblack-1c-8b.pgm diff --git a/tiff/test/custom_dir.c b/tiff/test/custom_dir.c index acf55ce5..3b3ad279 100644 --- a/tiff/test/custom_dir.c +++ b/tiff/test/custom_dir.c @@ -1,5 +1,3 @@ -/* $Id: custom_dir.c,v 1.3 2013-12-17 14:41:58 bfriesen Exp $ */ - /* * Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com> * diff --git a/tiff/test/defer_strile_loading.c b/tiff/test/defer_strile_loading.c new file mode 100644 index 00000000..b444c01f --- /dev/null +++ b/tiff/test/defer_strile_loading.c @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2019, Even Rouault <even.rouault at spatialys.com> + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* + * TIFF Library + * + * Module to test 'D' and 'O' open flags + */ + +#include "tif_config.h" + +#include <assert.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include "tiffio.h" +#include "tifftest.h" + +int test(int classictif, int height, int tiled) +{ + const char* filename = "defer_strile_loading.tif"; + TIFF* tif; + int i; + int ret = 0; + FILE* f; + + (void)ret; + + tif = TIFFOpen(filename, classictif ? "wDO" : "w8DO"); /* O should be ignored in write mode */ + if(!tif) + { + fprintf(stderr, "cannot create %s\n", filename); + return 1; + } + ret = TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + assert(ret); + if( tiled ) + { + int j; + ret = TIFFSetField(tif, TIFFTAG_TILEWIDTH, 16); + assert( ret ); + ret = TIFFSetField(tif, TIFFTAG_TILELENGTH, 16); + assert( ret ); + for( j = 0; j < (height+15) / 16; j++ ) + { + unsigned char tilebuffer[256]; + memset(tilebuffer, (unsigned char)j, 256); + ret = TIFFWriteEncodedTile( tif, j, tilebuffer, 256 ); + assert(ret == 256); + } + } + else + { + ret = TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1); + assert(ret); + for( i = 0; i < height; i++ ) + { + unsigned char c = (unsigned char)i; + ret = TIFFWriteEncodedStrip( tif, i, &c, 1 ); + assert(ret == 1); + + if( i == 1 && height > 100000 ) + i = height - 2; + } + } + TIFFClose(tif); + + f = fopen(filename, "rb"); + if( !f ) + return 1; + + for( i = 0; i < 2; i++ ) + { + tif = TIFFOpen(filename, i == 0 ? "rD" : "rO"); + if(!tif) + { + fprintf(stderr, "cannot open %s\n", filename); + fclose(f); + return 1; + } + if( tiled ) + { + int j; + for( j = 0; j < (height+15) / 16; j++ ) + { + int retry; + unsigned char expected_c = (unsigned char)j; + + for( retry = 0; retry < 2; retry++ ) + { + unsigned char tilebuffer[256]; + memset(tilebuffer,0, 256); + ret = TIFFReadEncodedTile( tif, j, tilebuffer, 256 ); + assert(ret == 256); + if( tilebuffer[0] != expected_c || + tilebuffer[255] != expected_c ) + { + fprintf(stderr, "unexpected value at tile %d: %d %d\n", + j, tilebuffer[0], tilebuffer[255]); + TIFFClose(tif); + fclose(f); + return 1; + } + } + + { + int err = 0; + int offset, size; + unsigned char inputbuffer[256]; + unsigned char tilebuffer[256]; + + offset = TIFFGetStrileOffsetWithErr(tif, j, &err); + assert(offset != 0); + assert(err == 0); + + size = TIFFGetStrileByteCountWithErr(tif, j, &err); + assert(size == 256); + assert(err == 0); + + fseek(f, offset, SEEK_SET); + fread(inputbuffer, 256, 1, f); + + memset(tilebuffer,0, 256); + ret = TIFFReadFromUserBuffer(tif, j, + inputbuffer, 256, + tilebuffer, 256 ); + assert(ret == 1); + if( tilebuffer[0] != expected_c || + tilebuffer[255] != expected_c ) + { + fprintf(stderr, "unexpected value at tile %d: %d %d\n", + j, tilebuffer[0], tilebuffer[255]); + TIFFClose(tif); + fclose(f); + return 1; + } + } + } + } + else + { + int j; + for( j = 0; j < height; j++ ) + { + int retry; + unsigned char expected_c = (unsigned char)j; + for( retry = 0; retry < 2; retry++ ) + { + unsigned char c = 0; + ret = TIFFReadEncodedStrip( tif, j, &c, 1 ); + assert(ret == 1); + if( c != expected_c ) + { + fprintf(stderr, "unexpected value at line %d: %d\n", + j, c); + TIFFClose(tif); + fclose(f); + return 1; + } + } + + { + int err = 0; + int offset, size; + unsigned char inputbuffer[1]; + unsigned char tilebuffer[1]; + + offset = TIFFGetStrileOffsetWithErr(tif, j, &err); + assert(offset != 0); + assert(err == 0); + + size = TIFFGetStrileByteCountWithErr(tif, j, &err); + assert(size == 1); + assert(err == 0); + + fseek(f, offset, SEEK_SET); + fread(inputbuffer, 1, 1, f); + + memset(tilebuffer,0, 1); + ret = TIFFReadFromUserBuffer(tif, j, + inputbuffer, 1, + tilebuffer, 1 ); + assert(ret == 1); + if( tilebuffer[0] != expected_c ) + { + fprintf(stderr, "unexpected value at line %d: %d\n", + j, tilebuffer[0]); + TIFFClose(tif); + fclose(f); + return 1; + } + } + + if( j == 1 && height > 100000 ) + j = height - 2; + } + + if( height > 100000 ) + { + /* Missing strip */ + int err = 0; + ret = TIFFGetStrileOffsetWithErr(tif, 2, &err); + assert(ret == 0); + assert(err == 0); + + ret = TIFFGetStrileByteCountWithErr(tif, 2, &err); + assert(ret == 0); + assert(err == 0); + + } + } + + { + int err = 0; + ret = TIFFGetStrileOffsetWithErr(tif, 0xFFFFFFFFU, &err); + assert(ret == 0); + assert(err == 1); + + ret = TIFFGetStrileByteCountWithErr(tif, 0xFFFFFFFFU, &err); + assert(ret == 0); + assert(err == 1); + } + + { + toff_t* offsets = NULL; + toff_t* bytecounts = NULL; + ret = TIFFGetField( tif, + tiled ? TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS, &offsets ); + assert(ret); + assert(offsets); + ret = TIFFGetField( tif, + tiled ? TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS, &bytecounts ); + assert(ret); + assert(bytecounts); + if( tiled ) + { + assert(bytecounts[0] == 256); + } + else + { + assert(bytecounts[0] == 1); + if( height > 1 && height <= 100000) + { + assert(offsets[1] == offsets[0] + 1); + assert(offsets[height - 1] == offsets[0] + height - 1); + } + assert(bytecounts[height - 1] == 1); + } + } + + TIFFClose(tif); + } + fclose(f); + + unlink(filename); + return 0; +} + +int +main() +{ + int is_classic; + for( is_classic = 1; is_classic >= 0; is_classic-- ) + { + int tiled; + for( tiled = 0; tiled <= 1; tiled ++ ) + { + if( test(is_classic, 1, tiled) ) + return 1; + if( test(is_classic, 8192, tiled) ) + return 1; + } + if( test(is_classic, 2000000, 0) ) + return 1; + } + return 0; +} diff --git a/tiff/test/defer_strile_writing.c b/tiff/test/defer_strile_writing.c new file mode 100644 index 00000000..4e358567 --- /dev/null +++ b/tiff/test/defer_strile_writing.c @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2019, Even Rouault <even.rouault at spatialys.com> + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* + * TIFF Library + * + * Module to test TIFFDeferStrileArrayWriting and TIFFForceStrileArrayWriting + */ + +#include "tif_config.h" + +#include <assert.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include "tiffio.h" + +int test(const char* mode, int tiled, int height) +{ + const char* filename = "defer_strile_writing.tif"; + TIFF* tif; + int i; + int ret = 0; + (void)ret; + + tif = TIFFOpen(filename, mode); + if(!tif) + { + fprintf(stderr, "cannot create %s\n", filename); + return 1; + } + ret = TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + assert(ret); + + if( tiled ) + { + ret = TIFFSetField(tif, TIFFTAG_TILEWIDTH, 16); + assert( ret ); + ret = TIFFSetField(tif, TIFFTAG_TILELENGTH, 16); + assert( ret ); + } + else + { + ret = TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1); + assert(ret); + } + + ret = TIFFDeferStrileArrayWriting(tif); + assert(ret); + + ret = TIFFWriteCheck( tif, tiled, "test" ); + assert(ret); + + ret = TIFFWriteDirectory( tif ); + assert(ret); + + /* Create other directory */ + TIFFFreeDirectory( tif ); + TIFFCreateDirectory( tif ); + + ret = TIFFSetField( tif, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE ); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_IMAGELENGTH, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + assert(ret); + ret = TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1); + assert(ret); + + ret = TIFFDeferStrileArrayWriting(tif); + assert(ret); + + ret = TIFFWriteCheck( tif, 0, "test" ); + assert(ret); + + ret = TIFFWriteDirectory( tif ); + assert(ret); + + /* Force writing of strile arrays */ + ret = TIFFSetDirectory( tif, 0 ); + assert(ret); + + ret = TIFFForceStrileArrayWriting(tif); + assert(ret); + + ret = TIFFSetDirectory( tif, 1 ); + assert(ret); + + ret = TIFFForceStrileArrayWriting(tif); + assert(ret); + + /* Now write data on frist directory */ + ret = TIFFSetDirectory( tif, 0 ); + assert(ret); + + if( tiled ) + { + int j; + for( j = 0; j < (height+15) / 16; j++ ) + { + unsigned char tilebuffer[256]; + memset(tilebuffer, (unsigned char)j, 256); + ret = TIFFWriteEncodedTile( tif, j, tilebuffer, 256 ); + assert(ret == 256); + } + } + else + { + for( i = 0; i < height; i++ ) + { + unsigned char c = (unsigned char)i; + ret = TIFFWriteEncodedStrip( tif, i, &c, 1 ); + assert(ret == 1); + + if( i == 1 && height > 100000 ) + i = height - 2; + } + } + + TIFFClose(tif); + + tif = TIFFOpen(filename, "r"); + if(!tif) + { + fprintf(stderr, "cannot open %s\n", filename); + return 1; + } + if( tiled ) + { + int j; + for( j = 0; j < (height+15) / 16; j++ ) + { + int retry; + for( retry = 0; retry < 2; retry++ ) + { + unsigned char tilebuffer[256]; + unsigned char expected_c = (unsigned char)j; + memset(tilebuffer,0, 256); + ret = TIFFReadEncodedTile( tif, j, tilebuffer, 256 ); + assert(ret == 256); + if( tilebuffer[0] != expected_c || + tilebuffer[255] != expected_c ) + { + fprintf(stderr, "unexpected value at tile %d: %d %d\n", + j, tilebuffer[0], tilebuffer[255]); + TIFFClose(tif); + return 1; + } + } + } + } + else + { + int j; + for( j = 0; j < height; j++ ) + { + int retry; + for( retry = 0; retry < 2; retry++ ) + { + unsigned char c = 0; + unsigned char expected_c = (unsigned char)j; + ret = TIFFReadEncodedStrip( tif, j, &c, 1 ); + assert(ret == 1); + if( c != expected_c ) + { + fprintf(stderr, "unexpected value at line %d: %d\n", + j, c); + TIFFClose(tif); + return 1; + } + } + } + } + + TIFFClose(tif); + + unlink(filename); + return 0; +} + +int +main() +{ + int tiled; + for( tiled = 0; tiled <= 1; tiled ++ ) + { + if( test("w", tiled, 1) ) + return 1; + if( test("w", tiled, 10) ) + return 1; + if( test("w8", tiled, 1) ) + return 1; + if( test("wD", tiled, 1) ) + return 1; + } + return 0; +} diff --git a/tiff/test/fax2tiff.sh b/tiff/test/fax2tiff.sh new file mode 100755 index 00000000..8806a647 --- /dev/null +++ b/tiff/test/fax2tiff.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Basic sanity check for fax2tiff +# +. ${srcdir:-.}/common.sh +infile="${IMAGES}/miniswhite-1c-1b.g3" +outfile="o-fax2tiff.tiff" +rm -f $outfile +echo "$MEMCHECK ${FAX2TIFF} -M -o $outfile $infile" +eval $MEMCHECK ${FAX2TIFF} -M -o $outfile $infile +status=$? +if [ $status != 0 ] ; then + echo "Returned failed status $status!" + echo "Output (if any) is in \"${outfile}\"." + exit $status +fi +f_tiffinfo_validate $outfile diff --git a/tiff/test/images/README.txt b/tiff/test/images/README.txt index 17f6292e..b6447d8e 100644 --- a/tiff/test/images/README.txt +++ b/tiff/test/images/README.txt @@ -27,3 +27,6 @@ PNM files: minisblack-1c-8b.pgm miniswhite-1c-1b.pbm rgb-3c-8b.ppm + +G3 Fax files : + miniswhite-1c-1b.g3 diff --git a/tiff/test/images/lzw-single-strip.tiff b/tiff/test/images/lzw-single-strip.tiff Binary files differnew file mode 100644 index 00000000..0ac27c6d --- /dev/null +++ b/tiff/test/images/lzw-single-strip.tiff diff --git a/tiff/test/images/miniswhite-1c-1b.g3 b/tiff/test/images/miniswhite-1c-1b.g3 Binary files differnew file mode 100644 index 00000000..9f00ce16 --- /dev/null +++ b/tiff/test/images/miniswhite-1c-1b.g3 diff --git a/tiff/test/long_tag.c b/tiff/test/long_tag.c index ab1440af..4bfdf805 100644 --- a/tiff/test/long_tag.c +++ b/tiff/test/long_tag.c @@ -1,5 +1,3 @@ -/* $Id: long_tag.c,v 1.5 2013-12-17 14:41:58 bfriesen Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/raw_decode.c b/tiff/test/raw_decode.c index f81aa059..a2fca03a 100644 --- a/tiff/test/raw_decode.c +++ b/tiff/test/raw_decode.c @@ -1,5 +1,3 @@ -/* $Id: raw_decode.c,v 1.7 2015-08-16 20:08:21 bfriesen Exp $ */ - /* * Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com> * diff --git a/tiff/test/refs/o-tiff2ps-EPS1.ps b/tiff/test/refs/o-tiff2ps-EPS1.ps new file mode 100644 index 00000000..9d9da8a2 --- /dev/null +++ b/tiff/test/refs/o-tiff2ps-EPS1.ps @@ -0,0 +1,112 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: tiff2ps +%%Title: miniswhite-1c-1b.tiff +%%CreationDate: Tue Apr 2 16:33:00 2019 +%%DocumentData: Clean7Bit +%%Origin: 0 0 +%%BoundingBox: 0 0 157 151 +%%LanguageLevel: 1 +%%Pages: 1 1 +%%EndComments +%%Page: 1 1 +gsave +100 dict begin +157.000000 151.000000 scale +%ImageData: 157 151 1 1 0 1 2 "image" +/scanLine 20 string def +157 151 1 +[157 0 0 -151 0 151] +{currentfile scanLine readhexstring pop} bind +image +0204153c0bfffffffff1ffffc7e01017ff8057ff5aa2803e1ffffffe0697ffffc7e485 +dfffd77fff48aca4dfd7fffff80003ffffcffe017fffe0c7ff1101250ffbfffff0241b +ffffffff80fffff37fff29fa48abf7ffffe41221ffffafffe3fffff19fff7ff82200f7 +fdff0040803fff5ffff5ffffe17ffffffe00088bc0070008259fff7ffffdfffff0ffff +7ffe040003c0001222001fff3ffffffffff15fdfffff084003004104809493fc1dffff +ffffc1badfffff0fd000010020140009e337ffffffffc3efffffff1abc040400000502 +04c6bfffffefffc36b7ffffe1ffe0c808804009490061bffffffff82fafffffc3dff08 +080000020042a78fffffffff87f7fffffc1fff0c0010428049080c27ffffffff87feff +fffc7ffd108000e0611090103ffffffffe077dfffffdbffc340003e808020203cfffff +fffc0bd77fffe0fffc000003e10022008877fffffffc06fdff3fe35ffc780217c02808 +28000ffffffff80f5fff6bc27ff040000fc00100a20103ffffffc007f5ff5ec2ffe082 +200bc480420454a1ffffffe0065fff7fc5ff0010005f1000205a4929ffffffe003d7ff +5fe7b80008202f029804000000ffffffc003efff37e5fe0010001e0401020240917fff +ffc004effffffbf80022001f018888a429087fffff8007b7ff5ff3e00080009c002122 +2544015ffff9c01fb7ff7ef7c0100400fc8408000020981ffff0783fe97f77fbc00800 +017e009006560a4547ffd2bffbffff5fd780020000f801041000a00033fccdbb9ffeff +1ba000500003fa1024a249125025f033effffeffffc000c00042f002860800880540d0 +47ffffffff574001c80003f9803e405054411400a9bfffffff7e0003804003f00a0302 +090114800005efffffff6f0003880007fc0203a040a3522a4017ffffffff5f00034000 +1af980a884120f1f8c000adffffffffff80fc0000ff82810420a27ffa800067fffffff +fff80f400033fc010a44508fff8e000bfffffffffffc0fc0003ff9809842404fff9e20 +07ffffdff7fffe0d400003ff200220291fff9b401afffffffffffc1fe01359ff089620 +015fffaa001bffffff1ffffa3d703eeeff810b22480fff905006fffffd6ffff81fb078 +adffe40e00412fff85400d7ffff9fffff01d787fedffe08ba8185fff501007ffff925f +fff03af8e7f7fff13f81401ffe054005ffffc1fffff03ffcf5effff00fa0094754d310 +05fffb07bfff803ffdddfffff00fe0145ea503d00fffff2f5fff003abfdffffff23fd2 +000151a7d81afffe3f7f7f803bbffffffff88fe081a02a23d006fffe7fbf39403ffebf +fffff23fe408068007d00bfffeffff6bf83f7f7ffffffd1fe01004aa2ff005fffff55f +46581afde7fffff087f00151008fd0027fffe2ff75f83fdc7bfffff05ff04004600fc0 +097fffc7ff79503677fffffff90ffa0495069f9002b7ffc9bf1e403edb7bfffff94ff0 +0420005f000127f7c3ff1e201764dffffff811440106963f80001ddffc5f0000296bbf +fffff842920b0200fe0000007fffbf00003681ebfffff8096cffc094fc20001fffff5f +000001015ffffff88064dfc001f980003ffffff700000200f9fffff0130a0fc29af400 +007fffffff00000003affffff8041403c2297d1800ffffffcf00000003fdfffff000a9 +87e402d01800fffffff720300002bfbffff8299407f005a09800fffffff764000003da +fffff80001aff020040000ffffffef78c00001fbfffff0002107f020880000ffffffc7 +db000003dffffff0024c87f042100000ffffffd759000003f6fffff0100895f801400d +00ffffffc7f3000007fffffff0024137f81e781fe0dfffff8f6c000007effffff00001 +fbfc29fc37b0ffffff8748000003feffffe000017efc11de5fe06fffff07d0000007df +fffff000037bfc13ff9ff07fffff8700000007fffffff0000ffcfe227ffff837ffff1f +2000000fbbfffff0003dfffe41fffffc1fffffe75000000fffffffe00205fdff647fff +f816ffffc7a0000007dfffffe06f843dff635fffff03fdff074000000fffffffe1b3e0 +1affe9ff67ff0522ce074000000fffffffc0bfb003ffc9f27ffe0398290700000007f7 +ffff81fff00fffce4077ff04a020470000000fffffff86fff8057ffcc05fff0000000f +0000000fffffff837ffa0ffff780ffff0000000700000017bfffff0fffff0ffff601ff +ff000000470000000fffffff09dfc78bffffc22fff0000000700000007ffffff0d5bf0 +eeffff89ffff0000000f0000000fffffff0bfff87eff8f12bfff000000270000000fff +ffff0feffc27fffd055fff000004070000001f7fffff3fb6d7ffff7907fffe0000000f +0000001ffffffc3e5d476fc0dd7fffff0000200f0000000ffffffc1ffdbdf5f12bffff +ff0000015f0000001ffffffc1f97edfff05fffefff0000003f0000000ffffff839febb +5ffcabbffffe000008bf0000002ffffffc3d56bfb7ff5fffffff000084ff0000001fff +fff85bdde5fffe29ffffff000000ff0000003fffffe066baaffffebbffffff000012ff +0000001ffffff02aebf66ffe5dffffff000001ff0000001fffffd057757bffff257fff +ff00000bff0000002fffffe0ad575f5fffd5ffffff000240ff0000003fffffc05bbcfe +bfff0a7fffff000003f70000006fffffc02aeb95ffffa5ffffff000093f70000003bff +ffc0aff99df77f0a7bfffe000423f70000003fffffb0112e733ffe95ddfefe000047c7 +0000007fffffe01bf7eeedff0ab3defe00000b970000005fffff804415a9b775a54fff +ee000027c70000007fffff8036db4a3fb685ba7ffe00008787000050bffffff0080455 +e6dd5867df6c000015870000007fffff801051a06eba9abfdffe000003070000605fff +ffc006082bb7ed954976f800000c07000000ffffffc004022a757a252bf7fc00002507 +0000a07effff700568591fe55ada2e9c00000007000000bffffe400a3a24a55a656fff +bc00000587000000fffffbe000845a5df81ad59af8000020070000009fffffe0004c24 +93c85556edf400000007000000ffffbf8000b25b2dbd1aa57bbc00000007000001ffff +ffa000491466e0035c5ffc00001407000001bfffffc000248b0bb86497db7000000007 +000000ffffff4000122a35390a26effc000000070000007fffff8000498782e454d579 +7c00000007000001bfffffc000210953ba89495ff400000007000001fbffffc0002892 +a968256ebde800000007000001ffffffc000858581f914dbfb7c00000007000003bfff +ff00002142649887699dfc00000007000001bfffff00004a80a961296dffe802000007 +000002dfffff00001191489822b757f800000007400001bfffff00001004a9a85576fb +d8000000077e2007ffffff0000038141500a97afb8000000077658077bffff00000611 +aca951ee79d000000007ffa207effffe0000008a51500c556ff000000007ffc907ffff +fe0000028141c80467e77000000007ff74065ffffe00000126ac50005cbfe000000007 +ffe80dfffffc0000008155a00017efc000000007fffe075ffffc000002a4aa58012937 +4000000007fffc0efffffc00000003ad50002acd8500000007fffd19dffffc000000a0 +62a000077f8058000007fffa0dfffffc00000084d9a800157501f0000007fffe06bfff +fc000000216450006dce023f000007fffc06bffff0000000601a400015d801ff500007 +fff009e7fff000000000418000057001ffb28007ffe0037fffe0000000c0a000000240 +07fffe8007fff0011bffe000000010010000007b21ffffe007ffffffffffe000000000 +000000007f82fffffc07ffffffffffc000000000000000007fc1ffffff07ffffffffff +c900000000000000006c04fffffb07ffffffffffffa0000000000000000c027ffff847 +ffffffffffffffc00000000000000001affffa27fffffffffffffff000000000000000 +04005ffc07fffffffffffffffd0000000000000000000000075fffffffffffffffc000 +000000000000220180ef1ffffffffffffffffe00000000000002000883ff1fffffffff +ffffffff00001800000000000009ff3fffffffffffffffff0000000001418000003bff +2fffffffffffffffff00010000027000901207ff7fffffffffffffffff7e00010037f8 +0018000fff7fffffffffffffffffff00a44007fc0030423fff7fffffffffffffffffff +c043002ffc003000afff +end +grestore +showpage +%%Trailer +%%EOF diff --git a/tiff/test/refs/o-tiff2ps-PS1.ps b/tiff/test/refs/o-tiff2ps-PS1.ps new file mode 100644 index 00000000..62c3e4bb --- /dev/null +++ b/tiff/test/refs/o-tiff2ps-PS1.ps @@ -0,0 +1,115 @@ +%!PS-Adobe-3.0 +%%Creator: tiff2ps +%%Title: miniswhite-1c-1b.tiff +%%CreationDate: Tue Apr 2 16:33:00 2019 +%%DocumentData: Clean7Bit +%%Origin: 0 0 +%%BoundingBox: 0 0 157 151 +%%LanguageLevel: 1 +%%Pages: (atend) +%%EndComments +%%BeginSetup +%%EndSetup +%%Page: 1 1 +gsave +100 dict begin +157.000000 151.000000 scale +%ImageData: 157 151 1 1 0 1 2 "image" +/scanLine 20 string def +157 151 1 +[157 0 0 -151 0 151] +{currentfile scanLine readhexstring pop} bind +image +0204153c0bfffffffff1ffffc7e01017ff8057ff5aa2803e1ffffffe0697ffffc7e485 +dfffd77fff48aca4dfd7fffff80003ffffcffe017fffe0c7ff1101250ffbfffff0241b +ffffffff80fffff37fff29fa48abf7ffffe41221ffffafffe3fffff19fff7ff82200f7 +fdff0040803fff5ffff5ffffe17ffffffe00088bc0070008259fff7ffffdfffff0ffff +7ffe040003c0001222001fff3ffffffffff15fdfffff084003004104809493fc1dffff +ffffc1badfffff0fd000010020140009e337ffffffffc3efffffff1abc040400000502 +04c6bfffffefffc36b7ffffe1ffe0c808804009490061bffffffff82fafffffc3dff08 +080000020042a78fffffffff87f7fffffc1fff0c0010428049080c27ffffffff87feff +fffc7ffd108000e0611090103ffffffffe077dfffffdbffc340003e808020203cfffff +fffc0bd77fffe0fffc000003e10022008877fffffffc06fdff3fe35ffc780217c02808 +28000ffffffff80f5fff6bc27ff040000fc00100a20103ffffffc007f5ff5ec2ffe082 +200bc480420454a1ffffffe0065fff7fc5ff0010005f1000205a4929ffffffe003d7ff +5fe7b80008202f029804000000ffffffc003efff37e5fe0010001e0401020240917fff +ffc004effffffbf80022001f018888a429087fffff8007b7ff5ff3e00080009c002122 +2544015ffff9c01fb7ff7ef7c0100400fc8408000020981ffff0783fe97f77fbc00800 +017e009006560a4547ffd2bffbffff5fd780020000f801041000a00033fccdbb9ffeff +1ba000500003fa1024a249125025f033effffeffffc000c00042f002860800880540d0 +47ffffffff574001c80003f9803e405054411400a9bfffffff7e0003804003f00a0302 +090114800005efffffff6f0003880007fc0203a040a3522a4017ffffffff5f00034000 +1af980a884120f1f8c000adffffffffff80fc0000ff82810420a27ffa800067fffffff +fff80f400033fc010a44508fff8e000bfffffffffffc0fc0003ff9809842404fff9e20 +07ffffdff7fffe0d400003ff200220291fff9b401afffffffffffc1fe01359ff089620 +015fffaa001bffffff1ffffa3d703eeeff810b22480fff905006fffffd6ffff81fb078 +adffe40e00412fff85400d7ffff9fffff01d787fedffe08ba8185fff501007ffff925f +fff03af8e7f7fff13f81401ffe054005ffffc1fffff03ffcf5effff00fa0094754d310 +05fffb07bfff803ffdddfffff00fe0145ea503d00fffff2f5fff003abfdffffff23fd2 +000151a7d81afffe3f7f7f803bbffffffff88fe081a02a23d006fffe7fbf39403ffebf +fffff23fe408068007d00bfffeffff6bf83f7f7ffffffd1fe01004aa2ff005fffff55f +46581afde7fffff087f00151008fd0027fffe2ff75f83fdc7bfffff05ff04004600fc0 +097fffc7ff79503677fffffff90ffa0495069f9002b7ffc9bf1e403edb7bfffff94ff0 +0420005f000127f7c3ff1e201764dffffff811440106963f80001ddffc5f0000296bbf +fffff842920b0200fe0000007fffbf00003681ebfffff8096cffc094fc20001fffff5f +000001015ffffff88064dfc001f980003ffffff700000200f9fffff0130a0fc29af400 +007fffffff00000003affffff8041403c2297d1800ffffffcf00000003fdfffff000a9 +87e402d01800fffffff720300002bfbffff8299407f005a09800fffffff764000003da +fffff80001aff020040000ffffffef78c00001fbfffff0002107f020880000ffffffc7 +db000003dffffff0024c87f042100000ffffffd759000003f6fffff0100895f801400d +00ffffffc7f3000007fffffff0024137f81e781fe0dfffff8f6c000007effffff00001 +fbfc29fc37b0ffffff8748000003feffffe000017efc11de5fe06fffff07d0000007df +fffff000037bfc13ff9ff07fffff8700000007fffffff0000ffcfe227ffff837ffff1f +2000000fbbfffff0003dfffe41fffffc1fffffe75000000fffffffe00205fdff647fff +f816ffffc7a0000007dfffffe06f843dff635fffff03fdff074000000fffffffe1b3e0 +1affe9ff67ff0522ce074000000fffffffc0bfb003ffc9f27ffe0398290700000007f7 +ffff81fff00fffce4077ff04a020470000000fffffff86fff8057ffcc05fff0000000f +0000000fffffff837ffa0ffff780ffff0000000700000017bfffff0fffff0ffff601ff +ff000000470000000fffffff09dfc78bffffc22fff0000000700000007ffffff0d5bf0 +eeffff89ffff0000000f0000000fffffff0bfff87eff8f12bfff000000270000000fff +ffff0feffc27fffd055fff000004070000001f7fffff3fb6d7ffff7907fffe0000000f +0000001ffffffc3e5d476fc0dd7fffff0000200f0000000ffffffc1ffdbdf5f12bffff +ff0000015f0000001ffffffc1f97edfff05fffefff0000003f0000000ffffff839febb +5ffcabbffffe000008bf0000002ffffffc3d56bfb7ff5fffffff000084ff0000001fff +fff85bdde5fffe29ffffff000000ff0000003fffffe066baaffffebbffffff000012ff +0000001ffffff02aebf66ffe5dffffff000001ff0000001fffffd057757bffff257fff +ff00000bff0000002fffffe0ad575f5fffd5ffffff000240ff0000003fffffc05bbcfe +bfff0a7fffff000003f70000006fffffc02aeb95ffffa5ffffff000093f70000003bff +ffc0aff99df77f0a7bfffe000423f70000003fffffb0112e733ffe95ddfefe000047c7 +0000007fffffe01bf7eeedff0ab3defe00000b970000005fffff804415a9b775a54fff +ee000027c70000007fffff8036db4a3fb685ba7ffe00008787000050bffffff0080455 +e6dd5867df6c000015870000007fffff801051a06eba9abfdffe000003070000605fff +ffc006082bb7ed954976f800000c07000000ffffffc004022a757a252bf7fc00002507 +0000a07effff700568591fe55ada2e9c00000007000000bffffe400a3a24a55a656fff +bc00000587000000fffffbe000845a5df81ad59af8000020070000009fffffe0004c24 +93c85556edf400000007000000ffffbf8000b25b2dbd1aa57bbc00000007000001ffff +ffa000491466e0035c5ffc00001407000001bfffffc000248b0bb86497db7000000007 +000000ffffff4000122a35390a26effc000000070000007fffff8000498782e454d579 +7c00000007000001bfffffc000210953ba89495ff400000007000001fbffffc0002892 +a968256ebde800000007000001ffffffc000858581f914dbfb7c00000007000003bfff +ff00002142649887699dfc00000007000001bfffff00004a80a961296dffe802000007 +000002dfffff00001191489822b757f800000007400001bfffff00001004a9a85576fb +d8000000077e2007ffffff0000038141500a97afb8000000077658077bffff00000611 +aca951ee79d000000007ffa207effffe0000008a51500c556ff000000007ffc907ffff +fe0000028141c80467e77000000007ff74065ffffe00000126ac50005cbfe000000007 +ffe80dfffffc0000008155a00017efc000000007fffe075ffffc000002a4aa58012937 +4000000007fffc0efffffc00000003ad50002acd8500000007fffd19dffffc000000a0 +62a000077f8058000007fffa0dfffffc00000084d9a800157501f0000007fffe06bfff +fc000000216450006dce023f000007fffc06bffff0000000601a400015d801ff500007 +fff009e7fff000000000418000057001ffb28007ffe0037fffe0000000c0a000000240 +07fffe8007fff0011bffe000000010010000007b21ffffe007ffffffffffe000000000 +000000007f82fffffc07ffffffffffc000000000000000007fc1ffffff07ffffffffff +c900000000000000006c04fffffb07ffffffffffffa0000000000000000c027ffff847 +ffffffffffffffc00000000000000001affffa27fffffffffffffff000000000000000 +04005ffc07fffffffffffffffd0000000000000000000000075fffffffffffffffc000 +000000000000220180ef1ffffffffffffffffe00000000000002000883ff1fffffffff +ffffffff00001800000000000009ff3fffffffffffffffff0000000001418000003bff +2fffffffffffffffff00010000027000901207ff7fffffffffffffffff7e00010037f8 +0018000fff7fffffffffffffffffff00a44007fc0030423fff7fffffffffffffffffff +c043002ffc003000afff +end +grestore +showpage +%%Trailer +%%Pages: 1 +%%EOF diff --git a/tiff/test/refs/o-tiff2ps-PS2.ps b/tiff/test/refs/o-tiff2ps-PS2.ps new file mode 100644 index 00000000..e7fe4339 --- /dev/null +++ b/tiff/test/refs/o-tiff2ps-PS2.ps @@ -0,0 +1,104 @@ +%!PS-Adobe-3.0 +%%Creator: tiff2ps +%%Title: miniswhite-1c-1b.tiff +%%CreationDate: Tue Apr 2 16:33:00 2019 +%%DocumentData: Clean7Bit +%%Origin: 0 0 +%%BoundingBox: 0 0 157 151 +%%LanguageLevel: 2 +%%Pages: (atend) +%%EndComments +%%BeginSetup +gsave newpath clippath pathbbox grestore + 4 2 roll 2 copy translate + exch 3 1 roll sub 3 1 roll sub exch + currentpagedevice /PageSize get aload pop + exch 3 1 roll div 3 1 roll div abs exch abs + 2 copy gt { exch } if pop + dup 1 lt { dup scale } { pop } ifelse +%%EndSetup +%%Page: 1 1 +%%PageOrientation: Landscape +%%PageBoundingBox: 0 0 157 151 +1 dict begin /PageSize [ 157.000000 151.000000 ] def currentdict end setpagedevice +<< + /Policies << + /PageSize 3 + >> +>> setpagedevice +gsave +100 dict begin +157.000000 151.000000 scale +% PostScript Level 2 only. +/DeviceGray setcolorspace +{ % exec + /im_stream currentfile /ASCII85Decode filter def + << + /ImageType 1 + /Width 157 + /Height 151 + /ImageMatrix [ 157 0 0 -151 0 151 ] + /BitsPerComponent 1 + /Interpolate true + /Decode [1 0] + /DataSource im_stream + >> image + im_stream status { im_stream flushfile } if +} +exec +rVPltoDejk!"Ju/3$7VQ!.UpIV-SSehuE`Xq.Ka.3#d/d!%<?t[o6KR-ia5Ps82is0EM0'!$=0# +mf(r0"98E4gZ/>7!!%KK!"=AXeciN^#QOiDmG7gC:]MI8!"NB:J-Xp1#Qb#+^OO$!TE#<!!$6Xj +!!3,oF?fR#pY'!TJ,fWN!"T&0J-#QIr'15Kh>cC5^]4?7!"PYE!!)c.r;XM.Iqrj&iW&rY!'Wgo +!!)LAs8N&Uli6Yua8c2?!'Cem!!)+JqtpEnqYg:O5QCcq!'HKr!!2!Yo7(u]s(cQKj8]/[!.>"N +!!C(<p\4^frVsQ5Du]k<!-ebL!!D-ZoDe9mJ%#+CfDkmO!-eME!!@`Qmsk?ZT'pUd^]4?7!Vh6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t!!!,rz!'gM`s8W-!s8RU5!!!#oz!&jlWs8W-!s8S;[!!!/sz!!$C+ +s8W-!s8V]hJ,fhaz!!!!`s8W-!s8W,u:]L[Oz!!!!0s8W-!s8W,rs.BJhz!!!!#s8W-!s8W-! +s8W,oTE"rlz5QCc`s8W-!h>Vm8huE`Wz!WW3"s8W,ts7^m@huE`Wz!<<)^s8W-!s8Vcm^]4?7 +z!<<*!s8K`^s8U";ci=%Gz!<<&us8A#YDsd<"J,fQLz!.k1Ls2YHFkPt#OJ,fQLz!!*%'^\@p2 +cb7*oJ,fQLz!!#6rs3LlJci6fA~> +end +grestore +showpage +%%Trailer +%%Pages: 1 +%%EOF diff --git a/tiff/test/refs/o-tiff2ps-PS3.ps b/tiff/test/refs/o-tiff2ps-PS3.ps new file mode 100644 index 00000000..6ec22b9b --- /dev/null +++ b/tiff/test/refs/o-tiff2ps-PS3.ps @@ -0,0 +1,104 @@ +%!PS-Adobe-3.0 +%%Creator: tiff2ps +%%Title: miniswhite-1c-1b.tiff +%%CreationDate: Tue Apr 2 16:33:00 2019 +%%DocumentData: Clean7Bit +%%Origin: 0 0 +%%BoundingBox: 0 0 157 151 +%%LanguageLevel: 3 +%%Pages: (atend) +%%EndComments +%%BeginSetup +gsave newpath clippath pathbbox grestore + 4 2 roll 2 copy translate + exch 3 1 roll sub 3 1 roll sub exch + currentpagedevice /PageSize get aload pop + exch 3 1 roll div 3 1 roll div abs exch abs + 2 copy gt { exch } if pop + dup 1 lt { dup scale } { pop } ifelse +%%EndSetup +%%Page: 1 1 +%%PageOrientation: Landscape +%%PageBoundingBox: 0 0 157 151 +1 dict begin /PageSize [ 157.000000 151.000000 ] def currentdict end setpagedevice +<< + /Policies << + /PageSize 3 + >> +>> setpagedevice +gsave +100 dict begin +157.000000 151.000000 scale +% PostScript Level 2 only. +/DeviceGray setcolorspace +{ % exec + /im_stream currentfile /ASCII85Decode filter def + << + /ImageType 1 + /Width 157 + /Height 151 + /ImageMatrix [ 157 0 0 -151 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8W'`!!*'![=;5Kerg"LrVuoms8W$?!!*'!mV]LHh+4ILs8W,o^]49u!!*'!n,$-eWegj+ +s8W,oJ`$5&!!*'!r-lA`ok7/ls8W,oM5U-%!!*'!q<h0^Xq?CAs8W,o!+#@2!!3-"s)kKJo;[l_ +s8W,o!&jTP!!3-"rI2I>qj84]s8W,o!/pZG!!3-"rn15Rs._h$s8W,o!#P2+!!E9$s*gtTs6("Y +s8W,o!!2kf!!E9$rEE:"rmo0*s8W,o!!D`k!!E9$s85cus4&lNs8W,o!!;:*!!E9$s'M=(s7h+o +VuQel!!Von!!E9$s*H(os6>L@&-)\)!!2m\!!E9$s5'6Ks,o,8_#OH0!!E$^!"],0s.ADfs6;!2 +!3cFt!"\c?!"],0s8Tf_s8%fU!)7t<!$D,h!$D7@s$'ljs8B_-!!.TE!"](i!$D7@s6oses8Rc/ +!!",9z!$D7@s8W-!s8RUt!!!,rz!'gM`s8W-!s8RU5!!!#oz!&jlWs8W-!s8S;[!!!/sz!!$C+ +s8W-!s8V]hJ,fhaz!!!!`s8W-!s8W,u:]L[Oz!!!!0s8W-!s8W,rs.BJhz!!!!#s8W-!s8W-! +s8W,oTE"rlz5QCc`s8W-!h>Vm8huE`Wz!WW3"s8W,ts7^m@huE`Wz!<<)^s8W-!s8Vcm^]4?7 +z!<<*!s8K`^s8U";ci=%Gz!<<&us8A#YDsd<"J,fQLz!.k1Ls2YHFkPt#OJ,fQLz!!*%'^\@p2 +cb7*oJ,fQLz!!#6rs3LlJci6fA~> +end +grestore +showpage +%%Trailer +%%Pages: 1 +%%EOF diff --git a/tiff/test/rewrite_tag.c b/tiff/test/rewrite_tag.c index 5db3e4ba..1708b024 100644 --- a/tiff/test/rewrite_tag.c +++ b/tiff/test/rewrite_tag.c @@ -1,5 +1,3 @@ -/* $Id: rewrite_tag.c,v 1.9 2015-08-23 14:23:00 bfriesen Exp $ */ - /* * Copyright (c) 2007, Frank Warmerdam <warmerdam@pobox.com> * @@ -32,6 +30,7 @@ #include "tif_config.h" #include <stdio.h> +#include <stdlib.h> #ifdef HAVE_UNISTD_H # include <unistd.h> @@ -40,7 +39,6 @@ #include "tiffio.h" #include "tiffiop.h" -const uint32 width = 10; const uint32 length = 40; const uint32 rows_per_strip = 1; @@ -51,6 +49,7 @@ int test_packbits() int i; unsigned char buf[10] = {0,0,0,0,0,0,0,0,0,0}; + uint32 width = 10; int length = 20; const char *filename = "test_packbits.tif"; @@ -138,17 +137,20 @@ int test_packbits() /************************************************************************/ /* rewrite_test() */ /************************************************************************/ -int rewrite_test( const char *filename, int length, int bigtiff, +int rewrite_test( const char *filename, uint32 width, int length, int bigtiff, uint64 base_value ) { TIFF *tif; int i; - unsigned char buf[10] = {5,6,7,8,9,10,11,12,13,14}; + unsigned char *buf; uint64 *rowoffset, *rowbytes; uint64 *upd_rowoffset; uint64 *upd_bytecount; + buf = calloc(1, width); + assert(buf); + /* Test whether we can write tags. */ if( bigtiff ) tif = TIFFOpen(filename, "w8"); @@ -157,6 +159,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, if (!tif) { fprintf (stderr, "Can't create test TIFF file %s.\n", filename); + free(buf); return 1; } @@ -204,6 +207,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, tif = TIFFOpen(filename, "r+"); if (!tif) { fprintf (stderr, "Can't open test TIFF file %s.\n", filename); + free(buf); return 1; } @@ -221,7 +225,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, upd_rowoffset = (uint64 *) _TIFFmalloc(sizeof(uint64) * length); for( i = 0; i < length; i++ ) - upd_rowoffset[i] = base_value + i*10; + upd_rowoffset[i] = base_value + i*width; if( !_TIFFRewriteField( tif, TIFFTAG_STRIPOFFSETS, TIFF_LONG8, length, upd_rowoffset ) ) @@ -234,7 +238,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, upd_bytecount = (uint64 *) _TIFFmalloc(sizeof(uint64) * length); for( i = 0; i < length; i++ ) - upd_bytecount[i] = 100 + i*10; + upd_bytecount[i] = 100 + i*width; if( !_TIFFRewriteField( tif, TIFFTAG_STRIPBYTECOUNTS, TIFF_LONG8, length, upd_bytecount ) ) @@ -252,6 +256,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, tif = TIFFOpen(filename, "r"); if (!tif) { fprintf (stderr, "Can't open test TIFF file %s.\n", filename); + free(buf); return 1; } @@ -263,7 +268,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, for( i = 0; i < length; i++ ) { - uint64 expect = base_value + i*10; + uint64 expect = base_value + i*width; if( rowoffset[i] != expect ) { @@ -286,7 +291,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, for( i = 0; i < length; i++ ) { - uint64 expect = 100 + i*10; + uint64 expect = 100 + i*width; if( rowbytes[i] != expect ) { @@ -302,6 +307,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, } TIFFClose( tif ); + free(buf); /* All tests passed; delete file and exit with success status. */ unlink(filename); @@ -310,6 +316,7 @@ int rewrite_test( const char *filename, int length, int bigtiff, failure: /* Something goes wrong; close file and return unsuccessful status. */ TIFFClose(tif); + free(buf); /* unlink(filename); */ return 1; @@ -327,16 +334,20 @@ main(void) failure |= test_packbits(); /* test fairly normal use */ - failure |= rewrite_test( "rewrite1.tif", 10, 0, 100 ); - failure |= rewrite_test( "rewrite2.tif", 10, 1, 100 ); + failure |= rewrite_test( "rewrite1.tif", 10, 10, 0, 100 ); + failure |= rewrite_test( "rewrite2.tif", 10, 10, 1, 100 ); /* test case of fitting all in directory entry */ - failure |= rewrite_test( "rewrite3.tif", 1, 0, 100 ); - failure |= rewrite_test( "rewrite4.tif", 1, 1, 100 ); + failure |= rewrite_test( "rewrite3.tif", 10, 1, 0, 100 ); + failure |= rewrite_test( "rewrite4.tif", 10, 1, 1, 100 ); /* test with very large values that don't fit in 4bytes (bigtiff only) */ - failure |= rewrite_test( "rewrite5.tif", 1000, 1, 0x6000000000ULL ); - failure |= rewrite_test( "rewrite6.tif", 1, 1, 0x6000000000ULL ); + failure |= rewrite_test( "rewrite5.tif", 10, 1000, 1, 0x6000000000ULL ); + failure |= rewrite_test( "rewrite6.tif", 10, 1, 1, 0x6000000000ULL ); + + /* StripByteCounts on LONG */ + failure |= rewrite_test( "rewrite7.tif", 65536, 1, 0, 100 ); + failure |= rewrite_test( "rewrite8.tif", 65536, 2, 0, 100 ); return failure; } diff --git a/tiff/test/short_tag.c b/tiff/test/short_tag.c index efc7da5b..75e7f5d5 100644 --- a/tiff/test/short_tag.c +++ b/tiff/test/short_tag.c @@ -1,5 +1,3 @@ -/* $Id: short_tag.c,v 1.9 2013-12-17 14:41:58 bfriesen Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/strip.c b/tiff/test/strip.c index 59422262..f2cb7735 100644 --- a/tiff/test/strip.c +++ b/tiff/test/strip.c @@ -1,5 +1,3 @@ -/* $Id: strip.c,v 1.5 2013-12-17 14:41:58 bfriesen Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/strip_rw.c b/tiff/test/strip_rw.c index 5247c0b3..bcf7d735 100644 --- a/tiff/test/strip_rw.c +++ b/tiff/test/strip_rw.c @@ -1,5 +1,3 @@ -/* $Id: strip_rw.c,v 1.6 2008/03/28 01:42:07 bfriesen Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/test_arrays.c b/tiff/test/test_arrays.c index 83767662..226e9d0c 100644 --- a/tiff/test/test_arrays.c +++ b/tiff/test/test_arrays.c @@ -1,5 +1,3 @@ -/* $Id: test_arrays.c,v 1.3 2006/03/23 14:54:02 dron Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/test_arrays.h b/tiff/test/test_arrays.h index 5131b231..62e1d33c 100644 --- a/tiff/test/test_arrays.h +++ b/tiff/test/test_arrays.h @@ -1,5 +1,3 @@ -/* $Id: test_arrays.h,v 1.3 2006/03/23 14:54:02 dron Exp $ */ - /* * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> * diff --git a/tiff/test/testtypes.c b/tiff/test/testtypes.c new file mode 100644 index 00000000..a36d21e5 --- /dev/null +++ b/tiff/test/testtypes.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019, Thomas Bernard <miniupnp@free.fr> + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* + * TIFF Library + * + * Module to test ASCII tags read/write functions. + */ + +#include "tif_config.h" + +#include <stdio.h> + +#include "tiffio.h" + +#define CHECK_TYPE(t, s) \ + if (sizeof(t) != s) { \ + fprintf(stderr, "sizeof(" # t ")=%d, it should be %d\n", (int)sizeof(t), (int)s); \ + return 1; \ + } + +int +main() +{ + CHECK_TYPE(TIFF_INT8_T, 1) + CHECK_TYPE(TIFF_INT16_T, 2) + CHECK_TYPE(TIFF_INT32_T, 4) + CHECK_TYPE(TIFF_INT64_T, 8) + CHECK_TYPE(TIFF_UINT8_T, 1) + CHECK_TYPE(TIFF_UINT16_T, 2) + CHECK_TYPE(TIFF_UINT32_T, 4) + CHECK_TYPE(TIFF_UINT64_T, 8) + CHECK_TYPE(TIFF_SIZE_T, sizeof(size_t)) + CHECK_TYPE(TIFF_SSIZE_T, sizeof(size_t)) + return 0; +} + +/* vim: set ts=8 sts=8 sw=8 noet: */ diff --git a/tiff/test/tiff2ps-EPS1.sh b/tiff/test/tiff2ps-EPS1.sh index ebe6f04b..b1dc82e7 100755 --- a/tiff/test/tiff2ps-EPS1.sh +++ b/tiff/test/tiff2ps-EPS1.sh @@ -2,5 +2,7 @@ # # Basic sanity check for tiffps with PostScript Level 1 encapsulated output # +PSFILE=o-tiff2ps-EPS1.ps . ${srcdir:-.}/common.sh -f_test_stdout "${TIFF2PS} -e -1" "${IMG_MINISWHITE_1C_1B}" "o-tiff2ps-EPS1.ps"
\ No newline at end of file +f_test_stdout "${TIFF2PS} -e -1" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}" +diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 1 diff --git a/tiff/test/tiff2ps-PS1.sh b/tiff/test/tiff2ps-PS1.sh index 65921597..73171b98 100755 --- a/tiff/test/tiff2ps-PS1.sh +++ b/tiff/test/tiff2ps-PS1.sh @@ -2,5 +2,7 @@ # # Basic sanity check for tiffps with PostScript Level 1 output # +PSFILE="o-tiff2ps-PS1.ps" . ${srcdir:-.}/common.sh -f_test_stdout "${TIFF2PS} -a -p -1" "${IMG_MINISWHITE_1C_1B}" "o-tiff2ps-PS1.ps"
\ No newline at end of file +f_test_stdout "${TIFF2PS} -a -p -1" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}" +diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 1 diff --git a/tiff/test/tiff2ps-PS2.sh b/tiff/test/tiff2ps-PS2.sh index 2a216069..9d3a521d 100755 --- a/tiff/test/tiff2ps-PS2.sh +++ b/tiff/test/tiff2ps-PS2.sh @@ -2,5 +2,7 @@ # # Basic sanity check for tiffps with PostScript Level 2 output # +PSFILE=o-tiff2ps-PS2.ps . ${srcdir:-.}/common.sh -f_test_stdout "${TIFF2PS} -a -p -2" "${IMG_MINISWHITE_1C_1B}" "o-tiff2ps-PS2.ps"
\ No newline at end of file +f_test_stdout "${TIFF2PS} -a -p -2" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}" +diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 1 diff --git a/tiff/test/tiff2ps-PS3.sh b/tiff/test/tiff2ps-PS3.sh index f9f34b66..eb55b9a0 100755 --- a/tiff/test/tiff2ps-PS3.sh +++ b/tiff/test/tiff2ps-PS3.sh @@ -2,5 +2,7 @@ # # Basic sanity check for tiffps with PostScript Level 3 output # +PSFILE=o-tiff2ps-PS3.ps . ${srcdir:-.}/common.sh -f_test_stdout "${TIFF2PS} -a -p -3" "${IMG_MINISWHITE_1C_1B}" "o-tiff2ps-PS3.ps"
\ No newline at end of file +f_test_stdout "${TIFF2PS} -a -p -3" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}" +diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 1 diff --git a/tiff/test/tiffcp-lzw-scanline-decode.sh b/tiff/test/tiffcp-lzw-scanline-decode.sh new file mode 100755 index 00000000..11654d19 --- /dev/null +++ b/tiff/test/tiffcp-lzw-scanline-decode.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# +# Basic sanity check for tiffcp with LZW decompression +# +. ${srcdir:-.}/common.sh +f_test_convert "${TIFFCP} -c none -r 1" "${IMG_LZW_SINGLE_STROP}" "o-tiffcp-lzw-scanline-decode.tiff"
\ No newline at end of file diff --git a/tiff/test/tifftest.h b/tiff/test/tifftest.h index 33052064..391b0f64 100644 --- a/tiff/test/tifftest.h +++ b/tiff/test/tifftest.h @@ -1,5 +1,3 @@ -/* $Id: tifftest.h,v 1.1 2008/04/15 14:18:36 dron Exp $ */ - /* * Copyright (c) 2008, Andrey Kiselev <dron@ak4719.spb.edu> * |