summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rwxr-xr-xconfigure142
-rw-r--r--configure.ac45
-rw-r--r--contrib/iptcutil/iptcutil.c6
-rw-r--r--libtiff/mkg3states.c5
-rw-r--r--libtiff/tif_config.h.in13
-rw-r--r--libtiff/tif_config.vc.h54
-rw-r--r--libtiff/tif_luv.c4
-rw-r--r--port/strcasecmp.c6
-rw-r--r--tools/bmp2tiff.c4
-rw-r--r--tools/fax2ps.c4
-rw-r--r--tools/fax2tiff.c6
-rw-r--r--tools/gif2tiff.c5
-rw-r--r--tools/pal2rgb.c5
-rw-r--r--tools/ppm2tiff.c4
-rw-r--r--tools/ras2tiff.c4
-rw-r--r--tools/raw2tiff.c4
-rw-r--r--tools/rgb2ycbcr.c4
-rw-r--r--tools/sgi2tiff.c4
-rw-r--r--tools/sgisv.c4
-rw-r--r--tools/thumbnail.c4
-rw-r--r--tools/tiff2bw.c4
-rw-r--r--tools/tiff2pdf.c23
-rw-r--r--tools/tiff2ps.c4
-rw-r--r--tools/tiff2rgba.c4
-rw-r--r--tools/tiffcmp.c4
-rw-r--r--tools/tiffcp.c4
-rw-r--r--tools/tiffcrop.c19
-rw-r--r--tools/tiffdither.c4
-rw-r--r--tools/tiffdump.c5
-rw-r--r--tools/tiffgt.c5
-rw-r--r--tools/tiffinfo.c4
-rw-r--r--tools/tiffmedian.c4
33 files changed, 373 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index cb8b22d9..776c167c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,20 @@
2015-06-20 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
+ * libtiff/tif_config.vc.h: Make adjustments to match the new
+ definitions that configure produces, including for WIN64. Still
+ needs to be tested.
+
* configure.ac: For 64-bit MinGW, fix SSIZE_FORMAT formatting
specifier. 64-bit MinGW supports 'long long' but support for
- 'lld' is not assured by the run-time DLLs.
+ 'lld' is not assured by the run-time DLLs and so GCC warns.
+ Add TIFF_SIZE_T and TIFF_SIZE_FORMAT to provide a type definition
+ and printf format specifier to deal with printing values of
+ 'size_t' type. In particular, this was necessary for WIN64.
+ Added a configure test for if the system headers provide 'optarg'
+ (normal case) and block out the many explicit 'extern' statements
+ in the utilities. This was found to be necessary under Windows
+ when getopt is in a DLL and the symbols are already imported with
+ dllimport via standard header files.
* test/raw_decode.c (XMD_H): Avoid conflicting typedefs for INT32
and boolean in MinGW build due to including jpeglib.h.
diff --git a/configure b/configure
index 290eaddd..b7cb1d0e 100755
--- a/configure
+++ b/configure
@@ -2198,6 +2198,52 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
@@ -17192,6 +17238,18 @@ $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
fi
+ac_fn_c_check_decl "$LINENO" "optarg" "ac_cv_have_decl_optarg" "$ac_includes_default"
+if test "x$ac_cv_have_decl_optarg" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OPTARG $ac_have_decl
+_ACEOF
+
+
# Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
# The cast to long int works around a bug in the HP C Compiler
@@ -17513,6 +17571,42 @@ _ACEOF
+# Obtain the size of 'size_t' and define as SIZEOF_SIZE_T. Result is
+# available in ac_cv_sizeof_size_t
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5
+$as_echo_n "checking size of size_t... " >&6; }
+if ${ac_cv_sizeof_size_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_size_t" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (size_t)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_size_t=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5
+$as_echo "$ac_cv_sizeof_size_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
+_ACEOF
+
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signed 8-bit type" >&5
$as_echo_n "checking for signed 8-bit type... " >&6; }
INT8_T='signed char'
@@ -17680,12 +17774,58 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Determine formatting specifier for 'size_t'. While the size should
+# be precise, the type determined may not match the system definition.
+# A named type is provided to allow casting to the type we determined
+# without changing the actual size.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 'size_t' format specifier" >&5
+$as_echo_n "checking for 'size_t' format specifier... " >&6; }
+SIZE_T='unknown'
+SIZE_FORMAT='unknown'
+if test $ac_cv_sizeof_unsigned_int -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned int'
+ SIZE_FORMAT='"%u"'
+elif test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned long'
+ SIZE_FORMAT='"%lu"'
+elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned long long'
+ case "${host_os}" in
+ mingw32*)
+ # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
+ SIZE_FORMAT='"%I64u"'
+ ;;
+ *)
+ SIZE_FORMAT='"%llu"'
+ ;;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SIZE_FORMAT" >&5
+$as_echo "$SIZE_FORMAT" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define TIFF_SIZE_T $SIZE_T
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define TIFF_SIZE_FORMAT $SIZE_FORMAT
+_ACEOF
+
+
# Determine TIFF equivalent of ssize_t
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signed size type" >&5
$as_echo_n "checking for signed size type... " >&6; }
SSIZE_T='unknown'
SSIZE_FORMAT='unknown'
-if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
+if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_unsigned_char_p
+then
+ SSIZE_T='signed int'
+ SSIZE_FORMAT='"%d"'
+elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
then
SSIZE_T='signed long'
SSIZE_FORMAT='"%ld"'
diff --git a/configure.ac b/configure.ac
index 7dd42e3d..7851956c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,9 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
+dnl Check if optarg (and presumably related externs) already declared in headers
+AC_CHECK_DECLS([optarg])
+
dnl ---------------------------------------------------------------------------
dnl Compute sized types for current CPU and compiler options
dnl ---------------------------------------------------------------------------
@@ -218,6 +221,10 @@ AC_CHECK_SIZEOF(unsigned long long)
# ac_cv_sizeof_unsigned_char_p.
AC_CHECK_SIZEOF(unsigned char *)
+# Obtain the size of 'size_t' and define as SIZEOF_SIZE_T. Result is
+# available in ac_cv_sizeof_size_t
+AC_CHECK_SIZEOF([size_t])
+
AC_MSG_CHECKING(for signed 8-bit type)
INT8_T='signed char'
AC_MSG_RESULT($INT8_T)
@@ -321,11 +328,47 @@ AC_MSG_RESULT($UINT64_T)
AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])
AC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])
+# Determine formatting specifier for 'size_t'. While the size should
+# be precise, the type determined may not match the system definition.
+# A named type is provided to allow casting to the type we determined
+# without changing the actual size.
+AC_MSG_CHECKING([for 'size_t' format specifier])
+SIZE_T='unknown'
+SIZE_FORMAT='unknown'
+if test $ac_cv_sizeof_unsigned_int -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned int'
+ SIZE_FORMAT='"%u"'
+elif test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned long'
+ SIZE_FORMAT='"%lu"'
+elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_size_t
+then
+ SIZE_T='unsigned long long'
+ case "${host_os}" in
+ mingw32*)
+ # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
+ SIZE_FORMAT='"%I64u"'
+ ;;
+ *)
+ SIZE_FORMAT='"%llu"'
+ ;;
+ esac
+fi
+AC_MSG_RESULT([$SIZE_FORMAT])
+AC_DEFINE_UNQUOTED([TIFF_SIZE_T],[$SIZE_T],[Unsigned size type])
+AC_DEFINE_UNQUOTED([TIFF_SIZE_FORMAT],[$SIZE_FORMAT],[Size type formatter])
+
# Determine TIFF equivalent of ssize_t
AC_MSG_CHECKING(for signed size type)
SSIZE_T='unknown'
SSIZE_FORMAT='unknown'
-if test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
+if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_unsigned_char_p
+then
+ SSIZE_T='signed int'
+ SSIZE_FORMAT='"%d"'
+elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_unsigned_char_p
then
SSIZE_T='signed long'
SSIZE_FORMAT='"%ld"'
diff --git a/contrib/iptcutil/iptcutil.c b/contrib/iptcutil/iptcutil.c
index e0c0b563..c359df87 100644
--- a/contrib/iptcutil/iptcutil.c
+++ b/contrib/iptcutil/iptcutil.c
@@ -1,4 +1,4 @@
-/* $Id: iptcutil.c,v 1.10 2015-05-29 13:43:47 bfriesen Exp $ */
+/* $Id: iptcutil.c,v 1.11 2015-06-21 01:09:09 bfriesen Exp $ */
#include "tif_config.h"
@@ -801,11 +801,11 @@ void chstore(char *string,int max,char ch)
switch(_p_flag&3)
{
case 1: /* convert to upper */
- c=toupper(ch);
+ c=toupper((int) ch);
break;
case 2: /* convert to lower */
- c=tolower(ch);
+ c=tolower((int) ch);
break;
default: /* use as is */
diff --git a/libtiff/mkg3states.c b/libtiff/mkg3states.c
index 1df9ccc5..16ad3c23 100644
--- a/libtiff/mkg3states.c
+++ b/libtiff/mkg3states.c
@@ -1,4 +1,4 @@
-/* "$Id: mkg3states.c,v 1.11 2010-03-10 18:56:48 bfriesen Exp $ */
+/* "$Id: mkg3states.c,v 1.12 2015-06-21 01:09:09 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -383,8 +383,11 @@ main(int argc, char* argv[])
FILE* fd;
char* outputfile;
int c;
+
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "c:s:bp")) != -1)
switch (c) {
diff --git a/libtiff/tif_config.h.in b/libtiff/tif_config.h.in
index 367b1d0c..468ddbd3 100644
--- a/libtiff/tif_config.h.in
+++ b/libtiff/tif_config.h.in
@@ -27,6 +27,10 @@
/* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
+ */
+#undef HAVE_DECL_OPTARG
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -252,6 +256,9 @@
/* The size of `signed short', as computed by sizeof. */
#undef SIZEOF_SIGNED_SHORT
+/* The size of `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
/* The size of `unsigned char *', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_CHAR_P
@@ -307,6 +314,12 @@
/* Pointer difference type */
#undef TIFF_PTRDIFF_T
+/* Size type formatter */
+#undef TIFF_SIZE_FORMAT
+
+/* Unsigned size type */
+#undef TIFF_SIZE_T
+
/* Signed size type formatter */
#undef TIFF_SSIZE_FORMAT
diff --git a/libtiff/tif_config.vc.h b/libtiff/tif_config.vc.h
index ef7588c0..cdccf3d4 100644
--- a/libtiff/tif_config.vc.h
+++ b/libtiff/tif_config.vc.h
@@ -26,6 +26,9 @@
/* Define to 1 if you have the `setmode' function. */
#define HAVE_SETMODE 1
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. */
+#define HAVE_DECL_OPTARG 1
+
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
@@ -44,6 +47,57 @@
/* Unsigned 64-bit type */
#define TIFF_UINT64_T unsigned __int64
+#if _WIN64
+/*
+ Windows 64-bit build
+*/
+
+/* Pointer difference type */
+# define TIFF_PTRDIFF_T TIFF_INT64_T
+
+/* The size of `size_t', as computed by sizeof. */
+# define SIZEOF_SIZE_T 8
+
+/* Size type formatter */
+# define TIFF_SIZE_FORMAT TIFF_INT64_FORMAT
+
+/* Unsigned size type */
+# define TIFF_SIZE_T TIFF_UINT64_T
+
+/* Signed size type formatter */
+# define TIFF_SSIZE_FORMAT TIFF_INT64_FORMAT
+
+/* Signed size type */
+# define TIFF_SSIZE_T TIFF_INT64_T
+
+#else
+/*
+ Windows 32-bit build
+*/
+
+/* Pointer difference type */
+# define TIFF_PTRDIFF_T signed int
+
+/* The size of `size_t', as computed by sizeof. */
+# define SIZEOF_SIZE_T 4
+
+/* Size type formatter */
+# define TIFF_SIZE_FORMAT "%u"
+
+/* Size type formatter */
+# define TIFF_SIZE_FORMAT "%u"
+
+/* Unsigned size type */
+# define TIFF_SIZE_T unsigned int
+
+/* Signed size type formatter */
+# define TIFF_SSIZE_FORMAT "%d"
+
+/* Signed size type */
+# define TIFF_SSIZE_T signed int
+
+#endif
+
/* Set the native cpu bit order */
#define HOST_FILLORDER FILLORDER_LSB2MSB
diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
index d2952a8a..4e328bad 100644
--- a/libtiff/tif_luv.c
+++ b/libtiff/tif_luv.c
@@ -1,4 +1,4 @@
-/* $Id: tif_luv.c,v 1.39 2015-05-31 21:24:44 bfriesen Exp $ */
+/* $Id: tif_luv.c,v 1.40 2015-06-21 01:09:09 bfriesen Exp $ */
/*
* Copyright (c) 1997 Greg Ward Larson
@@ -695,7 +695,9 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
+#undef log2 /* Conflict with C'99 function */
#define log2(x) ((1./M_LN2)*log(x))
+#undef exp2 /* Conflict with C'99 function */
#define exp2(x) exp(M_LN2*(x))
#define itrunc(x,m) ((m)==SGILOGENCODE_NODITHER ? \
diff --git a/port/strcasecmp.c b/port/strcasecmp.c
index 1ff4312b..de7e4232 100644
--- a/port/strcasecmp.c
+++ b/port/strcasecmp.c
@@ -1,4 +1,4 @@
-/* $Id: strcasecmp.c,v 1.3 2009-01-22 20:53:07 fwarmerdam Exp $ */
+/* $Id: strcasecmp.c,v 1.4 2015-06-21 01:09:09 bfriesen Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -44,8 +44,8 @@ strcasecmp(const char *s1, const char *s2)
const unsigned char *us1 = (const unsigned char *)s1,
*us2 = (const unsigned char *)s2;
- while (tolower(*us1) == tolower(*us2++))
+ while (tolower((int) *us1) == tolower((int) *us2++))
if (*us1++ == '\0')
return (0);
- return (tolower(*us1) - tolower(*--us2));
+ return (tolower((int) *us1) - tolower((int) *--us2));
}
diff --git a/tools/bmp2tiff.c b/tools/bmp2tiff.c
index d6c914de..ed456b24 100644
--- a/tools/bmp2tiff.c
+++ b/tools/bmp2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: bmp2tiff.c,v 1.25 2015-05-29 02:37:56 bfriesen Exp $
+/* $Id: bmp2tiff.c,v 1.26 2015-06-21 01:09:09 bfriesen Exp $
*
* Project: libtiff tools
* Purpose: Convert Windows BMP files in TIFF.
@@ -247,8 +247,10 @@ main(int argc, char* argv[])
uint32 row, clr;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "c:r:o:h")) != -1) {
switch (c) {
diff --git a/tools/fax2ps.c b/tools/fax2ps.c
index 14dac71f..4097e3d9 100644
--- a/tools/fax2ps.c
+++ b/tools/fax2ps.c
@@ -1,4 +1,4 @@
-/* $Id: fax2ps.c,v 1.28 2014-11-20 16:47:21 erouault Exp $" */
+/* $Id: fax2ps.c,v 1.29 2015-06-21 01:09:09 bfriesen Exp $" */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -323,8 +323,10 @@ static void usage(int code);
int
main(int argc, char** argv)
{
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
uint16 *pages = NULL, npages = 0, pageNumber;
int c, dowarnings = 0; /* if 1, enable library warnings */
TIFF* tif;
diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c
index 8881e5fc..38e8229f 100644
--- a/tools/fax2tiff.c
+++ b/tools/fax2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: fax2tiff.c,v 1.22 2010-03-10 18:56:49 bfriesen Exp $ */
+/* $Id: fax2tiff.c,v 1.23 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@@ -95,9 +95,11 @@ main(int argc, char* argv[])
int c;
int pn, npages;
float resY = 196.0;
+
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
-
+#endif
while ((c = getopt(argc, argv, "R:X:o:1234ABLMPUW5678abcflmprsuvwz?")) != -1)
switch (c) {
diff --git a/tools/gif2tiff.c b/tools/gif2tiff.c
index cf6cb561..4c4f7bb2 100644
--- a/tools/gif2tiff.c
+++ b/tools/gif2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: gif2tiff.c,v 1.17 2015-05-30 20:16:00 bfriesen Exp $ */
+/* $Id: gif2tiff.c,v 1.18 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@@ -137,8 +137,11 @@ void rasterize(int, char*);
int
main(int argc, char* argv[])
{
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
+#endif
+
int c, status;
while ((c = getopt(argc, argv, "c:r:")) != -1)
diff --git a/tools/pal2rgb.c b/tools/pal2rgb.c
index c7247174..7a578006 100644
--- a/tools/pal2rgb.c
+++ b/tools/pal2rgb.c
@@ -1,4 +1,4 @@
-/* $Id: pal2rgb.c,v 1.14 2014-12-21 20:04:31 erouault Exp $ */
+/* $Id: pal2rgb.c,v 1.15 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -81,8 +81,11 @@ main(int argc, char* argv[])
int cmap = -1;
TIFF *in, *out;
int c;
+
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "C:c:p:r:")) != -1)
switch (c) {
diff --git a/tools/ppm2tiff.c b/tools/ppm2tiff.c
index 70f74be5..91415e96 100644
--- a/tools/ppm2tiff.c
+++ b/tools/ppm2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: ppm2tiff.c,v 1.18 2012-12-10 18:19:11 tgl Exp $ */
+/* $Id: ppm2tiff.c,v 1.19 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -98,8 +98,10 @@ main(int argc, char* argv[])
unsigned int w, h, prec, row;
char *infile;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
tmsize_t scanline_size;
if (argc < 2) {
diff --git a/tools/ras2tiff.c b/tools/ras2tiff.c
index 56138767..a8fa0dfd 100644
--- a/tools/ras2tiff.c
+++ b/tools/ras2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: ras2tiff.c,v 1.21 2015-05-28 04:07:31 bfriesen Exp $ */
+/* $Id: ras2tiff.c,v 1.22 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -70,8 +70,10 @@ main(int argc, char* argv[])
uint16 config = PLANARCONFIG_CONTIG;
uint32 rowsperstrip = (uint32) -1;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "c:r:h")) != -1)
switch (c) {
diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c
index 5463f3bd..5862d9b6 100644
--- a/tools/raw2tiff.c
+++ b/tools/raw2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: raw2tiff.c,v 1.26 2015-05-30 16:13:29 bfriesen Exp $
+/* $Id: raw2tiff.c,v 1.27 2015-06-21 01:09:10 bfriesen Exp $
*
* Project: libtiff tools
* Purpose: Convert raw byte sequences in TIFF images
@@ -105,8 +105,10 @@ main(int argc, char* argv[])
uint32 row, col, band;
int c;
unsigned char *buf = NULL, *buf1 = NULL;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "c:r:H:w:l:b:d:LMp:si:o:h")) != -1) {
switch (c) {
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index a3eeb038..4a969c2c 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -1,4 +1,4 @@
-/* $Id: rgb2ycbcr.c,v 1.15 2013-05-02 14:44:29 tgl Exp $ */
+/* $Id: rgb2ycbcr.c,v 1.16 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -72,8 +72,10 @@ main(int argc, char* argv[])
{
TIFF *in, *out;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
+#endif
while ((c = getopt(argc, argv, "c:h:r:v:z")) != -1)
switch (c) {
diff --git a/tools/sgi2tiff.c b/tools/sgi2tiff.c
index 227e6210..b7fef0c1 100644
--- a/tools/sgi2tiff.c
+++ b/tools/sgi2tiff.c
@@ -1,4 +1,4 @@
-/* $Id: sgi2tiff.c,v 1.6 2010-03-10 18:56:49 bfriesen Exp $ */
+/* $Id: sgi2tiff.c,v 1.7 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -60,8 +60,10 @@ main(int argc, char* argv[])
IMAGE *in;
TIFF *out;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
switch (c) {
diff --git a/tools/sgisv.c b/tools/sgisv.c
index e0d91e06..3bc57609 100644
--- a/tools/sgisv.c
+++ b/tools/sgisv.c
@@ -1,4 +1,4 @@
-/* $Id: sgisv.c,v 1.6 2010-03-10 18:56:49 bfriesen Exp $ */
+/* $Id: sgisv.c,v 1.7 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@@ -56,8 +56,10 @@ int
main(int argc, char* argv[])
{
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
switch (c) {
diff --git a/tools/thumbnail.c b/tools/thumbnail.c
index 2699324d..ab6a1d28 100644
--- a/tools/thumbnail.c
+++ b/tools/thumbnail.c
@@ -1,4 +1,4 @@
-/* $Id: thumbnail.c,v 1.20 2014-12-21 20:04:31 erouault Exp $ */
+/* $Id: thumbnail.c,v 1.21 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@@ -71,8 +71,10 @@ static int generateThumbnail(TIFF*, TIFF*);
static void initScale();
static void usage(void);
+#if !HAVE_DECL_OPTARG
extern char* optarg;
extern int optind;
+#endif
int
main(int argc, char* argv[])
diff --git a/tools/tiff2bw.c b/tools/tiff2bw.c
index 6bdf6a2a..7464cf1e 100644
--- a/tools/tiff2bw.c
+++ b/tools/tiff2bw.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2bw.c,v 1.17 2014-12-21 20:58:30 erouault Exp $ */
+/* $Id: tiff2bw.c,v 1.18 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -127,8 +127,10 @@ main(int argc, char* argv[])
unsigned char *inbuf, *outbuf;
char thing[1024];
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
+#endif
while ((c = getopt(argc, argv, "c:r:R:G:B:")) != -1)
switch (c) {
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index d506a5cc..0ba9723e 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2pdf.c,v 1.88 2015-06-14 20:54:32 faxguy Exp $
+/* $Id: tiff2pdf.c,v 1.89 2015-06-21 01:09:10 bfriesen Exp $
*
* tiff2pdf - converts a TIFF image to a PDF document
*
@@ -593,9 +593,10 @@ checkMultiply64(uint64 first, uint64 second, T2P* t2p)
*/
int main(int argc, char** argv){
-
+#if !HAVE_DECL_OPTARG
extern char *optarg;
extern int optind;
+#endif
const char *outfilename = NULL;
T2P *t2p = NULL;
TIFF *input = NULL, *output = NULL;
@@ -912,7 +913,7 @@ int tiff2pdf_match_paper_size(float* width, float* length, char* papersize){
len=strlen(papersize);
for(i=0;i<len;i++){
- papersize[i]=toupper(papersize[i]);
+ papersize[i]=toupper((int) papersize[i]);
}
for(i=0;sizes[i]!=NULL; i++){
if (strcmp( (const char*)papersize, sizes[i])==0){
@@ -1048,8 +1049,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_pages==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %lu bytes of memory for tiff_pages array, %s",
- (unsigned long) directorycount * sizeof(T2P_PAGE),
+ "Can't allocate " TIFF_SIZE_FORMAT " bytes of memory for tiff_pages array, %s",
+ (TIFF_SIZE_T) directorycount * sizeof(T2P_PAGE),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return;
@@ -1059,8 +1060,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_tiles==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %lu bytes of memory for tiff_tiles array, %s",
- (unsigned long) directorycount * sizeof(T2P_TILES),
+ "Can't allocate " TIFF_SIZE_FORMAT " bytes of memory for tiff_tiles array, %s",
+ (TIFF_SIZE_T) directorycount * sizeof(T2P_TILES),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return;
@@ -1210,8 +1211,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if( t2p->tiff_tiles[i].tiles_tiles == NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %lu bytes of memory for t2p_read_tiff_init, %s",
- (unsigned long) t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE),
+ "Can't allocate " TIFF_SIZE_FORMAT " bytes of memory for t2p_read_tiff_init, %s",
+ (TIFF_SIZE_T) t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return;
@@ -2873,9 +2874,9 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %lu bytes of memory "
+ "Can't allocate " TIFF_SIZE_FORMAT " bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
- t2p->tiff_datasize,
+ (TIFF_SIZE_T) t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return(0);
diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c
index 7d21595f..82a5d84b 100644
--- a/tools/tiff2ps.c
+++ b/tools/tiff2ps.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2ps.c,v 1.53 2015-06-13 05:49:18 faxguy Exp $ */
+/* $Id: tiff2ps.c,v 1.54 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -246,8 +246,10 @@ main(int argc, char* argv[])
double pageWidth = 0;
double pageHeight = 0;
uint32 diroff = 0;
+#if !HAVE_DECL_OPTARG
extern char *optarg;
extern int optind;
+#endif
FILE* output = stdout;
pageOrientation[0] = '\0';
diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c
index 32071dbd..7d47c940 100644
--- a/tools/tiff2rgba.c
+++ b/tools/tiff2rgba.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2rgba.c,v 1.20 2014-06-08 03:37:02 bfriesen Exp $ */
+/* $Id: tiff2rgba.c,v 1.21 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -65,8 +65,10 @@ main(int argc, char* argv[])
{
TIFF *in, *out;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
+#endif
while ((c = getopt(argc, argv, "c:r:t:bn8")) != -1)
switch (c) {
diff --git a/tools/tiffcmp.c b/tools/tiffcmp.c
index 352fe122..1a008a30 100644
--- a/tools/tiffcmp.c
+++ b/tools/tiffcmp.c
@@ -1,4 +1,4 @@
-/* $Id: tiffcmp.c,v 1.17 2014-12-21 18:52:42 erouault Exp $ */
+/* $Id: tiffcmp.c,v 1.18 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -68,8 +68,10 @@ main(int argc, char* argv[])
{
TIFF *tif1, *tif2;
int c, dirnum;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
while ((c = getopt(argc, argv, "ltz:")) != -1)
switch (c) {
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index b4785d72..d415af32 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -1,4 +1,4 @@
-/* $Id: tiffcp.c,v 1.52 2015-05-28 13:17:35 bfriesen Exp $ */
+/* $Id: tiffcp.c,v 1.53 2015-06-21 01:09:10 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -168,8 +168,10 @@ main(int argc, char* argv[])
char mode[10];
char* mp = mode;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
*mp++ = 'w';
*mp = '\0';
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 7b250e29..c2732ec6 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -1,4 +1,4 @@
-/* $Id: tiffcrop.c,v 1.33 2015-06-13 05:49:18 faxguy Exp $ */
+/* $Id: tiffcrop.c,v 1.34 2015-06-21 01:09:10 bfriesen Exp $ */
/* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of
* the image data through additional options listed below
@@ -1541,8 +1541,10 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
char *opt_ptr = NULL; /* Pointer to next token in option set */
char *sep = NULL; /* Pointer to a token separator */
unsigned int i, j, start, end;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
*mp++ = 'w';
*mp = '\0';
@@ -1569,7 +1571,7 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
}
*dirnum = start - 1;
break;
- case 'e': switch (tolower(optarg[0])) /* image export modes*/
+ case 'e': switch (tolower((int) optarg[0])) /* image export modes*/
{
case 'c': crop_data->exp_mode = ONE_FILE_COMPOSITE;
crop_data->img_mode = COMPOSITE_IMAGES;
@@ -1692,14 +1694,14 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
/* convert option to lowercase */
end = strlen (opt_ptr);
for (i = 0; i < end; i++)
- *(opt_ptr + i) = tolower(*(opt_ptr + i));
+ *(opt_ptr + i) = tolower((int) *(opt_ptr + i));
/* Look for dump format specification */
if (strncmp(opt_ptr, "for", 3) == 0)
{
/* convert value to lowercase */
end = strlen (opt_offset + 1);
for (i = 1; i <= end; i++)
- *(opt_offset + i) = tolower(*(opt_offset + i));
+ *(opt_offset + i) = tolower((int) *(opt_offset + i));
/* check dump format value */
if (strncmp (opt_offset + 1, "txt", 3) == 0)
{
@@ -1766,7 +1768,7 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
}
break;
case 'E': /* edge reference */
- switch (tolower(optarg[0]))
+ switch (tolower((int) optarg[0]))
{
case 't': crop_data->edge_ref = EDGE_TOP;
break;
@@ -1783,7 +1785,7 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
break;
case 'F': /* flip eg mirror image or cropped segment, M was already used */
crop_data->crop_mode |= CROP_MIRROR;
- switch (tolower(optarg[0]))
+ switch (tolower((int) optarg[0]))
{
case 'h': crop_data->mirror = MIRROR_HORIZ;
break;
@@ -1889,7 +1891,7 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
*image_count = i;
break;
case 'O': /* page orientation */
- switch (tolower(optarg[0]))
+ switch (tolower((int) optarg[0]))
{
case 'a': page->orient = ORIENTATION_AUTO;
break;
@@ -2108,7 +2110,10 @@ update_output_file (TIFF **tiffout, char *mode, int autoindex,
int
main(int argc, char* argv[])
{
+
+#if !HAVE_DECL_OPTARG
extern int optind;
+#endif
uint16 defconfig = (uint16) -1;
uint16 deffillorder = 0;
uint32 deftilewidth = (uint32) 0;
diff --git a/tools/tiffdither.c b/tools/tiffdither.c
index f6182dbe..247553cd 100644
--- a/tools/tiffdither.c
+++ b/tools/tiffdither.c
@@ -1,4 +1,4 @@
-/* $Id: tiffdither.c,v 1.15 2015-03-02 16:16:38 erouault Exp $ */
+/* $Id: tiffdither.c,v 1.16 2015-06-21 01:09:11 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -210,8 +210,10 @@ main(int argc, char* argv[])
uint32 rowsperstrip = (uint32) -1;
uint16 fillorder = 0;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
+#endif
while ((c = getopt(argc, argv, "c:f:r:t:")) != -1)
switch (c) {
diff --git a/tools/tiffdump.c b/tools/tiffdump.c
index f490d85f..a5481260 100644
--- a/tools/tiffdump.c
+++ b/tools/tiffdump.c
@@ -1,4 +1,4 @@
-/* $Id: tiffdump.c,v 1.30 2014-12-22 02:52:38 bfriesen Exp $ */
+/* $Id: tiffdump.c,v 1.31 2015-06-21 01:09:11 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -97,8 +97,11 @@ const char* floatfmt = "%s%g"; /* FLOAT */
const char* doublefmt = "%s%g"; /* DOUBLE */
static void dump(int, uint64);
+
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
void
usage()
diff --git a/tools/tiffgt.c b/tools/tiffgt.c
index 8565111c..84ca491c 100644
--- a/tools/tiffgt.c
+++ b/tools/tiffgt.c
@@ -1,4 +1,4 @@
-/* $Id: tiffgt.c,v 1.12 2015-06-14 21:44:17 faxguy Exp $ */
+/* $Id: tiffgt.c,v 1.13 2015-06-21 01:09:11 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -74,8 +74,11 @@ static void raster_reshape(int, int);
static void raster_keys(unsigned char, int, int);
static void raster_special(int, int, int);
+#if !HAVE_DECL_OPTARG
extern char* optarg;
extern int optind;
+#endif
+
static TIFF* tif = NULL;
int
diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c
index 8493439f..acac2e42 100644
--- a/tools/tiffinfo.c
+++ b/tools/tiffinfo.c
@@ -1,4 +1,4 @@
-/* $Id: tiffinfo.c,v 1.22 2013-07-10 00:44:22 fwarmerdam Exp $ */
+/* $Id: tiffinfo.c,v 1.23 2015-06-21 01:09:11 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -69,8 +69,10 @@ main(int argc, char* argv[])
int dirnum = -1, multiplefiles, c;
uint16 order = 0;
TIFF* tif;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
long flags = 0;
uint64 diroff = 0;
int chopstrips = 0; /* disable strip chopping */
diff --git a/tools/tiffmedian.c b/tools/tiffmedian.c
index 56eeb211..f0c892e4 100644
--- a/tools/tiffmedian.c
+++ b/tools/tiffmedian.c
@@ -1,4 +1,4 @@
-/* $Id: tiffmedian.c,v 1.12 2015-05-28 03:08:18 bfriesen Exp $ */
+/* $Id: tiffmedian.c,v 1.13 2015-06-21 01:09:11 bfriesen Exp $ */
/*
* Apply median cut on an image.
@@ -123,8 +123,10 @@ main(int argc, char* argv[])
float floatv;
uint32 longv;
int c;
+#if !HAVE_DECL_OPTARG
extern int optind;
extern char* optarg;
+#endif
num_colors = MAX_CMAP_SIZE;
while ((c = getopt(argc, argv, "c:C:r:f")) != -1)