Lines 1-4
Link Here
|
1 |
/* $Id: tif_dirread.c,v 1.51 2005/03/03 16:00:01 dron Exp $ */ |
1 |
/* $Id: tif_dirread.c,v 1.53 2005/05/06 14:35:50 fwarmerdam Exp $ */ |
2 |
|
2 |
|
3 |
/* |
3 |
/* |
4 |
* Copyright (c) 1988-1997 Sam Leffler |
4 |
* Copyright (c) 1988-1997 Sam Leffler |
Lines 1310-1321
Link Here
|
1310 |
uint16 buf[10]; |
1310 |
uint16 buf[10]; |
1311 |
uint16* v = buf; |
1311 |
uint16* v = buf; |
1312 |
|
1312 |
|
1313 |
if (samples > NITEMS(buf)) |
1313 |
if (dir->tdir_count > NITEMS(buf)) |
1314 |
v = (uint16*) CheckMalloc(tif, samples, sizeof(uint16), |
1314 |
v = (uint16*) CheckMalloc(tif, dir->tdir_count, sizeof(uint16), |
1315 |
"to fetch per-sample values"); |
1315 |
"to fetch per-sample values"); |
1316 |
if (v && TIFFFetchShortArray(tif, dir, v)) { |
1316 |
if (v && TIFFFetchShortArray(tif, dir, v)) { |
1317 |
uint16 i; |
1317 |
uint16 i; |
1318 |
for (i = 1; i < samples; i++) |
1318 |
int check_count = dir->tdir_count; |
|
|
1319 |
if( samples < check_count ) |
1320 |
check_count = samples; |
1321 |
|
1322 |
for (i = 1; i < check_count; i++) |
1319 |
if (v[i] != v[0]) { |
1323 |
if (v[i] != v[0]) { |
1320 |
TIFFError(tif->tif_name, |
1324 |
TIFFError(tif->tif_name, |
1321 |
"Cannot handle different per-sample values for field \"%s\"", |
1325 |
"Cannot handle different per-sample values for field \"%s\"", |
Lines 1347-1358
Link Here
|
1347 |
uint32 buf[10]; |
1351 |
uint32 buf[10]; |
1348 |
uint32* v = buf; |
1352 |
uint32* v = buf; |
1349 |
|
1353 |
|
1350 |
if (samples > NITEMS(buf)) |
1354 |
if (dir->tdir_count > NITEMS(buf)) |
1351 |
v = (uint32*) CheckMalloc(tif, samples, sizeof(uint32), |
1355 |
v = (uint32*) CheckMalloc(tif, dir->tdir_count, sizeof(uint32), |
1352 |
"to fetch per-sample values"); |
1356 |
"to fetch per-sample values"); |
1353 |
if (v && TIFFFetchLongArray(tif, dir, v)) { |
1357 |
if (v && TIFFFetchLongArray(tif, dir, v)) { |
1354 |
uint16 i; |
1358 |
uint16 i; |
1355 |
for (i = 1; i < samples; i++) |
1359 |
int check_count = dir->tdir_count; |
|
|
1360 |
|
1361 |
if( samples < check_count ) |
1362 |
check_count = samples; |
1363 |
for (i = 1; i < check_count; i++) |
1356 |
if (v[i] != v[0]) { |
1364 |
if (v[i] != v[0]) { |
1357 |
TIFFError(tif->tif_name, |
1365 |
TIFFError(tif->tif_name, |
1358 |
"Cannot handle different per-sample values for field \"%s\"", |
1366 |
"Cannot handle different per-sample values for field \"%s\"", |
Lines 1384-1395
Link Here
|
1384 |
double buf[10]; |
1392 |
double buf[10]; |
1385 |
double* v = buf; |
1393 |
double* v = buf; |
1386 |
|
1394 |
|
1387 |
if (samples > NITEMS(buf)) |
1395 |
if (dir->tdir_count > NITEMS(buf)) |
1388 |
v = (double*) CheckMalloc(tif, samples, sizeof (double), |
1396 |
v = (double*) CheckMalloc(tif, dir->tdir_count, sizeof (double), |
1389 |
"to fetch per-sample values"); |
1397 |
"to fetch per-sample values"); |
1390 |
if (v && TIFFFetchAnyArray(tif, dir, v)) { |
1398 |
if (v && TIFFFetchAnyArray(tif, dir, v)) { |
1391 |
uint16 i; |
1399 |
uint16 i; |
1392 |
for (i = 1; i < samples; i++) |
1400 |
int check_count = dir->tdir_count; |
|
|
1401 |
if( samples < check_count ) |
1402 |
check_count = samples; |
1403 |
|
1404 |
for (i = 1; i < check_count; i++) |
1393 |
if (v[i] != v[0]) { |
1405 |
if (v[i] != v[0]) { |
1394 |
TIFFError(tif->tif_name, |
1406 |
TIFFError(tif->tif_name, |
1395 |
"Cannot handle different per-sample values for field \"%s\"", |
1407 |
"Cannot handle different per-sample values for field \"%s\"", |