summaryrefslogtreecommitdiff
path: root/libtiff/tif_pixarlog.c
diff options
context:
space:
mode:
authorAndrey Kiselev <dron@ak4719.spb.edu>2007-04-07 15:14:30 +0000
committerAndrey Kiselev <dron@ak4719.spb.edu>2007-04-07 15:14:30 +0000
commit46f6411b2c86424b6bd0368abee13b8937085c3f (patch)
tree7e047a29955422886ba93030300d151769e26961 /libtiff/tif_pixarlog.c
parent7acb6903d501cc14674730c9af803cd470c0835a (diff)
downloadlibtiff-git-46f6411b2c86424b6bd0368abee13b8937085c3f.tar.gz
Finally fix bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1274 by
introducing _TIFFMergeFieldInfo() returning integer error status instead of void in case of problems with field merging (e.g., if the field with such a tag already registered). TIFFMergeFieldInfo() in public API remains void. Use _TIFFMergeFieldInfo() everywhere and check returned value.
Diffstat (limited to 'libtiff/tif_pixarlog.c')
-rw-r--r--libtiff/tif_pixarlog.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c
index e682be87..1497c046 100644
--- a/libtiff/tif_pixarlog.c
+++ b/libtiff/tif_pixarlog.c
@@ -1,4 +1,4 @@
-/* $Id: tif_pixarlog.c,v 1.18 2007-03-31 01:41:11 joris Exp $ */
+/* $Id: tif_pixarlog.c,v 1.19 2007-04-07 15:14:31 dron Exp $ */
/*
* Copyright (c) 1996-1997 Sam Leffler
@@ -593,7 +593,6 @@ PixarLogMakeTables(PixarLogState *sp)
static int PixarLogEncode(TIFF*, tidata_t, tsize_t, uint16);
static int PixarLogDecode(TIFF*, tidata_t, tsize_t, uint16);
-#define N(a) (sizeof(a)/sizeof(a[0]))
#define PIXARLOGDATAFMT_UNKNOWN -1
static int
@@ -1290,11 +1289,23 @@ static const TIFFFieldInfo pixarlogFieldInfo[] = {
int
TIFFInitPixarLog(TIFF* tif, int scheme)
{
+ const char module[] = "TIFFInitPixarLog";
+
PixarLogState* sp;
assert(scheme == COMPRESSION_PIXARLOG);
/*
+ * Merge codec-specific tag information.
+ */
+ if (!_TIFFMergeFieldInfo(tif, pixarlogFieldInfo,
+ TIFFArrayCount(pixarlogFieldInfo))) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Merging PixarLog codec-specific tags failed");
+ return 0;
+ }
+
+ /*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (PixarLogState));
@@ -1323,7 +1334,6 @@ TIFFInitPixarLog(TIFF* tif, int scheme)
tif->tif_cleanup = PixarLogCleanup;
/* Override SetField so we can handle our private pseudo-tag */
- _TIFFMergeFieldInfo(tif, pixarlogFieldInfo, N(pixarlogFieldInfo));
sp->vgetparent = tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */
sp->vsetparent = tif->tif_tagmethods.vsetfield;
@@ -1345,7 +1355,7 @@ TIFFInitPixarLog(TIFF* tif, int scheme)
return (1);
bad:
- TIFFErrorExt(tif->tif_clientdata, "TIFFInitPixarLog",
+ TIFFErrorExt(tif->tif_clientdata, module,
"No space for PixarLog state block");
return (0);
}