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