/*
* Geeqie
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* Author: Vladimir Nadvornik
*
{NULL, NULL, NULL}
};
+static void _debug_exception(const char* file,
+ int line,
+ const char* func,
+ Exiv2::AnyError& e)
+{
+ gchar *str = g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL);
+ DEBUG_1("%s:%d:%s:Exiv2: %s", file, line, func, str);
+ g_free(str);
+}
+
+#define debug_exception(e) _debug_exception(__FILE__, __LINE__, __func__, e)
+
struct _ExifData
{
Exiv2::ExifData::const_iterator exifIter; /* for exif_get_next_item */
exifData_ = imageData_->exifData();
iptcData_ = imageData_->iptcData();
#if EXIV2_TEST_VERSION(0,17,0)
- syncExifWithXmp(exifData_, xmpData_);
+ try
+ {
+ syncExifWithXmp(exifData_, xmpData_);
+ }
+ catch (...)
+ {
+ DEBUG_1("Exiv2: Catching bug\n");
+ }
#endif
if (modified_xmp)
{
return new _ExifDataProcessed(path, sidecar_path, modified_xmp);
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
return TRUE;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return FALSE;
}
}
return TRUE;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return FALSE;
}
return (ExifItem *)item;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
return (ExifItem *)item;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
return NULL;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
return g_strdup(((Exiv2::Metadatum *)item)->key().c_str());
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
return ((Exiv2::Metadatum *)item)->tag();
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return 0;
}
}
return ((Exiv2::Metadatum *)item)->count();
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return 0;
}
}
return data;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
return utf8_validate_or_convert(((Exiv2::Metadatum *)item)->tagLabel().c_str());
}
catch (std::exception& e) {
-// std::cout << "Caught Exiv2 exception '" << e << "'\n";
+// debug_exception(e);
return NULL;
}
}
return format_id_trans_tbl[id];
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return EXIF_FORMAT_UNKNOWN;
}
}
return ((Exiv2::Metadatum *)item)->typeName();
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
gint exif_item_get_integer(ExifItem *item, gint *value)
{
try {
- if (!item) return 0;
+ if (!item || exif_item_get_elements(item) == 0) return 0;
*value = ((Exiv2::Metadatum *)item)->toLong();
return 1;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return 0;
}
}
return &ret;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
#endif
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
return 1;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return 0;
}
}
#if EXIV2_TEST_VERSION(0,16,0)
Exiv2::Xmpdatum *xmpdatum;
#endif
- if ((exifdatum = dynamic_cast<Exiv2::Exifdatum *>(metadatum)))
+ if ((exifdatum = dynamic_cast<Exiv2::Exifdatum *>(&item)))
stream << *exifdatum;
- else if ((iptcdatum = dynamic_cast<Exiv2::Iptcdatum *>(metadatum)))
+ else if ((iptcdatum = dynamic_cast<Exiv2::Iptcdatum *>(&item)))
stream << *iptcdatum;
#if EXIV2_TEST_VERSION(0,16,0)
- else if ((xmpdatum = dynamic_cast<Exiv2::Xmpdatum *>(metadatum)))
+ else if ((xmpdatum = dynamic_cast<Exiv2::Xmpdatum *>(&item)))
stream << *xmpdatum;
#endif
str = stream.str();
else
{
str = item.toString();
- if (str.length() > 5 && str.substr(0, 5) == "lang=")
- {
- std::string::size_type pos = str.find_first_of(' ');
- if (pos != std::string::npos) str = str.substr(pos+1);
- }
+ }
+ if (str.length() > 5 && str.substr(0, 5) == "lang=")
+ {
+ std::string::size_type pos = str.find_first_of(' ');
+ 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)
}
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
}
return list;
}
return NULL;
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
return NULL;
}
}
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ debug_exception(e);
}
return NULL;