Skip to content

Commit

Permalink
Set readcount to TIFF_VARIABLE for a variable number of values
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed May 28, 2022
1 parent 0a4a772 commit 40a918d
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/libImaging/TiffDecode.c
Expand Up @@ -815,11 +815,11 @@ ImagingLibTiffMergeFieldInfo(

// custom fields added with ImagingLibTiffMergeFieldInfo are only used for
// decoding, ignore readcount;
int readcount = 1;
int readcount = is_var_length ? TIFF_VARIABLE : 1;
// we support writing a single value, or a variable number of values
int writecount = 1;
int writecount = is_var_length ? TIFF_VARIABLE : 1;
// whether the first value should encode the number of values.
int passcount = 0;
int passcount = (is_var_length && field_type != TIFF_ASCII) ? 1 : 0;

TIFFFieldInfo info[] = {
{key,
Expand All @@ -831,14 +831,6 @@ ImagingLibTiffMergeFieldInfo(
passcount,
"CustomField"}};

if (is_var_length) {
info[0].field_writecount = -1;
}

if (is_var_length && field_type != TIFF_ASCII) {
info[0].field_passcount = 1;
}

n = sizeof(info) / sizeof(info[0]);

// Test for libtiff 4.0 or later, excluding libtiff 3.9.6 and 3.9.7
Expand Down

0 comments on commit 40a918d

Please sign in to comment.