tiff2ps: fix use of wrong data type that caused issues (/Height being written as 0) on 64-bit big endian platforms

This commit is contained in:
Even Rouault 2019-08-18 10:52:45 +02:00
parent 1a11c9df6e
commit b04da30e11
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D

View File

@ -682,8 +682,8 @@ isCCITTCompression(TIFF* tif)
static tsize_t tf_bytesperrow; static tsize_t tf_bytesperrow;
static tsize_t ps_bytesperrow; static tsize_t ps_bytesperrow;
static tsize_t tf_rowsperstrip; static uint32 tf_rowsperstrip;
static tsize_t tf_numberstrips; static uint32 tf_numberstrips;
static char *hex = "0123456789abcdef"; static char *hex = "0123456789abcdef";
/* /*
@ -1798,7 +1798,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
int use_rawdata; int use_rawdata;
uint32 tile_width, tile_height; uint32 tile_width, tile_height;
uint16 predictor, minsamplevalue, maxsamplevalue; uint16 predictor, minsamplevalue, maxsamplevalue;
int repeat_count; uint32 repeat_count;
char im_h[64], im_x[64], im_y[64]; char im_h[64], im_x[64], im_y[64];
char * imageOp = "image"; char * imageOp = "image";
@ -1850,7 +1850,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
fputs("{ % exec\n", fd); fputs("{ % exec\n", fd);
if (repeat_count > 1) if (repeat_count > 1)
fprintf(fd, "%d { %% repeat\n", repeat_count); fprintf(fd, "%u { %% repeat\n", repeat_count);
/* /*
* Output filter options and image dictionary. * Output filter options and image dictionary.
@ -2766,7 +2766,7 @@ PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
bufsize = (uint32) bc[0]; bufsize = (uint32) bc[0];
for ( s = 0; ++s < (tstrip_t)tf_numberstrips; ) { for ( s = 0; ++s < tf_numberstrips; ) {
if ( bc[s] > bufsize ) if ( bc[s] > bufsize )
bufsize = (uint32) bc[s]; bufsize = (uint32) bc[s];
} }
@ -2799,7 +2799,7 @@ PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
} }
#endif #endif
for (s = 0; s < (tstrip_t) tf_numberstrips; s++) { for (s = 0; s < tf_numberstrips; s++) {
cc = TIFFReadRawStrip(tif, s, tf_buf, (tmsize_t) bc[s]); cc = TIFFReadRawStrip(tif, s, tf_buf, (tmsize_t) bc[s]);
if (cc < 0) { if (cc < 0) {
TIFFError(filename, "Can't read strip"); TIFFError(filename, "Can't read strip");