* tools/tiffcrop.c: Fix warnings about variables set but not used.

This commit is contained in:
Bob Friesenhahn 2014-12-26 16:32:31 +00:00
parent a7ced11ff1
commit fdfa1a026f
2 changed files with 65 additions and 49 deletions

View File

@ -1,5 +1,7 @@
2014-12-26 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* tools/tiffcrop.c: Fix warnings about variables set but not used.
* contrib/iptcutil/iptcutil.c: Fix warnings about variables set
but not used.

View File

@ -1,4 +1,4 @@
/* $Id: tiffcrop.c,v 1.24 2014-12-21 15:15:32 erouault Exp $ */
/* $Id: tiffcrop.c,v 1.25 2014-12-26 16:32:32 bfriesen Exp $ */
/* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of
* the image data through additional options listed below
@ -2646,7 +2646,7 @@ extractContigSamplesBytes (uint8 *in, uint8 *out, uint32 cols,
{
int i, bytes_per_sample, sindex;
uint32 col, dst_rowsize, bit_offset;
uint32 src_byte, src_bit;
uint32 src_byte /*, src_bit */;
uint8 *src = in;
uint8 *dst = out;
@ -2688,12 +2688,12 @@ extractContigSamplesBytes (uint8 *in, uint8 *out, uint32 cols,
if (sindex == 0)
{
src_byte = bit_offset / 8;
src_bit = bit_offset % 8;
/* src_bit = bit_offset % 8; */
}
else
{
src_byte = (bit_offset + (sindex * bps)) / 8;
src_bit = (bit_offset + (sindex * bps)) % 8;
/* src_bit = (bit_offset + (sindex * bps)) % 8; */
}
src = in + src_byte;
for (i = 0; i < bytes_per_sample; i++)
@ -2969,7 +2969,7 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
tsample_t sample, uint16 spp, uint16 bps,
tsample_t count, uint32 start, uint32 end)
{
int ready_bits = 0, sindex = 0, shift_width = 0;
int ready_bits = 0, sindex = 0 /*, shift_width = 0 */;
uint32 col, src_byte, src_bit, bit_offset;
uint32 longbuff1 = 0, longbuff2 = 0;
uint64 maskbits = 0, matchbits = 0;
@ -2998,7 +2998,7 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
end = cols;
}
shift_width = ((bps + 7) / 8) + 1;
/* shift_width = ((bps + 7) / 8) + 1; */
ready_bits = 0;
maskbits = (uint64)-1 >> ( 64 - bps);
for (col = start; col < end; col++)
@ -3343,7 +3343,7 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
tsample_t count, uint32 start, uint32 end,
int shift)
{
int ready_bits = 0, sindex = 0, shift_width = 0;
int ready_bits = 0, sindex = 0 /*, shift_width = 0 */;
uint32 col, src_byte, src_bit, bit_offset;
uint32 longbuff1 = 0, longbuff2 = 0;
uint64 maskbits = 0, matchbits = 0;
@ -3372,7 +3372,7 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
end = cols;
}
shift_width = ((bps + 7) / 8) + 1;
/* shift_width = ((bps + 7) / 8) + 1; */
ready_bits = shift;
maskbits = (uint64)-1 >> ( 64 - bps);
for (col = start; col < end; col++)
@ -3692,7 +3692,7 @@ combineSeparateSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
FILE *dumpfile, int format, int level)
{
int ready_bits = 0;
int bytes_per_sample = 0;
/* int bytes_per_sample = 0; */
uint32 src_rowsize, dst_rowsize, src_offset;
uint32 bit_offset;
uint32 row, col, src_byte = 0, src_bit = 0;
@ -3709,7 +3709,7 @@ combineSeparateSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
return (1);
}
bytes_per_sample = (bps + 7) / 8;
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
maskbits = (uint8)-1 >> ( 8 - bps);
@ -3791,7 +3791,7 @@ combineSeparateSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
uint32 rows, uint16 spp, uint16 bps,
FILE *dumpfile, int format, int level)
{
int ready_bits = 0, bytes_per_sample = 0;
int ready_bits = 0 /*, bytes_per_sample = 0 */;
uint32 src_rowsize, dst_rowsize;
uint32 bit_offset, src_offset;
uint32 row, col, src_byte = 0, src_bit = 0;
@ -3809,7 +3809,7 @@ combineSeparateSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
return (1);
}
bytes_per_sample = (bps + 7) / 8;
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
maskbits = (uint16)-1 >> (16 - bps);
@ -3901,7 +3901,7 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
uint32 rows, uint16 spp, uint16 bps,
FILE *dumpfile, int format, int level)
{
int ready_bits = 0, bytes_per_sample = 0;
int ready_bits = 0 /*, bytes_per_sample = 0 */;
uint32 src_rowsize, dst_rowsize;
uint32 bit_offset, src_offset;
uint32 row, col, src_byte = 0, src_bit = 0;
@ -3919,7 +3919,7 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
return (1);
}
bytes_per_sample = (bps + 7) / 8;
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
maskbits = (uint32)-1 >> ( 32 - bps);
@ -4025,7 +4025,7 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
uint32 rows, uint16 spp, uint16 bps,
FILE *dumpfile, int format, int level)
{
int ready_bits = 0, bytes_per_sample = 0, shift_width = 0;
int ready_bits = 0 /*, bytes_per_sample = 0, shift_width = 0 */;
uint32 src_rowsize, dst_rowsize, bit_offset, src_offset;
uint32 src_byte = 0, src_bit = 0;
uint32 row, col;
@ -4044,11 +4044,11 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
return (1);
}
bytes_per_sample = (bps + 7) / 8;
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
maskbits = (uint64)-1 >> ( 64 - bps);
shift_width = ((bps + 7) / 8) + 1;
/* shift_width = ((bps + 7) / 8) + 1; */
for (row = 0; row < rows; row++)
{
@ -4550,7 +4550,7 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
uint32 tw, uint16 spp, uint16 bps,
FILE *dumpfile, int format, int level)
{
int ready_bits = 0, shift_width = 0;
int ready_bits = 0 /*, shift_width = 0 */;
uint32 src_rowsize, dst_rowsize, bit_offset, src_offset;
uint32 src_byte = 0, src_bit = 0;
uint32 row, col;
@ -4572,7 +4572,7 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
src_rowsize = ((bps * tw) + 7) / 8;
dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;
maskbits = (uint64)-1 >> ( 64 - bps);
shift_width = ((bps + 7) / 8) + 1;
/* shift_width = ((bps + 7) / 8) + 1; */
for (row = 0; row < rows; row++)
{
@ -5505,7 +5505,7 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
uint32 orows, ocols; /* rows and cols for output */
uint32 hmargin, vmargin; /* Horizontal and vertical margins */
uint32 x1, x2, y1, y2, line_bytes;
unsigned int orientation;
/* unsigned int orientation; */
uint32 i, j, k;
scale = 1.0;
@ -5642,7 +5642,7 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
case ORIENTATION_PORTRAIT:
ocols = TIFFhowmany(iwidth, owidth);
orows = TIFFhowmany(ilength, olength);
orientation = ORIENTATION_PORTRAIT;
/* orientation = ORIENTATION_PORTRAIT; */
break;
case ORIENTATION_LANDSCAPE:
@ -5651,7 +5651,7 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
x1 = olength;
olength = owidth;
owidth = x1;
orientation = ORIENTATION_LANDSCAPE;
/* orientation = ORIENTATION_LANDSCAPE; */
break;
case ORIENTATION_AUTO:
@ -5665,7 +5665,7 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
{ /* Portrait */
ocols = x1;
orows = x2;
orientation = ORIENTATION_PORTRAIT;
/* orientation = ORIENTATION_PORTRAIT; */
}
else
{ /* Landscape */
@ -5674,7 +5674,7 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
x1 = olength;
olength = owidth;
owidth = x1;
orientation = ORIENTATION_LANDSCAPE;
/* orientation = ORIENTATION_LANDSCAPE; */
}
}
@ -6154,14 +6154,14 @@ extractCompositeRegions(struct image_data *image, struct crop_mask *crop,
uint32 i, trailing_bits, prev_trailing_bits;
uint32 row, first_row, last_row, first_col, last_col;
uint32 src_rowsize, dst_rowsize, src_offset, dst_offset;
uint32 crop_width, crop_length, img_width, img_length;
uint32 crop_width, crop_length, img_width /*, img_length */;
uint32 prev_length, prev_width, composite_width;
uint16 bps, spp;
uint8 *src, *dst;
tsample_t count, sample = 0; /* Update to extract one or more samples */
img_width = image->width;
img_length = image->length;
/* img_length = image->length; */
bps = image->bps;
spp = image->spp;
count = spp;
@ -6404,13 +6404,13 @@ extractSeparateRegion(struct image_data *image, struct crop_mask *crop,
uint32 src_rowsize, dst_rowsize;
uint32 row, first_row, last_row, first_col, last_col;
uint32 src_offset, dst_offset;
uint32 crop_width, crop_length, img_width, img_length;
uint32 crop_width, crop_length, img_width /*, img_length */;
uint16 bps, spp;
uint8 *src, *dst;
tsample_t count, sample = 0; /* Update to extract more or more samples */
img_width = image->width;
img_length = image->length;
/* img_length = image->length; */
bps = image->bps;
spp = image->spp;
count = spp;
@ -6522,14 +6522,22 @@ extractImageSection(struct image_data *image, struct pageseg *section,
unsigned char *src_buff, unsigned char *sect_buff)
{
unsigned char bytebuff1, bytebuff2;
unsigned char *src, *dst;
#ifdef DEVELMODE
/* unsigned char *src, *dst; */
#endif
uint32 img_width, img_length, img_rowsize;
uint32 img_width, img_rowsize;
#ifdef DEVELMODE
uint32 img_length;
#endif
uint32 j, shift1, shift2, trailing_bits;
uint32 row, first_row, last_row, first_col, last_col;
uint32 src_offset, dst_offset, row_offset, col_offset;
uint32 offset1, offset2, full_bytes;
uint32 sect_width, sect_length;
uint32 sect_width;
#ifdef DEVELMODE
uint32 sect_length;
#endif
uint16 bps, spp;
#ifdef DEVELMODE
@ -6539,12 +6547,16 @@ extractImageSection(struct image_data *image, struct pageseg *section,
#endif
img_width = image->width;
#ifdef DEVELMODE
img_length = image->length;
#endif
bps = image->bps;
spp = image->spp;
src = src_buff;
dst = sect_buff;
#ifdef DEVELMODE
/* src = src_buff; */
/* dst = sect_buff; */
#endif
src_offset = 0;
dst_offset = 0;
@ -6566,7 +6578,9 @@ extractImageSection(struct image_data *image, struct pageseg *section,
last_col = section->x2;
sect_width = last_col - first_col + 1;
#ifdef DEVELMODE
sect_length = last_row - first_row + 1;
#endif
img_rowsize = ((img_width * bps + 7) / 8) * spp;
full_bytes = (sect_width * spp * bps) / 8; /* number of COMPLETE bytes per row in section */
trailing_bits = (sect_width * bps) % 8;
@ -8107,8 +8121,8 @@ static int
rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
uint32 length, uint32 col, uint8 *src, uint8 *dst)
{
int ready_bits = 0, shift_width = 0;
int bytes_per_sample, bytes_per_pixel;
int ready_bits = 0 /*, shift_width = 0 */;
/* int bytes_per_sample, bytes_per_pixel; */
uint32 row, rowsize, bit_offset;
uint32 src_byte, src_bit;
uint32 longbuff1 = 0, longbuff2 = 0;
@ -8125,12 +8139,12 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
return (1);
}
bytes_per_sample = (bps + 7) / 8;
bytes_per_pixel = ((bps * spp) + 7) / 8;
if (bytes_per_pixel < (bytes_per_sample + 1))
shift_width = bytes_per_pixel;
else
shift_width = bytes_per_sample + 1;
/* bytes_per_sample = (bps + 7) / 8; */
/* bytes_per_pixel = ((bps * spp) + 7) / 8; */
/* if (bytes_per_pixel < (bytes_per_sample + 1)) */
/* shift_width = bytes_per_pixel; */
/* else */
/* shift_width = bytes_per_sample + 1; */
rowsize = ((bps * spp * width) + 7) / 8;
ready_bits = 0;
@ -8722,8 +8736,8 @@ static int
reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
uint8 *ibuff, uint8 *obuff)
{
int ready_bits = 0, shift_width = 0;
int bytes_per_sample, bytes_per_pixel;
int ready_bits = 0 /*, shift_width = 0 */;
/* int bytes_per_sample, bytes_per_pixel; */
uint32 bit_offset;
uint32 src_byte = 0, high_bit = 0;
uint32 col;
@ -8745,12 +8759,12 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
mask_bits = (uint64)-1 >> (64 - bps);
dst = obuff;
bytes_per_sample = (bps + 7) / 8;
bytes_per_pixel = ((bps * spp) + 7) / 8;
if (bytes_per_pixel < (bytes_per_sample + 1))
shift_width = bytes_per_pixel;
else
shift_width = bytes_per_sample + 1;
/* bytes_per_sample = (bps + 7) / 8; */
/* bytes_per_pixel = ((bps * spp) + 7) / 8; */
/* if (bytes_per_pixel < (bytes_per_sample + 1)) */
/* shift_width = bytes_per_pixel; */
/* else */
/* shift_width = bytes_per_sample + 1; */
for (col = width; col > 0; col--)
{