tiffset: pass size for TIFFTAG_INKNAMES

Uses TIFFFieldPassCount() to know which arguments need to be
passed to TiffSetField()

fixes #18
see http://bugzilla.maptools.org/show_bug.cgi?id=2202
This commit is contained in:
Thomas Bernard 2020-04-05 19:33:02 +02:00
parent 632f6a1a4f
commit 4b64bf1cee
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -321,6 +321,7 @@ main(int argc, char* argv[])
const TIFFField *fip;
char *text;
size_t len;
int ret;
arg_index++;
fip = GetField(tiff, argv[arg_index]);
@ -354,7 +355,12 @@ main(int argc, char* argv[])
fclose( fp );
if(TIFFSetField( tiff, TIFFFieldTag(fip), text ) != 1) {
if(TIFFFieldPassCount( fip )) {
ret = TIFFSetField( tiff, TIFFFieldTag(fip), (uint16)len, text );
} else {
ret = TIFFSetField( tiff, TIFFFieldTag(fip), text );
}
if(!ret) {
fprintf(stderr, "Failed to set %s from file %s\n",
TIFFFieldName(fip), argv[arg_index]);
}