/* Fetch an array of RATIONAL or SRATIONAL values.  */
static int TIFFFetchRationalArray(TIFF *tif, TIFFDirEntry *dir, float *v)
/* Fetch an array of RATIONAL or SRATIONAL values.  */
static int TIFFFetchRationalArray(TIFF *tif, TIFFDirEntry *dir, float *v)
{
	int ok = 0;
	uint32* l;
	l = (uint32*)CheckMalloc(tif,
	    dir->tdir_count*TIFFDataWidth(dir->tdir_type),
	    "to fetch array of rationals");
	if (l) {
		if (TIFFFetchData(tif, dir, (char *)l)) {
			uint32 i;
			for (i = 0; i < dir->tdir_count; i++) {
				ok = cvtRational(tif, dir,
				    l[2*i+0], l[2*i+1], &v[i]);
				if (!ok)
					break;
			}
		}
		_TIFFfree((char *)l);
	}
	return (ok);
}