Another patch, that fix the locale settings for output of exiv2 errors.
(Did I say that I hate c++!?)

Regards
   Klaus
-- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <kl...@ethgen.de>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
>From e586951358f567b8024eba6fc2e2cdeebb9a60f0 Mon Sep 17 00:00:00 2001
From: Klaus Ethgen <kl...@ethgen.de>
Date: Sun, 5 Apr 2009 21:10:36 +0100
Subject: [PATCH] Fix locale mismatch in exiv2 errors

---
 src/exiv2.cc |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/exiv2.cc b/src/exiv2.cc
index 0078aca..2bd3397 100644
--- a/src/exiv2.cc
+++ b/src/exiv2.cc
@@ -414,7 +414,7 @@ ExifData *exif_read(gchar *path, gchar *sidecar_path, GHashTable *modified_xmp)
 		return new _ExifDataProcessed(path, sidecar_path, modified_xmp);
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 	
@@ -427,7 +427,7 @@ gboolean exif_write(ExifData *exif)
 		return TRUE;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return FALSE;
 	}
 }
@@ -439,7 +439,7 @@ gboolean exif_write_sidecar(ExifData *exif, gchar *path)
 		return TRUE;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return FALSE;
 	}
 	
@@ -488,7 +488,7 @@ ExifItem *exif_get_item(ExifData *exif, const gchar *key)
 		return (ExifItem *)item;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -525,7 +525,7 @@ ExifItem *exif_add_item(ExifData *exif, const gchar *key)
 		return (ExifItem *)item;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -563,7 +563,7 @@ ExifItem *exif_get_first_item(ExifData *exif)
 			
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -594,7 +594,7 @@ ExifItem *exif_get_next_item(ExifData *exif)
 		return NULL;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -606,7 +606,7 @@ char *exif_item_get_tag_name(ExifItem *item)
 		return g_strdup(((Exiv2::Metadatum *)item)->key().c_str());
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -618,7 +618,7 @@ guint exif_item_get_tag_id(ExifItem *item)
 		return ((Exiv2::Metadatum *)item)->tag();
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return 0;
 	}
 }
@@ -630,7 +630,7 @@ guint exif_item_get_elements(ExifItem *item)
 		return ((Exiv2::Metadatum *)item)->count();
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return 0;
 	}
 }
@@ -647,7 +647,7 @@ char *exif_item_get_data(ExifItem *item, guint *data_len)
 		return data;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -659,7 +659,7 @@ char *exif_item_get_description(ExifItem *item)
 		return utf8_validate_or_convert(((Exiv2::Metadatum *)item)->tagLabel().c_str());
 	}
 	catch (std::exception& e) {
-//		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+//		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -706,7 +706,7 @@ guint exif_item_get_format_id(ExifItem *item)
 		return format_id_trans_tbl[id];
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return EXIF_FORMAT_UNKNOWN;
 	}
 }
@@ -718,7 +718,7 @@ const char *exif_item_get_format_name(ExifItem *item, gboolean brief)
 		return ((Exiv2::Metadatum *)item)->typeName();
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -788,7 +788,7 @@ gint exif_item_get_integer(ExifItem *item, gint *value)
 		return 1;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return 0;
 	}
 }
@@ -806,7 +806,7 @@ ExifRational *exif_item_get_rational(ExifItem *item, gint *sign, guint n)
 		return &ret;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -830,7 +830,7 @@ gchar *exif_get_tag_description_by_key(const gchar *key)
 #endif
 			}
 			catch (Exiv2::AnyError& e) {
-				std::cout << "Caught Exiv2 exception '" << e << "'\n";
+				std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 				return NULL;
 			}
 		}
@@ -911,7 +911,7 @@ static gint exif_update_metadata_simple(ExifData *exif, const gchar *key, const
 		return 1;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return 0;
 	}
 }
@@ -1049,7 +1049,7 @@ static GList *exif_get_metadata_simple(ExifData *exif, const gchar *key, Metadat
 		}
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 	}
 	return list;
 }
@@ -1160,7 +1160,7 @@ guchar *exif_get_preview(ExifData *exif, guint *data_len, gint requested_width,
 		return NULL;
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 		return NULL;
 	}
 }
@@ -1258,7 +1258,7 @@ extern "C" guchar *exif_get_preview(ExifData *exif, guint *data_len, gint reques
 		
 	}
 	catch (Exiv2::AnyError& e) {
-		std::cout << "Caught Exiv2 exception '" << e << "'\n";
+		std::cout << "Caught Exiv2 exception '" << g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL) << "'\n";
 	}
 	return NULL;
 
-- 
1.6.2.1

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel

Reply via email to