The same fix apllies to _TIFFVGetField() function.

This commit is contained in:
Andrey Kiselev 2006-02-03 16:27:13 +00:00
parent 31c405b3b8
commit c155e59d8d

View File

@ -1,4 +1,4 @@
/* $Id: tif_dir.c,v 1.68 2006-02-03 15:58:42 dron Exp $ */ /* $Id: tif_dir.c,v 1.69 2006-02-03 16:27:13 dron Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -841,57 +841,66 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
*va_arg(ap, void **) = tv->value; *va_arg(ap, void **) = tv->value;
ret_val = 1; ret_val = 1;
} else { } else {
if (fip->field_type == TIFF_ASCII if ((fip->field_type == TIFF_ASCII
|| fip->field_readcount == TIFF_VARIABLE || fip->field_readcount == TIFF_VARIABLE
|| fip->field_readcount == TIFF_VARIABLE2 || fip->field_readcount == TIFF_VARIABLE2
|| fip->field_readcount == TIFF_SPP || fip->field_readcount == TIFF_SPP
|| tv->count > 1) { || tv->count > 1)
&& fip->field_tag != TIFFTAG_PAGENUMBER
&& fip->field_tag != TIFFTAG_HALFTONEHINTS
&& fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
&& fip->field_tag != TIFFTAG_DOTRANGE) {
*va_arg(ap, void **) = tv->value; *va_arg(ap, void **) = tv->value;
ret_val = 1; ret_val = 1;
} else { } else {
int i;
char *val = (char *)tv->value;
for (i = 0; i < tv->count;
i++, val += _TIFFDataSize(fip->field_type)) {
switch (fip->field_type) { switch (fip->field_type) {
case TIFF_BYTE: case TIFF_BYTE:
case TIFF_UNDEFINED: case TIFF_UNDEFINED:
*va_arg(ap, uint8*) = *va_arg(ap, uint8*) =
*(uint8 *)tv->value; *(uint8 *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_SBYTE: case TIFF_SBYTE:
*va_arg(ap, int8*) = *va_arg(ap, int8*) =
*(int8 *)tv->value; *(int8 *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_SHORT: case TIFF_SHORT:
*va_arg(ap, uint16*) = *va_arg(ap, uint16*) =
*(uint16 *)tv->value; *(uint16 *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_SSHORT: case TIFF_SSHORT:
*va_arg(ap, int16*) = *va_arg(ap, int16*) =
*(int16 *)tv->value; *(int16 *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_LONG: case TIFF_LONG:
case TIFF_IFD: case TIFF_IFD:
*va_arg(ap, uint32*) = *va_arg(ap, uint32*) =
*(uint32 *)tv->value; *(uint32 *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_SLONG: case TIFF_SLONG:
*va_arg(ap, int32*) = *va_arg(ap, int32*) =
*(int32 *)tv->value; *(int32 *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_RATIONAL: case TIFF_RATIONAL:
case TIFF_SRATIONAL: case TIFF_SRATIONAL:
case TIFF_FLOAT: case TIFF_FLOAT:
*va_arg(ap, float*) = *va_arg(ap, float*) =
*(float *)tv->value; *(float *)val;
ret_val = 1; ret_val = 1;
break; break;
case TIFF_DOUBLE: case TIFF_DOUBLE:
*va_arg(ap, double*) = *va_arg(ap, double*) =
*(double *)tv->value; *(double *)val;
ret_val = 1; ret_val = 1;
break; break;
default: default:
@ -900,6 +909,7 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
} }
} }
} }
}
break; break;
} }
} }