[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:42:02 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=9195470

The following commit has been merged in the master branch:
commit 9195470f22f194d2d6887889cffd435097323a2e
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat Nov 6 13:53:15 2010 +0000

    Allow "migration" of XMP namespaces. Simplified XMP-SDK RegisterNamespace().
---
 src/actions.cpp                              |   2 +-
 src/exiv2.cpp                                |   4 +
 src/properties.cpp                           |  13 +-
 src/properties.hpp                           |  14 ++-
 src/xmp.cpp                                  |  28 +++--
 src/xmp.hpp                                  |   8 +-
 test/data/xmpparser-test.out                 |  71 +----------
 xmpsdk/include/TXMPMeta.hpp                  |  20 +--
 xmpsdk/include/client-glue/TXMPMeta.incl_cpp |  12 +-
 xmpsdk/include/client-glue/WXMPMeta.hpp      |   8 +-
 xmpsdk/src/ExpatAdapter.cpp                  |   2 +-
 xmpsdk/src/WXMPMeta.cpp                      |  16 +--
 xmpsdk/src/XMPMeta.cpp                       | 175 ++++++++++-----------------
 xmpsdk/src/XMPMeta.hpp                       |   6 +-
 14 files changed, 131 insertions(+), 248 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index dab7ab4..58e9a60 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1422,7 +1422,7 @@ namespace Action {
             std::cout << _("Reg ") << modifyCmd.key_ << "=\""
                       << modifyCmd.value_ << "\"" << std::endl;
         }
-        // Registration has been done immediately after parsing the command.
+        Exiv2::XmpProperties::registerNs(modifyCmd.value_, modifyCmd.key_);
     }
 
     Modify::AutoPtr Modify::clone() const
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
index 3ae3379..6770c14 100644
--- a/src/exiv2.cpp
+++ b/src/exiv2.cpp
@@ -809,6 +809,10 @@ int Params::getopt(int argc, char* const argv[])
             rc = 1;
         }
     }
+    if (rc == 0 && (!cmdFiles_.empty() || !cmdLines_.empty())) {
+        // We'll set them again, after reading the file
+        Exiv2::XmpProperties::unregisterNs();
+    }
     if (   !directory_.empty()
         && !(action_ == Action::insert || action_ == Action::extract)) {
         std::cerr << progname() << ": "
diff --git a/src/properties.cpp b/src/properties.cpp
index 040afe8..ee1c1a4 100644
--- a/src/properties.cpp
+++ b/src/properties.cpp
@@ -1046,6 +1046,17 @@ namespace Exiv2 {
         std::string ns2 = ns;
         if (   ns2.substr(ns2.size() - 1, 1) != "/"
             && ns2.substr(ns2.size() - 1, 1) != "#") ns2 += "/";
+        // Check if there is already a registered namespace with this prefix
+        const XmpNsInfo* xnp = lookupNsRegistry(XmpNsInfo::Prefix(prefix));
+        if (xnp) {
+#ifndef SUPPRESS_WARNINGS
+            if (strcmp(xnp->ns_, ns2.c_str()) != 0) {
+                EXV_WARNING << "Updating namespace URI for " << prefix << " from "
+                            << xnp->ns_ << " to " << ns2 << "
";
+            }
+#endif
+            unregisterNs(xnp->ns_);
+        }
         // Allocated memory is freed when the namespace is unregistered.
         // Using malloc/free for better system compatibility in case
         // users don't unregister their namespaces explicitely.
@@ -1059,14 +1070,12 @@ namespace Exiv2 {
         xn.xmpPropertyInfo_ = 0;
         xn.desc_ = "";
         nsRegistry_[ns2] = xn;
-        XmpParser::registerNs(ns2, prefix);
     }
 
     void XmpProperties::unregisterNs(const std::string& ns)
     {
         NsRegistry::iterator i = nsRegistry_.find(ns);
         if (i != nsRegistry_.end()) {
-            XmpParser::unregisterNs(ns);
             std::free(const_cast<char*>(i->second.prefix_));
             std::free(const_cast<char*>(i->second.ns_));
             nsRegistry_.erase(i);
diff --git a/src/properties.hpp b/src/properties.hpp
index 2acf6b0..684bbf5 100644
--- a/src/properties.hpp
+++ b/src/properties.hpp
@@ -185,8 +185,8 @@ namespace Exiv2 {
         /*!
           @brief Register namespace \em ns with preferred prefix \em prefix.
 
-          If the namespace is a known or previously registered namespace, the
-          prefix is overwritten.
+          If the prefix is a known or previously registered prefix, the
+          corresponding namespace URI is overwritten.
 
           @note This invalidates XMP keys generated with the previous prefix.
          */
@@ -209,11 +209,15 @@ namespace Exiv2 {
           @note This invalidates XMP keys generated in any custom namespace.
          */
         static void unregisterNs();
-
-    private:
+        //! Type for the namespace registry
         typedef std::map<std::string, XmpNsInfo> NsRegistry;
+        /*!
+          @brief Get the registered namespace for a specific \em prefix from the registry.
+         */
         static const XmpNsInfo* lookupNsRegistry(const XmpNsInfo::Prefix& prefix);
-        static NsRegistry nsRegistry_;
+
+        // DATA
+        static NsRegistry nsRegistry_;          //! Namespace registry
 
     }; // class XmpProperties
 
diff --git a/src/xmp.cpp b/src/xmp.cpp
index eeecbf5..746ca49 100644
--- a/src/xmp.cpp
+++ b/src/xmp.cpp
@@ -381,13 +381,13 @@ namespace Exiv2 {
         if (!initialized_) {
 #ifdef EXV_HAVE_XMP_TOOLKIT
             initialized_ = SXMPMeta::Initialize();
-            SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam", 0);
-            SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi", 0);
-            SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto", 0);
-            SXMPMeta::RegisterNamespace("http://iptc.org/std/Iptc4xmpExt/2008-02-29/", "iptcExt", 0);
-            SXMPMeta::RegisterNamespace("http://ns.useplus.org/ldf/xmp/1.0/", "plus", 0);
-            SXMPMeta::RegisterNamespace("http://ns.iview-multimedia.com/mediapro/1.0/", "mediapro", 0);
-            SXMPMeta::RegisterNamespace("http://ns.microsoft.com/expressionmedia/1.0/", "expressionmedia", 0);
+            SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam");
+            SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi");
+            SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto");
+            SXMPMeta::RegisterNamespace("http://iptc.org/std/Iptc4xmpExt/2008-02-29/", "iptcExt");
+            SXMPMeta::RegisterNamespace("http://ns.useplus.org/ldf/xmp/1.0/", "plus");
+            SXMPMeta::RegisterNamespace("http://ns.iview-multimedia.com/mediapro/1.0/", "mediapro");
+            SXMPMeta::RegisterNamespace("http://ns.microsoft.com/expressionmedia/1.0/", "expressionmedia");
 #else
             initialized_ = true;
 #endif
@@ -407,12 +407,13 @@ namespace Exiv2 {
     }
 
 #ifdef EXV_HAVE_XMP_TOOLKIT
-    bool XmpParser::registerNs(const std::string& ns,
+    void XmpParser::registerNs(const std::string& ns,
                                const std::string& prefix)
     {
         try {
             initialize();
-            return SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str(), 0);
+            SXMPMeta::DeleteNamespace(ns.c_str());
+            SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str());
         }
         catch (const XMP_Error& e) {
             throw Error(40, e.GetID(), e.GetErrMsg());
@@ -610,7 +611,14 @@ namespace Exiv2 {
 #endif
             return 2;
         }
-
+        // Register custom namespaces with XMP-SDK
+        for (XmpProperties::NsRegistry::iterator i = XmpProperties::nsRegistry_.begin();
+             i != XmpProperties::nsRegistry_.end(); ++i) {
+#ifdef DEBUG
+            std::cerr << "Registering " << i->second.prefix_ << " : " << i->first << "
";
+#endif
+            registerNs(i->first, i->second.prefix_);
+        }
         SXMPMeta meta;
         for (XmpData::const_iterator i = xmpData.begin(); i != xmpData.end(); ++i) {
             const std::string ns = XmpProperties::ns(i->groupName());
diff --git a/src/xmp.hpp b/src/xmp.hpp
index f6f2306..0fc9970 100644
--- a/src/xmp.hpp
+++ b/src/xmp.hpp
@@ -256,8 +256,6 @@ namespace Exiv2 {
              the XMP toolkit to do the job.
      */
     class EXIV2API XmpParser {
-        friend void XmpProperties::registerNs(const std::string&, const std::string&);
-        friend void XmpProperties::unregisterNs(const std::string&);
     public:
         //! Options to control the format of the serialized XMP packet.
         enum XmpFormatFlags {
@@ -325,12 +323,8 @@ namespace Exiv2 {
     private:
         /*!
           @brief Register a namespace with the XMP Toolkit.
-
-          XmpProperties::registerNs calls this to synchronize namespaces.
-
-          @return \em true if the registered prefix matches the suggested prefix.
          */
-        static bool registerNs(const std::string& ns,
+        static void registerNs(const std::string& ns,
                                const std::string& prefix);
         /*!
           @brief Delete a namespace from the XMP Toolkit.
diff --git a/test/data/xmpparser-test.out b/test/data/xmpparser-test.out
index 3a9572f..43d2fab 100644
--- a/test/data/xmpparser-test.out
+++ b/test/data/xmpparser-test.out
@@ -32,34 +32,10 @@ Xmp.exif.NativeDigest                        XmpText   414  36864,40960,40961,37
 < <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1.2-113">
 ---
 > <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
-6,7c6,7
-<     xmlns:xap="http://ns.adobe.com/xap/1.0/"
-<     xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
----
->     xmlns:xmp="http://ns.adobe.com/xap/1.0/"
->     xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
-13,18c13,18
-<    xap:CreatorTool="Adobe Photoshop CS2 Macintosh"
-<    xap:CreateDate="2005-09-07T15:07:40-07:00"
-<    xap:ModifyDate="2005-09-07T15:09:51-07:00"
-<    xap:MetadataDate="2006-04-10T13:37:10-07:00"
-<    xapMM:DocumentID="uuid:9A3B7F52214211DAB6308A7391270C13"
-<    xapMM:InstanceID="uuid:B59AC1B3214311DAB6308A7391270C13"
----
->    xmp:CreatorTool="Adobe Photoshop CS2 Macintosh"
->    xmp:CreateDate="2005-09-07T15:07:40-07:00"
->    xmp:ModifyDate="2005-09-07T15:09:51-07:00"
->    xmp:MetadataDate="2006-04-10T13:37:10-07:00"
->    xmpMM:DocumentID="uuid:9A3B7F52214211DAB6308A7391270C13"
->    xmpMM:InstanceID="uuid:B59AC1B3214311DAB6308A7391270C13"
 35d34
 <      <rdf:li xml:lang="en-US">Blue Square Test File - .jpg</rdf:li>
 37a37
 >      <rdf:li xml:lang="en-US">Blue Square Test File - .jpg</rdf:li>
-54c54
-<    <xapMM:DerivedFrom
----
->    <xmpMM:DerivedFrom
 -----> Decoding XMP data read from StaffPhotographer-Example.xmp <-----
 Xmp.iptc.IntellectualGenre                   XmpText     7  Profile
 Xmp.iptc.Location                            XmpText    17  Moore family farm
@@ -129,51 +105,8 @@ Xmp.wine.Recommend                           XmpText     5  False
 <   <rdf:Description rdf:about="uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9"
 ---
 >   <rdf:Description rdf:about=""
-9,10c9,10
-<     xmlns:xap="http://ns.adobe.com/xap/1.0/"
-<     xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
----
->     xmlns:xmp="http://ns.adobe.com/xap/1.0/"
->     xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
-12c12
-<     xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/"
----
->     xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/"
-42,48c42,49
-<    xap:CreateDate="2005-03-13T02:01:44-06:00"
-<    xap:ModifyDate="2005-03-13T02:01:44-06:00"
-<    xap:MetadataDate="2007-01-08T13:25:45+01:00"
-<    xap:CreatorTool="Adobe Photoshop CS Windows"
-<    xapMM:DocumentID="adobe:docid:photoshop:0f410643-9396-11d9-bb8e-a67e6693b6e9"
-<    xapRights:WebStatement="http://www.bignewspaper.com/"
-<    xapRights:Marked="True"
----
->    xmp:CreateDate="2005-03-13T02:01:44-06:00"
->    xmp:ModifyDate="2005-03-13T02:01:44-06:00"
->    xmp:MetadataDate="2007-01-08T13:25:45+01:00"
->    xmp:CreatorTool="Adobe Photoshop CS Windows"
->    xmpMM:DocumentID="adobe:docid:photoshop:0f410643-9396-11d9-bb8e-a67e6693b6e9"
->    xmpMM:InstanceID="uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9"
->    xmpRights:WebStatement="http://www.bignewspaper.com/"
->    xmpRights:Marked="True"
-78c79
-<    <xapMM:DerivedFrom
----
->    <xmpMM:DerivedFrom
-81c82
-<    <xapRights:RightsUsageTerms>
----
->    <xmpRights:RightsUsageTerms>
-85,86c86,87
-<    </xapRights:RightsUsageTerms>
-<    <xapRights:UsageTerms>
----
->    </xmpRights:RightsUsageTerms>
->    <xmpRights:UsageTerms>
-90c91
-<    </xapRights:UsageTerms>
----
->    </xmpRights:UsageTerms>
+46a47
+>    xapMM:InstanceID="uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9"
 160,191c161
 <                                                                                                     
 <                                                                                                     
diff --git a/xmpsdk/include/TXMPMeta.hpp b/xmpsdk/include/TXMPMeta.hpp
index b2661ca..0bf04e1 100644
--- a/xmpsdk/include/TXMPMeta.hpp
+++ b/xmpsdk/include/TXMPMeta.hpp
@@ -267,30 +267,20 @@ public:
     /// new URI.
 
     // ---------------------------------------------------------------------------------------------
-    /// @brief 
-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list