Added support for a TIFF_SSIZE_T in order to return memory sizes but still

allow returning -1 for errors.
This commit is contained in:
Bob Friesenhahn 2007-06-26 22:52:05 +00:00
parent 671e370838
commit 5016816617
10 changed files with 50 additions and 19 deletions

View File

@ -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 <bfriesen@simple.dallas.tx.us>

View File

@ -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
#

27
configure vendored
View File

@ -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; }

View File

@ -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)

View File

@ -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
#

View File

@ -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
#

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */