[gimp] libgimp: clean up metadata patch to not warn and other minor changes
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: clean up metadata patch to not warn and other minor changes
- Date: Fri, 7 Jul 2017 16:26:32 +0000 (UTC)
commit 945a695f2d6cf216d4cd7659d94a86b2fba680ee
Author: Michael Natterer <mitch gimp org>
Date: Fri Jul 7 18:25:56 2017 +0200
libgimp: clean up metadata patch to not warn and other minor changes
libgimp/gimpimagemetadata.c | 54 ++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 26 deletions(-)
---
diff --git a/libgimp/gimpimagemetadata.c b/libgimp/gimpimagemetadata.c
index b786362..00d8a6c 100644
--- a/libgimp/gimpimagemetadata.c
+++ b/libgimp/gimpimagemetadata.c
@@ -32,11 +32,12 @@
#include "libgimp-intl.h"
+
typedef struct
{
gchar *tag;
gint type;
-} xmpstructs;
+} XmpStructs;
static void gimp_image_metadata_rotate (gint32 image_ID,
@@ -442,19 +443,32 @@ gimp_image_metadata_save_finish (gint32 image_ID,
if ((flags & GIMP_METADATA_SAVE_XMP) && support_xmp)
{
+ static const XmpStructs structlist[] =
+ {
+ { "Xmp.iptcExt.LocationCreated", GEXIV2_STRUCTURE_XA_BAG },
+ { "Xmp.iptcExt.LocationShown", GEXIV2_STRUCTURE_XA_BAG },
+ { "Xmp.iptcExt.ArtworkOrObject", GEXIV2_STRUCTURE_XA_BAG },
+ { "Xmp.iptcExt.RegistryId", GEXIV2_STRUCTURE_XA_BAG },
+ { "Xmp.xmpMM.History", GEXIV2_STRUCTURE_XA_SEQ },
+ { "Xmp.plus.ImageSupplier", GEXIV2_STRUCTURE_XA_SEQ },
+ { "Xmp.plus.ImageCreator", GEXIV2_STRUCTURE_XA_SEQ },
+ { "Xmp.plus.CopyrightOwner", GEXIV2_STRUCTURE_XA_SEQ },
+ { "Xmp.plus.Licensor", GEXIV2_STRUCTURE_XA_SEQ }
+ };
+
gchar **xmp_data;
struct timeval timer_usec;
- long long int timestamp_usec;
- gchar ts[1024];
+ gint64 timestamp_usec;
+ gchar ts[128];
gimp_metadata_register_xmp_namespaces ();
- gettimeofday(&timer_usec, NULL);
- timestamp_usec = ((long long int) timer_usec.tv_sec) * 1000000ll +
- (long long int) timer_usec.tv_usec;
- sprintf((gchar*)&ts, "%lld", timestamp_usec);
- gimp_metadata_add_xmp_history (GEXIV2_METADATA (metadata),
- "");
+ gettimeofday (&timer_usec, NULL);
+ timestamp_usec = ((gint64) timer_usec.tv_sec) * 1000000ll +
+ (gint64) timer_usec.tv_usec;
+ g_snprintf (ts, sizeof (ts), "%" G_GINT64_FORMAT, timestamp_usec);
+
+ gimp_metadata_add_xmp_history (metadata, "");
gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
"Xmp.GIMP.TimeStamp",
@@ -489,24 +503,11 @@ gimp_image_metadata_save_finish (gint32 image_ID,
xmp_data = gexiv2_metadata_get_xmp_tags (GEXIV2_METADATA (metadata));
/* Patch necessary structures */
- xmpstructs structlist[] =
- {
- { "Xmp.iptcExt.LocationCreated", GEXIV2_STRUCTURE_XA_BAG },
- { "Xmp.iptcExt.LocationShown", GEXIV2_STRUCTURE_XA_BAG },
- { "Xmp.iptcExt.ArtworkOrObject", GEXIV2_STRUCTURE_XA_BAG },
- { "Xmp.iptcExt.RegistryId", GEXIV2_STRUCTURE_XA_BAG },
- { "Xmp.xmpMM.History", GEXIV2_STRUCTURE_XA_SEQ },
- { "Xmp.plus.ImageSupplier", GEXIV2_STRUCTURE_XA_SEQ },
- { "Xmp.plus.ImageCreator", GEXIV2_STRUCTURE_XA_SEQ },
- { "Xmp.plus.CopyrightOwner", GEXIV2_STRUCTURE_XA_SEQ },
- { "Xmp.plus.Licensor", GEXIV2_STRUCTURE_XA_SEQ }
- };
-
for (i = 0; i < 9; i++)
{
- gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (new_g2metadata),
- structlist[i].tag,
- structlist[i].type);
+ gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (new_g2metadata),
+ structlist[i].tag,
+ structlist[i].type);
}
for (i = 0; xmp_data[i] != NULL; i++)
@@ -514,7 +515,8 @@ gimp_image_metadata_save_finish (gint32 image_ID,
if (! gexiv2_metadata_has_tag (new_g2metadata, xmp_data[i]) &&
gimp_metadata_is_tag_supported (xmp_data[i], mime_type))
{
- value = gexiv2_metadata_get_tag_string (GEXIV2_METADATA (metadata), xmp_data[i]);
+ value = gexiv2_metadata_get_tag_string (GEXIV2_METADATA (metadata),
+ xmp_data[i]);
gexiv2_metadata_set_tag_string (new_g2metadata, xmp_data[i],
value);
g_free (value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]