changeset 194:889cfa008789

raw related fixes
author nadvornik
date Sat, 22 Mar 2008 19:28:45 +0000
parents 50d7a137ea93
children d85687d951aa
files src/exiv2.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/exiv2.cc	Sat Mar 22 17:32:43 2008 +0000
+++ b/src/exiv2.cc	Sat Mar 22 19:28:45 2008 +0000
@@ -586,12 +586,14 @@
 
 const Value * RawFile::find(uint16_t tag, uint16_t group)
 {
-	printf("%04x %04x\n", tag, group);
 	TiffFinder finder(tag, group);
 	rootDir->accept(finder);
 	TiffEntryBase* te = dynamic_cast<TiffEntryBase*>(finder.result());
 	if (te)
+		{
+		if (debug) printf("(tag: %04x %04x) ", tag, group);
 		return te->pValue();
+		}
 	else
 		return NULL;
 }
@@ -659,14 +661,16 @@
 */
 	try {
 		RawFile rf(fd);
+		if (debug) printf("%s: offset ", path);
 		offset = rf.preview_offset();
+		if (debug) printf("%d\n", offset);
 	}
 	catch (Exiv2::AnyError& e) {
 		std::cout << "Caught Exiv2 exception '" << e << "'\n";
 		return 0;
 	}
 
-	if (image_offset)
+	if (image_offset && offset > 0)
 		{
 		*image_offset = offset;
 		if (lseek(fd, *image_offset, SEEK_SET) != *image_offset)