[gthumb] use the attribute id instead of the metadata id that can be null
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] use the attribute id instead of the metadata id that can be null
- Date: Fri, 23 Jul 2010 21:45:32 +0000 (UTC)
commit 94e1d15c3bf41219a3be6a7e668272ebf6141b93
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Jul 23 23:42:42 2010 +0200
use the attribute id instead of the metadata id that can be null
extensions/exiv2_tools/exiv2-utils.cpp | 13 +++++++------
gthumb/gth-main.c | 3 +++
2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index 4dc4b0c..7da3ce7 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -611,19 +611,20 @@ mandatory_string (Exiv2::ExifData &checkdata,
const char *
-gth_main_get_metadata_type (GthMetadata *metadata)
+gth_main_get_metadata_type (GthMetadata *metadata,
+ const char *attribute)
{
const char *value_type;
GthMetadataInfo *metadatum_info;
value_type = gth_metadata_get_value_type (metadata);
if (g_strcmp0 (value_type, "Undefined") == 0)
- value_type = NULL;
+ value_type = NULL;
if (value_type != NULL)
return value_type;
- metadatum_info = gth_main_get_metadata_info (gth_metadata_get_id (metadata));
+ metadatum_info = gth_main_get_metadata_info (attribute);
if (metadatum_info != NULL)
value_type = metadatum_info->type;
@@ -665,7 +666,7 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
*/
const char *raw_value = gth_metadata_get_raw (metadatum);
- const char *value_type = gth_main_get_metadata_type (metadatum);
+ const char *value_type = gth_main_get_metadata_type (metadatum, attributes[i]);
if ((raw_value != NULL) && (strcmp (raw_value, "") != 0) && (value_type != NULL)) {
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type));
@@ -760,7 +761,7 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
try {
const char *raw_value = gth_metadata_get_raw (metadatum);
- const char *value_type = gth_main_get_metadata_type (metadatum);
+ const char *value_type = gth_main_get_metadata_type (metadatum, attributes[i]);
if ((raw_value != NULL) && (strcmp (raw_value, "") != 0) && (value_type != NULL)) {
/* See the exif data code above for an explanation. */
@@ -796,7 +797,7 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
try {
const char *raw_value = gth_metadata_get_raw (metadatum);
- const char *value_type = gth_main_get_metadata_type (metadatum);
+ const char *value_type = gth_main_get_metadata_type (metadatum, attributes[i]);
if ((raw_value != NULL) && (strcmp (raw_value, "") != 0) && (value_type != NULL)) {
/* See the exif data code above for an explanation. */
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index c1d75d7..238222a 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -581,6 +581,9 @@ gth_main_get_metadata_info (const char *id)
{
int i;
+ if (id == NULL)
+ return NULL;
+
for (i = 0; i < Main->priv->metadata_info->len; i++) {
GthMetadataInfo *info;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]