head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.8 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.6 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.4 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.2 pkgsrc-2011Q2-base:1.2 pkgsrc-2010Q4:1.1.0.2 pkgsrc-2010Q4-base:1.1; locks; strict; comment @# @; 1.2 date 2011.01.12.18.46.36; author drochner; state dead; branches; next 1.1; 1.1 date 2010.12.03.16.51.04; author drochner; state Exp; branches; next ; desc @@ 1.2 log @update to 0.3.0 changes: -bugfixes -adaption to exiv2-0.21 API @ text @$NetBSD: patch-af,v 1.1 2010/12/03 16:51:04 drochner Exp $ --- gexiv2/gexiv2-metadata-xmp.cpp.orig 2010-09-10 21:52:54.000000000 +0000 +++ gexiv2/gexiv2-metadata-xmp.cpp @@@@ -51,7 +51,7 @@@@ gboolean gexiv2_metadata_has_xmp_tag(GEx 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 @@@@ gboolean gexiv2_metadata_clear_xmp_tag(G 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 @@@@ gchar** gexiv2_metadata_get_xmp_tags (GE 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 @@@@ gchar* gexiv2_metadata_get_xmp_tag_strin 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 @@@@ gchar* gexiv2_metadata_get_xmp_tag_inter 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 @@@@ glong gexiv2_metadata_get_xmp_tag_long ( 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 @@@@ gchar** gexiv2_metadata_get_xmp_tag_mult 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 @@@@ gboolean gexiv2_metadata_set_xmp_tag_mul 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; @ 1.1 log @add patch from upstream (trac changeset 2260) to fix crash when importing photos with weird Exif tags (upstream ticket #2514) bump PKGREVISION @ text @d1 1 a1 1 $NetBSD$ @