Fixed problem with wrong interpretation of the InkNames tag as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=466 Memory leak fixed.
This commit is contained in:
parent
58117ffafa
commit
3a8ae673b7
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffcp.c,v 1.17 2004-01-26 17:00:55 dron Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffcp.c,v 1.18 2004-01-28 12:12:01 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -500,8 +500,6 @@ static struct cpTag {
|
||||
{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
|
||||
{ TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
|
||||
{ TIFFTAG_INKSET, 1, TIFF_SHORT },
|
||||
{ TIFFTAG_INKNAMES, 1, TIFF_ASCII },
|
||||
{ TIFFTAG_NUMBEROFINKS, 1, TIFF_SHORT },
|
||||
{ TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
|
||||
{ TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
|
||||
{ TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
|
||||
@ -667,14 +665,34 @@ tiffcp(TIFF* in, TIFF* out)
|
||||
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
|
||||
TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
|
||||
}
|
||||
{ uint16 ninks;
|
||||
const char* inknames;
|
||||
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
|
||||
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
|
||||
if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {
|
||||
int inknameslen = strlen(inknames) + 1;
|
||||
const char* cp = inknames;
|
||||
while (ninks > 1) {
|
||||
cp = strchr(cp, '\0');
|
||||
if (cp) {
|
||||
cp++;
|
||||
inknameslen += (strlen(cp) + 1);
|
||||
}
|
||||
ninks--;
|
||||
}
|
||||
TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned short pg0, pg1;
|
||||
if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1))
|
||||
if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {
|
||||
if (pageNum < 0) /* only one input file */
|
||||
TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
|
||||
else
|
||||
TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
|
||||
}
|
||||
}
|
||||
{
|
||||
int i;
|
||||
short count;
|
||||
@ -713,9 +731,11 @@ tiffcp(TIFF* in, TIFF* out)
|
||||
TIFFSetField(out, fld->field_tag, data);
|
||||
}
|
||||
}
|
||||
|
||||
_TIFFfree(xtiffFieldInfo);
|
||||
}
|
||||
/* for (p = tags; p < &tags[NTAGS]; p++)
|
||||
CopyTag(p->tag, p->count, p->type);*/
|
||||
for (p = tags; p < &tags[NTAGS]; p++)
|
||||
CopyTag(p->tag, p->count, p->type);
|
||||
|
||||
cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
|
||||
return (cf ? (*cf)(in, out, length, width, samplesperpixel) : FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user