Skip to content

Commit

Permalink
Internal libtiff: resync with upstream
Browse files Browse the repository at this point in the history
The internal tag declaration structure has changed (one useless field
removed), which impacts our tif_jxl codec
  • Loading branch information
rouault committed Jan 12, 2025
1 parent 926f93b commit 47dc1c6
Show file tree
Hide file tree
Showing 23 changed files with 518 additions and 529 deletions.
1 change: 1 addition & 0 deletions frmts/gtiff/libtiff/gdal_libtiff_symbol_rename.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
#define TIFFOpenOptionsSetErrorHandlerExtR gdal_TIFFOpenOptionsSetErrorHandlerExtR
#define TIFFOpenOptionsSetMaxCumulatedMemAlloc gdal_TIFFOpenOptionsSetMaxCumulatedMemAlloc
#define TIFFOpenOptionsSetMaxSingleMemAlloc gdal_TIFFOpenOptionsSetMaxSingleMemAlloc
#define TIFFOpenOptionsSetWarnAboutUnknownTags gdal_TIFFOpenOptionsSetWarnAboutUnknownTags
#define TIFFOpenOptionsSetWarningHandlerExtR gdal_TIFFOpenOptionsSetWarningHandlerExtR
#define _TIFFPartialReadStripArray gdal__TIFFPartialReadStripArray
#define TIFFPredictorCleanup gdal_TIFFPredictorCleanup
Expand Down
35 changes: 18 additions & 17 deletions frmts/gtiff/libtiff/tif_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,9 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
{
TIFFTagValue *new_customValues;

td->td_customValueCount++;
new_customValues = (TIFFTagValue *)_TIFFreallocExt(
tif, td->td_customValues,
sizeof(TIFFTagValue) * td->td_customValueCount);
sizeof(TIFFTagValue) * (td->td_customValueCount + 1));
if (!new_customValues)
{
TIFFErrorExtR(tif, module,
Expand All @@ -737,6 +736,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
goto end;
}

td->td_customValueCount++;
td->td_customValues = new_customValues;

tv = td->td_customValues + (td->td_customValueCount - 1);
Expand All @@ -748,8 +748,8 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
/*
* Set custom value ... save a copy of the custom tag value.
*/
/*--: Rational2Double: For Rationals evaluate "set_field_type" to
* determine internal storage size. */
/*--: Rational2Double: For Rationals evaluate "set_get_field_type"
* to determine internal storage size. */
tv_size = TIFFFieldSetGetSize(fip);
if (tv_size == 0)
{
Expand Down Expand Up @@ -842,7 +842,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
fip->field_writecount == TIFF_SPP || tv->count > 1)
{
/*--: Rational2Double: For Rationals tv_size is set above to
* 4 or 8 according to fip->set_field_type! */
* 4 or 8 according to fip->set_get_field_type! */
_TIFFmemcpy(tv->value, va_arg(ap, void *),
tv->count * tv_size);
/* Test here for too big values for LONG8, SLONG8 in
Expand Down Expand Up @@ -977,7 +977,8 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
/*-- Rational2Double: For Rationals tv_size is set
* above to 4 or 8 according to fip->set_field_type!
* above to 4 or 8 according to
* fip->set_get_field_type!
*/
{
if (tv_size == 8)
Expand All @@ -995,11 +996,11 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
* default. */
if (tv_size != 4)
{
TIFFErrorExtR(
tif, module,
"Rational2Double: .set_field_type "
"in not 4 but %d",
tv_size);
TIFFErrorExtR(tif, module,
"Rational2Double: "
".set_get_field_type "
"in not 4 but %d",
tv_size);
}
}
}
Expand Down Expand Up @@ -1526,7 +1527,7 @@ static int _TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap)
case TIFF_SRATIONAL:
{
/*-- Rational2Double: For Rationals evaluate
* "set_field_type" to determine internal
* "set_get_field_type" to determine internal
* storage size and return value size. */
int tv_size = TIFFFieldSetGetSize(fip);
if (tv_size == 8)
Expand All @@ -1544,11 +1545,11 @@ static int _TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap)
* default. */
if (tv_size != 4)
{
TIFFErrorExtR(
tif, "_TIFFVGetField",
"Rational2Double: .set_field_type "
"in not 4 but %d",
tv_size);
TIFFErrorExtR(tif, "_TIFFVGetField",
"Rational2Double: "
".set_get_field_type "
"in not 4 but %d",
tv_size);
}
}
}
Expand Down
19 changes: 9 additions & 10 deletions frmts/gtiff/libtiff/tif_dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,15 @@ extern "C"

struct _TIFFField
{
uint32_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
uint32_t
field_anonymous; /* if true, this is a unknown / anonymous tag */
TIFFSetGetFieldType set_field_type; /* type to be passed to TIFFSetField
and TIFFGetField*/
TIFFSetGetFieldType get_field_type; /* not used */
unsigned short field_bit; /* bit in fieldsset bit vector */
uint32_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
uint32_t field_anonymous; /* if true, this is a unknown /
anonymous tag */
TIFFSetGetFieldType set_get_field_type; /* type to be passed to
TIFFSetField, TIFFGetField */
unsigned short field_bit; /* bit in fieldsset bit vector */
unsigned char field_oktochange; /* if true, can change while writing */
unsigned char field_passcount; /* if true, pass dir count on set */
char *field_name; /* ASCII name */
Expand Down
Loading

0 comments on commit 47dc1c6

Please sign in to comment.