Hello community,
here is the log from the commit of package libgexiv2 for openSUSE:Factory
checked in at Mon Jan 10 11:44:34 CET 2011.
--------
--- GNOME/libgexiv2/libgexiv2.changes 2010-09-11 18:38:47.000000000 +0200
+++ /mounts/work_src_done/STABLE/libgexiv2/libgexiv2.changes 2011-01-07 18:07:20.000000000 +0100
@@ -1,0 +2,7 @@
+Fri Jan 7 18:06:50 CET 2011 - vuntz@opensuse.org
+
+- Update to version 0.2.2:
+ + A more general case fix from 0.2.1, where guards against empty
+ nodes are now in place throughout the library.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
libgexiv2-0.2.1.tar.bz2
New:
----
libgexiv2-0.2.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libgexiv2.spec ++++++
--- /var/tmp/diff_new_pack.5LZLyb/_old 2011-01-10 11:44:08.000000000 +0100
+++ /var/tmp/diff_new_pack.5LZLyb/_new 2011-01-10 11:44:08.000000000 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package libgexiv2 (Version 0.2.1)
+# spec file for package libgexiv2 (Version 0.2.2)
#
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
Name: libgexiv2
-Version: 0.2.1
+Version: 0.2.2
Release: 1
License: GPLv2+
Summary: A GObject-based Exiv2 wrapper
++++++ libgexiv2-0.2.1.tar.bz2 -> libgexiv2-0.2.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata.cpp new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata.cpp
--- old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata.cpp 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata.cpp 2010-12-23 22:20:13.000000000 +0100
@@ -380,62 +380,51 @@
g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL);
g_return_val_if_fail(self->priv->image.get() != NULL, NULL);
- Exiv2::ExifData& exif_data = self->priv->image->exifData();
-
- if (!exif_data.empty ()) {
- Exiv2::ExifKey key ("Exif.Photo.DateTimeOriginal");
- Exiv2::ExifData::iterator it = exif_data.findKey (key);
- if (it != exif_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::ExifKey ("Exif.Image.DateTime");
- it = exif_data.findKey (key);
- if (it != exif_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::ExifKey ("Exif.Photo.DateTimeDigitized");
- it = exif_data.findKey (key);
- if (it != exif_data.end ())
- return g_strdup (it->toString ().c_str ());
- }
-
- Exiv2::XmpData& xmp_data = self->priv->image->xmpData();
-
- if (!xmp_data.empty ()) {
- Exiv2::XmpKey key ("Xmp.exif.DateTimeOriginal");
- Exiv2::XmpData::iterator it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::XmpKey ("Xmp.xmp.CreateDate");
- it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::XmpKey ("Xmp.exif.DateTimeDigitized");
- it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::XmpKey ("Xmp.tiff.DateTime");
- it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::XmpKey ("Xmp.photoshop.DateCreated");
- it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::XmpKey ("Xmp.xmp.ModifyDate");
- it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
-
- key = Exiv2::XmpKey ("Xmp.xmp.MetadataDate");
- it = xmp_data.findKey (key);
- if (it != xmp_data.end ())
- return g_strdup (it->toString ().c_str ());
+ if (gexiv2_metadata_has_exif(self)) {
+ gchar *datetime = gexiv2_metadata_get_exif_tag_interpreted_string(self,
+ "Exif.Photo.DateTimeOriginal");;
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_exif_tag_interpreted_string(self, "Exif.Image.DateTime");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_exif_tag_interpreted_string(self,
+ "Exif.Image.DateTimeDigitized");
+ if (datetime != NULL)
+ return datetime;
+ }
+
+ if (gexiv2_metadata_has_xmp(self)) {
+ gchar *datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self,
+ "Xmp.exif.DateTimeOriginal");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self, "Xmp.xmp.CreateDate");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self, "Xmp.exif.DateTimeDigitized");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self, "Xmp.tiff.DateTime");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self, "Xmp.photoshop.DateCreated");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self, "Xmp.xmp.ModifyDate");
+ if (datetime != NULL)
+ return datetime;
+
+ datetime = gexiv2_metadata_get_xmp_tag_interpreted_string(self, "Xmp.xmp.MetadataDate");
+ if (datetime != NULL)
+ return datetime;
}
/* FIXME: handle IPTC Date */
@@ -471,76 +460,43 @@
g_return_val_if_fail(GEXIV2_IS_METADATA (self), GEXIV2_ORIENTATION_UNSPECIFIED);
g_return_val_if_fail(self->priv->image.get() != NULL, GEXIV2_ORIENTATION_UNSPECIFIED);
- Exiv2::ExifData& exif_data = self->priv->image->exifData();
-
- if (!exif_data.empty ()) {
- /* Because some camera set a wrong standard exif orientation tag,
- We need to check makernote tags first!
- */
- Exiv2::ExifKey minolta_key1 ("Exif.MinoltaCs7D.Rotation");
- Exiv2::ExifData::iterator it = exif_data.findKey (minolta_key1);
- if (it != exif_data.end ()) {
- switch (it->toLong ()) {
+ if (gexiv2_metadata_has_exif(self)) {
+ // Because some camera set a wrong standard exif orientation tag,
+ // We need to check makernote tags first!
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.MinoltaCs7D.Rotation")) {
+ switch (gexiv2_metadata_get_exif_tag_long(self, "Exif.MinoltaCs7D.Rotation")) {
case 76:
return GEXIV2_ORIENTATION_ROT_90;
+
case 82:
return GEXIV2_ORIENTATION_ROT_270;
- default:
- return GEXIV2_ORIENTATION_NORMAL;
}
}
- Exiv2::ExifKey minolta_key2 ("Exif.MinoltaCs5D.Rotation");
- it = exif_data.findKey (minolta_key2);
- if (it != exif_data.end ()) {
- switch (it->toLong ()) {
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.MinoltaCs5D.Rotation")) {
+ switch (gexiv2_metadata_get_exif_tag_long(self, "Exif.MinoltaCs5D.Rotation")) {
case 76:
return GEXIV2_ORIENTATION_ROT_90;
+
case 82:
return GEXIV2_ORIENTATION_ROT_270;
- default:
- return GEXIV2_ORIENTATION_NORMAL;
}
}
-
- Exiv2::ExifKey std_key ("Exif.Image.Orientation");
- it = exif_data.findKey (std_key);
- // TODO: This was added in response to http://trac.yorba.org/ticket/2514
- // The user supplied a file to us with two Exif.Image.Orientation fields, one reported (the
- // first) as zero by exiv2. I discovered that field has a count() of zero, or is emtpy,
- // which causes a segfault when the iterator is dereferenced.
- //
- // This searches for the first matching non-empty key. A better solution would be to guard
- // against this in all searches for all domains, but that's too much of a change for now.
- // We'll probably need to do this for the next release.
- while (it != exif_data.end() && it->count() == 0)
- it++;
-
- if (it != exif_data.end ()) {
- GExiv2Orientation orientation = (GExiv2Orientation) it->toLong ();
-
- return ((orientation < GEXIV2_ORIENTATION_MIN ||
- orientation > GEXIV2_ORIENTATION_MAX) ?
- GEXIV2_ORIENTATION_UNSPECIFIED : orientation);
- }
+ GExiv2Orientation orientation = (GExiv2Orientation) gexiv2_metadata_get_exif_tag_long(self,
+ "Exif.Image.Orientation");
+ if (orientation >= GEXIV2_ORIENTATION_MIN && orientation <= GEXIV2_ORIENTATION_MAX)
+ return orientation;
}
- Exiv2::XmpData& xmp_data = self->priv->image->xmpData();
-
- if (!xmp_data.empty ()) {
- Exiv2::XmpKey tiff_width_key ("Xmp.tiff.ImageWidth");
- Exiv2::XmpData::iterator it = xmp_data.findKey (tiff_width_key);
- if (it != xmp_data.end ()) {
- GExiv2Orientation orientation = (GExiv2Orientation) it->toLong ();
-
- return ((orientation < GEXIV2_ORIENTATION_MIN ||
- orientation > GEXIV2_ORIENTATION_MAX) ?
- GEXIV2_ORIENTATION_UNSPECIFIED : orientation);
- }
+ GExiv2Orientation orientation = GEXIV2_ORIENTATION_UNSPECIFIED;
+ if (gexiv2_metadata_has_xmp_tag(self, "Xmp.tiff.ImageWidth")) {
+ orientation = (GExiv2Orientation) gexiv2_metadata_get_xmp_tag_long(self,
+ "Xmp.tiff.ImageWidth");
}
- return GEXIV2_ORIENTATION_UNSPECIFIED;
+ return (orientation < GEXIV2_ORIENTATION_MIN || orientation > GEXIV2_ORIENTATION_MAX)
+ ? GEXIV2_ORIENTATION_UNSPECIFIED : orientation;
}
gboolean gexiv2_metadata_get_supports_exif (GExiv2Metadata *self) {
@@ -576,15 +532,8 @@
exif_data["Exif.Image.Orientation"] = static_cast (orientation);
xmp_data["Xmp.tiff.ImageWidth"] = static_cast (orientation);
- Exiv2::ExifKey minolta_key1 ("Exif.MinoltaCs7D.Rotation");
- Exiv2::ExifData::iterator it = exif_data.findKey (minolta_key1);
- if (it != exif_data.end ())
- exif_data.erase (it);
-
- Exiv2::ExifKey minolta_key2 ("Exif.MinoltaCs5D.Rotation");
- it = exif_data.findKey (minolta_key2);
- if (it != exif_data.end ())
- exif_data.erase (it);
+ gexiv2_metadata_clear_exif_tag(self, "Exif.MinoltaCs7D.Rotation");
+ gexiv2_metadata_clear_exif_tag(self, "Exif.MinoltaCs5D.Rotation");
}
gint gexiv2_metadata_get_pixel_width (GExiv2Metadata *self) {
@@ -605,32 +554,20 @@
g_return_val_if_fail (GEXIV2_IS_METADATA (self), -1);
g_return_val_if_fail(self->priv->image.get() != NULL, -1);
- Exiv2::ExifData& exif_data = self->priv->image->exifData();
-
- if (!exif_data.empty ()) {
- Exiv2::ExifKey pixel_dim_key ("Exif.Photo.PixelXDimension");
- Exiv2::ExifData::iterator it = exif_data.findKey (pixel_dim_key);
- if (it != exif_data.end ())
- return it->toLong ();
-
- Exiv2::ExifKey image_width_key ("Exif.Image.ImageWidth");
- it = exif_data.findKey (image_width_key);
- if (it != exif_data.end ())
- return it->toLong ();
+ if (gexiv2_metadata_has_exif(self)) {
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.Photo.PixelXDimension"))
+ return gexiv2_metadata_get_exif_tag_long(self, "Exif.Photo.PixelXDimension");
+
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.Image.ImageWidth"))
+ return gexiv2_metadata_get_exif_tag_long(self, "Exif.Image.ImageWidth");
}
- Exiv2::XmpData& xmp_data = self->priv->image->xmpData();
-
- if (!exif_data.empty ()) {
- Exiv2::XmpKey tiff_width_key ("Xmp.tiff.ImageWidth");
- Exiv2::XmpData::iterator it = xmp_data.findKey (tiff_width_key);
- if (it != xmp_data.end ())
- return it->toLong ();
-
- Exiv2::XmpKey xmp_exif_key ("Xmp.exif.PixelXDimension");
- it = xmp_data.findKey (xmp_exif_key);
- if (it != xmp_data.end ())
- return it->toLong ();
+ if (gexiv2_metadata_has_xmp(self)) {
+ if (gexiv2_metadata_has_xmp_tag(self, "Xmp.tiff.ImageWidth"))
+ return gexiv2_metadata_get_xmp_tag_long(self, "Xmp.tiff.ImageWidth");
+
+ if (gexiv2_metadata_has_xmp_tag(self, "Xmp.exif.PixelXDimension"))
+ return gexiv2_metadata_get_xmp_tag_long(self, "Xmp.exif.PixelXDimension");
}
return -1;
@@ -640,32 +577,20 @@
g_return_val_if_fail (GEXIV2_IS_METADATA (self), -1);
g_return_val_if_fail(self->priv->image.get() != NULL, -1);
- Exiv2::ExifData& exif_data = self->priv->image->exifData();
-
- if (!exif_data.empty ()) {
- Exiv2::ExifKey pixel_dim_key ("Exif.Photo.PixelYDimension");
- Exiv2::ExifData::iterator it = exif_data.findKey (pixel_dim_key);
- if (it != exif_data.end ())
- return it->toLong ();
-
- Exiv2::ExifKey image_height_key ("Exif.Image.ImageHeight");
- it = exif_data.findKey (image_height_key);
- if (it != exif_data.end ())
- return it->toLong ();
+ if (gexiv2_metadata_has_exif(self)) {
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.Photo.PixelYDimension"))
+ return gexiv2_metadata_get_exif_tag_long(self, "Exif.Photo.PixelYDimension");
+
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.Image.ImageHeight"))
+ return gexiv2_metadata_get_exif_tag_long(self, "Exif.Image.ImageHeight");
}
- Exiv2::XmpData& xmp_data = self->priv->image->xmpData();
-
- if (!exif_data.empty ()) {
- Exiv2::XmpKey tiff_height_key ("Xmp.tiff.ImageHeight");
- Exiv2::XmpData::iterator it = xmp_data.findKey (tiff_height_key);
- if (it != xmp_data.end ())
- return it->toLong ();
-
- Exiv2::XmpKey xmp_exif_key ("Xmp.exif.PixelYDimension");
- it = xmp_data.findKey (xmp_exif_key);
- if (it != xmp_data.end ())
- return it->toLong ();
+ if (gexiv2_metadata_has_xmp(self)) {
+ if (gexiv2_metadata_has_xmp_tag(self, "Xmp.tiff.ImageHeight"))
+ return gexiv2_metadata_get_xmp_tag_long(self, "Xmp.tiff.ImageHeight");
+
+ if (gexiv2_metadata_has_xmp_tag(self, "Xmp.exif.PixelYDimension"))
+ return gexiv2_metadata_get_xmp_tag_long(self, "Xmp.exif.PixelYDimension");
}
return -1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-exif.cpp new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-exif.cpp
--- old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-exif.cpp 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-exif.cpp 2010-12-23 22:20:13.000000000 +0100
@@ -20,7 +20,7 @@
g_return_val_if_fail (GEXIV2_IS_METADATA (self), FALSE);
g_return_val_if_fail(self->priv->image.get() != NULL, FALSE);
- return ! (self->priv->image->exifData().empty ());
+ return ! (self->priv->image->exifData().empty());
}
gboolean gexiv2_metadata_has_exif_tag(GExiv2Metadata *self, const gchar* tag) {
@@ -29,10 +29,9 @@
g_return_val_if_fail(self->priv->image.get() != NULL, FALSE);
Exiv2::ExifData &exif_data = self->priv->image->exifData();
-
for (Exiv2::ExifData::iterator it = exif_data.begin(); it != exif_data.end(); ++it) {
- if (g_ascii_strcasecmp(tag, it->key().c_str()) == 0)
- return true;
+ if (it->count() > 0 && g_ascii_strcasecmp(tag, it->key().c_str()) == 0)
+ return TRUE;
}
return FALSE;
@@ -49,7 +48,7 @@
Exiv2::ExifData::iterator it = exif_data.begin();
while (it != exif_data.end()) {
- if (g_ascii_strcasecmp(tag, it->key().c_str()) == 0) {
+ if (it->count() > 0 && g_ascii_strcasecmp(tag, it->key().c_str()) == 0) {
it = exif_data.erase(it);
erased = true;
} else {
@@ -81,8 +80,10 @@
gint count = 0;
for (Exiv2::ExifData::iterator it = exif_data.begin(); it != exif_data.end(); ++it) {
- list = g_slist_prepend (list, g_strdup (it->key ().c_str ()));
- count++;
+ if (it->count() > 0) {
+ list = g_slist_prepend (list, g_strdup (it->key ().c_str ()));
+ count++;
+ }
}
data = g_new (gchar*, count + 1);
@@ -104,7 +105,10 @@
try {
Exiv2::ExifData::iterator it = exif_data.findKey(Exiv2::ExifKey(tag));
- if (it != exif_data.end ())
+ while (it != exif_data.end() && it->count() == 0)
+ it++;
+
+ if (it != exif_data.end())
return g_strdup (it->toString ().c_str ());
} catch (Exiv2::Error& e) {
LOG_ERROR(e);
@@ -122,7 +126,10 @@
try {
Exiv2::ExifData::iterator it = exif_data.findKey(Exiv2::ExifKey(tag));
- if (it != exif_data.end ()) {
+ while (it != exif_data.end() && it->count() == 0)
+ it++;
+
+ if (it != exif_data.end()) {
std::ostringstream os;
it->write (os);
@@ -161,7 +168,10 @@
try {
Exiv2::ExifData::iterator it = exif_data.findKey(Exiv2::ExifKey(tag));
- if (it != exif_data.end ())
+ while (it != exif_data.end() && it->count() == 0)
+ it++;
+
+ if (it != exif_data.end())
return it->toLong ();
} catch (Exiv2::Error& e) {
LOG_ERROR(e);
@@ -198,7 +208,10 @@
try {
Exiv2::ExifData::iterator it = exif_data.findKey(Exiv2::ExifKey(tag));
- if (it != exif_data.end ()) {
+ while (it != exif_data.end() && it->count() == 0)
+ it++;
+
+ if (it != exif_data.end()) {
Exiv2::Rational r = it->toRational();
*nom = r.first;
*den = r.second;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-gps.cpp new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-gps.cpp
--- old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-gps.cpp 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-gps.cpp 2010-12-23 22:20:13.000000000 +0100
@@ -28,7 +28,6 @@
*longitude = 0.0;
gchar* longitude_ref = gexiv2_metadata_get_exif_tag_string (self, "Exif.GPSInfo.GPSLongitudeRef");
-
if (longitude_ref == NULL || longitude_ref[0] == '\0')
return FALSE;
@@ -90,7 +89,6 @@
*latitude = 0.0;
gchar* latitude_ref = gexiv2_metadata_get_exif_tag_string (self, "Exif.GPSInfo.GPSLatitudeRef");
-
if (latitude_ref == NULL || latitude_ref[0] == '\0')
return FALSE;
@@ -152,7 +150,6 @@
*altitude = 0.0;
gchar* altitude_ref = gexiv2_metadata_get_exif_tag_string (self, "Exif.GPSInfo.GPSAltitudeRef");
-
if (altitude_ref == NULL || altitude_ref[0] == '\0')
return FALSE;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-iptc.cpp new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-iptc.cpp
--- old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-iptc.cpp 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-iptc.cpp 2010-12-23 22:20:13.000000000 +0100
@@ -23,7 +23,7 @@
g_return_val_if_fail(GEXIV2_IS_METADATA (self), FALSE);
g_return_val_if_fail(self->priv->image.get() != NULL, FALSE);
- return ! (self->priv->image->iptcData().empty ());
+ return ! (self->priv->image->iptcData().empty());
}
gboolean gexiv2_metadata_has_iptc_tag(GExiv2Metadata *self, const gchar* tag) {
@@ -34,7 +34,7 @@
Exiv2::IptcData &iptc_data = self->priv->image->iptcData();
for (Exiv2::IptcData::iterator it = iptc_data.begin(); it != iptc_data.end(); ++it) {
- if (g_ascii_strcasecmp(tag, it->key().c_str()) == 0)
+ if (it->count() > 0 && g_ascii_strcasecmp(tag, it->key().c_str()) == 0)
return true;
}
@@ -52,7 +52,7 @@
Exiv2::IptcData::iterator it = iptc_data.begin();
while (it != iptc_data.end()) {
- if (g_ascii_strcasecmp(tag, it->key().c_str()) == 0) {
+ if (it->count() > 0 && g_ascii_strcasecmp(tag, it->key().c_str()) == 0) {
it = iptc_data.erase(it);
erased = true;
} else {
@@ -84,8 +84,10 @@
gint count = 0;
for (Exiv2::IptcData::iterator it = iptc_data.begin(); it != iptc_data.end(); ++it) {
- list = g_slist_prepend (list, g_strdup (it->key ().c_str ()));
- count = count + 1;
+ if (it->count() > 0) {
+ list = g_slist_prepend (list, g_strdup (it->key ().c_str ()));
+ count++;
+ }
}
data = g_new (gchar*, count + 1);
@@ -98,7 +100,6 @@
return data;
}
-
gchar* gexiv2_metadata_get_iptc_tag_string (GExiv2Metadata *self, const gchar* tag) {
g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL);
g_return_val_if_fail(tag != NULL, NULL);
@@ -108,7 +109,10 @@
try {
Exiv2::IptcData::iterator it = iptc_data.findKey(Exiv2::IptcKey(tag));
- if (it != iptc_data.end ())
+ while (it != iptc_data.end() && it->count() == 0)
+ it++;
+
+ if (it != iptc_data.end())
return g_strdup (it->toString ().c_str ());
} catch (Exiv2::Error& e) {
LOG_ERROR(e);
@@ -126,7 +130,10 @@
try {
Exiv2::IptcData::iterator it = iptc_data.findKey(Exiv2::IptcKey(tag));
- if (it != iptc_data.end ()) {
+ while (it != iptc_data.end() && it->count() == 0)
+ it++;
+
+ if (it != iptc_data.end()) {
std::ostringstream os;
it->write (os);
@@ -172,9 +179,9 @@
try {
Exiv2::IptcKey key (tag);
for (Exiv2::IptcData::iterator it = iptc_data.begin(); it != iptc_data.end(); ++it) {
- if (key.key () == it->key ()) {
+ if (it->count() > 0 && key.key () == it->key ()) {
list = g_slist_prepend (list, g_strdup (it->toString ().c_str ()));
- count ++;
+ count++;
}
}
@@ -207,7 +214,7 @@
Exiv2::IptcKey iptc_key(tag);
Exiv2::IptcData::iterator iptc_it = iptc_data.begin();
while (iptc_it != iptc_data.end()) {
- if (iptc_key.key () == iptc_it->key ())
+ if (iptc_it->count() > 0 && iptc_key.key () == iptc_it->key ())
iptc_it = iptc_data.erase (iptc_it);
else
++iptc_it;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-xmp.cpp new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-xmp.cpp
--- old/libgexiv2-0.2.1/gexiv2/gexiv2-metadata-xmp.cpp 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/gexiv2/gexiv2-metadata-xmp.cpp 2010-12-23 22:20:13.000000000 +0100
@@ -51,7 +51,7 @@
Exiv2::XmpData &xmp_data = self->priv->image->xmpData();
for (Exiv2::XmpData::iterator it = xmp_data.begin(); it != xmp_data.end(); ++it) {
- if (g_ascii_strcasecmp(tag, it->key().c_str()) == 0)
+ if (it->count() > 0 && g_ascii_strcasecmp(tag, it->key().c_str()) == 0)
return true;
}
@@ -69,7 +69,7 @@
Exiv2::XmpData::iterator it = xmp_data.begin();
while (it != xmp_data.end()) {
- if (g_ascii_strcasecmp(tag, it->key().c_str()) == 0) {
+ if (it->count() > 0 && g_ascii_strcasecmp(tag, it->key().c_str()) == 0) {
it = xmp_data.erase(it);
erased = true;
} else {
@@ -94,8 +94,10 @@
gint count = 0;
for (Exiv2::XmpData::iterator it = xmp_data.begin(); it != xmp_data.end(); ++it) {
- list = g_slist_prepend (list, g_strdup (it->key ().c_str ()));
- count = count + 1;
+ if (it->count() > 0) {
+ list = g_slist_prepend (list, g_strdup (it->key ().c_str ()));
+ count++;
+ }
}
data = g_new (gchar*, count + 1);
@@ -116,10 +118,11 @@
Exiv2::XmpData& xmp_data = self->priv->image->xmpData();
try {
-
Exiv2::XmpData::iterator it = xmp_data.findKey(Exiv2::XmpKey(tag));
+ while (it != xmp_data.end() && it->count() == 0)
+ it++;
- if (it != xmp_data.end ())
+ if (it != xmp_data.end())
return g_strdup (it->toString ().c_str ());
} catch (Exiv2::Error& e) {
LOG_ERROR(e);
@@ -137,7 +140,10 @@
try {
Exiv2::XmpData::iterator it = xmp_data.findKey(Exiv2::XmpKey(tag));
- if (it != xmp_data.end ()) {
+ while (it != xmp_data.end() && it->count() == 0)
+ it++;
+
+ if (it != xmp_data.end()) {
std::ostringstream os;
it->write (os);
@@ -177,7 +183,10 @@
try {
Exiv2::XmpData::iterator it = xmp_data.findKey(Exiv2::XmpKey(tag));
- if (it != xmp_data.end ())
+ while (it != xmp_data.end() && it->count() == 0)
+ it++;
+
+ if (it != xmp_data.end())
return it->toLong ();
} catch (Exiv2::Error& e) {
LOG_ERROR(e);
@@ -211,7 +220,10 @@
try {
Exiv2::XmpData::iterator it = xmp_data.findKey(Exiv2::XmpKey(tag));
- if (it != xmp_data.end ()) {
+ while (it != xmp_data.end() && it->count() == 0)
+ it++;
+
+ if (it != xmp_data.end()) {
int size = it->count ();
gchar **array = g_new (gchar*, size + 1);
array[size] = NULL;
@@ -242,9 +254,12 @@
try {
/* first clear existing tag */
- Exiv2::XmpData::iterator xmp_it = xmp_data.findKey(Exiv2::XmpKey(tag));
- if (xmp_it != xmp_data.end ())
- xmp_data.erase (xmp_it);
+ Exiv2::XmpData::iterator it = xmp_data.findKey(Exiv2::XmpKey(tag));
+ while (it != xmp_data.end() && it->count() == 0)
+ it++;
+
+ if (it != xmp_data.end())
+ xmp_data.erase (it);
/* ... and then set the others */
const gchar **val_it = values;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/Makefile new/libgexiv2-0.2.2/Makefile
--- old/libgexiv2-0.2.1/Makefile 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/Makefile 2010-12-23 22:20:13.000000000 +0100
@@ -1,5 +1,5 @@
PKGNAME = gexiv2
-VERSION = 0.2.1
+VERSION = 0.2.2
LIBRARY = lib$(PKGNAME)
LIBRARY_BIN = $(LIBRARY).la
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgexiv2-0.2.1/NEWS new/libgexiv2-0.2.2/NEWS
--- old/libgexiv2-0.2.1/NEWS 2010-09-10 23:52:54.000000000 +0200
+++ new/libgexiv2-0.2.2/NEWS 2010-12-23 22:20:13.000000000 +0100
@@ -1,3 +1,10 @@
+gexiv2 0.2.2 - 23 December 2010
+-------------------------------
+
+ * A more general case fix from 0.2.1, where guards against empty nodes are
+ now in place throughout the library.
+
+
gexiv2 0.2.1 - 10 September 2010
--------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org