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:
parent
632f6a1a4f
commit
4b64bf1cee
@ -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]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user