fix some portability and warning issues with tiffcrop
This commit is contained in:
parent
1468d4291f
commit
6e6e603753
@ -1,5 +1,7 @@
|
||||
2008-06-17 Frank Warmerdam <warmerdam@pobox.com>
|
||||
|
||||
* tools/tiffcrop.c: Fix some portability problems.
|
||||
|
||||
* libtiff/tif_ojpeg.c: Use same jpeg/win32 boolean/FAR hacks as are
|
||||
used in tif_jpeg.c.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tiffcrop.c,v 1.6 2008-05-24 00:18:55 fwarmerdam Exp $ */
|
||||
/* $Id: tiffcrop.c,v 1.7 2008-06-17 20:16:54 fwarmerdam Exp $ */
|
||||
|
||||
/* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of
|
||||
* the image data through additional options listed below
|
||||
@ -123,6 +123,10 @@ extern int getopt(int, char**, char*);
|
||||
# define unlink delete
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
#define streq(a,b) (strcmp((a),(b)) == 0)
|
||||
#define strneq(a,b,n) (strncmp((a),(b),(n)) == 0)
|
||||
|
||||
@ -934,6 +938,9 @@ main(int argc, char* argv[])
|
||||
unsigned int total_images = 0;
|
||||
unsigned int end_of_input = FALSE;
|
||||
|
||||
extern int optind;
|
||||
extern char* optarg;
|
||||
|
||||
initImageData(&image);
|
||||
initCropMasks(&crop);
|
||||
initPageSetup(&page, sections, seg_buffs);
|
||||
@ -2024,23 +2031,23 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,
|
||||
if (x1 < 1)
|
||||
crop->regionlist[i].x1 = 0;
|
||||
else
|
||||
crop->regionlist[i].x1 = x1 - 1;
|
||||
crop->regionlist[i].x1 = (int) (x1 - 1);
|
||||
|
||||
if (x2 > image->width - 1)
|
||||
crop->regionlist[i].x2 = image->width - 1;
|
||||
else
|
||||
crop->regionlist[i].x2 = x2 - 1;
|
||||
crop->regionlist[i].x2 = (int) (x2 - 1);
|
||||
zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1;
|
||||
|
||||
if (y1 < 1)
|
||||
crop->regionlist[i].y1 = 0;
|
||||
else
|
||||
crop->regionlist[i].y1 = y1 - 1;
|
||||
crop->regionlist[i].y1 = (int) (y1 - 1);
|
||||
|
||||
if (y2 > image->length - 1)
|
||||
crop->regionlist[i].y2 = image->length - 1;
|
||||
else
|
||||
crop->regionlist[i].y2 = y2 - 1;
|
||||
crop->regionlist[i].y2 = (int) (y2 - 1);
|
||||
|
||||
zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;
|
||||
|
||||
@ -2423,8 +2430,8 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop)
|
||||
} /* end switch statement */
|
||||
buffsize = (uint32)((ceil)(((zwidth * image->bps + 7 ) / 8) * image->spp)
|
||||
* (ceil(zlength)));
|
||||
crop->regionlist[i].width = zwidth;
|
||||
crop->regionlist[i].length = zlength;
|
||||
crop->regionlist[i].width = (int) zwidth;
|
||||
crop->regionlist[i].length = (int) zlength;
|
||||
crop->regionlist[i].buffsize = buffsize;
|
||||
crop->bufftotal += buffsize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user