From 9a94eb411ee86b8c6e23943d0aef38226dd6939e Mon Sep 17 00:00:00 2001 From: Andrey Kiselev Date: Mon, 29 Nov 2004 16:39:13 +0000 Subject: [PATCH] Properly handle tags, which have the uint32 counts. As per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=693 --- libtiff/tif_dir.c | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c index ce382ae0..87806301 100644 --- a/libtiff/tif_dir.c +++ b/libtiff/tif_dir.c @@ -1,4 +1,4 @@ -/* $Id: tif_dir.c,v 1.41 2004-10-09 18:33:56 dron Exp $ */ +/* $Id: tif_dir.c,v 1.42 2004-11-29 16:39:13 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -997,37 +997,35 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap) ** Do we have a custom value? */ ret_val = 0; - for( i = 0; i < td->td_customValueCount; i++ ) + for (i = 0; i < td->td_customValueCount; i++) { - TIFFTagValue *tv = td->td_customValues + i; + TIFFTagValue *tv = td->td_customValues + i; - if( tv->info->field_tag != tag ) - continue; + if (tv->info->field_tag != tag) + continue; - if( fip->field_passcount ) - { - *va_arg(ap, unsigned short *) = (unsigned short) tv->count; - *va_arg(ap, void **) = tv->value; - ret_val = 1; - break; - } - else if( fip->field_type == TIFF_ASCII ) - { - *va_arg(ap, void **) = tv->value; - ret_val = 1; - break; - } - else - { - TIFFError("_TIFFVGetField", - "%s: Pass by value is not implemented.", - tif->tif_name); - break; + if (fip->field_passcount) { + if (fip->field_readcount == TIFF_VARIABLE2) + *va_arg(ap, uint32*) = (uint32)tv->count; + else /* Assume TIFF_VARIABLE */ + *va_arg(ap, uint16*) = (uint16)tv->count; + *va_arg(ap, void **) = tv->value; + ret_val = 1; + break; + } else if (fip->field_type == TIFF_ASCII) { + *va_arg(ap, void **) = tv->value; + ret_val = 1; + break; + } else { + TIFFError("_TIFFVGetField", + "%s: Pass by value is not implemented.", + tif->tif_name); + break; } } } } - return( ret_val ); + return(ret_val); } /*