diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c index 2098b2ab..21223131 100644 --- a/tools/fax2tiff.c +++ b/tools/fax2tiff.c @@ -74,14 +74,10 @@ static void usage(void); Struct to carry client data. Note that it does not appear that the client data is actually used in this program. */ -typedef struct _FAX_Client_Data +typedef union _FAX_Client_Data { -#if defined(_WIN32) && defined(USE_WIN32_FILEIO) - intptr_t fh; /* Operating system file handle */ -#else - int fd; /* Integer file descriptor */ -#endif - + thandle_t fh; /* Operating system file handle */ + int fd; /* Integer file descriptor */ } FAX_Client_Data; int @@ -89,7 +85,7 @@ main(int argc, char* argv[]) { FILE *in; TIFF *out = NULL; - FAX_Client_Data client_data; + FAX_Client_Data client_data; TIFFErrorHandler whandler = NULL; int compression_in = COMPRESSION_CCITTFAX3; int compression_out = COMPRESSION_CCITTFAX3; @@ -280,11 +276,11 @@ main(int argc, char* argv[]) continue; } #if defined(_WIN32) && defined(USE_WIN32_FILEIO) - client_data.fh = _get_osfhandle(fileno(in)); + client_data.fh = (thandle_t)_get_osfhandle(fileno(in)); #else - client_data.fd = fileno(in); + client_data.fd = fileno(in); #endif - TIFFSetClientdata(faxTIFF, (thandle_t) &client_data); + TIFFSetClientdata(faxTIFF, client_data.fh); TIFFSetFileName(faxTIFF, (const char*)argv[optind]); TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize); TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);