diff --git a/ChangeLog b/ChangeLog index b739fedf..e9778ac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * configure.ac: Fix typo when substituting value for unsigned 8 bit type. Added support for a TIFF_PTRDIFF_T type to use when doing pointer arithmetic. + Added support for a TIFF_SSIZE_T in order to return memory sizes but still + allow returning -1 for errors. * libtiff/tiffconf.vc.h: Add porting type defintions for WIN32. 2007-06-25 Bob Friesenhahn diff --git a/build/Makefile.in b/build/Makefile.in index 49edf393..81935835 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.in,v 1.5 2007-06-26 20:05:38 bfriesen Exp $ +# $Id: Makefile.in,v 1.6 2007-06-26 22:52:12 bfriesen Exp $ # # Tag Image File Format (TIFF) Software # diff --git a/configure b/configure index 1b342686..9f2b79a0 100755 --- a/configure +++ b/configure @@ -24877,6 +24877,25 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# Determine TIFF equivalent of ssize_t +{ echo "$as_me:$LINENO: checking for signed size type" >&5 +echo $ECHO_N "checking for signed size type... $ECHO_C" >&6; } +SSIZE_T='unknown' +if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p +then + SSIZE_T='signed long' +elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p +then + SSIZE_T='signed long long' +fi +{ echo "$as_me:$LINENO: result: $SSIZE_T" >&5 +echo "${ECHO_T}$SSIZE_T" >&6; } + +cat >>confdefs.h <<_ACEOF +#define TIFF_SSIZE_T $SSIZE_T +_ACEOF + + # Determine the type to use for the difference between two pointers. # We will default to the POSIX ptrdiff_t if it is available, but will # be prepared for the case when it is not. @@ -24940,13 +24959,7 @@ fi if test $PTRDIFF_T = unknown then - if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p - then - PTRDIFF_T='signed long' - elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p - then - PTRDIFF_T='signed long long' - fi + PTRDIFF_T=$SSIZE_T fi { echo "$as_me:$LINENO: checking for pointer difference type" >&5 echo $ECHO_N "checking for pointer difference type... $ECHO_C" >&6; } diff --git a/configure.ac b/configure.ac index 57a9e47c..c6a94e79 100644 --- a/configure.ac +++ b/configure.ac @@ -208,6 +208,19 @@ fi AC_MSG_RESULT($UINT64_T) AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type]) +# Determine TIFF equivalent of ssize_t +AC_MSG_CHECKING(for signed size type) +SSIZE_T='unknown' +if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p +then + SSIZE_T='signed long' +elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p +then + SSIZE_T='signed long long' +fi +AC_MSG_RESULT($SSIZE_T) +AC_DEFINE_UNQUOTED(TIFF_SSIZE_T,$SSIZE_T,[Signed size type]) + # Determine the type to use for the difference between two pointers. # We will default to the POSIX ptrdiff_t if it is available, but will # be prepared for the case when it is not. @@ -215,13 +228,7 @@ PTRDIFF_T='unknown' AC_CHECK_TYPE(ptrdiff_t,[PTRDIFF_T=ptrdiff_t]) if test $PTRDIFF_T = unknown then - if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p - then - PTRDIFF_T='signed long' - elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p - then - PTRDIFF_T='signed long long' - fi + PTRDIFF_T=$SSIZE_T fi AC_MSG_CHECKING(for pointer difference type) AC_MSG_RESULT($PTRDIFF_T) diff --git a/contrib/dbs/xtiff/Makefile.in b/contrib/dbs/xtiff/Makefile.in index 8bb175a6..ccb0bbc4 100644 --- a/contrib/dbs/xtiff/Makefile.in +++ b/contrib/dbs/xtiff/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.in,v 1.40 2007-06-26 20:05:39 bfriesen Exp $ +# $Id: Makefile.in,v 1.41 2007-06-26 22:52:13 bfriesen Exp $ # # Tag Image File Format (TIFF) Software # diff --git a/html/Makefile.in b/html/Makefile.in index 3c06b4b8..2abd2c53 100644 --- a/html/Makefile.in +++ b/html/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.in,v 1.53 2007-06-26 20:05:40 bfriesen Exp $ +# $Id: Makefile.in,v 1.54 2007-06-26 22:52:13 bfriesen Exp $ # # Tag Image File Format (TIFF) Software # diff --git a/libtiff/tif_config.h.in b/libtiff/tif_config.h.in index e9ce813b..4c0fcdcf 100644 --- a/libtiff/tif_config.h.in +++ b/libtiff/tif_config.h.in @@ -265,6 +265,9 @@ /* Pointer difference type */ #undef TIFF_PTRDIFF_T +/* Signed size type */ +#undef TIFF_SSIZE_T + /* Unsigned 16-bit type */ #undef TIFF_UINT16_T diff --git a/libtiff/tiffconf.h.in b/libtiff/tiffconf.h.in index 0d573d7e..6da9c5a6 100644 --- a/libtiff/tiffconf.h.in +++ b/libtiff/tiffconf.h.in @@ -31,6 +31,9 @@ /* Unsigned 8-bit type */ #undef TIFF_UINT8_T +/* Signed size type */ +#undef TIFF_SSIZE_T + /* Pointer difference type */ #undef TIFF_PTRDIFF_T diff --git a/libtiff/tiffconf.vc.h b/libtiff/tiffconf.vc.h index 8680b56d..efec8188 100644 --- a/libtiff/tiffconf.vc.h +++ b/libtiff/tiffconf.vc.h @@ -46,6 +46,9 @@ /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned __int64 +/* Signed size type */ +#define TIFF_SSIZE_T signed long + /* Pointer difference type */ #define TIFF_PTRDIFF_T long diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h index e7a6e3de..bbcdb698 100644 --- a/libtiff/tiffio.h +++ b/libtiff/tiffio.h @@ -1,4 +1,4 @@ -/* $Id: tiffio.h,v 1.69 2007-06-26 20:05:40 bfriesen Exp $ */ +/* $Id: tiffio.h,v 1.70 2007-06-26 22:52:13 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -60,7 +60,7 @@ typedef struct tiff TIFF; */ /* this is the machine addressing size type, only it's signed, so make it int32 on 32bit machines, int64 on 64bit machines */ -typedef TIFF_PTRDIFF_T tmsize_t; +typedef TIFF_SSIZE_T tmsize_t; /* the following are depriciated and should be replaced by their defining counterparts */ typedef uint32 ttag_t; /* directory tag */