diff src/exiv2.cc @ 1245:13d4501bfa7a

compilation fixes for older exiv2
author nadvornik
date Wed, 21 Jan 2009 18:16:26 +0000
parents 947e603a52c6
children 8b89e3ff286b
line wrap: on
line diff
--- a/src/exiv2.cc	Tue Jan 20 22:53:09 2009 +0000
+++ b/src/exiv2.cc	Wed Jan 21 18:16:26 2009 +0000
@@ -290,7 +290,9 @@
 #endif
 			imageData_->image()->setExifData(exifData_);
 			imageData_->image()->setIptcData(iptcData_);
+#if EXIV2_TEST_VERSION(0,16,0)
 			imageData_->image()->setXmpData(xmpData_);
+#endif
 			imageData_->image()->writeMetadata();
 			} 
 		else
@@ -804,7 +806,10 @@
 				}
 		}
 		catch (Exiv2::AnyError& e) {
-			try {
+#if EXIV2_TEST_VERSION(0,16,0)
+			try 
+#endif
+			{
 				Exiv2::IptcKey ekey(key);
 				Exiv2::IptcData::iterator pos = exif->iptcData().findKey(ekey);
 				while (pos != exif->iptcData().end())
@@ -819,8 +824,8 @@
 					work = work->next;
 					}
 			}
+#if EXIV2_TEST_VERSION(0,16,0)
 			catch (Exiv2::AnyError& e) {
-#if EXIV2_TEST_VERSION(0,16,0)
 				Exiv2::XmpKey ekey(key);
 				Exiv2::XmpData::iterator pos = exif->xmpData().findKey(ekey);
 				while (pos != exif->xmpData().end())
@@ -834,10 +839,8 @@
 					exif->xmpData()[key] = (gchar *)work->data;
 					work = work->next;
 					}
-#else
-				throw e;
+			}
 #endif
-			}
 		}
 		return 1;
 	}
@@ -874,19 +877,19 @@
 
 static GList *exif_add_value_to_glist(GList *list, Exiv2::Metadatum &item)
 {
+#if EXIV2_TEST_VERSION(0,16,0)
 	Exiv2::TypeId id = item.typeId();
 	if (id == Exiv2::asciiString ||
 	    id == Exiv2::undefined ||
 	    id == Exiv2::string ||
 	    id == Exiv2::date ||
 	    id == Exiv2::time ||
-#if EXIV2_TEST_VERSION(0,16,0)
 	    id == Exiv2::xmpText ||
 	    id == Exiv2::langAlt ||
-#endif 
 	    id == Exiv2::comment
 	    )
 		{
+#endif 
 		/* read as a single entry */
 		std::string str = item.toString();
 		if (str.length() > 5 && str.substr(0, 5) == "lang=")
@@ -895,6 +898,7 @@
 			if (pos != std::string::npos) str = str.substr(pos+1);
 			}
 		list = g_list_append(list, utf8_validate_or_convert(str.c_str())); 
+#if EXIV2_TEST_VERSION(0,16,0)
 		}
 	else
 		{
@@ -903,6 +907,7 @@
 		for (i = 0; i < item.count(); i++)
 			list = g_list_append(list, utf8_validate_or_convert(item.toString(i).c_str())); 
 		}
+#endif 
 	return list;
 }