Skip to content

Commit 68d62c6

Browse files
committed
Rectify some shadowed declarations and warnings in tools and test modules.
1 parent cf118ec commit 68d62c6

File tree

7 files changed

+80
-80
lines changed

7 files changed

+80
-80
lines changed

contrib/iptcutil/iptcutil.c

+16-16
Original file line numberDiff line numberDiff line change
@@ -459,38 +459,38 @@ int main(int argc, char *argv[])
459459
{
460460
if (state == 0)
461461
{
462-
int state, next;
462+
int state2, next2;
463463

464-
char brkused, quoted;
464+
char brkused2, quoted2;
465465

466-
state = 0;
467-
next = 0;
466+
state2 = 0;
467+
next2 = 0;
468468
while (tokenizer(0, newstr, inputlen, token, "", "#", "", 0,
469-
&brkused, &next, &quoted) == 0)
469+
&brkused2, &next2, &quoted2) == 0)
470470
{
471-
if (state == 0)
471+
if (state2 == 0)
472472
dataset = (unsigned char)atoi(newstr);
473-
else if (state == 1)
473+
else if (state2 == 1)
474474
recnum = (unsigned char)atoi(newstr);
475-
state++;
475+
state2++;
476476
}
477477
}
478478
else if (state == 1)
479479
{
480-
int next;
480+
int next2;
481481

482482
unsigned long len;
483483

484-
char brkused, quoted;
484+
char brkused2, quoted2;
485485

486-
next = 0;
486+
next2 = 0;
487487
len = (unsigned long)strlen(token);
488488
while (tokenizer(0, newstr, inputlen, token, "", "&", "", 0,
489-
&brkused, &next, &quoted) == 0)
489+
&brkused2, &next2, &quoted2) == 0)
490490
{
491-
if (brkused && next > 0)
491+
if (brkused2 && next2 > 0)
492492
{
493-
char *s = &token[next - 1];
493+
char *s = &token[next2 - 1];
494494

495495
len -= convertHTMLcodes(s, (int)strlen(s));
496496
}
@@ -511,9 +511,9 @@ int main(int argc, char *argv[])
511511
fputc((len >> 8) & 255, ofile);
512512
fputc(len & 255, ofile);
513513
}
514-
next = 0;
514+
next2 = 0;
515515
while (len--)
516-
fputc(token[next++], ofile);
516+
fputc(token[next2++], ofile);
517517
}
518518
state++;
519519
}

test/rewrite_tag.c

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "tiffio.h"
4040
#include "tiffiop.h"
4141

42-
const uint32_t length = 40;
4342
const uint32_t rows_per_strip = 1;
4443

4544
int test_packbits()

test/test_directory.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ int test_SubIFD_directrory_handling(bool is_big_tiff)
758758
}
759759

760760
tdir_t numberOfMainIFDs = TIFFNumberOfDirectories(tif);
761-
if (numberOfMainIFDs != N_DIRECTORIES - number_of_sub_IFDs)
761+
if (numberOfMainIFDs != (tdir_t)N_DIRECTORIES - number_of_sub_IFDs)
762762
{
763763
fprintf(stderr,
764764
"Unexpected number of directories in %s. Expected %i, "

test/test_transferfunction_write_read.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const uint16_t bps = 8;
3939
const uint16_t photometric = PHOTOMETRIC_RGB;
4040
const uint16_t rows_per_strip = 100; /* up to 2**32-1 */
4141
const uint16_t planarconfig = PLANARCONFIG_CONTIG;
42-
const char *filename = "test_transferfunction_write_read.tif";
4342

4443
/* Data and pointer to three transfer functions. */
4544
uint16_t *pTransferFunctionData;
@@ -266,6 +265,9 @@ int write_basic_IFD_data(TIFF **ptif, const char *filename, int wrtTransferFunct
266265
/*==== main() ====*/
267266
int main()
268267
{
268+
269+
const char *filename = "test_transferfunction_write_read.tif";
270+
269271
if (setup_transfer_functions())
270272
return 1;
271273

test/test_write_read_tags.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ uint32_t listTagsNotFollowPasscountRules[] = {
158158
int check_tag_definitions(void);
159159
int write_test_tiff(TIFF *tif, const char *filenameRead);
160160
int write_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
161-
uint32_t *listTagsNotToWrite, uint32_t nTagsInList,
161+
uint32_t *plistTagsNotToWrite, uint32_t nTagsInList,
162162
uint32_t *iCnt);
163163
int tagIsInList(uint32_t tTag, uint32_t *list, uint32_t nTagsInList);
164164
int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
165-
uint32_t *listTagsNotFollowPasscountRules,
165+
uint32_t *plistTagsNotFollowPasscountRules,
166166
uint32_t nTagsInList);
167167
int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
168-
uint32_t *listTagsNotToWrite, uint32_t nTagsNotToWrite,
168+
uint32_t *plistTagsNotToWrite, uint32_t nTagsNotToWrite,
169169
uint32_t *iCnt);
170170

171171
/* ==== main() ========================================================
@@ -686,7 +686,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
686686
*
687687
*/
688688
int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
689-
uint32_t *listTagsNotFollowPasscountRules,
689+
uint32_t *plistTagsNotFollowPasscountRules,
690690
uint32_t nTagsInList)
691691
{
692692
uint32_t t;
@@ -699,7 +699,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
699699
for (t = 0; t < nTags; t++)
700700
{
701701
if (tagIsInList(tFieldArray->fields[t].field_tag,
702-
listTagsNotFollowPasscountRules, nTagsInList))
702+
plistTagsNotFollowPasscountRules, nTagsInList))
703703
continue;
704704

705705
if (tFieldArray->fields[t].field_writecount !=
@@ -728,7 +728,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
728728
for (t = 0; t < nTags; t++)
729729
{
730730
if (tagIsInList(tFieldArray->fields[t].field_tag,
731-
listTagsNotFollowPasscountRules, nTagsInList))
731+
plistTagsNotFollowPasscountRules, nTagsInList))
732732
continue;
733733

734734
if (tFieldArray->fields[t].field_writecount < 0)
@@ -828,7 +828,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
828828
for (t = 0; t < nTags; t++)
829829
{
830830
if (tagIsInList(tFieldArray->fields[t].field_tag,
831-
listTagsNotFollowPasscountRules, nTagsInList))
831+
plistTagsNotFollowPasscountRules, nTagsInList))
832832
continue;
833833

834834
/* TIFF_SETGET_UNDEFINED tags FIELD_IGNORE tags are not written to file.
@@ -935,7 +935,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
935935
* iCnt is an index into predefined arrays for the values to write.
936936
*/
937937
int write_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
938-
uint32_t *listTagsNotToWrite, uint32_t nTagsInList,
938+
uint32_t *plistTagsNotToWrite, uint32_t nTagsInList,
939939
uint32_t *iCnt)
940940
{
941941

@@ -950,7 +950,7 @@ int write_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
950950
uint32_t variableArrayCount = VARIABLE_ARRAY_SIZE;
951951

952952
uint32_t tTag = tFieldArray->fields[t].field_tag;
953-
if (tagIsInList(tTag, listTagsNotToWrite, nTagsInList))
953+
if (tagIsInList(tTag, plistTagsNotToWrite, nTagsInList))
954954
continue;
955955

956956
TIFFDataType tType =
@@ -1271,7 +1271,7 @@ int tagIsInList(uint32_t tTag, uint32_t *list, uint32_t nTagsInList)
12711271
* The read values are compared to the written ones.
12721272
*/
12731273
int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
1274-
uint32_t *listTagsNotToWrite, uint32_t nTagsNotToWrite,
1274+
uint32_t *plistTagsNotToWrite, uint32_t nTagsNotToWrite,
12751275
uint32_t *iCnt)
12761276
{
12771277

@@ -1315,7 +1315,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
13151315
tFieldArray->fields[t]
13161316
.set_field_type; /* e.g. TIFF_SETGET_C0_FLOAT */
13171317
char *tFieldName = tFieldArray->fields[t].field_name;
1318-
if (tagIsInList(tTag, listTagsNotToWrite, nTagsNotToWrite))
1318+
if (tagIsInList(tTag, plistTagsNotToWrite, nTagsNotToWrite))
13191319
continue;
13201320

13211321
/*-- dependent on set_field_type read value --*/

tools/tiffcp.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -1199,11 +1199,11 @@ typedef void biasFn(void *image, void *bias, uint32_t pixels);
11991199
static void subtract##bits(void *i, void *b, uint32_t pixels) \
12001200
{ \
12011201
uint##bits##_t *image = i; \
1202-
uint##bits##_t *bias = b; \
1202+
uint##bits##_t *biasx = b; \
12031203
while (pixels--) \
12041204
{ \
1205-
*image = *image > *bias ? *image - *bias : 0; \
1206-
image++, bias++; \
1205+
*image = *image > *biasx ? *image - *biasx : 0; \
1206+
image++, biasx++; \
12071207
} \
12081208
}
12091209

@@ -1854,7 +1854,7 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer)
18541854

18551855
DECLAREwriteFunc(writeBufferToContigStrips)
18561856
{
1857-
uint32_t row, rowsperstrip;
1857+
uint32_t row;
18581858
tstrip_t strip = 0;
18591859

18601860
(void)imagewidth;
@@ -1879,7 +1879,6 @@ DECLAREwriteFunc(writeBufferToContigStrips)
18791879
DECLAREwriteFunc(writeBufferToSeparateStrips)
18801880
{
18811881
uint32_t rowsize = imagewidth * spp;
1882-
uint32_t rowsperstrip;
18831882
tsize_t stripsize = TIFFStripSize(out);
18841883
tdata_t obuf;
18851884
tstrip_t strip = 0;
@@ -1915,7 +1914,7 @@ DECLAREwriteFunc(writeBufferToSeparateStrips)
19151914
uint32_t nrows = (row + rowsperstrip > imagelength)
19161915
? imagelength - row
19171916
: rowsperstrip;
1918-
tsize_t stripsize = TIFFVStripSize(out, nrows);
1917+
stripsize = TIFFVStripSize(out, nrows);
19191918

19201919
cpContigBufToSeparateBuf(obuf, (uint8_t *)buf + row * rowsize + s,
19211920
nrows, imagewidth, 0, 0, spp,

0 commit comments

Comments
 (0)