[gthumb/gthumb-2-12] Enable building with exiv2-0.21 (#349150)



commit a520bcbe5a7be15153d707fa9753b947cfe58810
Author: Alexandre Rostovtsev <tetromino gmail com>
Date:   Sun Dec 19 22:19:12 2010 -0500

    Enable building with exiv2-0.21 (#349150)
    
    Due to API changes in exiv2-0.21 (see
    http://dev.exiv2.org/issues/show/0000721), gthumb with exiv2 support
    enabled fails to compile. This patch updates gthumb to allow compilation
    with both exiv2-0.20 and 0.21. Since ifd IDs are no longer part of the
    public API, the patch uses group names instead (which works with
    exiv2-0.20 as well, modulo the fact that 0.21 has isMakerGroup() instead
    of isMakerIfd() in 0.20).
    In addition, instead of numeric comparison with ids1Id (which wouldn't
    work with exiv2-0.21 in any case), isMakerGroup()/isMakerIfd() are now
    used to determine whether or not a tag is a MakerNote.
    
    Signed-off-by: Alexandre Rostovtsev <tetromino gmail com>

 extensions/exiv2_tools/exiv2-utils.cpp |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index 780bf29..f24b50d 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -497,19 +497,19 @@ set_attributes_from_tagsets (GFileInfo *info)
 static const char *
 get_exif_default_category (const Exiv2::Exifdatum &md)
 {
+#if EXIV2_TEST_VERSION(0, 21, 0)
+	if (Exiv2::ExifTags::isMakerGroup(md.groupName()))
+#else
 	if (Exiv2::ExifTags::isMakerIfd(md.ifdId()))
+#endif
 		return "Exif::MakerNotes";
 
-	switch (md.ifdId()) {
-	case Exiv2::ifd1Id:
+	if (md.groupName().compare("Thumbnail") == 0)
 		return "Exif::Thumbnail";
-	case Exiv2::gpsIfdId:
+	else if (md.groupName().compare("GPSInfo") == 0)
 		return "Exif::GPS";
-	case Exiv2::iopIfdId:
+	else if (md.groupName().compare("Iop") == 0)
 		return "Exif::Versions";
-	default:
-		break;
-	}
 
 	return "Exif::Other";
 }
@@ -531,7 +531,11 @@ exiv2_read_metadata (Exiv2::Image::AutoPtr  image,
 			stringstream description;
 			if (! md->tagLabel().empty())
 				description << md->tagLabel();
-			else if (md->ifdId () > Exiv2::ifd1Id)
+#if EXIV2_TEST_VERSION(0, 21, 0)
+			else if (Exiv2::ExifTags::isMakerGroup(md->groupName()))
+#else
+			else if (Exiv2::ExifTags::isMakerIfd(md->ifdId()))
+#endif
 				// Must be a MakerNote - include group name
 				description << md->groupName() << "." << md->tagName();
 			else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]