diff src/exiv2.cc @ 495:c7a2471e5c4e

Introduce macros to display debug messages. if (debug) printf(...) is now replaced by variadic macros: DEBUG_1() And for higher debugging levels: DEBUG_2() DEBUG_3() DEBUG_4()
author zas_
date Wed, 23 Apr 2008 20:47:19 +0000
parents 2fef42c958bb
children a1f13fab6686
line wrap: on
line diff
--- a/src/exiv2.cc	Wed Apr 23 13:46:18 2008 +0000
+++ b/src/exiv2.cc	Wed Apr 23 20:47:19 2008 +0000
@@ -81,13 +81,13 @@
 		image->readMetadata();
 
 #if EXIV2_TEST_VERSION(0,16,0)
-		if (debug >= 2) printf("xmp count %li\n", image->xmpData().count());
+		DEBUG_2("xmp count %li\n", image->xmpData().count());
 		if (sidecar_path && image->xmpData().empty())
 			{
 			sidecar = Exiv2::ImageFactory::open(sidecar_path);
 			sidecar->readMetadata();
 			have_sidecar = sidecar->good();
-			if (debug >= 2) printf("sidecar xmp count %li\n", sidecar->xmpData().count());
+			DEBUG_2("sidecar xmp count %li\n", sidecar->xmpData().count());
 			}
 
 #endif
@@ -140,7 +140,7 @@
 
 ExifData *exif_read(gchar *path, gchar *sidecar_path)
 {
-	if (debug) printf("exif read %s,  sidecar: %s\n", path, sidecar_path ? sidecar_path : "-");
+	DEBUG_1("exif read %s,  sidecar: %s\n", path, sidecar_path ? sidecar_path : "-");
 	try {
 		return new ExifData(path, sidecar_path);
 	}
@@ -715,7 +715,7 @@
 	TiffEntryBase* te = dynamic_cast<TiffEntryBase*>(finder.result());
 	if (te)
 		{
-		if (debug) printf("(tag: %04x %04x) ", tag, group);
+		DEBUG_1("(tag: %04x %04x) ", tag, group);
 		return te->pValue();
 		}
 	else
@@ -763,9 +763,8 @@
 
 	try {
 		RawFile rf(fd);
-		if (debug) printf("%s: offset ", path);
 		offset = rf.preview_offset();
-		if (debug) printf("%lu\n", offset);
+		DEBUG_1("%s: offset %lu\n", path, offset);
 	}
 	catch (Exiv2::AnyError& e) {
 		std::cout << "Caught Exiv2 exception '" << e << "'\n";