summaryrefslogtreecommitdiff
path: root/tools/tiffinfo.c
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2012-06-06 06:05:29 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2012-06-06 06:05:29 +0000
commitb246f148ff6d8c68021a9ecd37eff0c857a45e78 (patch)
tree262f4d9e5151072f8b90401b49fb3a0dda5ddc11 /tools/tiffinfo.c
parent7e632eb41ce7c1094b610122f166ec922e8b5b01 (diff)
downloadlibtiff-git-b246f148ff6d8c68021a9ecd37eff0c857a45e78.tar.gz
nicer way to avoid reading data for non-image directories
Diffstat (limited to 'tools/tiffinfo.c')
-rw-r--r--tools/tiffinfo.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c
index dd8bc79f..ae1a5f62 100644
--- a/tools/tiffinfo.c
+++ b/tools/tiffinfo.c
@@ -1,4 +1,4 @@
-/* $Id: tiffinfo.c,v 1.20 2012-06-01 23:22:54 fwarmerdam Exp $ */
+/* $Id: tiffinfo.c,v 1.21 2012-06-06 06:05:29 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -53,7 +53,7 @@ static int readdata = 0; /* read data in file */
static int stoponerr = 1; /* stop on first read error */
static void usage(void);
-static void tiffinfo(TIFF*, uint16, long);
+static void tiffinfo(TIFF*, uint16, long, int);
static void
PrivateErrorHandler(const char* module, const char* fmt, va_list ap)
@@ -139,22 +139,19 @@ main(int argc, char* argv[])
if (tif != NULL) {
if (dirnum != -1) {
if (TIFFSetDirectory(tif, (tdir_t) dirnum))
- tiffinfo(tif, order, flags);
+ tiffinfo(tif, order, flags, 1);
} else if (diroff != 0) {
if (TIFFSetSubDirectory(tif, diroff))
- tiffinfo(tif, order, flags);
+ tiffinfo(tif, order, flags, 1);
} else {
do {
toff_t offset;
- tiffinfo(tif, order, flags);
+ tiffinfo(tif, order, flags, 1);
if (TIFFGetField(tif, TIFFTAG_EXIFIFD,
&offset)) {
if (TIFFReadEXIFDirectory(tif, offset)) {
- int old_readdata = readdata;
- readdata = 0;
- tiffinfo(tif, order, flags);
- readdata = old_readdata;
+ tiffinfo(tif, order, flags, 0);
}
}
} while (TIFFReadDirectory(tif));
@@ -445,10 +442,10 @@ TIFFReadRawData(TIFF* tif, int bitrev)
}
static void
-tiffinfo(TIFF* tif, uint16 order, long flags)
+tiffinfo(TIFF* tif, uint16 order, long flags, int is_image)
{
TIFFPrintDirectory(tif, stdout, flags);
- if (!readdata)
+ if (!readdata || !is_image)
return;
if (rawdata) {
if (order) {