summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bernard <miniupnp@free.fr>2019-02-23 23:58:28 +0100
committerThomas Bernard <miniupnp@free.fr>2019-05-31 20:10:51 +0200
commit4d26884a15a36fdd8db06b42731d09c7d2a05ade (patch)
treefbb5d6405734900818bed7842a127f8a3d24e1ca
parent69ce2652ef2feae25a4569eb57b837dde0a1bd71 (diff)
downloadlibtiff-git-4d26884a15a36fdd8db06b42731d09c7d2a05ade.tar.gz
make TIFF_SSIZE_T the same bitwidth as TIFF_SIZE_T
it was previously the same bitwidth as unsigned char * Pointers can be larger than size_t.
-rw-r--r--CMakeLists.txt20
-rw-r--r--configure.ac6
-rw-r--r--test/testtypes.c2
3 files changed, 10 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22cf520c..721ebb30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -338,29 +338,21 @@ endif()
if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T)
set(TIFF_SIZE_T "unsigned int")
set(TIFF_SIZE_FORMAT "%u")
+ set(TIFF_SSIZE_T "signed int")
+ set(TIFF_SSIZE_FORMAT "%d")
elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
set(TIFF_SIZE_T "unsigned long")
set(TIFF_SIZE_FORMAT "%lu")
-elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
- set(TIFF_SIZE_T "unsigned long long")
- if (MINGW)
- set(TIFF_SIZE_FORMAT "%I64u")
- else()
- set(TIFF_SIZE_FORMAT "%llu")
- endif()
-endif()
-
-if(SIZEOF_SIGNED_INT EQUAL SIZEOF_UNSIGNED_CHAR_P)
- set(TIFF_SSIZE_T "signed int")
- set(TIFF_SSIZE_FORMAT "%d")
-elseif(SIZEOF_SIGNED_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
set(TIFF_SSIZE_T "signed long")
set(TIFF_SSIZE_FORMAT "%ld")
-elseif(SIZEOF_SIGNED_LONG_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
+elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
+ set(TIFF_SIZE_T "unsigned long long")
set(TIFF_SSIZE_T "signed long long")
if (MINGW)
+ set(TIFF_SIZE_FORMAT "%I64u")
set(TIFF_SSIZE_FORMAT "%I64d")
else()
+ set(TIFF_SIZE_FORMAT "%llu")
set(TIFF_SSIZE_FORMAT "%lld")
endif()
endif()
diff --git a/configure.ac b/configure.ac
index 54915e05..09f959f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,15 +365,15 @@ AC_DEFINE_UNQUOTED([TIFF_SIZE_FORMAT],[$SIZE_FORMAT],[Size type formatter])
AC_MSG_CHECKING(for signed size type)
SSIZE_T='unknown'
SSIZE_FORMAT='unknown'
-if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_unsigned_char_p
+if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_size_t
then
SSIZE_T='signed int'
SSIZE_FORMAT='"%d"'
-elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
+elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_size_t
then
SSIZE_T='signed long'
SSIZE_FORMAT='"%ld"'
-elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_unsigned_char_p
+elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_size_t
then
SSIZE_T='signed long long'
case "${host_os}" in
diff --git a/test/testtypes.c b/test/testtypes.c
index 100b7766..a36d21e5 100644
--- a/test/testtypes.c
+++ b/test/testtypes.c
@@ -51,7 +51,7 @@ main()
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(unsigned char *))
+ CHECK_TYPE(TIFF_SSIZE_T, sizeof(size_t))
return 0;
}