fix fax2tiff

see http://bugzilla.maptools.org/show_bug.cgi?id=2799
fixes d9bc8472e7
This commit is contained in:
Yuri Aksenov 2019-01-29 14:24:19 +01:00 committed by Thomas Bernard
parent 329433af90
commit 88b410f800
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -74,14 +74,10 @@ static void usage(void);
Struct to carry client data. Note that it does not appear that the client Struct to carry client data. Note that it does not appear that the client
data is actually used in this program. data is actually used in this program.
*/ */
typedef struct _FAX_Client_Data typedef union _FAX_Client_Data
{ {
#if defined(_WIN32) && defined(USE_WIN32_FILEIO) thandle_t fh; /* Operating system file handle */
intptr_t fh; /* Operating system file handle */
#else
int fd; /* Integer file descriptor */ int fd; /* Integer file descriptor */
#endif
} FAX_Client_Data; } FAX_Client_Data;
int int
@ -280,11 +276,11 @@ main(int argc, char* argv[])
continue; continue;
} }
#if defined(_WIN32) && defined(USE_WIN32_FILEIO) #if defined(_WIN32) && defined(USE_WIN32_FILEIO)
client_data.fh = _get_osfhandle(fileno(in)); client_data.fh = (thandle_t)_get_osfhandle(fileno(in));
#else #else
client_data.fd = fileno(in); client_data.fd = fileno(in);
#endif #endif
TIFFSetClientdata(faxTIFF, (thandle_t) &client_data); TIFFSetClientdata(faxTIFF, client_data.fh);
TIFFSetFileName(faxTIFF, (const char*)argv[optind]); TIFFSetFileName(faxTIFF, (const char*)argv[optind]);
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize); TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);