This commit is contained in:
Andrey Kiselev 2003-06-30 18:25:50 +00:00
parent a05e169f19
commit ab8b5a13e3
2 changed files with 35 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v 1.27 2003-02-26 20:38:49 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v 1.28 2003-06-30 18:25:50 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -115,6 +115,8 @@ bad:
static int
_TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
{
static const char module[] = "_TIFFVSetField";
TIFFDirectory* td = &tif->tif_dir;
int status = 1;
uint32 v32;
@ -564,6 +566,10 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
if( fip->field_passcount )
{
tv->value = _TIFFmalloc(tv_size * tv->count);
if ( !tv->value ) {
va_end(ap);
return 0;
}
_TIFFmemcpy( tv->value, (void *) va_arg(ap,void*),
tv->count * tv_size );
}
@ -572,6 +578,10 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
const char *value = (const char *) va_arg(ap,const char *);
tv->count = strlen(value)+1;
tv->value = _TIFFmalloc(tv->count);
if ( !tv->value ) {
va_end(ap);
return 0;
}
strcpy( tv->value, value );
}
else
@ -581,6 +591,10 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
printf( "TIFFVSetField ... pass by value not imp.\n" );
tv->value = _TIFFmalloc(tv_size * tv->count);
if ( !tv->value ) {
va_end(ap);
return 0;
}
_TIFFmemset( tv->value, 0, tv->count * tv_size );
status = 0;
}
@ -593,18 +607,18 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
va_end(ap);
return (status);
badvalue:
TIFFError(tif->tif_name, "%d: Bad value for \"%s\"", v,
_TIFFFieldWithTag(tif, tag)->field_name);
TIFFError(module, "%.1000s: Bad value %d for \"%s\"", v,
tif->tif_name, _TIFFFieldWithTag(tif, tag)->field_name);
va_end(ap);
return (0);
badvalue32:
TIFFError(tif->tif_name, "%ld: Bad value for \"%s\"", v32,
_TIFFFieldWithTag(tif, tag)->field_name);
TIFFError(module, "%.1000s: Bad value %ld for \"%s\"", v32,
tif->tif_name, _TIFFFieldWithTag(tif, tag)->field_name);
va_end(ap);
return (0);
badvaluedbl:
TIFFError(tif->tif_name, "%f: Bad value for \"%s\"", d,
_TIFFFieldWithTag(tif, tag)->field_name);
TIFFError(module, "%.1000s: Bad value %f for \"%s\"", d,
tif->tif_name, _TIFFFieldWithTag(tif, tag)->field_name);
va_end(ap);
return (0);
}
@ -951,7 +965,7 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
*/
if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
{
TIFFError("TIFFGetField",
TIFFError("_TIFFVGetField",
"%s: Invalid %stag \"%s\" (not supported by codec)",
tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
_TIFFFieldWithTag(tif, tag)->field_name);

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v 1.18 2003-06-30 08:24:40 dron Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v 1.19 2003-06-30 18:25:50 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -592,6 +592,8 @@ bad:
static int
EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
{
static const char module[] = "EstimateStripByteCounts";
register TIFFDirEntry *dp;
register TIFFDirectory *td = &tif->tif_dir;
uint16 i;
@ -612,9 +614,16 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
/* calculate amount of space used by indirect values */
for (dp = dir, n = dircount; n > 0; n--, dp++)
{
uint32 cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);
if (cc > sizeof (uint32))
space += cc;
uint32 cc = TIFFDataWidth(dp->tdir_type);
if (cc == 0) {
TIFFError(module,
"%.1000s: Cannot determine size of unknown tag type %d",
tif->tif_name, dp->tdir_type);
return -1;
}
cc = cc * dp->tdir_count;
if (cc > sizeof (uint32))
space += cc;
}
space = filesize - space;
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)