Revision: 1148
http://geeqie.svn.sourceforge.net/geeqie/?rev=1148&view=rev
Author: nadvornik
Date: 2008-10-04 20:28:31 +0000 (Sat, 04 Oct 2008)
Log Message:
-----------
fixed charset of exiv2 strings in non-utf8 locales
Modified Paths:
--------------
trunk/src/bar_exif.c
trunk/src/exif-common.c
trunk/src/exif.c
trunk/src/exif.h
trunk/src/exiv2.cc
trunk/src/pan-view.c
trunk/src/preferences.c
Modified: trunk/src/bar_exif.c
===================================================================
--- trunk/src/bar_exif.c 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/bar_exif.c 2008-10-04 20:28:31 UTC (rev 1148)
@@ -625,11 +625,12 @@
for (i = 0; ExifUIList[i].key; i++)
{
- const gchar *text;
+ gchar *text;
text = exif_get_description_by_key(ExifUIList[i].key);
eb->labels[i] = table_add_line(table, 0, i, text, NULL,
&eb->keys[i]);
+ g_free(text);
}
eb->custom_sep = gtk_hseparator_new();
Modified: trunk/src/exif-common.c
===================================================================
--- trunk/src/exif-common.c 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/exif-common.c 2008-10-04 20:28:31 UTC (rev 1148)
@@ -541,7 +541,7 @@
return NULL;
}
-const gchar *exif_get_description_by_key(const gchar *key)
+gchar *exif_get_description_by_key(const gchar *key)
{
if (!key) return NULL;
@@ -552,7 +552,7 @@
key += 10;
for (i = 0; ExifFormattedList[i].key; i++)
if (strcmp(key, ExifFormattedList[i].key + 10) == 0)
- return _(ExifFormattedList[i].description);
+ return
g_strdup(_(ExifFormattedList[i].description));
}
return exif_get_tag_description_by_key(key);
Modified: trunk/src/exif.c
===================================================================
--- trunk/src/exif.c 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/exif.c 2008-10-04 20:28:31 UTC (rev 1148)
@@ -1493,7 +1493,7 @@
return NULL;
}
-const gchar *exif_get_tag_description_by_key(const gchar *key)
+gchar *exif_get_tag_description_by_key(const gchar *key)
{
gint i;
@@ -1502,7 +1502,7 @@
i = 0;
while (ExifKnownMarkersList[i].tag > 0)
{
- if (strcmp(key, ExifKnownMarkersList[i].key) == 0) return
_(ExifKnownMarkersList[i].description);
+ if (strcmp(key, ExifKnownMarkersList[i].key) == 0) return
g_strdup(_(ExifKnownMarkersList[i].description));
i++;
}
Modified: trunk/src/exif.h
===================================================================
--- trunk/src/exif.h 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/exif.h 2008-10-04 20:28:31 UTC (rev 1148)
@@ -137,8 +137,8 @@
gchar *exif_item_get_string(ExifItem *item, gint idx);
-const gchar *exif_get_description_by_key(const gchar *key);
-const gchar *exif_get_tag_description_by_key(const gchar *key);
+gchar *exif_get_description_by_key(const gchar *key);
+gchar *exif_get_tag_description_by_key(const gchar *key);
gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint
*key_valid);
Modified: trunk/src/exiv2.cc
===================================================================
--- trunk/src/exiv2.cc 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/exiv2.cc 2008-10-04 20:28:31 UTC (rev 1148)
@@ -375,7 +375,7 @@
{
try {
if (!item) return NULL;
- return g_strdup(((Exiv2::Metadatum *)item)->tagLabel().c_str());
+ return g_locale_to_utf8(((Exiv2::Metadatum
*)item)->tagLabel().c_str(), -1, NULL, NULL, NULL);
}
catch (std::exception& e) {
// std::cout << "Caught Exiv2 exception '" << e << "'\n";
@@ -449,7 +449,7 @@
if (!item) return NULL;
Exiv2::Metadatum *metadatum = (Exiv2::Metadatum *)item;
#if EXIV2_TEST_VERSION(0,17,0)
- return g_strdup(metadatum->print().c_str());
+ return g_locale_to_utf8(metadatum->print().c_str(), -1, NULL,
NULL, NULL);
#else
std::stringstream str;
Exiv2::Exifdatum *exifdatum;
@@ -466,7 +466,7 @@
str << *xmpdatum;
#endif
- return g_strdup(str.str().c_str());
+ return g_locale_to_utf8(str.str().c_str(), -1, NULL, NULL,
NULL);
#endif
}
catch (Exiv2::AnyError& e) {
@@ -491,6 +491,7 @@
if (pos != std::string::npos) str = str.substr(pos+1);
}
+// return g_locale_to_utf8(str.c_str(), -1, NULL, NULL, NULL); //
FIXME
return g_strdup(str.c_str());
}
catch (Exiv2::AnyError& e) {
@@ -530,11 +531,11 @@
}
}
-const gchar *exif_get_tag_description_by_key(const gchar *key)
+gchar *exif_get_tag_description_by_key(const gchar *key)
{
try {
Exiv2::ExifKey ekey(key);
- return Exiv2::ExifTags::tagLabel(ekey.tag(), ekey.ifdId ());
+ return g_locale_to_utf8(Exiv2::ExifTags::tagLabel(ekey.tag(),
ekey.ifdId ()), -1, NULL, NULL, NULL);
}
catch (Exiv2::AnyError& e) {
std::cout << "Caught Exiv2 exception '" << e << "'\n";
Modified: trunk/src/pan-view.c
===================================================================
--- trunk/src/pan-view.c 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/pan-view.c 2008-10-04 20:28:31 UTC (rev 1148)
@@ -1446,6 +1446,7 @@
for (i = 0; ExifUIList[i].key; i++)
{
gchar *label;
+ gchar *desc;
gchar *text;
gchar *utf8_text;
@@ -1458,7 +1459,9 @@
continue;
}
- label = g_strdup_printf("%s:",
exif_get_description_by_key(ExifUIList[i].key));
+ desc = exif_get_description_by_key(ExifUIList[i].key);
+ label = g_strdup_printf("%s:", desc);
+ g_free(desc);
utf8_text = utf8_validate_or_convert(text);
g_free(text);
pan_text_alignment_add(ta, label, utf8_text);
Modified: trunk/src/preferences.c
===================================================================
--- trunk/src/preferences.c 2008-10-01 20:57:56 UTC (rev 1147)
+++ trunk/src/preferences.c 2008-10-04 20:28:31 UTC (rev 1148)
@@ -1328,11 +1328,12 @@
for (i = 0; ExifUIList[i].key; i++)
{
- const gchar *title;
+ gchar *title;
title = exif_get_description_by_key(ExifUIList[i].key);
exif_item(table, 0, i, title, ExifUIList[i].current,
&ExifUIList[i].temp);
+ g_free(title);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn