summaryrefslogtreecommitdiff
path: root/graphics/tiff
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/tiff')
-rw-r--r--graphics/tiff/INSTALL.OpenWindows25
-rw-r--r--graphics/tiff/Makefile61
-rw-r--r--graphics/tiff/PLIST244
-rw-r--r--graphics/tiff/buildlink3.mk4
-rw-r--r--graphics/tiff/distinfo39
-rw-r--r--graphics/tiff/files/config.site29
-rw-r--r--graphics/tiff/patches/patch-aa56
-rw-r--r--graphics/tiff/patches/patch-ab24
-rw-r--r--graphics/tiff/patches/patch-ac23
-rw-r--r--graphics/tiff/patches/patch-ad101
-rw-r--r--graphics/tiff/patches/patch-ae48
-rw-r--r--graphics/tiff/patches/patch-af31
-rw-r--r--graphics/tiff/patches/patch-ag62
-rw-r--r--graphics/tiff/patches/patch-ah22
-rw-r--r--graphics/tiff/patches/patch-ai16
-rw-r--r--graphics/tiff/patches/patch-aj116
-rw-r--r--graphics/tiff/patches/patch-ak17
-rw-r--r--graphics/tiff/patches/patch-al87
-rw-r--r--graphics/tiff/patches/patch-am76
-rw-r--r--graphics/tiff/patches/patch-an60
-rw-r--r--graphics/tiff/patches/patch-ao311
-rw-r--r--graphics/tiff/patches/patch-ap64
-rw-r--r--graphics/tiff/patches/patch-aq23
-rw-r--r--graphics/tiff/patches/patch-ar55
-rw-r--r--graphics/tiff/patches/patch-as13
-rw-r--r--graphics/tiff/patches/patch-at68
-rw-r--r--graphics/tiff/patches/patch-au107
-rw-r--r--graphics/tiff/patches/patch-av17
-rw-r--r--graphics/tiff/patches/patch-aw100
-rw-r--r--graphics/tiff/patches/patch-ax44
30 files changed, 218 insertions, 1725 deletions
diff --git a/graphics/tiff/INSTALL.OpenWindows b/graphics/tiff/INSTALL.OpenWindows
deleted file mode 100644
index 8efe20d9988..00000000000
--- a/graphics/tiff/INSTALL.OpenWindows
+++ /dev/null
@@ -1,25 +0,0 @@
-# $NetBSD: INSTALL.OpenWindows,v 1.4 2004/01/03 18:33:24 reed Exp $
-
-LIBTIFF="libtiff.so.3 libtiff.so"
-
-case ${STAGE} in
-POST-INSTALL)
- for lib in ${LIBTIFF}; do
- src="${PKG_PREFIX}/lib/${lib}"
- dest="${X11BASE}/lib/${lib}"
- if [ -f ${dest} ]; then
- ${MV} -f ${dest} ${dest}.openwin
- ${LN} -sf ${src} ${dest}
- fi
- done
- ;;
-
-POST-DEINSTALL)
- for lib in ${LIBTIFF}; do
- file="${X11BASE}/lib/${lib}"
- if [ -f ${file}.openwin ]; then
- ${MV} -f ${file}.openwin ${file}
- fi
- done
- ;;
-esac
diff --git a/graphics/tiff/Makefile b/graphics/tiff/Makefile
index bfea8bc79f0..bf57bccd90b 100644
--- a/graphics/tiff/Makefile
+++ b/graphics/tiff/Makefile
@@ -1,17 +1,9 @@
-# $NetBSD: Makefile,v 1.60 2004/12/22 03:57:15 reed Exp $
+# $NetBSD: Makefile,v 1.61 2004/12/28 23:10:10 reed Exp $
-DISTNAME= tiff-v3.6.1
-PKGNAME= ${DISTNAME:S/-v/-/}
-PKGREVISION= 6
+DISTNAME= tiff-3.7.1
CATEGORIES= graphics
-MASTER_SITES= ftp://ftp.remotesensing.org/pub/libtiff/old/ \
- ftp://ftp.fu-berlin.de/unix/graphics/tiff/old/
-DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
-# need DISTFILES above for adding lzw-files to it if USE_GIF is defined
-# in mk.conf
-DISTFILES+= TIFFTechNote2.html
-# It is in CVS for Release-v3-6-1, but accidently excluded from distribution.
-SITES_TIFFTechNote2.html= ${MASTER_SITE_LOCAL:=tiff/}
+MASTER_SITES= ftp://ftp.remotesensing.org/pub/libtiff/ \
+ http://libtiff.maptools.org/dl/
MAINTAINER= tech-pkg@NetBSD.org
HOMEPAGE= http://www.remotesensing.org/libtiff/
@@ -19,56 +11,23 @@ COMMENT= Library and tools for reading and writing TIFF data files
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
-# use DIST_SUBDIR because TIFFTechNote2.html could be changed later
-DIST_SUBDIR= ${PKGNAME_NOREV}
-
BUILD_DEFS+= USE_GIF
PKG_INSTALLATION_TYPES= overwrite pkgviews
USE_BUILDLINK3= yes
USE_LIBTOOL= yes
-HAS_CONFIGURE= yes
-CONFIGURE_ARGS= --noninteractive --site=${FILESDIR} --prefix=${PREFIX}
-MAKE_ENV+= PKGDIRMODE=${PKGDIRMODE}
-
-.include "../../mk/bsd.prefs.mk"
+GNU_CONFIGURE= yes
-.if !empty(X11BASE:M*openwin)
-USE_PKGINSTALL= yes
-DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/INSTALL.OpenWindows
-INSTALL_EXTRA_TMPL+= ${.CURDIR}/INSTALL.OpenWindows
-.endif
+CONFIGURE_ARGS+= --enable-rpath
-post-extract:
- ${CP} ${DISTDIR}/${DIST_SUBDIR}/TIFFTechNote2.html ${WRKSRC}/html/
+.include "../../mk/bsd.prefs.mk"
-.if defined(USE_GIF)
-LZW_VERSION= 1.5
-DISTFILES+= libtiff-lzw-compression-kit-${LZW_VERSION}.tar.gz
-EXTRACT_ONLY+= libtiff-lzw-compression-kit-${LZW_VERSION}.tar.gz
-LZWWRKDIR= ${WRKDIR}/libtiff-lzw-compression-kit-${LZW_VERSION}
-pre-patch:
- ${CP} ${LZWWRKDIR}/tif_lzw.c ${WRKSRC}/libtiff
+.if !defined(USE_GIF) || !empty(USE_GIF:M[Nn][Oo])
+# disable support for LZW algorithm
+CONFIGURE_ARGS+= --disable-lzw
.endif
-CPPFLAGS+= -Dunix
-CONFIGURE_ENV+= PREFIX="${PREFIX}"
-CONFIGURE_ENV+= ENVOPTS="${CFLAGS} ${CPPFLAGS}"
-
-INSTALLATION_DIRS= share/doc/html
-
-# reference correct relative man page when using .so;
-# libtoolize build of TIFF tools
-post-patch:
- ${MV} ${WRKSRC}/man/Makefile.in ${WRKSRC}/man/Makefile.in.in
- ${SED} -e "s,\$${MANDIR}\(.*\)\.\([0-9]\).,${PREFIX}/man/man\2/\1.\2,g" \
- -e "s,\$${MANDIR}\(.*\)\.\([0-9]\),${PREFIX}/man/man\2/\1.\2,g" \
- ${WRKSRC}/man/Makefile.in.in > ${WRKSRC}/man/Makefile.in
- ${MV} ${WRKSRC}/tools/Makefile.in ${WRKSRC}/tools/Makefile.in.in
- ${SED} -e "s,\(\$${CC} -o\),\$${LIBTOOL} \1,g" \
- ${WRKSRC}/tools/Makefile.in.in > ${WRKSRC}/tools/Makefile.in
-
.include "../../devel/zlib/buildlink3.mk"
.include "../../graphics/jpeg/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/graphics/tiff/PLIST b/graphics/tiff/PLIST
index b383b574340..9359ce0b073 100644
--- a/graphics/tiff/PLIST
+++ b/graphics/tiff/PLIST
@@ -1,4 +1,5 @@
-@comment $NetBSD: PLIST,v 1.4 2004/09/22 08:09:38 jlam Exp $
+@comment $NetBSD: PLIST,v 1.5 2004/12/28 23:10:10 reed Exp $
+bin/bmp2tiff
bin/fax2ps
bin/fax2tiff
bin/gif2tiff
@@ -23,8 +24,10 @@ bin/tiffsplit
include/tiff.h
include/tiffconf.h
include/tiffio.h
+include/tiffio.hxx
include/tiffvers.h
lib/libtiff.la
+man/man1/bmp2tiff.1
man/man1/fax2ps.1
man/man1/fax2tiff.1
man/man1/gif2tiff.1
@@ -46,80 +49,30 @@ man/man1/tiffdump.1
man/man1/tiffgt.1
man/man1/tiffinfo.1
man/man1/tiffmedian.1
+man/man1/tiffset.1
man/man1/tiffsplit.1
man/man1/tiffsv.1
-man/man3/TIFFCheckTile.3
-man/man3/TIFFClientOpen.3
man/man3/TIFFClose.3
-man/man3/TIFFComputeStrip.3
-man/man3/TIFFComputeTile.3
-man/man3/TIFFCurrentDirectory.3
-man/man3/TIFFCurrentRow.3
-man/man3/TIFFCurrentStrip.3
-man/man3/TIFFCurrentTile.3
man/man3/TIFFDataWidth.3
-man/man3/TIFFDefaultStripSize.3
-man/man3/TIFFDefaultTileSize.3
man/man3/TIFFError.3
-man/man3/TIFFFdOpen.3
-man/man3/TIFFFileName.3
-man/man3/TIFFFileno.3
-man/man3/TIFFFindCODEC.3
man/man3/TIFFFlush.3
-man/man3/TIFFFlushData.3
man/man3/TIFFGetField.3
-man/man3/TIFFGetFieldDefaulted.3
-man/man3/TIFFGetMode.3
-man/man3/TIFFIsByteSwapped.3
-man/man3/TIFFIsMSB2LSB.3
-man/man3/TIFFIsTiled.3
-man/man3/TIFFIsUpSampled.3
-man/man3/TIFFLastDirectory.3
-man/man3/TIFFNumberOfStrips.3
-man/man3/TIFFNumberOfTiles.3
man/man3/TIFFOpen.3
man/man3/TIFFPrintDirectory.3
man/man3/TIFFRGBAImage.3
-man/man3/TIFFRGBAImageBegin.3
-man/man3/TIFFRGBAImageEnd.3
-man/man3/TIFFRGBAImageGet.3
-man/man3/TIFFRGBAImageOK.3
-man/man3/TIFFReadBufferSetup.3
man/man3/TIFFReadDirectory.3
man/man3/TIFFReadEncodedStrip.3
man/man3/TIFFReadEncodedTile.3
man/man3/TIFFReadRGBAImage.3
-man/man3/TIFFReadRGBAImageOriented.3
man/man3/TIFFReadRGBAStrip.3
man/man3/TIFFReadRGBATile.3
man/man3/TIFFReadRawStrip.3
man/man3/TIFFReadRawTile.3
man/man3/TIFFReadScanline.3
man/man3/TIFFReadTile.3
-man/man3/TIFFRegisterCODEC.3
-man/man3/TIFFReverseBits.3
-man/man3/TIFFRewriteDirectory.3
-man/man3/TIFFScanlineSize.3
man/man3/TIFFSetDirectory.3
-man/man3/TIFFSetErrorHandler.3
man/man3/TIFFSetField.3
-man/man3/TIFFSetSubDirectory.3
-man/man3/TIFFSetWarningHandler.3
-man/man3/TIFFStripSize.3
-man/man3/TIFFSwabArrayOfLong.3
-man/man3/TIFFSwabArrayOfShort.3
-man/man3/TIFFSwabLong.3
-man/man3/TIFFSwabShort.3
-man/man3/TIFFTileRowSize.3
-man/man3/TIFFTileSize.3
-man/man3/TIFFUnRegisterCODEC.3
-man/man3/TIFFVGetField.3
-man/man3/TIFFVGetFieldDefaulted.3
-man/man3/TIFFVSetField.3
-man/man3/TIFFVStripSize.3
-man/man3/TIFFVTileSize.3
man/man3/TIFFWarning.3
-man/man3/TIFFWriteBufferSetup.3
man/man3/TIFFWriteDirectory.3
man/man3/TIFFWriteEncodedStrip.3
man/man3/TIFFWriteEncodedTile.3
@@ -130,68 +83,139 @@ man/man3/TIFFWriteTile.3
man/man3/TIFFbuffer.3
man/man3/TIFFcodec.3
man/man3/TIFFcolor.3
-man/man3/TIFFfree.3
-man/man3/TIFFmalloc.3
-man/man3/TIFFmemcmp.3
-man/man3/TIFFmemcpy.3
man/man3/TIFFmemory.3
-man/man3/TIFFmemset.3
man/man3/TIFFquery.3
-man/man3/TIFFrealloc.3
man/man3/TIFFsize.3
man/man3/TIFFstrip.3
man/man3/TIFFswab.3
man/man3/TIFFtile.3
man/man3/libtiff.3
-share/doc/html/tiff/TIFFTechNote2.html
-share/doc/html/tiff/bugs.html
-share/doc/html/tiff/build.html
-share/doc/html/tiff/contrib.html
-share/doc/html/tiff/document.html
-share/doc/html/tiff/images.html
-share/doc/html/tiff/images/back.gif
-share/doc/html/tiff/images/bali.jpg
-share/doc/html/tiff/images/cat.gif
-share/doc/html/tiff/images/cover.jpg
-share/doc/html/tiff/images/cramps.gif
-share/doc/html/tiff/images/dave.gif
-share/doc/html/tiff/images/info.gif
-share/doc/html/tiff/images/jello.jpg
-share/doc/html/tiff/images/jim.gif
-share/doc/html/tiff/images/note.gif
-share/doc/html/tiff/images/oxford.gif
-share/doc/html/tiff/images/quad.jpg
-share/doc/html/tiff/images/ring.gif
-share/doc/html/tiff/images/smallliz.jpg
-share/doc/html/tiff/images/strike.gif
-share/doc/html/tiff/images/warning.gif
-share/doc/html/tiff/index.html
-share/doc/html/tiff/internals.html
-share/doc/html/tiff/intro.html
-share/doc/html/tiff/libtiff.html
-share/doc/html/tiff/misc.html
-share/doc/html/tiff/support.html
-share/doc/html/tiff/tools.html
-share/doc/html/tiff/v3.4beta007.html
-share/doc/html/tiff/v3.4beta016.html
-share/doc/html/tiff/v3.4beta018.html
-share/doc/html/tiff/v3.4beta024.html
-share/doc/html/tiff/v3.4beta028.html
-share/doc/html/tiff/v3.4beta029.html
-share/doc/html/tiff/v3.4beta031.html
-share/doc/html/tiff/v3.4beta032.html
-share/doc/html/tiff/v3.4beta033.html
-share/doc/html/tiff/v3.4beta034.html
-share/doc/html/tiff/v3.4beta035.html
-share/doc/html/tiff/v3.4beta036.html
-share/doc/html/tiff/v3.5.1.html
-share/doc/html/tiff/v3.5.2.html
-share/doc/html/tiff/v3.5.3.html
-share/doc/html/tiff/v3.5.4.html
-share/doc/html/tiff/v3.5.5.html
-share/doc/html/tiff/v3.5.6-beta.html
-share/doc/html/tiff/v3.5.7.html
-share/doc/html/tiff/v3.6.0.html
-share/doc/html/tiff/v${PKGVERSION}.html
-@dirrm share/doc/html/tiff/images
-@dirrm share/doc/html/tiff
+share/doc/tiff/COPYRIGHT
+share/doc/tiff/ChangeLog
+share/doc/tiff/README
+share/doc/tiff/RELEASE-DATE
+share/doc/tiff/TODO
+share/doc/tiff/VERSION
+share/doc/tiff/html/TIFFTechNote2.html
+share/doc/tiff/html/addingtags.html
+share/doc/tiff/html/bugs.html
+share/doc/tiff/html/build.html
+share/doc/tiff/html/contrib.html
+share/doc/tiff/html/document.html
+share/doc/tiff/html/images.html
+share/doc/tiff/html/images/back.gif
+share/doc/tiff/html/images/bali.jpg
+share/doc/tiff/html/images/cat.gif
+share/doc/tiff/html/images/cover.jpg
+share/doc/tiff/html/images/cramps.gif
+share/doc/tiff/html/images/dave.gif
+share/doc/tiff/html/images/info.gif
+share/doc/tiff/html/images/jello.jpg
+share/doc/tiff/html/images/jim.gif
+share/doc/tiff/html/images/note.gif
+share/doc/tiff/html/images/oxford.gif
+share/doc/tiff/html/images/quad.jpg
+share/doc/tiff/html/images/ring.gif
+share/doc/tiff/html/images/smallliz.jpg
+share/doc/tiff/html/images/strike.gif
+share/doc/tiff/html/images/warning.gif
+share/doc/tiff/html/index.html
+share/doc/tiff/html/internals.html
+share/doc/tiff/html/intro.html
+share/doc/tiff/html/libtiff.html
+share/doc/tiff/html/man/TIFFClose.3t.html
+share/doc/tiff/html/man/TIFFDataWidth.3t.html
+share/doc/tiff/html/man/TIFFError.3t.html
+share/doc/tiff/html/man/TIFFFlush.3t.html
+share/doc/tiff/html/man/TIFFGetField.3t.html
+share/doc/tiff/html/man/TIFFOpen.3t.html
+share/doc/tiff/html/man/TIFFPrintDirectory.3t.html
+share/doc/tiff/html/man/TIFFRGBAImage.3t.html
+share/doc/tiff/html/man/TIFFReadDirectory.3t.html
+share/doc/tiff/html/man/TIFFReadEncodedStrip.3t.html
+share/doc/tiff/html/man/TIFFReadEncodedTile.3t.html
+share/doc/tiff/html/man/TIFFReadRGBAImage.3t.html
+share/doc/tiff/html/man/TIFFReadRGBAStrip.3t.html
+share/doc/tiff/html/man/TIFFReadRGBATile.3t.html
+share/doc/tiff/html/man/TIFFReadRawStrip.3t.html
+share/doc/tiff/html/man/TIFFReadRawTile.3t.html
+share/doc/tiff/html/man/TIFFReadScanline.3t.html
+share/doc/tiff/html/man/TIFFReadTile.3t.html
+share/doc/tiff/html/man/TIFFSetDirectory.3t.html
+share/doc/tiff/html/man/TIFFSetField.3t.html
+share/doc/tiff/html/man/TIFFWarning.3t.html
+share/doc/tiff/html/man/TIFFWriteDirectory.3t.html
+share/doc/tiff/html/man/TIFFWriteEncodedStrip.3t.html
+share/doc/tiff/html/man/TIFFWriteEncodedTile.3t.html
+share/doc/tiff/html/man/TIFFWriteRawStrip.3t.html
+share/doc/tiff/html/man/TIFFWriteRawTile.3t.html
+share/doc/tiff/html/man/TIFFWriteScanline.3t.html
+share/doc/tiff/html/man/TIFFWriteTile.3t.html
+share/doc/tiff/html/man/TIFFbuffer.3t.html
+share/doc/tiff/html/man/TIFFcodec.3t.html
+share/doc/tiff/html/man/TIFFcolor.3t.html
+share/doc/tiff/html/man/TIFFmemory.3t.html
+share/doc/tiff/html/man/TIFFquery.3t.html
+share/doc/tiff/html/man/TIFFsize.3t.html
+share/doc/tiff/html/man/TIFFstrip.3t.html
+share/doc/tiff/html/man/TIFFswab.3t.html
+share/doc/tiff/html/man/TIFFtile.3t.html
+share/doc/tiff/html/man/fax2ps.1.html
+share/doc/tiff/html/man/fax2tiff.1.html
+share/doc/tiff/html/man/gif2tiff.1.html
+share/doc/tiff/html/man/index.html
+share/doc/tiff/html/man/libtiff.3t.html
+share/doc/tiff/html/man/pal2rgb.1.html
+share/doc/tiff/html/man/ppm2tiff.1.html
+share/doc/tiff/html/man/ras2tiff.1.html
+share/doc/tiff/html/man/raw2tiff.1.html
+share/doc/tiff/html/man/rgb2ycbcr.1.html
+share/doc/tiff/html/man/sgi2tiff.1.html
+share/doc/tiff/html/man/thumbnail.1.html
+share/doc/tiff/html/man/tiff2bw.1.html
+share/doc/tiff/html/man/tiff2pdf.1.html
+share/doc/tiff/html/man/tiff2ps.1.html
+share/doc/tiff/html/man/tiff2rgba.1.html
+share/doc/tiff/html/man/tiffcmp.1.html
+share/doc/tiff/html/man/tiffcp.1.html
+share/doc/tiff/html/man/tiffdither.1.html
+share/doc/tiff/html/man/tiffdump.1.html
+share/doc/tiff/html/man/tiffgt.1.html
+share/doc/tiff/html/man/tiffinfo.1.html
+share/doc/tiff/html/man/tiffmedian.1.html
+share/doc/tiff/html/man/tiffset.1.html
+share/doc/tiff/html/man/tiffsplit.1.html
+share/doc/tiff/html/man/tiffsv.1.html
+share/doc/tiff/html/misc.html
+share/doc/tiff/html/support.html
+share/doc/tiff/html/tools.html
+share/doc/tiff/html/v3.4beta007.html
+share/doc/tiff/html/v3.4beta016.html
+share/doc/tiff/html/v3.4beta018.html
+share/doc/tiff/html/v3.4beta024.html
+share/doc/tiff/html/v3.4beta028.html
+share/doc/tiff/html/v3.4beta029.html
+share/doc/tiff/html/v3.4beta031.html
+share/doc/tiff/html/v3.4beta032.html
+share/doc/tiff/html/v3.4beta033.html
+share/doc/tiff/html/v3.4beta034.html
+share/doc/tiff/html/v3.4beta035.html
+share/doc/tiff/html/v3.4beta036.html
+share/doc/tiff/html/v3.5.1.html
+share/doc/tiff/html/v3.5.2.html
+share/doc/tiff/html/v3.5.3.html
+share/doc/tiff/html/v3.5.4.html
+share/doc/tiff/html/v3.5.5.html
+share/doc/tiff/html/v3.5.6-beta.html
+share/doc/tiff/html/v3.5.7.html
+share/doc/tiff/html/v3.6.0.html
+share/doc/tiff/html/v3.6.1.html
+share/doc/tiff/html/v3.7.0.html
+share/doc/tiff/html/v3.7.0alpha.html
+share/doc/tiff/html/v3.7.0beta.html
+share/doc/tiff/html/v3.7.0beta2.html
+share/doc/tiff/html/v${PKGVERSION}.html
+@dirrm share/doc/tiff/html/man
+@dirrm share/doc/tiff/html/images
+@dirrm share/doc/tiff/html
+@dirrm share/doc/tiff
diff --git a/graphics/tiff/buildlink3.mk b/graphics/tiff/buildlink3.mk
index 43499428038..0c08127121e 100644
--- a/graphics/tiff/buildlink3.mk
+++ b/graphics/tiff/buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.9 2004/12/22 03:57:15 reed Exp $
+# $NetBSD: buildlink3.mk,v 1.10 2004/12/28 23:10:10 reed Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
@@ -12,7 +12,7 @@ BUILDLINK_PACKAGES+= tiff
.if !empty(TIFF_BUILDLINK3_MK:M+)
BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
-BUILDLINK_RECOMMENDED.tiff+= tiff>=3.6.1nb6
+BUILDLINK_RECOMMENDED.tiff+= tiff>=3.7.0
BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
.endif # TIFF_BUILDLINK3_MK
diff --git a/graphics/tiff/distinfo b/graphics/tiff/distinfo
index c7f6d19973c..3eb63e9beee 100644
--- a/graphics/tiff/distinfo
+++ b/graphics/tiff/distinfo
@@ -1,32 +1,9 @@
-$NetBSD: distinfo,v 1.19 2004/12/22 03:57:15 reed Exp $
+$NetBSD: distinfo,v 1.20 2004/12/28 23:10:10 reed Exp $
-SHA1 (tiff-3.6.1/tiff-v3.6.1.tar.gz) = f7817145d8756152cc341804df6477f37ef93c38
-Size (tiff-3.6.1/tiff-v3.6.1.tar.gz) = 1072165 bytes
-SHA1 (tiff-3.6.1/TIFFTechNote2.html) = bf202e0ded764f0f6b9cda673245dea4ebfaf73f
-Size (tiff-3.6.1/TIFFTechNote2.html) = 35698 bytes
-SHA1 (tiff-3.6.1/libtiff-lzw-compression-kit-1.5.tar.gz) = 97d103ca8595cf6759fc6c52f4199be4b02b95b0
-Size (tiff-3.6.1/libtiff-lzw-compression-kit-1.5.tar.gz) = 9646 bytes
-SHA1 (patch-aa) = b3f0850bd47805f54e44e8160baf237fd511e0a5
-SHA1 (patch-ab) = 186b597cb44768570d844d55a4f4358a89974633
-SHA1 (patch-ac) = 754a02bb0561f8944fa1c870ab8dd6c1d6bf0c49
-SHA1 (patch-ad) = b48c93d29d5ff39079b6d320c5e67d9c1cdde8c7
-SHA1 (patch-ae) = 8272e39a8a0324b0f8a1e661721b5c9367c0d8e7
-SHA1 (patch-af) = d6c9fd4f10c26e6b2ad8eb5ec51e9205504b62c7
-SHA1 (patch-ag) = 9171499433deebf0b1f271fe5940bfc563446381
-SHA1 (patch-ah) = 44ecf92862dc20cdb5e4b1dd4cdbf7c765dc95e2
-SHA1 (patch-ai) = cab07f23d9ef47008fee393f1d4c2438d0c96124
-SHA1 (patch-aj) = 9ea4c71308e73a20f10befcfabe31ecfce794519
-SHA1 (patch-ak) = f3375d4b1f6a93c0a14c05ba2047ede622ddae9a
-SHA1 (patch-al) = 203c17a448cf61d9b92bf24b93ca87dc8aff2454
-SHA1 (patch-am) = 812da6e94797ae976b86c65888804f470abda7a0
-SHA1 (patch-an) = 22589375f39ec68e848efc3e11fb5142e8247919
-SHA1 (patch-ao) = 2173925f79eba50a822b8914dc8b09f0b0140209
-SHA1 (patch-ap) = 83a15df9ecb4c8c81c808c02ea59f0941c4ba135
-SHA1 (patch-aq) = d9056e59e185bc8a7e6375ba0f9c9ffc6f537344
-SHA1 (patch-ar) = 9ba144120468a1674276dab4fc15ebba54e594fe
-SHA1 (patch-as) = 6f4cb72b8fb2bfd638014cb074f789f93b1d892b
-SHA1 (patch-at) = 306fe455551affe97bb4b5febb4c72cc498528e5
-SHA1 (patch-au) = a80951b097925c25c295abdb4c79fd431c094965
-SHA1 (patch-av) = 6610c19feddf1fe7f2ba4a9ff2bb52383a91ad75
-SHA1 (patch-aw) = 56fe3328e27f11e3f0220a1637d21c7abe0568a0
-SHA1 (patch-ax) = 3beda76b748e62f034b9a554fea95f37137e30fb
+SHA1 (tiff-3.7.1.tar.gz) = 001b03350182869c7f5d46e6b27862b85cb06fc3
+Size (tiff-3.7.1.tar.gz) = 1253810 bytes
+SHA1 (patch-aa) = 995c418791f2c8ce3f634dac117949048955b625
+SHA1 (patch-ab) = 1e6a2dd379e388f11c5a7b1959240fd66d29b88a
+SHA1 (patch-ac) = 40e817380c5183cf2e1e5461c05600073dec7348
+SHA1 (patch-ad) = 301e0ce2c121e9082e0ff9c5681c2ea1e0e6dcff
+SHA1 (patch-ae) = bb2e2d3a5be49204356c3c504d3a4bd5ba1fd9b2
diff --git a/graphics/tiff/files/config.site b/graphics/tiff/files/config.site
deleted file mode 100644
index 8aafed35fa6..00000000000
--- a/graphics/tiff/files/config.site
+++ /dev/null
@@ -1,29 +0,0 @@
-# $NetBSD: config.site,v 1.8 2001/06/18 21:32:24 jlam Exp $
-
-DIR_BIN=${PREFIX}/bin # destination for applications
-DIR_LIB=${PREFIX}/lib # destination for library
-DIR_INC=${PREFIX}/include # destination for include files
-DIR_MAN=${PREFIX}/man # destination for man pages
-DIR_HTML=${PREFIX}/share/doc/html/tiff # destination for html documentation
-DIRS_LIBINC=${BUILDLINK_DIR}/include # dirs to search for ancillary includes
-
-# JPEG support
-#
-JPEG=yes
-DIR_JPEGLIB=${BUILDLINK_DIR}/lib
-LIBJPEG="${LDFLAGS} -ljpeg"
-
-# ZLIB compression support
-#
-ZIP=yes
-DIR_GZLIB=${BUILDLINK_DIR}/lib
-LIBGZ="${LDFLAGS} -lz"
-
-DSO=no # don't use libtiff's shared lib mechanism
-
-INSTALL=
-LIBGL=no # don't build SGI -lgl apps
-LIBIMAGE=no # don't build SGI -limage apps
-HTML=yes # build HTML documentation
-
-MANSCHEME=bsd-source-cat-strip
diff --git a/graphics/tiff/patches/patch-aa b/graphics/tiff/patches/patch-aa
index ffca752bf25..b02bc2363a4 100644
--- a/graphics/tiff/patches/patch-aa
+++ b/graphics/tiff/patches/patch-aa
@@ -1,41 +1,17 @@
-$NetBSD: patch-aa,v 1.14 2004/09/05 16:49:03 jschauma Exp $
+$NetBSD: patch-aa,v 1.15 2004/12/28 23:10:09 reed Exp $
---- configure.orig Mon Apr 12 09:58:40 2004
-+++ configure Mon Apr 12 10:01:34 2004
-@@ -59,7 +59,7 @@
- LIBIMAGE=auto # auto-enable build of SGI -limage apps
- : ${CC=} # name of C compiler to use
- : ${CCOMPILER=} # full pathname of C compiler
--: ${OPTIMIZER=-O} # Optimization flag
-+: ${OPTIMIZER=} # Optimization flag
- : ${ENVOPTS=} # CC opts for ANSI C compilation
- : ${MAKE=make} # make to use
-
-@@ -488,7 +488,7 @@
-
- checkCompiler()
- {
-- compiler=$1
-+ compiler="$*"
- if isGNU $compiler; then
- ISGCC=yes
- else
-@@ -514,7 +514,7 @@
- $RM dummy dummy.o
- capture $compiler -o dummy ${C_ANSI} dummy.c && {
- CC=$compiler;
-- test -z "${CCOMPILER-}" && CCOMPILER=`findApp $compiler $PATH`
-+ test -z "${CCOMPILER-}" && CCOMPILER=$compiler
- test -z "${ENVOPTS-}" && ENVOPTS="${C_ANSI-}"
- return 0
- }
-@@ -1743,6 +1743,9 @@
- -[LR]/*) echo "$i" ;;
- -L*) echo "$i" | sed 's;^-L;-L../;' ;;
- -R*) echo "$i" | sed 's;^-R;-R../;' ;;
-+ -rpath*) echo "$i" ;;
-+ -W*) echo "$i" ;;
-+ -*) echo "$i" ;;
- *) echo "../$i" ;;
- esac
- done) | tr '\012' ' '
+--- man/Makefile.in.orig Mon Dec 20 11:41:54 2004
++++ man/Makefile.in
+@@ -373,11 +373,7 @@ install-man3: $(man3_MANS) $(man_MANS)
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+- ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+- case "$$ext" in \
+- 3*) ;; \
+- *) ext='3' ;; \
+- esac; \
++ ext='3'; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
diff --git a/graphics/tiff/patches/patch-ab b/graphics/tiff/patches/patch-ab
index 4a373f093b1..eae035c5722 100644
--- a/graphics/tiff/patches/patch-ab
+++ b/graphics/tiff/patches/patch-ab
@@ -1,13 +1,13 @@
-$NetBSD: patch-ab,v 1.13 2004/01/03 18:33:24 reed Exp $
+$NetBSD: patch-ab,v 1.14 2004/12/28 23:10:10 reed Exp $
---- libtiff/tiff.h.orig Mon Oct 7 11:50:46 2002
-+++ libtiff/tiff.h
-@@ -79,7 +79,7 @@ typedef char int8;
- typedef unsigned char uint8;
- typedef short int16;
- typedef unsigned short uint16; /* sizeof (uint16) must == 2 */
--#if defined(__alpha) || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) || defined(__LP64__) || defined(__arch64__)
-+#if defined(__alpha) || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) || defined(__LP64__) || defined(__arch64__) || defined(_LP64)
- typedef int int32;
- typedef unsigned int uint32; /* sizeof (uint32) must == 4 */
- #else
+--- html/Makefile.in.orig 2004-12-20 11:41:54.000000000 -0800
++++ html/Makefile.in
+@@ -224,7 +224,7 @@ target_alias = @target_alias@
+ target_cpu = @target_cpu@
+ target_os = @target_os@
+ target_vendor = @target_vendor@
+-docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)/html
++docdir = $(prefix)/share/doc/$(PACKAGE)/html
+ docfiles = \
+ addingtags.html \
+ bugs.html \
diff --git a/graphics/tiff/patches/patch-ac b/graphics/tiff/patches/patch-ac
index 4f82f08ef2d..17fa5e29ad6 100644
--- a/graphics/tiff/patches/patch-ac
+++ b/graphics/tiff/patches/patch-ac
@@ -1,12 +1,13 @@
-$NetBSD: patch-ac,v 1.13 2002/03/05 10:33:36 martti Exp $
+$NetBSD: patch-ac,v 1.14 2004/12/28 23:10:10 reed Exp $
---- html/index.html.orig Fri Nov 23 16:56:18 2001
-+++ html/index.html Mon Mar 4 16:03:43 2002
-@@ -77,7 +77,6 @@
- <LI><A HREF="bugs.html">Bugs, Bugzilla, and the TIFF mailing list</A>
- <LI><A HREF="images.html">Test images</A>
- <LI><A HREF="misc.html">Acknowledgements and copyright issues</A>
--<LI><A HREF="man/index.html">Man Pages</A>
- </UL>
-
- <P>
+--- html/man/Makefile.in.orig Mon Dec 20 11:29:26 2004
++++ html/man/Makefile.in
+@@ -213,7 +213,7 @@ target_alias = @target_alias@
+ target_cpu = @target_cpu@
+ target_os = @target_os@
+ target_vendor = @target_vendor@
+-docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)/html/man
++docdir = $(prefix)/share/doc/$(PACKAGE)/html/man
+ docfiles = \
+ fax2ps.1.html \
+ fax2ps.1.html \
diff --git a/graphics/tiff/patches/patch-ad b/graphics/tiff/patches/patch-ad
index c728cb3af15..5e7e3928351 100644
--- a/graphics/tiff/patches/patch-ad
+++ b/graphics/tiff/patches/patch-ad
@@ -1,90 +1,13 @@
-$NetBSD: patch-ad,v 1.11 2004/04/27 22:38:51 tv Exp $
+$NetBSD: patch-ad,v 1.12 2004/12/28 23:10:10 reed Exp $
---- libtiff/Makefile.in.orig Mon Nov 17 04:24:41 2003
-+++ libtiff/Makefile.in
-@@ -36,12 +36,18 @@ SRCDIR = @LIBSRCDIR@
- SHELL = @SCRIPT_SH@
- SCRIPT_SH = @SCRIPT_SH@
- NULL =
--CC = @CCOMPILER@
-+CCOMPILER = @CCOMPILER@
-+CC = ${LIBTOOL} ${CCOMPILER}
- AR = @AR@
- AROPTS = @AROPTS@
- RANLIB = @RANLIB@
- INSTALL = @INSTALL@
-
-+LIBJPEG = @LIBJPEG@
-+LIBGZ = @LIBGZ@
-+LIBPORT = @LIBPORT@
-+MACHLIBS = @MACHDEPLIBS@
-+
- #
- # If JPEG support is to be included and the Independent JPEG
- # Software distribution is not installed then DIR_JPEG must
-@@ -143,7 +149,7 @@ OBJS = \
- tif_write.o \
- tif_zip.o \
- ${NULL}
--TARGETS = libtiff.a
-+TARGETS = libtiff.la
-
- all: ${TARGETS}
- if [ @DSO@dso != nodso ]; then \
-@@ -152,9 +158,10 @@ all: ${TARGETS}
- true; \
- fi
-
--libtiff.a: ${OBJS}
-- ${AR} ${AROPTS} libtiff.a $?
-- ${RANLIB} libtiff.a
-+libtiff.la: ${OBJS}
-+ ${CC} -o $@ ${OBJS:.o=.lo} -rpath @DIR_LIB@ \
-+ -version-info @DIST_MAJOR@:@DIST_MINOR@ \
-+ ${LIBJPEG} ${LIBGZ} ${LIBPORT} ${MACHLIBS}
-
- #
- # NB: The configure script verifies that the configured
-@@ -294,8 +301,13 @@ tif_dir.o: ${SRCDIR}/tif_dir.c
- ${CC} -c ${CFLAGS} ${SRCDIR}/tif_dir.c
- tif_dirinfo.o: ${SRCDIR}/tif_dirinfo.c
- ${CC} -c ${CFLAGS} ${SRCDIR}/tif_dirinfo.c
-+.if (${MACHINE_ARCH} == "sparc64")
-+tif_dirread.o: ${SRCDIR}/tif_dirread.c
-+ ${CC} -c ${CFLAGS} -O0 ${SRCDIR}/tif_dirread.c
-+.else
- tif_dirread.o: ${SRCDIR}/tif_dirread.c
- ${CC} -c ${CFLAGS} ${SRCDIR}/tif_dirread.c
-+.endif
- tif_dirwrite.o: ${SRCDIR}/tif_dirwrite.c
- ${CC} -c ${CFLAGS} ${SRCDIR}/tif_dirwrite.c
- tif_dumpmode.o: ${SRCDIR}/tif_dumpmode.c
-@@ -368,7 +380,7 @@ INCS = ${SRCDIR}/tiff.h ${SRCDIR}/tiffio
- INCS_PRIVATE = ${SRCDIR}/tiffiop.h ${SRCDIR}/tif_dir.h ${SRCDIR}/port.h
-
- installHdrs: ${INCS}
-- ${INSTALL} -idb tiff.sw.dev -m 755 -dir ${DESTDIR}@DIR_INC@
-+ ${INSTALL} -idb tiff.sw.dev -m ${PKGDIRMODE} -dir ${DESTDIR}@DIR_INC@
- for i in ${INCS}; do \
- f=`basename $$i`; \
- ${INSTALL} -idb tiff.sw.dev -m 444 -F ${DESTDIR}@DIR_INC@ \
-@@ -376,7 +388,7 @@ installHdrs: ${INCS}
- done
-
- installPrivateHdrs: ${INCS_PRIVATE}
-- ${INSTALL} -idb tiff.sw.dev -m 755 -dir ${DESTDIR}@DIR_INC@
-+ ${INSTALL} -idb tiff.sw.dev -m ${PKGDIRMODE} -dir ${DESTDIR}@DIR_INC@
- for i in ${INCS_PRIVATE}; do \
- f=`basename $$i`; \
- ${INSTALL} -idb tiff.sw.dev -m 444 -F ${DESTDIR}@DIR_INC@ \
-@@ -397,8 +409,8 @@ installDSO: @DSO@dso
- fi
-
- install: all installHdrs
-- ${INSTALL} -idb tiff.sw.dev -m 755 -dir ${DESTDIR}@DIR_LIB@
-- ${INSTALL} -idb tiff.sw.dev -m 444 -F ${DESTDIR}@DIR_LIB@ -O libtiff.a
-+ ${INSTALL} -idb tiff.sw.dev -m ${PKGDIRMODE} -dir ${DESTDIR}@DIR_LIB@
-+ ${LIBTOOL} ${BSD_INSTALL_LIB} libtiff.la @DIR_LIB@
- if [ @DSO@dso != nodso ]; then \
- ${MAKE} -${MAKEFLAGS} installDSO; \
- else \
+--- Makefile.in.orig Mon Dec 20 11:41:46 2004
++++ Makefile.in
+@@ -236,7 +236,7 @@ target_alias = @target_alias@
+ target_cpu = @target_cpu@
+ target_os = @target_os@
+ target_vendor = @target_vendor@
+-docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
++docdir = $(prefix)/share/doc/$(PACKAGE)
+ AUTOMAKE_OPTIONS = dist-zip foreign
+ docfiles = \
+ COPYRIGHT \
diff --git a/graphics/tiff/patches/patch-ae b/graphics/tiff/patches/patch-ae
index 2d36aa8a866..084c0825715 100644
--- a/graphics/tiff/patches/patch-ae
+++ b/graphics/tiff/patches/patch-ae
@@ -1,37 +1,13 @@
-$NetBSD: patch-ae,v 1.8 2004/04/27 20:38:48 tv Exp $
+$NetBSD: patch-ae,v 1.9 2004/12/28 23:10:10 reed Exp $
---- man/Makefile.in.orig Mon Dec 22 03:22:15 2003
-+++ man/Makefile.in
-@@ -363,9 +363,7 @@ apps/Makefile:
- ${ECHO} 'install:'; \
- for i in *.1; do \
- f=${MANAPPNAME}; \
-- ${ECHO} ' cd ..; ${INSTALL} -m 444 \
-- -F $${DESTDIR}${MAN}/${MANAPPS} \
-- -idb tiff.man.tools -src' apps/"$$i" '-O' "$$f"; \
-+ ${ECHO} ' ${BSD_INSTALL_DATA}' $$i ${MAN}/${MANAPPS}/$$f; \
- done \
- )>apps/Makefile
- lib/Makefile:
-@@ -376,17 +374,15 @@ lib/Makefile:
- ${ECHO} 'install:'; \
- for i in *.3t; do \
- f=${MANLIBNAME}; \
-- ${ECHO} ' cd ..; ${INSTALL} -m 444 \
-- -F $${DESTDIR}${MAN}/${MANLIB} \
-- -idb tiff.man.dev -src' lib/"$$i" '-O' "$$f"; \
-+ ${ECHO} ' ${BSD_INSTALL_DATA}' $$i ${MAN}/${MANLIB}/$$f; \
- done \
- )>lib/Makefile
-
- install: all
-- ${INSTALL} -m 755 -dir -idb tiff.man.tools ${DESTDIR}${MAN}
-- ${INSTALL} -m 755 -dir -idb tiff.man.tools ${DESTDIR}${MAN}/${MANAPPS}
-+ ${INSTALL} -m ${PKGDIRMODE} -dir -idb tiff.man.tools ${DESTDIR}${MAN}
-+ ${INSTALL} -m ${PKGDIRMODE} -dir -idb tiff.man.tools ${DESTDIR}${MAN}/${MANAPPS}
- cd apps; ${MAKE} -${MAKEFLAGS} install
-- ${INSTALL} -m 755 -dir -idb tiff.man.dev ${DESTDIR}${MAN}/${MANLIB}
-+ ${INSTALL} -m ${PKGDIRMODE} -dir -idb tiff.man.dev ${DESTDIR}${MAN}/${MANLIB}
- cd lib; ${MAKE} -${MAKEFLAGS} install
-
- clean:
+--- html/images/Makefile.in.orig Mon Dec 20 11:29:26 2004
++++ html/images/Makefile.in
+@@ -213,7 +213,7 @@ target_alias = @target_alias@
+ target_cpu = @target_cpu@
+ target_os = @target_os@
+ target_vendor = @target_vendor@
+-docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)/html/images
++docdir = $(prefix)/share/doc/$(PACKAGE)/html/images
+ docfiles = \
+ back.gif \
+ bali.jpg \
diff --git a/graphics/tiff/patches/patch-af b/graphics/tiff/patches/patch-af
deleted file mode 100644
index 3208798d5bf..00000000000
--- a/graphics/tiff/patches/patch-af
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-af,v 1.8 2004/04/27 20:38:48 tv Exp $
-
---- tools/Makefile.in.orig Thu Nov 27 10:08:12 2003
-+++ tools/Makefile.in
-@@ -48,10 +48,10 @@ OPTIMIZER=@OPTIMIZER@
- IPATH = -I. -I${SRCDIR} -I${LIBDIR}
- CFLAGS = @ENVOPTS@ ${COPTS} ${OPTIMIZER} ${IPATH}
- #
--TIFFLIB = ${DEPTH}/libtiff/libtiff.@DSOSUF@
-+TIFFLIB = ${DEPTH}/libtiff/libtiff.la
- LIBJPEG = @LIBJPEG@
- LIBGZ = @LIBGZ@
--LIBTIFF = @TIFFLIBREF@
-+LIBTIFF = ${TIFFLIB}
- LIBPORT = @LIBPORT@
- MACHLIBS= @MACHDEPLIBS@
- LIBS = ${LIBTIFF} ${LIBJPEG} ${LIBGZ} ${LIBPORT} ${MACHLIBS}
-@@ -115,10 +115,9 @@ all: ${TARGETS}
- true; \
- fi
- install: all
-- ${INSTALL} -idb tiff.sw.tools -m 755 \
-- -dir ${DESTDIR}@DIR_BIN@
-- ${INSTALL} -idb tiff.sw.tools -m 755 \
-- -F ${DESTDIR}@DIR_BIN@ -O ${TARGETS}
-+ ${INSTALL} -idb tiff.sw.tools -m ${PKGDIRMODE} \
-+ -dir @DIR_BIN@
-+ ${LIBTOOL} ${BSD_INSTALL_PROGRAM} ${TARGETS} @DIR_BIN@
- @if [ "@LIBIMAGE@" = yes ]; then \
- ${INSTALL} -idb tiff.sw.tools -m 755 \
- -F ${DESTDIR}@DIR_BIN@ -O sgi2tiff; \
diff --git a/graphics/tiff/patches/patch-ag b/graphics/tiff/patches/patch-ag
deleted file mode 100644
index 377ae4c0cf2..00000000000
--- a/graphics/tiff/patches/patch-ag
+++ /dev/null
@@ -1,62 +0,0 @@
-$NetBSD: patch-ag,v 1.8 2004/12/22 03:57:15 reed Exp $
-
---- libtiff/tif_fax3.c.orig 2003-11-06 09:22:13.000000000 +0100
-+++ libtiff/tif_fax3.c 2004-10-18 16:24:04.000000000 +0200
-@@ -437,6 +437,21 @@
- #undef ZERO
- #undef FILL
-
-+static char *
-+CheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
-+{
-+ char *cp = NULL;
-+ tsize_t bytes = nmemb * elem_size;
-+
-+ if (nmemb && elem_size && bytes / elem_size == nmemb)
-+ cp = (char*) _TIFFmalloc(bytes);
-+
-+ if (cp == NULL)
-+ TIFFError(tif->tif_name, "No space %s", what);
-+
-+ return (cp);
-+}
-+
- /*
- * Setup G3/G4-related compression/decompression state
- * before data is processed. This routine is called once
-@@ -451,7 +466,7 @@
- Fax3BaseState* sp = Fax3State(tif);
- long rowbytes, rowpixels;
- int needsRefLine;
-- Fax3CodecState* dsp = DecoderState(tif);
-+ Fax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);
- uint32 nruns;
-
- if (td->td_bitspersample != 1) {
-@@ -481,13 +496,10 @@
-
- nruns = needsRefLine ? 2*TIFFroundup(rowpixels,32) : rowpixels;
-
-- dsp->runs = (uint32*) _TIFFmalloc((2*nruns+3)*sizeof (uint32));
-- if (dsp->runs == NULL) {
-- TIFFError("Fax3SetupState",
-- "%s: No space for Group 3/4 run arrays",
-- tif->tif_name);
-+ dsp->runs = (uint32*) CheckMalloc(tif, 2*nruns+3, sizeof (uint32),
-+ "for Group 3/4 run arrays");
-+ if (dsp->runs == NULL)
- return (0);
-- }
- dsp->curruns = dsp->runs;
- if (needsRefLine)
- dsp->refruns = dsp->runs + (nruns>>1);
-@@ -1284,7 +1296,8 @@
- sp->recvparams = 0;
- sp->subaddress = NULL;
-
-- tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
-+ if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
-+ tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
- DecoderState(tif)->runs = NULL;
- TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
- EncoderState(tif)->refline = NULL;
diff --git a/graphics/tiff/patches/patch-ah b/graphics/tiff/patches/patch-ah
deleted file mode 100644
index a5c77b39d22..00000000000
--- a/graphics/tiff/patches/patch-ah
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD: patch-ah,v 1.2 2004/04/27 20:38:48 tv Exp $
-
---- html/Makefile.in.orig Wed Oct 2 11:14:34 2002
-+++ html/Makefile.in
-@@ -86,6 +86,8 @@ HTMLFILES=\
- v3.5.5.html \
- v3.5.6-beta.html \
- v3.5.7.html \
-+ v3.6.0.html \
-+ v3.6.1.html \
- ${NULL}
- IMAGES=\
- images/back.gif \
-@@ -110,7 +112,7 @@ TARGETS=
- all: ${TARGETS}
-
- install: all
-- ${INSTALL} -m 755 -dir -idb tiff.man.html ${DESTDIR}${HTML} ${DESTDIR}${HTML}/images
-+ ${INSTALL} -m ${PKGDIRMODE} -dir -idb tiff.man.html ${DESTDIR}${HTML} ${DESTDIR}${HTML}/images
- for i in ${HTMLFILES} ${IMAGES}; do \
- ${INSTALL} -idb tiff.man.html -m 444 -F ${DESTDIR}${HTML} \
- -src ${SRCDIR}/$$i -O $$i; \
diff --git a/graphics/tiff/patches/patch-ai b/graphics/tiff/patches/patch-ai
deleted file mode 100644
index 00f332e6481..00000000000
--- a/graphics/tiff/patches/patch-ai
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ai,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tiffiop.h.orig 2003-12-26 12:56:25.000000000 +0100
-+++ libtiff/tiffiop.h 2004-10-18 16:25:32.000000000 +0200
-@@ -198,8 +198,9 @@
- #endif
-
- /* NB: the uint32 casts are to silence certain ANSI-C compilers */
--#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
--#define TIFFroundup(x, y) (TIFFhowmany(x,y)*((uint32)(y)))
-+#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
-+#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
-+#define TIFFroundup(x, y) (TIFFhowmany(x,y)*(y))
-
- #define TIFFmax(A,B) ((A)>(B)?(A):(B))
- #define TIFFmin(A,B) ((A)<(B)?(A):(B))
diff --git a/graphics/tiff/patches/patch-aj b/graphics/tiff/patches/patch-aj
deleted file mode 100644
index 55717db5029..00000000000
--- a/graphics/tiff/patches/patch-aj
+++ /dev/null
@@ -1,116 +0,0 @@
-$NetBSD: patch-aj,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_aux.c.orig 2003-12-07 12:58:36.000000000 +0100
-+++ libtiff/tif_aux.c 2004-10-18 16:25:32.000000000 +0200
-@@ -33,36 +33,59 @@
- #include "tif_predict.h"
- #include <math.h>
-
--static void
-+static int
- TIFFDefaultTransferFunction(TIFFDirectory* td)
- {
- uint16 **tf = td->td_transferfunction;
-- long i, n = 1<<td->td_bitspersample;
-+ tsize_t i, n, nbytes;
-
-- tf[0] = (uint16 *)_TIFFmalloc(n * sizeof (uint16));
-+ tf[0] = tf[1] = tf[2] = 0;
-+ if (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2)
-+ return 0;
-+
-+ n = 1<<td->td_bitspersample;
-+ nbytes = n * sizeof (uint16);
-+ if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes)))
-+ return 0;
- tf[0][0] = 0;
- for (i = 1; i < n; i++) {
- double t = (double)i/((double) n-1.);
- tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5);
- }
-+
- if (td->td_samplesperpixel - td->td_extrasamples > 1) {
-- tf[1] = (uint16 *)_TIFFmalloc(n * sizeof (uint16));
-- _TIFFmemcpy(tf[1], tf[0], n * sizeof (uint16));
-- tf[2] = (uint16 *)_TIFFmalloc(n * sizeof (uint16));
-- _TIFFmemcpy(tf[2], tf[0], n * sizeof (uint16));
-+ if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes)))
-+ goto bad;
-+ _TIFFmemcpy(tf[1], tf[0], nbytes);
-+ if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes)))
-+ goto bad;
-+ _TIFFmemcpy(tf[2], tf[0], nbytes);
- }
-+ return 1;
-+
-+bad:
-+ if (tf[0])
-+ _TIFFfree(tf[0]);
-+ if (tf[1])
-+ _TIFFfree(tf[1]);
-+ if (tf[2])
-+ _TIFFfree(tf[2]);
-+ tf[0] = tf[1] = tf[2] = 0;
-+ return 0;
- }
-
--static void
-+static int
- TIFFDefaultRefBlackWhite(TIFFDirectory* td)
- {
- int i;
-
-- td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float));
-+ if (!(td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float))))
-+ return 0;
- for (i = 0; i < 3; i++) {
- td->td_refblackwhite[2*i+0] = 0;
- td->td_refblackwhite[2*i+1] = (float)((1L<<td->td_bitspersample)-1L);
- }
-+ return 1;
- }
-
- /*
-@@ -155,6 +178,8 @@
- if (!td->td_ycbcrcoeffs) {
- td->td_ycbcrcoeffs = (float *)
- _TIFFmalloc(3*sizeof (float));
-+ if (!td->td_ycbcrcoeffs)
-+ return (0);
- /* defaults are from CCIR Recommendation 601-1 */
- td->td_ycbcrcoeffs[0] = 0.299f;
- td->td_ycbcrcoeffs[1] = 0.587f;
-@@ -173,6 +198,8 @@
- if (!td->td_whitepoint) {
- td->td_whitepoint = (float *)
- _TIFFmalloc(2 * sizeof (float));
-+ if (!td->td_whitepoint)
-+ return (0);
- /* TIFF 6.0 specification says that it is no default
- value for the WhitePoint, but AdobePhotoshop TIFF
- Technical Note tells that it should be CIE D50. */
-@@ -184,8 +211,11 @@
- *va_arg(ap, float **) = td->td_whitepoint;
- return (1);
- case TIFFTAG_TRANSFERFUNCTION:
-- if (!td->td_transferfunction[0])
-- TIFFDefaultTransferFunction(td);
-+ if (!td->td_transferfunction[0] &&
-+ !TIFFDefaultTransferFunction(td)) {
-+ TIFFError(tif->tif_name, "No space for \"TransferFunction\" tag");
-+ return (0);
-+ }
- *va_arg(ap, uint16 **) = td->td_transferfunction[0];
- if (td->td_samplesperpixel - td->td_extrasamples > 1) {
- *va_arg(ap, uint16 **) = td->td_transferfunction[1];
-@@ -193,8 +223,8 @@
- }
- return (1);
- case TIFFTAG_REFERENCEBLACKWHITE:
-- if (!td->td_refblackwhite)
-- TIFFDefaultRefBlackWhite(td);
-+ if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(td))
-+ return (0);
- *va_arg(ap, float **) = td->td_refblackwhite;
- return (1);
- }
diff --git a/graphics/tiff/patches/patch-ak b/graphics/tiff/patches/patch-ak
deleted file mode 100644
index 5718c1259c9..00000000000
--- a/graphics/tiff/patches/patch-ak
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-ak,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_compress.c.orig 2002-04-09 19:51:29.000000000 +0200
-+++ libtiff/tif_compress.c 2004-10-18 16:25:32.000000000 +0200
-@@ -210,9 +210,11 @@
- cd->info->init = init;
- cd->next = registeredCODECS;
- registeredCODECS = cd;
-- } else
-+ } else {
- TIFFError("TIFFRegisterCODEC",
- "No space to register compression scheme %s", name);
-+ return NULL;
-+ }
- return (cd->info);
- }
-
diff --git a/graphics/tiff/patches/patch-al b/graphics/tiff/patches/patch-al
deleted file mode 100644
index 2898c486dbf..00000000000
--- a/graphics/tiff/patches/patch-al
+++ /dev/null
@@ -1,87 +0,0 @@
-$NetBSD: patch-al,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_dir.c.orig 2003-12-26 12:56:25.000000000 +0100
-+++ libtiff/tif_dir.c 2004-10-18 16:25:32.000000000 +0200
-@@ -40,26 +40,33 @@
- #define DATATYPE_UINT 2 /* !unsigned integer data */
- #define DATATYPE_IEEEFP 3 /* !IEEE floating point data */
-
--void
--_TIFFsetByteArray(void** vpp, void* vp, long n)
-+static void
-+setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
- {
- if (*vpp)
- _TIFFfree(*vpp), *vpp = 0;
-- if (vp && (*vpp = (void*) _TIFFmalloc(n)))
-- _TIFFmemcpy(*vpp, vp, n);
-+ if (vp) {
-+ tsize_t bytes = nmemb * elem_size;
-+ if (elem_size && bytes / elem_size == nmemb)
-+ *vpp = (void*) _TIFFmalloc(bytes);
-+ if (*vpp)
-+ _TIFFmemcpy(*vpp, vp, bytes);
-+ }
- }
-+void _TIFFsetByteArray(void** vpp, void* vp, long n)
-+ { setByteArray(vpp, vp, n, 1); }
- void _TIFFsetString(char** cpp, char* cp)
-- { _TIFFsetByteArray((void**) cpp, (void*) cp, (long) (strlen(cp)+1)); }
-+ { setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }
- void _TIFFsetNString(char** cpp, char* cp, long n)
-- { _TIFFsetByteArray((void**) cpp, (void*) cp, n); }
-+ { setByteArray((void**) cpp, (void*) cp, n, 1); }
- void _TIFFsetShortArray(uint16** wpp, uint16* wp, long n)
-- { _TIFFsetByteArray((void**) wpp, (void*) wp, n*sizeof (uint16)); }
-+ { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); }
- void _TIFFsetLongArray(uint32** lpp, uint32* lp, long n)
-- { _TIFFsetByteArray((void**) lpp, (void*) lp, n*sizeof (uint32)); }
-+ { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); }
- void _TIFFsetFloatArray(float** fpp, float* fp, long n)
-- { _TIFFsetByteArray((void**) fpp, (void*) fp, n*sizeof (float)); }
-+ { setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }
- void _TIFFsetDoubleArray(double** dpp, double* dp, long n)
-- { _TIFFsetByteArray((void**) dpp, (void*) dp, n*sizeof (double)); }
-+ { setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); }
-
- /*
- * Install extra samples information.
-@@ -521,14 +528,21 @@
- */
- if( tv == NULL )
- {
-- td->td_customValueCount++;
-- if( td->td_customValueCount > 1 )
-- td->td_customValues = (TIFFTagValue *)
-- _TIFFrealloc(td->td_customValues,
-- sizeof(TIFFTagValue) * td->td_customValueCount);
-- else
-- td->td_customValues = (TIFFTagValue *)
-- _TIFFmalloc(sizeof(TIFFTagValue));
-+ TIFFTagValue *new_customValues;
-+
-+ td->td_customValueCount++;
-+ new_customValues = (TIFFTagValue *)
-+ _TIFFrealloc(td->td_customValues,
-+ sizeof(TIFFTagValue) * td->td_customValueCount);
-+ if (!new_customValues) {
-+ TIFFError(module,
-+ "%s: Failed to allocate space for list of custom values",
-+ tif->tif_name);
-+ status = 0;
-+ goto end;
-+ }
-+
-+ td->td_customValues = new_customValues;
-
- tv = td->td_customValues + (td->td_customValueCount-1);
- tv->info = fip;
-@@ -584,6 +598,8 @@
- TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
- tif->tif_flags |= TIFF_DIRTYDIRECT;
- }
-+
-+end:
- va_end(ap);
- return (status);
- badvalue:
diff --git a/graphics/tiff/patches/patch-am b/graphics/tiff/patches/patch-am
deleted file mode 100644
index 0785204a67a..00000000000
--- a/graphics/tiff/patches/patch-am
+++ /dev/null
@@ -1,76 +0,0 @@
-$NetBSD: patch-am,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_luv.c.orig 2003-11-27 16:08:10.000000000 +0100
-+++ libtiff/tif_luv.c 2004-10-18 16:25:32.000000000 +0200
-@@ -212,11 +212,11 @@
- rc = *bp++ + (2-128);
- b = (int16)(*bp++ << shft);
- cc -= 2;
-- while (rc--)
-+ while (rc-- && i < npixels)
- tp[i++] |= b;
- } else { /* non-run */
- rc = *bp++; /* nul is noop */
-- while (--cc && rc--)
-+ while (--cc && rc-- && i < npixels)
- tp[i++] |= (int16)*bp++ << shft;
- }
- if (i != npixels) {
-@@ -312,11 +312,11 @@
- rc = *bp++ + (2-128);
- b = (uint32)*bp++ << shft;
- cc -= 2;
-- while (rc--)
-+ while (rc-- && i < npixels)
- tp[i++] |= b;
- } else { /* non-run */
- rc = *bp++; /* nul is noop */
-- while (--cc && rc--)
-+ while (--cc && rc-- && i < npixels)
- tp[i++] |= (uint32)*bp++ << shft;
- }
- if (i != npixels) {
-@@ -1161,6 +1161,17 @@
- return (SGILOGDATAFMT_UNKNOWN);
- }
-
-+static uint32
-+multiply(size_t m1, size_t m2)
-+{
-+ uint32 bytes = m1 * m2;
-+
-+ if (m1 && bytes / m1 != m2)
-+ bytes = 0;
-+
-+ return bytes;
-+}
-+
- static int
- LogL16InitState(TIFF* tif)
- {
-@@ -1189,9 +1200,9 @@
- "No support for converting user data format to LogL");
- return (0);
- }
-- sp->tbuflen = td->td_imagewidth * td->td_rowsperstrip;
-- sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16));
-- if (sp->tbuf == NULL) {
-+ sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);
-+ if (multiply(sp->tbuflen, sizeof (int16)) == 0 ||
-+ (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) {
- TIFFError(module, "%s: No space for SGILog translation buffer",
- tif->tif_name);
- return (0);
-@@ -1287,9 +1298,9 @@
- "No support for converting user data format to LogLuv");
- return (0);
- }
-- sp->tbuflen = td->td_imagewidth * td->td_rowsperstrip;
-- sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32));
-- if (sp->tbuf == NULL) {
-+ sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);
-+ if (multiply(sp->tbuflen, sizeof (uint32)) == 0 ||
-+ (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) {
- TIFFError(module, "%s: No space for SGILog translation buffer",
- tif->tif_name);
- return (0);
diff --git a/graphics/tiff/patches/patch-an b/graphics/tiff/patches/patch-an
deleted file mode 100644
index be86b58b8d4..00000000000
--- a/graphics/tiff/patches/patch-an
+++ /dev/null
@@ -1,60 +0,0 @@
-$NetBSD: patch-an,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_dirinfo.c.orig 2003-12-22 09:22:15.000000000 +0100
-+++ libtiff/tif_dirinfo.c 2004-10-18 16:25:32.000000000 +0200
-@@ -31,6 +31,8 @@
- */
- #include "tiffiop.h"
- #include <stdlib.h>
-+#include <assert.h>
-+#include <stdio.h>
-
- /*
- * NB: NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG.
-@@ -309,6 +311,7 @@
- tif->tif_fieldinfo = (TIFFFieldInfo**)
- _TIFFmalloc(n * sizeof (TIFFFieldInfo*));
- }
-+ assert(tif->tif_fieldinfo != NULL);
- tp = &tif->tif_fieldinfo[tif->tif_nfields];
- for (i = 0; i < n; i++)
- tp[i] = (TIFFFieldInfo*) &info[i]; /* XXX */
-@@ -376,7 +379,7 @@
- TIFFDataType
- _TIFFSampleToTagType(TIFF* tif)
- {
-- int bps = (int) TIFFhowmany(tif->tif_dir.td_bitspersample, 8);
-+ uint32 bps = TIFFhowmany8(tif->tif_dir.td_bitspersample);
-
- switch (tif->tif_dir.td_sampleformat) {
- case SAMPLEFORMAT_IEEEFP:
-@@ -422,9 +425,6 @@
- return ((const TIFFFieldInfo *)0);
- }
-
--#include <assert.h>
--#include <stdio.h>
--
- const TIFFFieldInfo*
- _TIFFFieldWithTag(TIFF* tif, ttag_t tag)
- {
-@@ -460,6 +460,8 @@
- TIFFFieldInfo *fld;
-
- fld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo));
-+ if (fld == NULL)
-+ return NULL;
- _TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );
-
- fld->field_tag = tag;
-@@ -470,6 +472,10 @@
- fld->field_oktochange = TRUE;
- fld->field_passcount = TRUE;
- fld->field_name = (char *) _TIFFmalloc(32);
-+ if (fld->field_name == NULL) {
-+ _TIFFfree(fld);
-+ return NULL;
-+ }
-
- /* note that this name is a special sign to TIFFClose() and
- * _TIFFSetupFieldInfo() to free the field
diff --git a/graphics/tiff/patches/patch-ao b/graphics/tiff/patches/patch-ao
deleted file mode 100644
index 91d2fa79a0c..00000000000
--- a/graphics/tiff/patches/patch-ao
+++ /dev/null
@@ -1,311 +0,0 @@
-$NetBSD: patch-ao,v 1.2 2004/12/22 03:57:15 reed Exp $
-
---- libtiff/tif_dirread.c.orig 2003-12-22 09:22:15.000000000 +0100
-+++ libtiff/tif_dirread.c 2004-10-18 16:25:32.000000000 +0200
-@@ -62,11 +62,17 @@
- static void ChopUpSingleUncompressedStrip(TIFF*);
-
- static char *
--CheckMalloc(TIFF* tif, tsize_t n, const char* what)
-+CheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)
- {
-- char *cp = (char*)_TIFFmalloc(n);
-+ char *cp = NULL;
-+ tsize_t bytes = nmemb * elem_size;
-+
-+ if (nmemb && elem_size && bytes / elem_size == nmemb)
-+ cp = (char*)_TIFFmalloc(bytes);
-+
- if (cp == NULL)
- TIFFError(tif->tif_name, "No space %s", what);
-+
- return (cp);
- }
-
-@@ -93,6 +99,7 @@
- toff_t nextdiroff;
- char* cp;
- int diroutoforderwarning = 0;
-+ toff_t* new_dirlist;
-
- tif->tif_diroff = tif->tif_nextdiroff;
- if (tif->tif_diroff == 0) /* no more directories */
-@@ -108,14 +115,15 @@
- return (0);
- }
- tif->tif_dirnumber++;
-- tif->tif_dirlist = _TIFFrealloc(tif->tif_dirlist,
-- tif->tif_dirnumber * sizeof(toff_t));
-- if (!tif->tif_dirlist) {
-+ new_dirlist = _TIFFrealloc(tif->tif_dirlist,
-+ tif->tif_dirnumber * sizeof(toff_t));
-+ if (!new_dirlist) {
- TIFFError(module,
- "%.1000s: Failed to allocate space for IFD list",
- tif->tif_name);
- return (0);
- }
-+ tif->tif_dirlist = new_dirlist;
- tif->tif_dirlist[tif->tif_dirnumber - 1] = tif->tif_diroff;
-
- /*
-@@ -140,7 +148,7 @@
- if (tif->tif_flags & TIFF_SWAB)
- TIFFSwabShort(&dircount);
- dir = (TIFFDirEntry *)CheckMalloc(tif,
-- dircount * sizeof (TIFFDirEntry), "to read TIFF directory");
-+ dircount, sizeof (TIFFDirEntry), "to read TIFF directory");
- if (dir == NULL)
- return (0);
- if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {
-@@ -167,7 +175,7 @@
- if (tif->tif_flags & TIFF_SWAB)
- TIFFSwabShort(&dircount);
- dir = (TIFFDirEntry *)CheckMalloc(tif,
-- dircount * sizeof (TIFFDirEntry), "to read TIFF directory");
-+ dircount, sizeof (TIFFDirEntry), "to read TIFF directory");
- if (dir == NULL)
- return (0);
- if (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) {
-@@ -175,9 +183,10 @@
- "%.1000s: Can not read TIFF directory",
- tif->tif_name);
- goto bad;
-- } else
-+ } else {
- _TIFFmemcpy(dir, tif->tif_base + off,
-- dircount*sizeof (TIFFDirEntry));
-+ dircount*sizeof (TIFFDirEntry));
-+ }
- off += dircount* sizeof (TIFFDirEntry);
- if (off + sizeof (uint32) <= tif->tif_size)
- _TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));
-@@ -390,6 +399,11 @@
- td->td_nstrips = TIFFNumberOfTiles(tif);
- tif->tif_flags |= TIFF_ISTILED;
- }
-+ if (!td->td_nstrips) {
-+ TIFFError(module, "%s: cannot handle zero number of %s",
-+ tif->tif_name, isTiled(tif) ? "tiles" : "strips");
-+ goto bad;
-+ }
- td->td_stripsperimage = td->td_nstrips;
- if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
- td->td_stripsperimage /= td->td_samplesperpixel;
-@@ -466,7 +480,7 @@
- break;
- }
- v *= sizeof (uint16);
-- cp = CheckMalloc(tif, dp->tdir_count * sizeof (uint16),
-+ cp = CheckMalloc(tif, dp->tdir_count, sizeof (uint16),
- "to read \"TransferFunction\" tag");
- if (cp != NULL) {
- if (TIFFFetchData(tif, dp, cp)) {
-@@ -573,8 +587,10 @@
- if(EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
- }
-- if (dir)
-+ if (dir) {
- _TIFFfree((char *)dir);
-+ dir = NULL;
-+ }
- if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
- td->td_maxsamplevalue = (uint16)((1L<<td->td_bitspersample)-1);
- /*
-@@ -603,6 +619,17 @@
- tif->tif_curtile = (ttile_t) -1;
- tif->tif_tilesize = TIFFTileSize(tif);
- tif->tif_scanlinesize = TIFFScanlineSize(tif);
-+
-+ if (!tif->tif_tilesize) {
-+ TIFFError(module, "%s: cannot handle zero tile size",
-+ tif->tif_name);
-+ return (0);
-+ }
-+ if (!tif->tif_scanlinesize) {
-+ TIFFError(module, "%s: cannot handle zero scanline size",
-+ tif->tif_name);
-+ return (0);
-+ }
- return (1);
- bad:
- if (dir)
-@@ -622,7 +649,7 @@
- if (td->td_stripbytecount)
- _TIFFfree(td->td_stripbytecount);
- td->td_stripbytecount = (uint32*)
-- CheckMalloc(tif, td->td_nstrips * sizeof (uint32),
-+ CheckMalloc(tif, td->td_nstrips, sizeof (uint32),
- "for \"StripByteCounts\" array");
- if (td->td_compression != COMPRESSION_NONE) {
- uint32 space = (uint32)(sizeof (TIFFHeader)
-@@ -931,7 +958,7 @@
- uint32* l;
-
- l = (uint32*)CheckMalloc(tif,
-- dir->tdir_count*TIFFDataWidth((TIFFDataType) dir->tdir_type),
-+ dir->tdir_count, TIFFDataWidth((TIFFDataType) dir->tdir_type),
- "to fetch array of rationals");
- if (l) {
- if (TIFFFetchData(tif, dir, (char *)l)) {
-@@ -1087,35 +1114,35 @@
- case TIFF_SBYTE:
- /* NB: always expand BYTE values to shorts */
- cp = CheckMalloc(tif,
-- dp->tdir_count * sizeof (uint16), mesg);
-+ dp->tdir_count, sizeof (uint16), mesg);
- ok = cp && TIFFFetchByteArray(tif, dp, (uint16*) cp);
- break;
- case TIFF_SHORT:
- case TIFF_SSHORT:
- cp = CheckMalloc(tif,
-- dp->tdir_count * sizeof (uint16), mesg);
-+ dp->tdir_count, sizeof (uint16), mesg);
- ok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);
- break;
- case TIFF_LONG:
- case TIFF_SLONG:
- cp = CheckMalloc(tif,
-- dp->tdir_count * sizeof (uint32), mesg);
-+ dp->tdir_count, sizeof (uint32), mesg);
- ok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);
- break;
- case TIFF_RATIONAL:
- case TIFF_SRATIONAL:
- cp = CheckMalloc(tif,
-- dp->tdir_count * sizeof (float), mesg);
-+ dp->tdir_count, sizeof (float), mesg);
- ok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp);
- break;
- case TIFF_FLOAT:
- cp = CheckMalloc(tif,
-- dp->tdir_count * sizeof (float), mesg);
-+ dp->tdir_count, sizeof (float), mesg);
- ok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp);
- break;
- case TIFF_DOUBLE:
- cp = CheckMalloc(tif,
-- dp->tdir_count * sizeof (double), mesg);
-+ dp->tdir_count, sizeof (double), mesg);
- ok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp);
- break;
- case TIFF_ASCII:
-@@ -1124,7 +1151,7 @@
- * Some vendors write strings w/o the trailing
- * NULL byte, so always append one just in case.
- */
-- cp = CheckMalloc(tif, dp->tdir_count+1, mesg);
-+ cp = CheckMalloc(tif, dp->tdir_count+1, 1, mesg);
- if( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 )
- cp[dp->tdir_count] = '\0'; /* XXX */
- break;
-@@ -1226,8 +1253,9 @@
- uint16* v = buf;
-
- if (samples > NITEMS(buf))
-- v = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
-- if (TIFFFetchShortArray(tif, dir, v)) {
-+ v = (uint16*) CheckMalloc(tif, samples, sizeof (uint16),
-+ "to fetch per-sample values");
-+ if (v && TIFFFetchShortArray(tif, dir, v)) {
- int i;
- for (i = 1; i < samples; i++)
- if (v[i] != v[0]) {
-@@ -1240,7 +1268,7 @@
- status = 1;
- }
- bad:
-- if (v != buf)
-+ if (v && v != buf)
- _TIFFfree((char*) v);
- }
- return (status);
-@@ -1262,8 +1290,9 @@
- double* v = buf;
-
- if (samples > NITEMS(buf))
-- v = (double*) _TIFFmalloc(samples * sizeof (double));
-- if (TIFFFetchAnyArray(tif, dir, v)) {
-+ v = (double*) CheckMalloc(tif, samples, sizeof (double),
-+ "to fetch per-sample values");
-+ if (v && TIFFFetchAnyArray(tif, dir, v)) {
- int i;
- for (i = 1; i < samples; i++)
- if (v[i] != v[0]) {
-@@ -1276,7 +1305,7 @@
- status = 1;
- }
- bad:
-- if (v != buf)
-+ if (v && v != buf)
- _TIFFfree(v);
- }
- return (status);
-@@ -1301,7 +1330,7 @@
- */
- if (*lpp == NULL &&
- (*lpp = (uint32 *)CheckMalloc(tif,
-- nstrips * sizeof (uint32), "for strip array")) == NULL)
-+ nstrips, sizeof (uint32), "for strip array")) == NULL)
- return (0);
- lp = *lpp;
- memset( lp, 0, sizeof(uint32) * nstrips );
-@@ -1311,7 +1340,7 @@
- * Handle uint16->uint32 expansion.
- */
- uint16* dp = (uint16*) CheckMalloc(tif,
-- dir->tdir_count* sizeof (uint16), "to fetch strip tag");
-+ dir->tdir_count, sizeof (uint16), "to fetch strip tag");
- if (dp == NULL)
- return (0);
- if( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) {
-@@ -1328,7 +1357,7 @@
- /* Special case to correct length */
-
- uint32* dp = (uint32*) CheckMalloc(tif,
-- dir->tdir_count* sizeof (uint32), "to fetch strip tag");
-+ dir->tdir_count, sizeof (uint32), "to fetch strip tag");
- if (dp == NULL)
- return (0);
-
-@@ -1360,8 +1389,12 @@
- uint16* v = buf;
- int status;
-
-- if (dir->tdir_count > NITEMS(buf))
-- v = (uint16*) _TIFFmalloc(dir->tdir_count * sizeof (uint16));
-+ if (dir->tdir_count > NITEMS(buf)) {
-+ v = (uint16*) CheckMalloc(tif, dir->tdir_count, sizeof (uint16),
-+ "to fetch extra samples");
-+ if (!v)
-+ return (0);
-+ }
- if (dir->tdir_type == TIFF_BYTE)
- status = TIFFFetchByteArray(tif, dir, v);
- else
-@@ -1390,10 +1423,10 @@
- /*
- * Handle LONG's for backward compatibility.
- */
-- cp = CheckMalloc(tif, dir->tdir_count * sizeof (uint32), mesg);
-+ cp = CheckMalloc(tif, dir->tdir_count, sizeof (uint32), mesg);
- if( (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) != 0) {
- float* fp = (float*)
-- CheckMalloc(tif, dir->tdir_count * sizeof (float), mesg);
-+ CheckMalloc(tif, dir->tdir_count, sizeof (float), mesg);
- if( (ok = (fp != NULL)) != 0 ) {
- uint32 i;
- for (i = 0; i < dir->tdir_count; i++)
-@@ -1444,9 +1477,9 @@
- if (rowsperstrip >= td->td_rowsperstrip)
- return;
- nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);
-- newcounts = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
-+ newcounts = (uint32*) CheckMalloc(tif, nstrips, sizeof (uint32),
- "for chopped \"StripByteCounts\" array");
-- newoffsets = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
-+ newoffsets = (uint32*) CheckMalloc(tif, nstrips, sizeof (uint32),
- "for chopped \"StripOffsets\" array");
- if (newcounts == NULL || newoffsets == NULL) {
- /*
diff --git a/graphics/tiff/patches/patch-ap b/graphics/tiff/patches/patch-ap
deleted file mode 100644
index fa33da60b80..00000000000
--- a/graphics/tiff/patches/patch-ap
+++ /dev/null
@@ -1,64 +0,0 @@
-$NetBSD: patch-ap,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_dirwrite.c.orig 2003-12-22 09:22:15.000000000 +0100
-+++ libtiff/tif_dirwrite.c 2004-10-18 16:25:32.000000000 +0200
-@@ -692,8 +692,14 @@
- uint16* w = buf;
- int i, status, samples = tif->tif_dir.td_samplesperpixel;
-
-- if (samples > NITEMS(buf))
-+ if (samples > NITEMS(buf)) {
- w = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
-+ if (w == NULL) {
-+ TIFFError(tif->tif_name,
-+ "No space to write per-sample shorts");
-+ return (0);
-+ }
-+ }
- TIFFGetField(tif, tag, &v);
- for (i = 0; i < samples; i++)
- w[i] = v;
-@@ -717,8 +723,14 @@
- int i, status;
- int samples = (int) tif->tif_dir.td_samplesperpixel;
-
-- if (samples > NITEMS(buf))
-+ if (samples > NITEMS(buf)) {
- w = (double*) _TIFFmalloc(samples * sizeof (double));
-+ if (w == NULL) {
-+ TIFFError(tif->tif_name,
-+ "No space to write per-sample values");
-+ return (0);
-+ }
-+ }
- TIFFGetField(tif, tag, &v);
- for (i = 0; i < samples; i++)
- w[i] = v;
-@@ -840,6 +852,11 @@
- dir->tdir_type = (short) type;
- dir->tdir_count = n;
- t = (uint32*) _TIFFmalloc(2*n * sizeof (uint32));
-+ if (t == NULL) {
-+ TIFFError(tif->tif_name,
-+ "No space to write RATIONAL array");
-+ return (0);
-+ }
- for (i = 0; i < n; i++) {
- float fv = v[i];
- int sign = 1;
-@@ -910,8 +927,14 @@
- char* w = buf;
- int i, status = 0;
-
-- if (n * TIFFDataWidth(type) > sizeof buf)
-+ if (n * TIFFDataWidth(type) > sizeof buf) {
- w = (char*) _TIFFmalloc(n * TIFFDataWidth(type));
-+ if (w == NULL) {
-+ TIFFError(tif->tif_name,
-+ "No space to write array");
-+ return (0);
-+ }
-+ }
- switch (type) {
- case TIFF_BYTE:
- { uint8* bp = (uint8*) w;
diff --git a/graphics/tiff/patches/patch-aq b/graphics/tiff/patches/patch-aq
deleted file mode 100644
index 1add6574ea3..00000000000
--- a/graphics/tiff/patches/patch-aq
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD: patch-aq,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_extension.c.orig 2003-12-22 09:22:15.000000000 +0100
-+++ libtiff/tif_extension.c 2004-10-18 16:25:32.000000000 +0200
-@@ -32,6 +32,7 @@
- */
-
- #include "tiffiop.h"
-+#include <assert.h>
-
- int TIFFGetTagListCount( TIFF *tif )
-
-@@ -100,8 +101,10 @@
- */
-
- link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
-+ assert (link != NULL);
- link->next = tif->tif_clientinfo;
- link->name = (char *) _TIFFmalloc(strlen(name)+1);
-+ assert (link->name != NULL);
- strcpy(link->name, name);
- link->data = data;
-
diff --git a/graphics/tiff/patches/patch-ar b/graphics/tiff/patches/patch-ar
deleted file mode 100644
index ab3a93ad0c5..00000000000
--- a/graphics/tiff/patches/patch-ar
+++ /dev/null
@@ -1,55 +0,0 @@
-$NetBSD: patch-ar,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_getimage.c.orig 2003-12-22 09:22:15.000000000 +0100
-+++ libtiff/tif_getimage.c 2004-10-18 16:25:32.000000000 +0200
-@@ -565,6 +565,7 @@
- TIFFError(TIFFFileName(tif), "No space for tile buffer");
- return (0);
- }
-+ _TIFFmemset(buf, 0, TIFFTileSize(tif));
- TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
- TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
-
-@@ -664,6 +665,7 @@
- TIFFError(TIFFFileName(tif), "No space for tile buffer");
- return (0);
- }
-+ _TIFFmemset(buf, 0, 4*tilesize);
- r = buf;
- g = r + tilesize;
- b = g + tilesize;
-@@ -727,9 +729,7 @@
- (*put)(img, raster+y*w+col, col, y,
- npix, nrow, fromskew, toskew + fromskew,
- r + pos, g + pos, b + pos, a + pos);
-- }
-- else
-- {
-+ } else {
- (*put)(img, raster+y*w+col, col, y,
- tw, nrow, 0, toskew, r + pos, g + pos, b + pos, a + pos);
- }
-@@ -783,13 +783,13 @@
- TIFFError(TIFFFileName(tif), "No space for strip buffer");
- return (0);
- }
-+ _TIFFmemset(buf, 0, TIFFStripSize(tif));
-
- flip = setorientation(img);
- if (flip & FLIP_VERTICALLY) {
- y = h - 1;
- toskew = -(int32)(w + w);
-- }
-- else {
-+ } else {
- y = 0;
- toskew = -(int32)(w - w);
- }
-@@ -865,6 +865,7 @@
- TIFFError(TIFFFileName(tif), "No space for tile buffer");
- return (0);
- }
-+ _TIFFmemset(buf, 0, 4*stripsize);
- g = r + stripsize;
- b = g + stripsize;
- a = b + stripsize;
diff --git a/graphics/tiff/patches/patch-as b/graphics/tiff/patches/patch-as
deleted file mode 100644
index 9cc2feac5c0..00000000000
--- a/graphics/tiff/patches/patch-as
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-as,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_next.c.orig 2003-07-11 08:25:25.000000000 +0200
-+++ libtiff/tif_next.c 2004-10-18 16:25:32.000000000 +0200
-@@ -87,7 +87,7 @@
- */
- off = (bp[0] * 256) + bp[1];
- n = (bp[2] * 256) + bp[3];
-- if (cc < 4+n)
-+ if (cc < 4+n || off+n > scanline)
- goto bad;
- _TIFFmemcpy(row+off, bp+4, n);
- bp += 4+n;
diff --git a/graphics/tiff/patches/patch-at b/graphics/tiff/patches/patch-at
deleted file mode 100644
index 8ae7a393d14..00000000000
--- a/graphics/tiff/patches/patch-at
+++ /dev/null
@@ -1,68 +0,0 @@
-$NetBSD: patch-at,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_pixarlog.c.orig 2003-07-08 08:50:09.000000000 +0200
-+++ libtiff/tif_pixarlog.c 2004-10-18 16:25:32.000000000 +0200
-@@ -630,11 +630,23 @@
- return guess;
- }
-
-+static uint32
-+multiply(size_t m1, size_t m2)
-+{
-+ uint32 bytes = m1 * m2;
-+
-+ if (m1 && bytes / m1 != m2)
-+ bytes = 0;
-+
-+ return bytes;
-+}
-+
- static int
- PixarLogSetupDecode(TIFF* tif)
- {
- TIFFDirectory *td = &tif->tif_dir;
- PixarLogState* sp = DecoderState(tif);
-+ tsize_t tbuf_size;
- static const char module[] = "PixarLogSetupDecode";
-
- assert(sp != NULL);
-@@ -647,8 +659,13 @@
-
- sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
- td->td_samplesperpixel : 1);
-- sp->tbuf = (uint16 *) _TIFFmalloc(sp->stride *
-- td->td_imagewidth * td->td_rowsperstrip * sizeof(uint16));
-+ tbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth),
-+ td->td_rowsperstrip), sizeof(uint16));
-+ if (tbuf_size == 0)
-+ return (0);
-+ sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
-+ if (sp->tbuf == NULL)
-+ return (0);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
- sp->user_datafmt = PixarLogGuessDataFmt(td);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
-@@ -798,6 +815,7 @@
- {
- TIFFDirectory *td = &tif->tif_dir;
- PixarLogState* sp = EncoderState(tif);
-+ tsize_t tbuf_size;
- static const char module[] = "PixarLogSetupEncode";
-
- assert(sp != NULL);
-@@ -806,8 +824,13 @@
-
- sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
- td->td_samplesperpixel : 1);
-- sp->tbuf = (uint16 *) _TIFFmalloc(sp->stride *
-- td->td_imagewidth * td->td_rowsperstrip * sizeof(uint16));
-+ tbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth),
-+ td->td_rowsperstrip), sizeof(uint16));
-+ if (tbuf_size == 0)
-+ return (0);
-+ sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
-+ if (sp->tbuf == NULL)
-+ return (0);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
- sp->user_datafmt = PixarLogGuessDataFmt(td);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
diff --git a/graphics/tiff/patches/patch-au b/graphics/tiff/patches/patch-au
deleted file mode 100644
index e57012cf854..00000000000
--- a/graphics/tiff/patches/patch-au
+++ /dev/null
@@ -1,107 +0,0 @@
-$NetBSD: patch-au,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_strip.c.orig 2003-11-11 16:43:10.000000000 +0100
-+++ libtiff/tif_strip.c 2004-10-18 16:25:33.000000000 +0200
-@@ -31,6 +31,32 @@
- */
- #include "tiffiop.h"
-
-+static uint32
-+summarize(TIFF* tif, size_t summand1, size_t summand2, const char* where)
-+{
-+ uint32 bytes = summand1 + summand2;
-+
-+ if (bytes - summand1 != summand2) {
-+ TIFFError(tif->tif_name, "Integer overflow in %s", where);
-+ bytes = 0;
-+ }
-+
-+ return (bytes);
-+}
-+
-+static uint32
-+multiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where)
-+{
-+ uint32 bytes = nmemb * elem_size;
-+
-+ if (elem_size && bytes / elem_size != nmemb) {
-+ TIFFError(tif->tif_name, "Integer overflow in %s", where);
-+ bytes = 0;
-+ }
-+
-+ return (bytes);
-+}
-+
- /*
- * Compute which strip a (row,sample) value is in.
- */
-@@ -66,7 +92,8 @@
- (td->td_imagelength != 0 ? 1 : 0) :
- TIFFhowmany(td->td_imagelength, td->td_rowsperstrip));
- if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
-- nstrips *= td->td_samplesperpixel;
-+ nstrips = multiply(tif, nstrips, td->td_samplesperpixel,
-+ "TIFFNumberOfStrips");
- return (nstrips);
- }
-
-@@ -100,15 +127,20 @@
- ycbcrsubsampling + 1 );
-
- w = TIFFroundup(td->td_imagewidth, ycbcrsubsampling[0]);
-- scanline = TIFFhowmany(w*td->td_bitspersample, 8);
-+ scanline = TIFFhowmany8(multiply(tif, w, td->td_bitspersample,
-+ "TIFFVStripSize"));
- samplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1];
- nrows = TIFFroundup(nrows, ycbcrsubsampling[1]);
- /* NB: don't need TIFFhowmany here 'cuz everything is rounded */
-+ scanline = multiply(tif, nrows, scanline, "TIFFVStripSize");
- return ((tsize_t)
-- (nrows*scanline + 2*(nrows*scanline / samplingarea)));
-+ summarize(tif, scanline,
-+ multiply(tif, 2, scanline / samplingarea,
-+ "TIFFVStripSize"), "TIFFVStripSize"));
- } else
- #endif
-- return ((tsize_t)(nrows * TIFFScanlineSize(tif)));
-+ return ((tsize_t) multiply(tif, nrows, TIFFScanlineSize(tif),
-+ "TIFFVStripSize"));
- }
-
-
-@@ -189,10 +221,12 @@
- TIFFDirectory *td = &tif->tif_dir;
- tsize_t scanline;
-
-- scanline = td->td_bitspersample * td->td_imagewidth;
-+ scanline = multiply (tif, td->td_bitspersample, td->td_imagewidth,
-+ "TIFFScanlineSize");
- if (td->td_planarconfig == PLANARCONFIG_CONTIG)
-- scanline *= td->td_samplesperpixel;
-- return ((tsize_t) TIFFhowmany(scanline, 8));
-+ scanline = multiply (tif, scanline, td->td_samplesperpixel,
-+ "TIFFScanlineSize");
-+ return ((tsize_t) TIFFhowmany8(scanline));
- }
-
- /*
-@@ -207,11 +241,14 @@
- TIFFDirectory *td = &tif->tif_dir;
- tsize_t scanline;
-
-- scanline = td->td_bitspersample * td->td_imagewidth;
-+ scanline = multiply (tif, td->td_bitspersample, td->td_imagewidth,
-+ "TIFFRasterScanlineSize");
- if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
-- scanline *= td->td_samplesperpixel;
-- return ((tsize_t) TIFFhowmany(scanline, 8));
-+ scanline = multiply (tif, scanline, td->td_samplesperpixel,
-+ "TIFFRasterScanlineSize");
-+ return ((tsize_t) TIFFhowmany8(scanline));
- } else
-- return ((tsize_t)
-- TIFFhowmany(scanline, 8)*td->td_samplesperpixel);
-+ return ((tsize_t) multiply (tif, TIFFhowmany8(scanline),
-+ td->td_samplesperpixel,
-+ "TIFFRasterScanlineSize"));
- }
diff --git a/graphics/tiff/patches/patch-av b/graphics/tiff/patches/patch-av
deleted file mode 100644
index 743e733ae00..00000000000
--- a/graphics/tiff/patches/patch-av
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-av,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_thunder.c.orig 2003-07-11 08:25:25.000000000 +0200
-+++ libtiff/tif_thunder.c 2004-10-18 16:25:33.000000000 +0200
-@@ -91,8 +91,10 @@
- } else
- lastpixel |= lastpixel << 4;
- npixels += n;
-- for (; n > 0; n -= 2)
-- *op++ = (tidataval_t) lastpixel;
-+ if (npixels < maxpixels) {
-+ for (; n > 0; n -= 2)
-+ *op++ = (tidataval_t) lastpixel;
-+ }
- if (n == -1)
- *--op &= 0xf0;
- lastpixel &= 0xf;
diff --git a/graphics/tiff/patches/patch-aw b/graphics/tiff/patches/patch-aw
deleted file mode 100644
index 36edc849287..00000000000
--- a/graphics/tiff/patches/patch-aw
+++ /dev/null
@@ -1,100 +0,0 @@
-$NetBSD: patch-aw,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_tile.c.orig 2003-11-11 16:43:10.000000000 +0100
-+++ libtiff/tif_tile.c 2004-10-18 16:25:33.000000000 +0200
-@@ -31,6 +31,32 @@
- */
- #include "tiffiop.h"
-
-+static uint32
-+summarize(TIFF* tif, size_t summand1, size_t summand2, const char* where)
-+{
-+ uint32 bytes = summand1 + summand2;
-+
-+ if (bytes - summand1 != summand2) {
-+ TIFFError(tif->tif_name, "Integer overflow in %s", where);
-+ bytes = 0;
-+ }
-+
-+ return (bytes);
-+}
-+
-+static uint32
-+multiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where)
-+{
-+ uint32 bytes = nmemb * elem_size;
-+
-+ if (elem_size && bytes / elem_size != nmemb) {
-+ TIFFError(tif->tif_name, "Integer overflow in %s", where);
-+ bytes = 0;
-+ }
-+
-+ return (bytes);
-+}
-+
- /*
- * Compute which tile an (x,y,z,s) value is in.
- */
-@@ -119,11 +145,13 @@
- if (dz == (uint32) -1)
- dz = td->td_imagedepth;
- ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
-- (TIFFhowmany(td->td_imagewidth, dx) *
-- TIFFhowmany(td->td_imagelength, dy) *
-- TIFFhowmany(td->td_imagedepth, dz));
-+ multiply(tif, multiply(tif, TIFFhowmany(td->td_imagewidth, dx),
-+ TIFFhowmany(td->td_imagelength, dy),
-+ "TIFFNumberOfTiles"),
-+ TIFFhowmany(td->td_imagedepth, dz), "TIFFNumberOfTiles");
- if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
-- ntiles *= td->td_samplesperpixel;
-+ ntiles = multiply(tif, ntiles, td->td_samplesperpixel,
-+ "TIFFNumberOfTiles");
- return (ntiles);
- }
-
-@@ -138,10 +166,12 @@
-
- if (td->td_tilelength == 0 || td->td_tilewidth == 0)
- return ((tsize_t) 0);
-- rowsize = td->td_bitspersample * td->td_tilewidth;
-+ rowsize = multiply(tif, td->td_bitspersample, td->td_tilewidth,
-+ "TIFFTileRowSize");
- if (td->td_planarconfig == PLANARCONFIG_CONTIG)
-- rowsize *= td->td_samplesperpixel;
-- return ((tsize_t) TIFFhowmany(rowsize, 8));
-+ rowsize = multiply(tif, rowsize, td->td_samplesperpixel,
-+ "TIFFTileRowSize");
-+ return ((tsize_t) TIFFhowmany8(rowsize));
- }
-
- /*
-@@ -170,16 +200,24 @@
- */
- tsize_t w =
- TIFFroundup(td->td_tilewidth, td->td_ycbcrsubsampling[0]);
-- tsize_t rowsize = TIFFhowmany(w*td->td_bitspersample, 8);
-+ tsize_t rowsize =
-+ TIFFhowmany8(multiply(tif, w, td->td_bitspersample,
-+ "TIFFVTileSize"));
- tsize_t samplingarea =
- td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
- nrows = TIFFroundup(nrows, td->td_ycbcrsubsampling[1]);
- /* NB: don't need TIFFhowmany here 'cuz everything is rounded */
-- tilesize = nrows*rowsize + 2*(nrows*rowsize / samplingarea);
-+ tilesize = multiply(tif, nrows, rowsize, "TIFFVTileSize");
-+ tilesize = summarize(tif, tilesize,
-+ multiply(tif, 2, tilesize / samplingarea,
-+ "TIFFVTileSize"),
-+ "TIFFVTileSize");
- } else
- #endif
-- tilesize = nrows * TIFFTileRowSize(tif);
-- return ((tsize_t)(tilesize * td->td_tiledepth));
-+ tilesize = multiply(tif, nrows, TIFFTileRowSize(tif),
-+ "TIFFVTileSize");
-+ return ((tsize_t)
-+ multiply(tif, tilesize, td->td_tiledepth, "TIFFVTileSize"));
- }
-
- /*
diff --git a/graphics/tiff/patches/patch-ax b/graphics/tiff/patches/patch-ax
deleted file mode 100644
index c30d15cf3ba..00000000000
--- a/graphics/tiff/patches/patch-ax
+++ /dev/null
@@ -1,44 +0,0 @@
-$NetBSD: patch-ax,v 1.1 2004/10/18 14:37:24 tron Exp $
-
---- libtiff/tif_write.c.orig 2003-08-05 10:49:13.000000000 +0200
-+++ libtiff/tif_write.c 2004-10-18 16:25:33.000000000 +0200
-@@ -597,21 +597,30 @@
- static int
- TIFFGrowStrips(TIFF* tif, int delta, const char* module)
- {
-- TIFFDirectory *td = &tif->tif_dir;
-+ TIFFDirectory *td = &tif->tif_dir;
-+ uint32 *new_stripoffset, *new_stripbytecount;
-
- assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
-- td->td_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset,
-- (td->td_nstrips + delta) * sizeof (uint32));
-- td->td_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount,
-- (td->td_nstrips + delta) * sizeof (uint32));
-- if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL) {
-+ new_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset,
-+ (td->td_nstrips + delta) * sizeof (uint32));
-+ new_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount,
-+ (td->td_nstrips + delta) * sizeof (uint32));
-+ if (new_stripoffset == NULL || new_stripbytecount == NULL) {
-+ if (new_stripoffset)
-+ _TIFFfree(new_stripoffset);
-+ if (new_stripbytecount)
-+ _TIFFfree(new_stripbytecount);
- td->td_nstrips = 0;
- TIFFError(module, "%s: No space to expand strip arrays",
-- tif->tif_name);
-+ tif->tif_name);
- return (0);
- }
-- _TIFFmemset(td->td_stripoffset+td->td_nstrips, 0, delta*sizeof (uint32));
-- _TIFFmemset(td->td_stripbytecount+td->td_nstrips, 0, delta*sizeof (uint32));
-+ td->td_stripoffset = new_stripoffset;
-+ td->td_stripbytecount = new_stripbytecount;
-+ _TIFFmemset(td->td_stripoffset + td->td_nstrips,
-+ 0, delta*sizeof (uint32));
-+ _TIFFmemset(td->td_stripbytecount + td->td_nstrips,
-+ 0, delta*sizeof (uint32));
- td->td_nstrips += delta;
- return (1);
- }