mirror of
https://gitlab.com/libtiff/libtiff.git
synced 2026-01-18 21:51:18 +01:00
Correct -Wformat errors
Fix format string mismatches where the format specifier doesn't match the argument type: - Change %d to %u for unsigned int/uint32_t arguments - Change %u to %d for signed int arguments - Add casts where needed for printf family functions - Use PRIu64/PRIi64 for uint64_t/int64_t arguments Fix -Wformat-nonliteral warnings Add TIFF_ATTRIBUTE((__format__(__printf__, N, 0))) to functions that accept format strings as parameters (va_list style). The 0 indicates no variadic arguments to check since the format is validated at the call site.
This commit is contained in:
@@ -79,15 +79,15 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||
list(APPEND test_flags
|
||||
-pedantic
|
||||
-Wextra
|
||||
)
|
||||
endif()
|
||||
if(broken-warnings)
|
||||
list(APPEND test_flags
|
||||
-Wformat
|
||||
-Wformat-overflow
|
||||
-Wformat-nonliteral
|
||||
-Wformat-signedness
|
||||
-Wformat-truncation
|
||||
)
|
||||
endif()
|
||||
if(broken-warnings)
|
||||
list(APPEND test_flags
|
||||
-Wdeclaration-after-statement
|
||||
-Wconversion
|
||||
-Wsign-conversion
|
||||
|
||||
@@ -291,10 +291,10 @@ int formatIPTC(FILE *ifile, FILE *ofile)
|
||||
|
||||
/* now finish up by formatting this binary data into ASCII equivalent */
|
||||
if (strlen(readable) > 0)
|
||||
fprintf(ofile, "%d#%d#%s=", (unsigned int)dataset,
|
||||
fprintf(ofile, "%u#%u#%s=", (unsigned int)dataset,
|
||||
(unsigned int)recnum, readable);
|
||||
else
|
||||
fprintf(ofile, "%d#%d=", (unsigned int)dataset,
|
||||
fprintf(ofile, "%u#%u=", (unsigned int)dataset,
|
||||
(unsigned int)recnum);
|
||||
/* Silence Coverity Scan warning about tainted_data: Passing tainted
|
||||
* expression *str to formatString, which uses it as an offset. */
|
||||
|
||||
@@ -754,7 +754,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
if (tv_size == 0)
|
||||
{
|
||||
status = 0;
|
||||
TIFFErrorExtR(tif, module, "%s: Bad field type %d for \"%s\"",
|
||||
TIFFErrorExtR(tif, module, "%s: Bad field type %u for \"%s\"",
|
||||
tif->tif_name, fip->field_type, fip->field_name);
|
||||
goto end;
|
||||
}
|
||||
@@ -808,7 +808,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
TIFFWarningExtR(tif, module,
|
||||
"%s: Null count for \"%s\" (type "
|
||||
"%d, writecount %d, passcount %d)",
|
||||
"%u, writecount %d, passcount %d)",
|
||||
tif->tif_name, fip->field_name,
|
||||
fip->field_type, fip->field_writecount,
|
||||
fip->field_passcount);
|
||||
@@ -860,7 +860,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
tif, module,
|
||||
"%s: Bad LONG8 value %" PRIu64
|
||||
" at %d. array position for \"%s\" tag "
|
||||
"%d in ClassicTIFF. Tag won't be "
|
||||
"%u in ClassicTIFF. Tag won't be "
|
||||
"written to file",
|
||||
tif->tif_name, pui64[i], i,
|
||||
fip->field_name, tag);
|
||||
@@ -880,7 +880,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
tif, module,
|
||||
"%s: Bad SLONG8 value %" PRIi64
|
||||
" at %d. array position for \"%s\" tag "
|
||||
"%d in ClassicTIFF. Tag won't be "
|
||||
"%u in ClassicTIFF. Tag won't be "
|
||||
"written to file",
|
||||
tif->tif_name, pi64[i], i,
|
||||
fip->field_name, tag);
|
||||
@@ -948,7 +948,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"%s: Bad LONG8 or IFD8 value %" PRIu64
|
||||
" for \"%s\" tag %d in ClassicTIFF. Tag "
|
||||
" for \"%s\" tag %u in ClassicTIFF. Tag "
|
||||
"won't be written to file",
|
||||
tif->tif_name, v2, fip->field_name, tag);
|
||||
goto badvalueifd8long8;
|
||||
@@ -967,7 +967,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"%s: Bad SLONG8 value %" PRIi64
|
||||
" for \"%s\" tag %d in ClassicTIFF. Tag "
|
||||
" for \"%s\" tag %u in ClassicTIFF. Tag "
|
||||
"won't be written to file",
|
||||
tif->tif_name, v2, fip->field_name, tag);
|
||||
goto badvalueifd8long8;
|
||||
|
||||
@@ -678,7 +678,7 @@ void _TIFFPrintFieldInfo(TIFF *tif, FILE *fd)
|
||||
for (i = 0; i < tif->tif_nfields; i++)
|
||||
{
|
||||
const TIFFField *fip = tif->tif_fields[i];
|
||||
fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n",
|
||||
fprintf(fd, "field[%2d] %5lu, %2d, %2d, %u, %2d, %5s, %5s, %s\n",
|
||||
(int)i, (unsigned long)fip->field_tag, fip->field_readcount,
|
||||
fip->field_writecount, fip->field_type, fip->field_bit,
|
||||
fip->field_oktochange ? "TRUE" : "FALSE",
|
||||
|
||||
@@ -5822,7 +5822,7 @@ int _TIFFCheckDirNumberAndOffset(TIFF *tif, tdir_t dirn, uint64_t diroff)
|
||||
{
|
||||
TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
|
||||
"Cannot handle more than %u TIFF directories",
|
||||
TIFF_MAX_DIR_COUNT);
|
||||
(unsigned)TIFF_MAX_DIR_COUNT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ static const char *StateNames[] = {
|
||||
{ \
|
||||
if (pa >= thisrun + sp->nruns) \
|
||||
{ \
|
||||
TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u", \
|
||||
TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", \
|
||||
isTiled(tif) ? tif->tif_curtile \
|
||||
: tif->tif_curstrip); \
|
||||
@@ -444,7 +444,7 @@ static const char *StateNames[] = {
|
||||
if (pb + 1 >= sp->refruns + sp->nruns) \
|
||||
{ \
|
||||
TIFFErrorExtR( \
|
||||
tif, module, "Buffer overflow at line %u of %s %u", \
|
||||
tif, module, "Buffer overflow at line %d of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", \
|
||||
isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip); \
|
||||
return (-1); \
|
||||
@@ -465,7 +465,7 @@ static const char *StateNames[] = {
|
||||
if (pa >= thisrun + sp->nruns) \
|
||||
{ \
|
||||
TIFFErrorExtR( \
|
||||
tif, module, "Buffer overflow at line %u of %s %u", \
|
||||
tif, module, "Buffer overflow at line %d of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", \
|
||||
isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip); \
|
||||
return (-1); \
|
||||
@@ -478,7 +478,7 @@ static const char *StateNames[] = {
|
||||
if (pb + 1 >= sp->refruns + sp->nruns) \
|
||||
{ \
|
||||
TIFFErrorExtR(tif, module, \
|
||||
"Buffer overflow at line %u of %s %u", \
|
||||
"Buffer overflow at line %d of %s %u", \
|
||||
sp->line, \
|
||||
isTiled(tif) ? "tile" : "strip", \
|
||||
isTiled(tif) ? tif->tif_curtile \
|
||||
@@ -577,7 +577,7 @@ static const char *StateNames[] = {
|
||||
if (pb >= sp->refruns + sp->nruns) \
|
||||
{ \
|
||||
TIFFErrorExtR(tif, module, \
|
||||
"Buffer overflow at line %u of %s %u", \
|
||||
"Buffer overflow at line %d of %s %u", \
|
||||
sp->line, \
|
||||
isTiled(tif) ? "tile" : "strip", \
|
||||
isTiled(tif) ? tif->tif_curtile \
|
||||
@@ -592,7 +592,7 @@ static const char *StateNames[] = {
|
||||
if (pb >= sp->refruns + sp->nruns) \
|
||||
{ \
|
||||
TIFFErrorExtR(tif, module, \
|
||||
"Buffer overflow at line %u of %s %u", \
|
||||
"Buffer overflow at line %d of %s %u", \
|
||||
sp->line, \
|
||||
isTiled(tif) ? "tile" : "strip", \
|
||||
isTiled(tif) ? tif->tif_curtile \
|
||||
|
||||
@@ -617,7 +617,7 @@ int TIFFRGBAImageGet(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
{
|
||||
TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
|
||||
"Error in TIFFRGBAImageGet: row offset %d exceeds "
|
||||
"image height %d",
|
||||
"image height %u",
|
||||
img->row_offset, img->height);
|
||||
return 0;
|
||||
}
|
||||
@@ -757,7 +757,7 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtTileContig: column offset %d exceeds "
|
||||
"image width %d",
|
||||
"image width %u",
|
||||
img->col_offset, img->width);
|
||||
return 0;
|
||||
}
|
||||
@@ -930,7 +930,7 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtTileSeparate: column offset %d exceeds "
|
||||
"image width %d",
|
||||
"image width %u",
|
||||
img->col_offset, img->width);
|
||||
return 0;
|
||||
}
|
||||
@@ -1161,7 +1161,7 @@ static int gtStripContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtStripContig: column offset %d exceeds "
|
||||
"image width %d",
|
||||
"image width %u",
|
||||
img->col_offset, imagewidth);
|
||||
return 0;
|
||||
}
|
||||
@@ -1306,7 +1306,7 @@ static int gtStripSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtStripSeparate: column offset %d exceeds "
|
||||
"image width %d",
|
||||
"image width %u",
|
||||
img->col_offset, imagewidth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -440,12 +440,12 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
if (infoArray[0] != (unsigned)sp->lerc_version)
|
||||
{
|
||||
TIFFWarningExtR(tif, module,
|
||||
"Unexpected version number: %d. Expected: %d",
|
||||
"Unexpected version number: %u. Expected: %d",
|
||||
infoArray[0], sp->lerc_version);
|
||||
}
|
||||
if (infoArray[1] != (unsigned)lerc_data_type)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected dataType: %d. Expected: %d",
|
||||
TIFFErrorExtR(tif, module, "Unexpected dataType: %u. Expected: %d",
|
||||
infoArray[1], lerc_data_type);
|
||||
return 0;
|
||||
}
|
||||
@@ -458,7 +458,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
if (nFoundDims != 1 && nFoundDims != (unsigned)ndims)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nDim: %d. Expected: 1 or %d",
|
||||
TIFFErrorExtR(tif, module, "Unexpected nDim: %u. Expected: 1 or %d",
|
||||
nFoundDims, ndims);
|
||||
return 0;
|
||||
}
|
||||
@@ -467,20 +467,20 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
#endif
|
||||
if (nFoundDims != (unsigned)ndims)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nDim: %d. Expected: %d",
|
||||
TIFFErrorExtR(tif, module, "Unexpected nDim: %u. Expected: %d",
|
||||
nFoundDims, ndims);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (infoArray[3] != sp->segment_width)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nCols: %d. Expected: %du",
|
||||
TIFFErrorExtR(tif, module, "Unexpected nCols: %u. Expected: %u",
|
||||
infoArray[3], sp->segment_width);
|
||||
return 0;
|
||||
}
|
||||
if (infoArray[4] != sp->segment_height)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nRows: %d. Expected: %u",
|
||||
TIFFErrorExtR(tif, module, "Unexpected nRows: %u. Expected: %u",
|
||||
infoArray[4], sp->segment_height);
|
||||
return 0;
|
||||
}
|
||||
@@ -504,21 +504,21 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
#endif
|
||||
if (nFoundBands != td->td_samplesperpixel)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nBands: %d. Expected: %d",
|
||||
TIFFErrorExtR(tif, module, "Unexpected nBands: %u. Expected: %d",
|
||||
nFoundBands, td->td_samplesperpixel);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (nFoundBands != 1)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nBands: %d. Expected: %d",
|
||||
TIFFErrorExtR(tif, module, "Unexpected nBands: %u. Expected: %d",
|
||||
nFoundBands, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (infoArray[7] != lerc_data_size)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected blobSize: %d. Expected: %u",
|
||||
TIFFErrorExtR(tif, module, "Unexpected blobSize: %u. Expected: %u",
|
||||
infoArray[7], lerc_data_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ static void PredictorPrintDir(TIFF *tif, FILE *fd, long flags)
|
||||
fprintf(fd, "floating point predictor ");
|
||||
break;
|
||||
}
|
||||
fprintf(fd, "%d (0x%x)\n", sp->predictor, sp->predictor);
|
||||
fprintf(fd, "%d (0x%x)\n", sp->predictor, (unsigned)sp->predictor);
|
||||
}
|
||||
if (sp->printdir)
|
||||
(*sp->printdir)(tif, fd, flags);
|
||||
|
||||
@@ -744,7 +744,7 @@ static void _TIFFprintAsciiBounded(FILE *fd, const char *cp, size_t max_chars)
|
||||
if (*tp)
|
||||
fprintf(fd, "\\%c", *tp);
|
||||
else
|
||||
fprintf(fd, "\\%03o", *cp & 0xff);
|
||||
fprintf(fd, "\\%03o", (unsigned int)(*cp & 0xff));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,7 +362,8 @@ int _TIFFmemcmp(const void *p1, const void *p2, tmsize_t c)
|
||||
return (memcmp(p1, p2, (size_t)c));
|
||||
}
|
||||
|
||||
static void unixWarningHandler(const char *module, const char *fmt, va_list ap)
|
||||
static void TIFF_ATTRIBUTE((__format__(__printf__, 2, 0)))
|
||||
unixWarningHandler(const char *module, const char *fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
fprintf(stderr, "%s: ", module);
|
||||
@@ -372,7 +373,8 @@ static void unixWarningHandler(const char *module, const char *fmt, va_list ap)
|
||||
}
|
||||
TIFFErrorHandler _TIFFwarningHandler = unixWarningHandler;
|
||||
|
||||
static void unixErrorHandler(const char *module, const char *fmt, va_list ap)
|
||||
static void TIFF_ATTRIBUTE((__format__(__printf__, 2, 0)))
|
||||
unixErrorHandler(const char *module, const char *fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
fprintf(stderr, "%s: ", module);
|
||||
|
||||
@@ -710,7 +710,7 @@ static int TWebPPostEncode(TIFF *tif)
|
||||
break;
|
||||
default:
|
||||
TIFFErrorExtR(tif, module,
|
||||
"WebPEncode returned an unknown error code: %d",
|
||||
"WebPEncode returned an unknown error code: %u",
|
||||
sp->sPicture.error_code);
|
||||
pszErrorMsg = "Unknown WebP error type.";
|
||||
break;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
@@ -343,7 +344,7 @@ TIFF *TIFFOpenWExt(const wchar_t *name, const char *mode, TIFFOpenOptions *opts)
|
||||
NULL);
|
||||
if (fd == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
_TIFFErrorEarly(opts, NULL, module, "%S: Cannot open", name);
|
||||
_TIFFErrorEarly(opts, NULL, module, "%ls: Cannot open", name);
|
||||
return ((TIFF *)0);
|
||||
}
|
||||
|
||||
|
||||
@@ -790,7 +790,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WriteCount for .set_get_field_type %d should be "
|
||||
"WriteCount for .set_get_field_type %u should be "
|
||||
"1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[i].field_name);
|
||||
}
|
||||
@@ -809,9 +809,10 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"WriteCount for .set_get_field_type %d should be -1 or "
|
||||
"WriteCount for .set_get_field_type %u should be -1 or "
|
||||
"greater than 1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[i].field_name);
|
||||
(unsigned)tSetFieldType,
|
||||
tFieldArray->fields[i].field_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -882,7 +883,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within writing switch for "
|
||||
"SetFieldType %u not defined within writing switch for "
|
||||
"%s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
}; /*-- switch() --*/
|
||||
@@ -896,9 +897,10 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
if (tWriteCount == 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WriteCount for .set_get_field_type %d should be -1 or "
|
||||
"WriteCount for .set_get_field_type %u should be -1 or"
|
||||
"greater than 1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[i].field_name);
|
||||
(unsigned)tSetFieldType,
|
||||
tFieldArray->fields[i].field_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -995,8 +997,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value of IMAGEWIDTH %" PRIu32
|
||||
" differs from set value %" PRIu16 "\n",
|
||||
auxUint32, width);
|
||||
" differs from set value %u\n",
|
||||
auxUint32, (unsigned int)width);
|
||||
}
|
||||
retCode = TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &auxUint32);
|
||||
if (!retCode)
|
||||
@@ -1007,8 +1009,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value of TIFFTAG_IMAGELENGTH %" PRIu32
|
||||
" differs from set value %" PRIu16 "\n",
|
||||
auxUint32, length);
|
||||
" differs from set value %u\n",
|
||||
auxUint32, (unsigned int)length);
|
||||
}
|
||||
|
||||
#ifdef ADDITIONAL_TAGS
|
||||
@@ -1670,7 +1672,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"Reading: WriteCount for .set_get_field_type %d should "
|
||||
"Reading: WriteCount for .set_get_field_type %u should "
|
||||
"be -1 or greater than 1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[i].field_name);
|
||||
}
|
||||
@@ -1795,7 +1797,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within writing switch for "
|
||||
"SetFieldType %u not defined within writing switch for "
|
||||
"%s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
GOTOFAILURE
|
||||
@@ -1810,9 +1812,10 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
if (tWriteCount == 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WriteCount for .set_get_field_type %d should be -1 or "
|
||||
"WriteCount for .set_get_field_type %u should be -1 or"
|
||||
"greater than 1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[i].field_name);
|
||||
(unsigned)tSetFieldType,
|
||||
tFieldArray->fields[i].field_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1938,7 +1941,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within switch case "
|
||||
"SetFieldType %u not defined within switch case "
|
||||
"reading for UINT for %s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
GOTOFAILURE
|
||||
|
||||
@@ -157,7 +157,7 @@ int test(int classictif, int height, int tiled)
|
||||
if (offset > INT32_MAX)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Offset %" PRId64 " exceeds fseek limit.\n",
|
||||
"Offset %" PRIu64 " exceeds fseek limit.\n",
|
||||
offset);
|
||||
TIFFClose(tif);
|
||||
fclose(f);
|
||||
@@ -225,7 +225,7 @@ int test(int classictif, int height, int tiled)
|
||||
if (offset > INT32_MAX)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Offset %" PRId64 " exceeds fseek limit.\n",
|
||||
"Offset %" PRIu64 " exceeds fseek limit.\n",
|
||||
offset);
|
||||
TIFFClose(tif);
|
||||
fclose(f);
|
||||
|
||||
@@ -648,7 +648,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"WriteCount for .set_get_field_type %d should "
|
||||
"WriteCount for .set_get_field_type %u should "
|
||||
"be 1! %s\n",
|
||||
tSetFieldType,
|
||||
tFieldArray->fields[i].field_name);
|
||||
@@ -668,7 +668,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"WriteCount for .set_get_field_type %d should "
|
||||
"WriteCount for .set_get_field_type %u should "
|
||||
"be -1 or greater than 1! %s\n",
|
||||
tSetFieldType,
|
||||
tFieldArray->fields[i].field_name);
|
||||
@@ -713,7 +713,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within writing "
|
||||
"SetFieldType %u not defined within writing "
|
||||
"switch for %s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
}; /*-- switch() --*/
|
||||
@@ -756,8 +756,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
if (auxUint32 != width)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value of IMAGEWIDTH %d differs from set value %d\n",
|
||||
auxUint32, width);
|
||||
"Read value of IMAGEWIDTH %u differs from set value %u\n",
|
||||
auxUint32, (unsigned int)width);
|
||||
GOTOFAILURE
|
||||
}
|
||||
retCode = TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &auxUint32);
|
||||
@@ -765,8 +765,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"Read value of TIFFTAG_IMAGELENGTH %d differs from set value %d\n",
|
||||
auxUint32, length);
|
||||
"Read value of TIFFTAG_IMAGELENGTH %u differs from set value %u\n",
|
||||
auxUint32, (unsigned int)length);
|
||||
GOTOFAILURE
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
fprintf(
|
||||
stderr,
|
||||
"Reading: WriteCount for .set_get_field_type "
|
||||
"%d should be -1 or greater than 1! %s\n",
|
||||
"%u should be -1 or greater than 1! %s\n",
|
||||
tSetFieldType,
|
||||
tFieldArray->fields[i].field_name);
|
||||
GOTOFAILURE
|
||||
@@ -1308,7 +1308,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within reading "
|
||||
"SetFieldType %u not defined within reading "
|
||||
"switch for %s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
}; /*-- switch() --*/
|
||||
|
||||
@@ -114,9 +114,9 @@ static int check_rgba_pixel(int pixel, int min_red, int max_red, int min_green,
|
||||
fprintf(stderr,
|
||||
"Got R=%d (expected %d..%d), G=%d (expected %d..%d), B=%d "
|
||||
"(expected %d..%d), A=%d (expected %d..%d)\n",
|
||||
TIFFGetR(rgba), min_red, max_red, TIFFGetG(rgba), min_green,
|
||||
max_green, TIFFGetB(rgba), min_blue, max_blue, TIFFGetA(rgba),
|
||||
min_alpha, max_alpha);
|
||||
(int)TIFFGetR(rgba), min_red, max_red, (int)TIFFGetG(rgba),
|
||||
min_green, max_green, (int)TIFFGetB(rgba), min_blue, max_blue,
|
||||
(int)TIFFGetA(rgba), min_alpha, max_alpha);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,10 +292,11 @@ int rewrite_test(const char *filename, uint32_t width, int length, int bigtiff,
|
||||
if (rowoffset[i] != expect)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s:STRIPOFFSETS[%d]: Got %X:%08X instead of %X:%08X.\n",
|
||||
filename, i, (int)(rowoffset[i] >> 32),
|
||||
(int)(rowoffset[i] & 0xFFFFFFFF), (int)(expect >> 32),
|
||||
(int)(expect & 0xFFFFFFFF));
|
||||
"%s:STRIPOFFSETS[%u]: Got %X:%08X instead of %X:%08X.\n",
|
||||
filename, (unsigned)i, (unsigned)(rowoffset[i] >> 32),
|
||||
(unsigned)(rowoffset[i] & 0xFFFFFFFF),
|
||||
(unsigned)(expect >> 32),
|
||||
(unsigned)(expect & 0xFFFFFFFF));
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
@@ -313,10 +314,11 @@ int rewrite_test(const char *filename, uint32_t width, int length, int bigtiff,
|
||||
if (rowbytes[i] != expect)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s:STRIPBYTECOUNTS[%d]: Got %X:%08X instead of %X:%08X.\n",
|
||||
filename, i, (int)(rowbytes[i] >> 32),
|
||||
(int)(rowbytes[i] & 0xFFFFFFFF), (int)(expect >> 32),
|
||||
(int)(expect & 0xFFFFFFFF));
|
||||
"%s:STRIPBYTECOUNTS[%u]: Got %X:%08X instead of %X:%08X.\n",
|
||||
filename, (unsigned)i, (unsigned)(rowbytes[i] >> 32),
|
||||
(unsigned)(rowbytes[i] & 0xFFFFFFFF),
|
||||
(unsigned)(expect >> 32),
|
||||
(unsigned)(expect & 0xFFFFFFFF));
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1271,7 +1271,7 @@ int test_SubIFD_enlargement(const char *filename, bool is_big_tiff)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Unexpected number of directories in %s. Expected %i, "
|
||||
"found %i.\n",
|
||||
"found %u.\n",
|
||||
filename, NUMBER_OF_DIRS - number_of_sub_IFDs,
|
||||
numberOfMainIFDs);
|
||||
goto failure;
|
||||
|
||||
@@ -181,8 +181,8 @@ const char *orientationStrings[] = {
|
||||
{ \
|
||||
fprintf( \
|
||||
stdXOut, \
|
||||
"Can't write image data scanline %d sample %d of %s at line %d\n", \
|
||||
row, sample, filename, line); \
|
||||
"Can't write image data scanline %u sample %u of %s at line %d\n", \
|
||||
(unsigned)(row), (unsigned)(sample), filename, line); \
|
||||
goto failure; \
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ int checkRasterContents(char *txt, TIFFRGBAImage *img, uint32_t *raster,
|
||||
{
|
||||
fprintf(stdXOut,
|
||||
"\nPixel value of P%d = (%d, %d, %d)/(%02x, %02x, %02x) in "
|
||||
"raster at offset %d does not match expected value "
|
||||
"raster at offset %u does not match expected value "
|
||||
"(%d, "
|
||||
"%d, %d)/(%02x, %02x, %02x)",
|
||||
i, a.u8[0], a.u8[1], a.u8[2], a.u8[0], a.u8[1], a.u8[2],
|
||||
@@ -683,8 +683,8 @@ void printRaster(char *txt, TIFFRGBAImage *img, uint32_t *raster, uint32_t rw,
|
||||
if (img->col_offset != 0 || img->row_offset != 0)
|
||||
{
|
||||
sprintf(straux,
|
||||
"\n--- (%3d /%3d) Orientation = %d (%s) %s, %s readWidth = %d, "
|
||||
"readLength = %d, col_off = %d, row_off = %d, "
|
||||
"\n--- (%3u /%3u) Orientation = %d (%s) %s, %s readWidth = %u, "
|
||||
"readLength = %u, col_off = %d, row_off = %d, "
|
||||
"req_orientation=%d (%s) using %s---\n",
|
||||
img->width, img->height, orientation,
|
||||
orientationStrings[orientation],
|
||||
@@ -696,8 +696,8 @@ void printRaster(char *txt, TIFFRGBAImage *img, uint32_t *raster, uint32_t rw,
|
||||
else
|
||||
{
|
||||
sprintf(straux,
|
||||
"\n--- (%3d /%3d) Orientation = %d (%s) %s, %s readWidth = %d, "
|
||||
"readLength = %d, req_orientation=%d (%s) using "
|
||||
"\n--- (%3u /%3u) Orientation = %d (%s) %s, %s readWidth = %u, "
|
||||
"readLength = %u, req_orientation=%d (%s) using "
|
||||
"%s---\n",
|
||||
img->width, img->height, orientation,
|
||||
orientationStrings[orientation],
|
||||
|
||||
@@ -71,7 +71,7 @@ int CheckCurDirNum(TIFF *tif, tdir_t expected_dirnum, int line)
|
||||
if (curdir != expected_dirnum)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Error: curdir %d is different to expected one %d at line %d\n",
|
||||
"Error: curdir %u is different to expected one %u at line %d\n",
|
||||
curdir, expected_dirnum, line);
|
||||
return 1;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ int CheckCurDirNum(TIFF *tif, tdir_t expected_dirnum, int line)
|
||||
#define TIFFCheckpointDirectory_M(tif, dirnum, filename, line) \
|
||||
if (!TIFFCheckpointDirectory(tif)) \
|
||||
{ \
|
||||
fprintf(stderr, "Can't checkpoint directory %d of %s at line %d\n", \
|
||||
fprintf(stderr, "Can't checkpoint directory %u of %s at line %d\n", \
|
||||
dirnum, filename, line); \
|
||||
goto failure; \
|
||||
}
|
||||
@@ -97,7 +97,7 @@ int CheckCurDirNum(TIFF *tif, tdir_t expected_dirnum, int line)
|
||||
#define TIFFSetDirectory_M(tif, dirnum, filename, line) \
|
||||
if (!TIFFSetDirectory(tif, dirnum)) \
|
||||
{ \
|
||||
fprintf(stderr, "Can't set directory %d of %s at line %d\n", dirnum, \
|
||||
fprintf(stderr, "Can't set directory %u of %s at line %d\n", dirnum, \
|
||||
filename, line); \
|
||||
goto failure; \
|
||||
}
|
||||
@@ -357,7 +357,7 @@ int test_arbitrary_directrory_loading(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -816,7 +816,7 @@ int test_SubIFD_directrory_handling(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -899,7 +899,7 @@ int test_SubIFD_directrory_handling(unsigned int openMode)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Unexpected number of directories in %s. Expected %i, "
|
||||
"found %i.\n",
|
||||
"found %u.\n",
|
||||
filename, N_DIRECTORIES - number_of_sub_IFDs, numberOfMainIFDs);
|
||||
goto failure;
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ int test_SetSubDirectory_failure(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -1235,7 +1235,7 @@ int test_rewrite_lastdir_offset(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -1395,7 +1395,7 @@ int test_lastdir_offset(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -1499,7 +1499,7 @@ int test_lastdir_offset(unsigned int openMode)
|
||||
if (get_dir_offsets(filename, offsets_comparison, mode))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Error reading directory offsets from %s in mode %d.\n",
|
||||
"Error reading directory offsets from %s in mode %u.\n",
|
||||
filename, mode);
|
||||
goto failure;
|
||||
}
|
||||
@@ -1590,7 +1590,7 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -1810,7 +1810,7 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
|
||||
CHECKCURDIRNUM_M(tif, expected_curdir, __LINE__);
|
||||
expected_curdir++;
|
||||
/* Second loop starts with IFD 0 read from file. */
|
||||
TIFFSetDirectory_M(tif, 0, filename, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 0u, filename, __LINE__);
|
||||
TIFFCreateDirectory(tif);
|
||||
}
|
||||
|
||||
@@ -1871,7 +1871,7 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
|
||||
expected_curdir++;
|
||||
|
||||
/* Second loop starts with IFD 0 read from file. */
|
||||
TIFFSetDirectory_M(tif, 0, filename, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 0u, filename, __LINE__);
|
||||
TIFFCreateDirectory(tif);
|
||||
}
|
||||
|
||||
@@ -1913,10 +1913,10 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
|
||||
CHECKCURDIRNUM_M(tif, expected_curdir, __LINE__);
|
||||
expected_curdir++;
|
||||
}
|
||||
TIFFSetDirectory_M(tif, 0, filename, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 0u, filename, __LINE__);
|
||||
offsetBase[0] = TIFFCurrentDirOffset(tif);
|
||||
CHECKCURDIRNUM_M(tif, 0, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 1, filename, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 1u, filename, __LINE__);
|
||||
offsetBase[1] = TIFFCurrentDirOffset(tif);
|
||||
CHECKCURDIRNUM_M(tif, 1, __LINE__);
|
||||
/* TIFFReadDirectory() shall fail but curdir shall be incremented,
|
||||
@@ -1932,7 +1932,7 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
|
||||
}
|
||||
offsetBase[2] = TIFFCurrentDirOffset(tif);
|
||||
CHECKCURDIRNUM_M(tif, 2, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 0, filename, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 0u, filename, __LINE__);
|
||||
CHECKCURDIRNUM_M(tif, 0, __LINE__);
|
||||
/* TIFFSetDirectory() shall fail on IFD2 but curdir shall be incremented,
|
||||
* because parts of corrupt IFD2 are read in. */
|
||||
@@ -1947,7 +1947,7 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
|
||||
CHECKCURDIRNUM_M(tif, 2, __LINE__);
|
||||
/* Also TIFFSetSubDirectory() shall fail for IFD2 and curdir shall be
|
||||
* set correctly to 2. Therefore, set it back to IFD0 first. */
|
||||
TIFFSetDirectory_M(tif, 0, filename, __LINE__);
|
||||
TIFFSetDirectory_M(tif, 0u, filename, __LINE__);
|
||||
CHECKCURDIRNUM_M(tif, 0, __LINE__);
|
||||
if (TIFFSetSubDirectory(tif, offsetBase[2]))
|
||||
{
|
||||
@@ -2121,7 +2121,7 @@ int test_curdircount_setting(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
@@ -2214,7 +2214,7 @@ int test_solitary_custom_directory(unsigned int openMode)
|
||||
|
||||
if (openMode >= (sizeof(openModeStrings) / sizeof(openModeStrings[0])))
|
||||
{
|
||||
fprintf(stderr, "Index %d for openMode parameter out of range.\n",
|
||||
fprintf(stderr, "Index %u for openMode parameter out of range.\n",
|
||||
openMode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,9 @@ typedef struct MyErrorHandlerUserDataStruct
|
||||
char module[64];
|
||||
} MyErrorHandlerUserDataStruct;
|
||||
|
||||
static int myErrorHandler(TIFF *tiff, void *user_data, const char *module,
|
||||
const char *fmt, va_list ap)
|
||||
static int TIFF_ATTRIBUTE((__format__(__printf__, 4, 0)))
|
||||
myErrorHandler(TIFF *tiff, void *user_data, const char *module,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
MyErrorHandlerUserDataStruct *errorhandler_user_data =
|
||||
(MyErrorHandlerUserDataStruct *)user_data;
|
||||
@@ -287,11 +288,11 @@ int test_header_byte_order(TIFF *tif, char *openModeString)
|
||||
(tif->tif_header.common.tiff_version != TIFF_VERSION_BIG))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Bad version number %" PRIu16 " (0x%4.4" PRIx16
|
||||
") for '%s'. Should be 0x%4.4" PRIx16 ".\n",
|
||||
tif->tif_header.common.tiff_version,
|
||||
tif->tif_header.common.tiff_version, openModeString,
|
||||
TIFF_VERSION_CLASSIC);
|
||||
"Bad version number %u (0x%4.4x"
|
||||
") for '%s'. Should be 0x%4.4x.\n",
|
||||
(unsigned int)tif->tif_header.common.tiff_version,
|
||||
(unsigned int)tif->tif_header.common.tiff_version, openModeString,
|
||||
(unsigned int)TIFF_VERSION_CLASSIC);
|
||||
return 1;
|
||||
}
|
||||
if (TIFFIsBigTIFF(tif))
|
||||
|
||||
@@ -638,7 +638,7 @@ static int readTestTiff_ignore_some_tags(const char *szFileName)
|
||||
if (ret != 0)
|
||||
{
|
||||
fprintf(stdout,
|
||||
"Error: Tag %d, set to be ignored, has been read from file.\n",
|
||||
"Error: Tag %u, set to be ignored, has been read from file.\n",
|
||||
tiff_field_info[2].field_tag);
|
||||
GOTOFAILURE
|
||||
}
|
||||
@@ -647,7 +647,7 @@ static int readTestTiff_ignore_some_tags(const char *szFileName)
|
||||
if (ret != 0)
|
||||
{
|
||||
fprintf(stdout,
|
||||
"Error: Tag %d, set to be ignored, has been read from file.\n",
|
||||
"Error: Tag %u, set to be ignored, has been read from file.\n",
|
||||
tiff_field_info[4].field_tag);
|
||||
GOTOFAILURE
|
||||
}
|
||||
|
||||
@@ -566,8 +566,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value of IMAGEWIDTH %" PRIu32
|
||||
" differs from set value %" PRIu16 ".\n",
|
||||
auxUint32, width);
|
||||
" differs from set value %u.\n",
|
||||
auxUint32, (unsigned int)width);
|
||||
goto failure;
|
||||
}
|
||||
if (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &auxUint32))
|
||||
@@ -579,8 +579,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value of TIFFTAG_IMAGELENGTH %" PRIu32
|
||||
" differs from set value %" PRIu16 ".\n",
|
||||
auxUint32, length);
|
||||
" differs from set value %u.\n",
|
||||
auxUint32, (unsigned int)length);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
@@ -596,9 +596,8 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
|
||||
if (auxUint16 != NINKS)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value of TIFFTAG_NUMBEROFINKS %" PRIu32
|
||||
" differs from set value %" PRIu16 ".\n",
|
||||
auxUint16, NINKS);
|
||||
"Read value of TIFFTAG_NUMBEROFINKS %u differs from set value %u.\n",
|
||||
auxUint16, (unsigned int)NINKS);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
@@ -854,7 +853,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr,
|
||||
"WriteCount %d for tag \t%-25s does not fit to "
|
||||
"'set_get_field_type' %d. "
|
||||
"'set_get_field_type' %u. "
|
||||
"Should be TIFF_VARIABLE2=-3\n",
|
||||
tFieldArray->fields[t].field_writecount,
|
||||
tFieldArray->fields[t].field_name,
|
||||
@@ -881,7 +880,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr,
|
||||
"WriteCount %d for tag \t%-25s does not fit to "
|
||||
"'set_get_field_type' %d. "
|
||||
"'set_get_field_type' %u. "
|
||||
"Should be TIFF_VARIABLE=-1\n",
|
||||
tFieldArray->fields[t].field_writecount,
|
||||
tFieldArray->fields[t].field_name,
|
||||
@@ -906,7 +905,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr,
|
||||
"WriteCount %d for tag \t%-25s does not fit to "
|
||||
"'set_get_field_type' %d. "
|
||||
"'set_get_field_type' %u. "
|
||||
"Should be >1. \n",
|
||||
tFieldArray->fields[t].field_writecount,
|
||||
tFieldArray->fields[t].field_name,
|
||||
@@ -924,7 +923,7 @@ int testPasscountFlag(const char *szMsg, const TIFFFieldArray *tFieldArray,
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr,
|
||||
"WriteCount %d for tag \t%-25s does not fit to "
|
||||
"'set_get_field_type' %d. "
|
||||
"'set_get_field_type' %u. "
|
||||
"Should be 1. \n",
|
||||
tFieldArray->fields[t].field_writecount,
|
||||
tFieldArray->fields[t].field_name,
|
||||
@@ -1109,7 +1108,7 @@ int write_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WriteCount for .set_get_field_type %d should be "
|
||||
"WriteCount for .set_get_field_type %u should be "
|
||||
"1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[t].field_name);
|
||||
}
|
||||
@@ -1197,7 +1196,7 @@ int write_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within writing switch for "
|
||||
"SetFieldType %u not defined within writing switch for "
|
||||
"%s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
}; /*-- switch(tSetFieldType) --*/
|
||||
@@ -1213,7 +1212,7 @@ int write_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (tWriteCount == 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WriteCount for .set_get_field_type %d should be -1 or "
|
||||
"WriteCount for .set_get_field_type %u should be -1 or "
|
||||
"greater than 1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[t].field_name);
|
||||
}
|
||||
@@ -1356,7 +1355,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (retCode2 != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %s differs from set value "
|
||||
"%u:Read value of %s %s differs from set value "
|
||||
"%s\n",
|
||||
i, tFieldName, auxCharArray, auxTextArrayW[i]);
|
||||
GOTOFAILURE
|
||||
@@ -1400,7 +1399,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxInt32 != (char)auxInt32ArrayW[i])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %d differs from set "
|
||||
"%u:Read value of %s %d differs from set "
|
||||
"value %d\n",
|
||||
i, tFieldName, auxInt32, auxInt32ArrayW[i]);
|
||||
}
|
||||
@@ -1419,7 +1418,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxInt32 != (short)auxInt32ArrayW[i])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %d differs from set "
|
||||
"%u:Read value of %s %d differs from set "
|
||||
"value %d\n",
|
||||
i, tFieldName, auxInt32, auxInt32ArrayW[i]);
|
||||
GOTOFAILURE
|
||||
@@ -1438,7 +1437,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
auxShortArray[1] != auxInt32ArrayW[i])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %d/%d UINT16_PAIR differs "
|
||||
"%u:Read value of %s %d/%d UINT16_PAIR differs "
|
||||
"from set "
|
||||
"values %d/%d\n",
|
||||
i, tFieldName, auxShortArray[0], auxShortArray[1],
|
||||
@@ -1470,9 +1469,9 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxUint32 != auxU)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %d differs "
|
||||
"%u:Read value of %s %u differs "
|
||||
"from set "
|
||||
"value %d\n",
|
||||
"value %u\n",
|
||||
i, tFieldName, auxUint32, auxU);
|
||||
GOTOFAILURE
|
||||
}
|
||||
@@ -1480,7 +1479,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %d differs from set "
|
||||
"%u:Read value of %s %d differs from set "
|
||||
"value %d\n",
|
||||
i, tFieldName, auxInt32, auxInt32ArrayW[i]);
|
||||
GOTOFAILURE
|
||||
@@ -1500,7 +1499,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxUint64 != (uint64_t)auxInt32ArrayW[i])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %" PRIu64 " differs from set"
|
||||
"%u:Read value of %s %" PRIu64 " differs from set"
|
||||
"value %d\n",
|
||||
i, tFieldName, auxUint64, auxInt32ArrayW[i]);
|
||||
GOTOFAILURE
|
||||
@@ -1521,7 +1520,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (unionInt32.Short1 != 1 && auxUint64 != 18)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %" PRIu64
|
||||
"%u:Read value of %s %" PRIu64
|
||||
" differs from set"
|
||||
"value %d\n",
|
||||
i, tFieldName, auxUint64, 18);
|
||||
@@ -1564,7 +1563,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (!(tTag == EXIFTAG_SUBJECTDISTANCE && auxFloat == -1.0))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %f differs from set value "
|
||||
"%u:Read value of %s %f differs from set value "
|
||||
"%f\n",
|
||||
i, tFieldName, auxFloat, auxDoubleArrayW[i]);
|
||||
GOTOFAILURE
|
||||
@@ -1594,7 +1593,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (!(tTag == EXIFTAG_SUBJECTDISTANCE && auxDouble == -1.0))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%d:Read value of %s %f differs from set value "
|
||||
"%u:Read value of %s %f differs from set value "
|
||||
"%f\n",
|
||||
i, tFieldName, auxDouble, auxDoubleArrayW[i]);
|
||||
GOTOFAILURE
|
||||
@@ -1639,7 +1638,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"WriteCount for .set_get_field_type %d should be -1, "
|
||||
"WriteCount for .set_get_field_type %u should be -1, "
|
||||
"-2, -3 or "
|
||||
"greater than 1! %s\n",
|
||||
tSetFieldType, tFieldArray->fields[t].field_name);
|
||||
@@ -1715,7 +1714,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (fabs(dblDiff) > fabs(dblDiffLimit))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value %d of %s #%d %f differs "
|
||||
"Read value %u of %s #%d %f differs "
|
||||
"from set value %f\n",
|
||||
i, tFieldName, j, auxFloatArray[j],
|
||||
auxFloatArrayW[i + j]);
|
||||
@@ -1741,7 +1740,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (fabs(dblDiff) > fabs(dblDiffLimit))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value %d of %s #%d %f differs "
|
||||
"Read value %u of %s #%d %f differs "
|
||||
"from set value %f\n",
|
||||
i, tFieldName, j, auxDoubleArray[j],
|
||||
auxDoubleArrayW[i + j]);
|
||||
@@ -1778,7 +1777,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxCharArray[j] != auxCharCompare[j])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value %d of %s #%d %d differs "
|
||||
"Read value %u of %s #%d %d differs "
|
||||
"from set value %d\n",
|
||||
i, tFieldName, j, auxCharArray[j],
|
||||
auxCharArrayW[i + j]);
|
||||
@@ -1801,7 +1800,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxShortArray[j] != auxShortArrayW[i + j])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value %d of %s #%d %d "
|
||||
"Read value %u of %s #%d %d "
|
||||
"differs from "
|
||||
"set value %d\n",
|
||||
i, tFieldName, j, auxShortArray[j],
|
||||
@@ -1825,7 +1824,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
if (auxInt32Array[j] != auxInt32ArrayW[i + j])
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Read value %d of %s #%d %d "
|
||||
"Read value %u of %s #%d %d "
|
||||
"differs from "
|
||||
"set value %d\n",
|
||||
i, tFieldName, j, auxInt32Array[j],
|
||||
@@ -1837,7 +1836,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within array"
|
||||
"SetFieldType %u not defined within array"
|
||||
"reading clause for %s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
GOTOFAILURE
|
||||
@@ -1853,7 +1852,7 @@ int read_all_tags(TIFF *tif, const TIFFFieldArray *tFieldArray,
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"SetFieldType %d not defined within reading switch for "
|
||||
"SetFieldType %u not defined within reading switch for "
|
||||
"%s.\n",
|
||||
tSetFieldType, tFieldName);
|
||||
GOTOFAILURE
|
||||
|
||||
@@ -252,7 +252,7 @@ void printTIF(TIFF *tif, uint16_t pageNumber)
|
||||
creation_time = time(0);
|
||||
printf("%%%%CreationDate: %s", ctime(&creation_time));
|
||||
printf("%%%%Origin: 0 0\n");
|
||||
printf("%%%%BoundingBox: 0 0 %u %u\n", (int)(pageWidth * points),
|
||||
printf("%%%%BoundingBox: 0 0 %d %d\n", (int)(pageWidth * points),
|
||||
(int)(pageHeight * points)); /* XXX */
|
||||
printf("%%%%Pages: (atend)\n");
|
||||
printf("%%%%EndComments\n");
|
||||
@@ -460,7 +460,7 @@ int main(int argc, char **argv)
|
||||
fclose(fd);
|
||||
}
|
||||
printf("%%%%Trailer\n");
|
||||
printf("%%%%Pages: %u\n", totalPages);
|
||||
printf("%%%%Pages: %d\n", totalPages);
|
||||
printf("%%%%EOF\n");
|
||||
|
||||
free(pages);
|
||||
|
||||
@@ -387,8 +387,8 @@ static void cpTag(TIFF *in, TIFF *out, uint16_t tag, uint16_t count,
|
||||
break;
|
||||
default:
|
||||
TIFFError(TIFFFileName(in),
|
||||
"Data type %d is not supported, tag %d skipped.", tag,
|
||||
type);
|
||||
"Data type %u is not supported, tag %d skipped.",
|
||||
type, tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,8 +240,8 @@ static void cpTag(TIFF *in, TIFF *out, uint16_t tag, uint16_t count,
|
||||
break;
|
||||
default:
|
||||
TIFFError(TIFFFileName(in),
|
||||
"Data type %d is not supported, tag %d skipped.", tag,
|
||||
type);
|
||||
"Data type %u is not supported, tag %d skipped.",
|
||||
type, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ static void setrow(uint8_t *row, uint32_t nrows, const uint8_t *rows[])
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "acc=%d, area=%d\n", acc, area);
|
||||
fprintf(stderr, "acc=%u, area=%u\n", acc, area);
|
||||
*row++ = cmap[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,8 +463,8 @@ static void cpTag(TIFF *in, TIFF *out, uint16_t tag, uint16_t count,
|
||||
break;
|
||||
default:
|
||||
TIFFError(TIFFFileName(in),
|
||||
"Data type %d is not supported, tag %d skipped.", tag,
|
||||
type);
|
||||
"Data type %u is not supported, tag %u skipped.",
|
||||
(unsigned)type, (unsigned)tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1237,7 +1237,7 @@ void t2p_read_tiff_init(T2P *t2p, TIFF *input)
|
||||
if (!TIFFSetDirectory(input, i))
|
||||
{
|
||||
TIFFError(TIFF2PDF_MODULE,
|
||||
"Can't set directory %" PRIu16 " of input file %s", i,
|
||||
"Can't set directory %u of input file %s", i,
|
||||
TIFFFileName(input));
|
||||
t2p->t2p_error = T2P_ERR_ERROR;
|
||||
return;
|
||||
@@ -1346,7 +1346,7 @@ void t2p_read_tiff_init(T2P *t2p, TIFF *input)
|
||||
if (tiff_transferfunctioncount != t2p->tiff_transferfunctioncount)
|
||||
{
|
||||
TIFFError(TIFF2PDF_MODULE,
|
||||
"Different transfer function on page %" PRIu16, i);
|
||||
"Different transfer function on page %u", i);
|
||||
t2p->t2p_error = T2P_ERR_ERROR;
|
||||
return;
|
||||
}
|
||||
@@ -1409,7 +1409,7 @@ void t2p_read_tiff_init(T2P *t2p, TIFF *input)
|
||||
&(t2p->tiff_tiles[i].tiles_tilewidth));
|
||||
if (t2p->tiff_tiles[i].tiles_tilewidth < 1)
|
||||
{
|
||||
TIFFError(TIFF2PDF_MODULE, "Invalid tile width (%d), %s",
|
||||
TIFFError(TIFF2PDF_MODULE, "Invalid tile width (%u), %s",
|
||||
t2p->tiff_tiles[i].tiles_tilewidth,
|
||||
TIFFFileName(input));
|
||||
t2p->t2p_error = T2P_ERR_ERROR;
|
||||
@@ -1419,7 +1419,7 @@ void t2p_read_tiff_init(T2P *t2p, TIFF *input)
|
||||
&(t2p->tiff_tiles[i].tiles_tilelength));
|
||||
if (t2p->tiff_tiles[i].tiles_tilelength < 1)
|
||||
{
|
||||
TIFFError(TIFF2PDF_MODULE, "Invalid tile length (%d), %s",
|
||||
TIFFError(TIFF2PDF_MODULE, "Invalid tile length (%u), %s",
|
||||
t2p->tiff_tiles[i].tiles_tilelength,
|
||||
TIFFFileName(input));
|
||||
t2p->t2p_error = T2P_ERR_ERROR;
|
||||
@@ -2863,7 +2863,7 @@ tsize_t t2p_readwrite_pdf_image(T2P *t2p, TIFF *input, TIFF *output)
|
||||
if (stripbuffer == NULL)
|
||||
{
|
||||
TIFFError(TIFF2PDF_MODULE,
|
||||
"Can't allocate %" PRId64
|
||||
"Can't allocate %" PRIu64
|
||||
" bytes of memory for t2p_readwrite_pdf_image, %s",
|
||||
max_striplength, TIFFFileName(input));
|
||||
_TIFFfree(buffer);
|
||||
@@ -4433,9 +4433,9 @@ tsize_t t2p_write_pdf_header(T2P *t2p, TIFF *output)
|
||||
int buflen = 0;
|
||||
const char mod[] = "t2p_write_pdf_header()";
|
||||
|
||||
buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%" PRIu16 ".%" PRIu16 " ",
|
||||
(uint16_t)(t2p->pdf_majorversion & 0xff),
|
||||
(uint16_t)(t2p->pdf_minorversion & 0xff));
|
||||
buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ",
|
||||
(unsigned int)(t2p->pdf_majorversion & 0xff),
|
||||
(unsigned int)(t2p->pdf_minorversion & 0xff));
|
||||
check_snprintf_ret(t2p, buflen, buffer);
|
||||
add_t2pWriteFile_check(output, (tdata_t)buffer, buflen, mod, written);
|
||||
add_t2pWriteFile_check(output, (tdata_t) "\n%\342\343\317\323\n", 7, mod,
|
||||
@@ -5040,7 +5040,7 @@ tsize_t t2p_write_pdf_pages(T2P *t2p, TIFF *output)
|
||||
}
|
||||
}
|
||||
add_t2pWriteFile_check(output, (tdata_t) "] \n/Count ", 10, mod, written);
|
||||
buflen = snprintf(buffer, sizeof(buffer), "%" PRIu16, t2p->tiff_pagecount);
|
||||
buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_pagecount);
|
||||
check_snprintf_ret(t2p, buflen, buffer);
|
||||
add_t2pWriteFile_check(output, (tdata_t)buffer, buflen, mod, written);
|
||||
add_t2pWriteFile_check(output, (tdata_t) " \n>> \n", 6, mod, written);
|
||||
@@ -6298,7 +6298,7 @@ tsize_t t2p_write_pdf_trailer(T2P *t2p, TIFF *output)
|
||||
/* Silence CoverityScan warning about bad crypto function */
|
||||
/* coverity[dont_call] */
|
||||
for (i = 0; i < sizeof(t2p->pdf_fileid) - 8; i += 8)
|
||||
snprintf(t2p->pdf_fileid + i, 9, "%.8X", rand());
|
||||
snprintf(t2p->pdf_fileid + i, 9, "%.8X", (unsigned int)rand());
|
||||
|
||||
add_t2pWriteFile_check(output, (tdata_t) "trailer\n<<\n/Size ", 17, mod,
|
||||
written);
|
||||
|
||||
@@ -684,14 +684,27 @@ static const char RGBcolorimage[] = "\
|
||||
*
|
||||
* It is claimed to be part of some future revision of the EPS spec.
|
||||
*/
|
||||
static void PhotoshopBanner(FILE *fd, uint32_t w, uint32_t h, tmsize_t bs,
|
||||
int nc, const char *startline)
|
||||
static void TIFF_ATTRIBUTE((__format__(__printf__, 6, 0)))
|
||||
PhotoshopBanner(FILE *fd, uint32_t w, uint32_t h, tmsize_t bs, int nc,
|
||||
const char *startline)
|
||||
{
|
||||
fprintf(fd,
|
||||
"%%ImageData: %" PRIu32 " %" PRIu32 " %" PRIu16
|
||||
" %d 0 %" TIFF_SSIZE_FORMAT " 2 \"",
|
||||
w, h, bitspersample, nc, bs);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
fprintf(fd, startline, nc);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
fprintf(fd, "\"\n");
|
||||
}
|
||||
|
||||
@@ -2738,7 +2751,19 @@ void PSpage(FILE *fd, TIFF *tif, uint32_t w, uint32_t h)
|
||||
break;
|
||||
case PHOTOMETRIC_MINISBLACK:
|
||||
case PHOTOMETRIC_MINISWHITE:
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
PhotoshopBanner(fd, w, h, 1, 1, imageOp);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
fprintf(fd, "/scanLine %" TIFF_SSIZE_FORMAT " string def\n",
|
||||
ps_bytesperrow);
|
||||
fprintf(fd, "%" PRIu32 " %" PRIu32 " %" PRIu16 "\n", w, h,
|
||||
|
||||
@@ -568,7 +568,7 @@ static int SeparateCompare(int reversed, int sample, uint32_t row,
|
||||
{
|
||||
if (*cp1 != *p2)
|
||||
{
|
||||
printf("Scanline %" PRIu32 ", pixel %" PRIu32 ", sample %d: ", row,
|
||||
printf("Scanline %" PRIu32 ", pixel %d, sample %d: ", row,
|
||||
pixel, sample);
|
||||
if (reversed)
|
||||
printf("%02x %02x\n", *p2, *cp1);
|
||||
|
||||
@@ -776,8 +776,8 @@ static void cpTag(TIFF *in, TIFF *out, uint16_t tag, uint16_t count,
|
||||
break;
|
||||
default:
|
||||
TIFFError(TIFFFileName(in),
|
||||
"Data type %" PRIu16 " is not supported, tag %d skipped.",
|
||||
tag, type);
|
||||
"Data type %u is not supported, tag %u skipped.",
|
||||
(unsigned)type, (unsigned)tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1795,8 +1795,8 @@ static void cpTag(TIFF *in, TIFF *out, uint16_t tag, uint16_t count,
|
||||
break;
|
||||
default:
|
||||
TIFFError(TIFFFileName(in),
|
||||
"Data type %" PRIu16 " is not supported, tag %d skipped",
|
||||
tag, type);
|
||||
"Data type %u is not supported, tag %u skipped",
|
||||
(unsigned)type, (unsigned)tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2414,7 +2414,7 @@ void process_command_opts(int argc, char *argv[], char *mp, char *mode,
|
||||
}
|
||||
if ((page->cols * page->rows) < 1)
|
||||
{
|
||||
TIFFError("No subdivisions", "%d",
|
||||
TIFFError("No subdivisions", "%u",
|
||||
(page->cols * page->rows));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -2762,7 +2762,7 @@ int main(int argc, char *argv[])
|
||||
/* dump.infilename is guaranteed to be NUL terminated and
|
||||
have 20 bytes fewer than PATH_MAX */
|
||||
snprintf(temp_filename, sizeof(temp_filename),
|
||||
"%s-read-%03d.%s", dump.infilename, dump_images,
|
||||
"%s-read-%03u.%s", dump.infilename, dump_images,
|
||||
(dump.format == DUMP_TEXT) ? "txt" : "raw");
|
||||
if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL)
|
||||
{
|
||||
@@ -2783,7 +2783,7 @@ int main(int argc, char *argv[])
|
||||
/* dump.outfilename is guaranteed to be NUL terminated and
|
||||
have 20 bytes fewer than PATH_MAX */
|
||||
snprintf(temp_filename, sizeof(temp_filename),
|
||||
"%s-write-%03d.%s", dump.outfilename, dump_images,
|
||||
"%s-write-%03u.%s", dump.outfilename, dump_images,
|
||||
(dump.format == DUMP_TEXT) ? "txt" : "raw");
|
||||
if ((dump.outfile = fopen(temp_filename, dump.mode)) ==
|
||||
NULL)
|
||||
@@ -2799,7 +2799,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (dump.debug)
|
||||
TIFFError("main", "Reading image %4d of %4d total pages.",
|
||||
TIFFError("main", "Reading image %4u of %4u total pages.",
|
||||
dirnum + 1, total_pages);
|
||||
|
||||
if (loadImage(in, &image, &dump, &read_buff))
|
||||
@@ -3174,7 +3174,19 @@ static void dump_info(FILE *dumpfile, int format, char *prefix, char *msg, ...)
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
fprintf(dumpfile, "%s ", prefix);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
vfprintf(dumpfile, msg, ap);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
fprintf(dumpfile, "\n");
|
||||
va_end(ap);
|
||||
}
|
||||
@@ -4365,7 +4377,7 @@ static int readContigStripsIntoBuffer(TIFF *in, uint8_t *buf)
|
||||
rows = bytes_read / scanline_size;
|
||||
if ((strip < (nstrips - 1)) && (bytes_read != (int32_t)stripsize))
|
||||
TIFFError("",
|
||||
"Strip %" PRIu32 ": read %" PRId64
|
||||
"Strip %" PRIu32 ": read %" PRIu64
|
||||
" bytes, strip size %" PRIu64,
|
||||
strip + 1, (uint64_t)bytes_read, (uint64_t)stripsize);
|
||||
|
||||
@@ -6306,7 +6318,7 @@ static int getCropOffsets(struct image_data *image, struct crop_mask *crop,
|
||||
if (seg == 0 || total == 0 || seg > total)
|
||||
{
|
||||
TIFFError("getCropOffsets",
|
||||
"Crop zone %d:%d is out of specification, thus skipped.",
|
||||
"Crop zone %u:%u is out of specification, thus skipped.",
|
||||
seg, total);
|
||||
continue;
|
||||
}
|
||||
@@ -7350,8 +7362,8 @@ static int correct_orientation(struct image_data *image,
|
||||
rotation = (uint16_t)270;
|
||||
else
|
||||
{
|
||||
TIFFError("correct_orientation", "Invalid rotation value: %" PRIu16,
|
||||
(uint16_t)(image->adjustments & ROTATE_ANY));
|
||||
TIFFError("correct_orientation", "Invalid rotation value: %u",
|
||||
(unsigned int)(image->adjustments & ROTATE_ANY));
|
||||
return (-1);
|
||||
}
|
||||
/* Dummy variable in order not to switch two times the
|
||||
|
||||
@@ -79,7 +79,6 @@ static const char sbytefmt[] = "%s%" PRId8; /* SBYTE */
|
||||
static const char shortfmtd[] = "%s%" PRIu16; /* SHORT */
|
||||
static const char shortfmth[] = "%s%#" PRIx16;
|
||||
static const char sshortfmtd[] = "%s%" PRId16; /* SSHORT */
|
||||
static const char sshortfmth[] = "%s%#" PRIx16;
|
||||
static const char longfmtd[] = "%s%" PRIu32; /* LONG */
|
||||
static const char longfmth[] = "%s%#" PRIx32;
|
||||
static const char slongfmtd[] = "%s%" PRId32; /* SLONG */
|
||||
@@ -205,9 +204,9 @@ static void dump(int fd, uint64_t diroff)
|
||||
if (swabflag)
|
||||
TIFFSwabLong(&hdr.classic.tiff_diroff);
|
||||
printf("Magic: %#x <%s-endian> Version: %#x <%s>\n",
|
||||
hdr.classic.tiff_magic,
|
||||
hdr.classic.tiff_magic == TIFF_BIGENDIAN ? "big" : "little", 42,
|
||||
"ClassicTIFF");
|
||||
(unsigned)hdr.classic.tiff_magic,
|
||||
hdr.classic.tiff_magic == TIFF_BIGENDIAN ? "big" : "little",
|
||||
(unsigned)42, "ClassicTIFF");
|
||||
if (diroff == 0)
|
||||
diroff = hdr.classic.tiff_diroff;
|
||||
}
|
||||
@@ -223,11 +222,12 @@ static void dump(int fd, uint64_t diroff)
|
||||
TIFFSwabShort(&hdr.big.tiff_unused);
|
||||
TIFFSwabLong8(&hdr.big.tiff_diroff);
|
||||
}
|
||||
printf("Magic: %#x <%s-endian> Version: %#x <%s>\n", hdr.big.tiff_magic,
|
||||
hdr.big.tiff_magic == TIFF_BIGENDIAN ? "big" : "little", 43,
|
||||
"BigTIFF");
|
||||
printf("OffsetSize: %#x Unused: %#x\n", hdr.big.tiff_offsetsize,
|
||||
hdr.big.tiff_unused);
|
||||
printf("Magic: %#x <%s-endian> Version: %#x <%s>\n",
|
||||
(unsigned)hdr.big.tiff_magic,
|
||||
hdr.big.tiff_magic == TIFF_BIGENDIAN ? "big" : "little",
|
||||
(unsigned)43, "BigTIFF");
|
||||
printf("OffsetSize: %#x Unused: %#x\n", (unsigned)hdr.big.tiff_offsetsize,
|
||||
(unsigned)hdr.big.tiff_unused);
|
||||
if (diroff == 0)
|
||||
diroff = hdr.big.tiff_diroff;
|
||||
bigtiff = 1;
|
||||
@@ -751,8 +751,14 @@ static void PrintData(FILE *fd, uint16_t type, uint32_t count,
|
||||
{
|
||||
int16_t *wp = (int16_t *)data;
|
||||
while (count-- > 0)
|
||||
fprintf(fd, hex_mode ? sshortfmth : sshortfmtd, sep, *wp++),
|
||||
sep = " ";
|
||||
{
|
||||
int16_t val = *wp++;
|
||||
if (hex_mode)
|
||||
fprintf(fd, "%s%#x", sep, (unsigned int)val);
|
||||
else
|
||||
fprintf(fd, sshortfmtd, sep, val);
|
||||
sep = " ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TIFF_LONG:
|
||||
@@ -769,8 +775,14 @@ static void PrintData(FILE *fd, uint16_t type, uint32_t count,
|
||||
{
|
||||
int32_t *lp = (int32_t *)data;
|
||||
while (count-- > 0)
|
||||
fprintf(fd, hex_mode ? slongfmth : slongfmtd, sep, *lp++),
|
||||
sep = " ";
|
||||
{
|
||||
int32_t val = *lp++;
|
||||
if (hex_mode)
|
||||
fprintf(fd, slongfmth, sep, (uint32_t)val);
|
||||
else
|
||||
fprintf(fd, slongfmtd, sep, val);
|
||||
sep = " ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TIFF_LONG8:
|
||||
@@ -876,7 +888,19 @@ static void ReadError(char *what) { Fatal("Error while reading %s", what); }
|
||||
static void vError(FILE *fd, const char *fmt, va_list ap)
|
||||
{
|
||||
fprintf(fd, "%s: ", curfile);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
vfprintf(fd, fmt, ap);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
fprintf(fd, ".\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user