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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:45:37 UTC 2017


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

The following commit has been merged in the master branch:
commit fdb33b467b36a5cd9cd4edfdbb05eea103f2ae10
Author: Robin Mills <robin at clanmills.com>
Date:   Mon Aug 24 11:24:39 2015 +0000

    Modification to r3891 to respect -g option on exiv2 command-line.
---
 src/version.cpp | 60 ++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 38 insertions(+), 22 deletions(-)

diff --git a/src/version.cpp b/src/version.cpp
index ca91320..ab9bbbb 100644
--- a/src/version.cpp
+++ b/src/version.cpp
@@ -69,25 +69,32 @@ EXIV2_RCSID("@(#) $Id$")
 # include <XMP.incl_cpp>
 #include "xmp.hpp"
 
-static XMP_Status namespaceDumper ( void* /*refCon*/
-                  , XMP_StringPtr buffer
-                  , XMP_StringLen bufferSize
+typedef struct {
+    std::ostream& os;
+    const char*   name;
+} NSDumper;
+
+static XMP_Status namespaceDumper
+( void*         refCon
+, XMP_StringPtr buffer
+, XMP_StringLen bufferSize
 ) {
-	XMP_Status result = 0 ;
-	std::string out(buffer,bufferSize);
-	// remove blanks
-	// http://stackoverflow.com/questions/83439/remove-spaces-from-stdstring-in-c
-	std::string::iterator end_pos = std::remove(out.begin(), out.end(), ' ');
-	out.erase(end_pos, out.end());
-
-	bool bHttp = out.find("http://") != std::string::npos ;
-	bool bNS   = out.find(":") != std::string::npos && !bHttp;
-	if ( bHttp || bNS ) {
-		if ( bNS )   std::cout << "xmlns=" ;
-		             std::cout <<  out     ;
-		if ( bHttp ) std::cout << std::endl;
-	}
-	return     result;
+    XMP_Status result = 0 ;
+    std::string out(buffer,bufferSize);
+    // remove blanks
+    // http://stackoverflow.com/questions/83439/remove-spaces-from-stdstring-in-c
+    std::string::iterator end_pos = std::remove(out.begin(), out.end(), ' ');
+    out.erase(end_pos, out.end());
+
+    bool bHttp = out.find("http://") != std::string::npos ;
+    bool bNS   = out.find(":") != std::string::npos && !bHttp;
+    if ( bHttp || bNS ) {
+        NSDumper* nsDumper = (NSDumper*) refCon;
+        if ( bNS )   nsDumper->os << nsDumper->name << "=" ;
+                     nsDumper->os <<  out     ;
+        if ( bHttp ) nsDumper->os << std::endl;
+    }
+    return     result;
 }
 #endif // EXV_HAVE_XMP_TOOLKIT
 
@@ -165,11 +172,11 @@ typedef string_v::iterator  string_i;
   };
 #endif
 
-static void output(std::ostream& os,const exv_grep_keys_t& greps,const char* name,const std::string& value)
+static bool shouldOutput(const exv_grep_keys_t& greps,const char* name,const std::string& value)
 {
     bool bPrint = greps.empty();
     for( exv_grep_keys_t::const_iterator g = greps.begin();
-        !bPrint && g != greps.end() ; ++g
+      !bPrint && g != greps.end() ; ++g
     ) {
 #if EXV_HAVE_REGEX
         bPrint = (  0 == regexec( &(*g), name         , 0, NULL, 0)
@@ -179,7 +186,12 @@ static void output(std::ostream& os,const exv_grep_keys_t& greps,const char* nam
         bPrint = std::string(name).find(*g) != std::string::npos || value.find(*g) != std::string::npos;
 #endif
     }
-    if ( bPrint ) os << name << "=" << value << endl;
+    return bPrint;
+}
+
+static void output(std::ostream& os,const exv_grep_keys_t& greps,const char* name,const std::string& value)
+{
+    if ( shouldOutput(greps,name,value) ) os << name << "=" << value << endl;
 }
 
 static void output(std::ostream& os,const exv_grep_keys_t& greps,const char* name,int value)
@@ -545,7 +557,11 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys)
 
 #ifdef EXV_HAVE_XMP_TOOLKIT
     Exiv2::XmpParser::initialize();
-    SXMPMeta::DumpNamespaces(namespaceDumper,NULL);
+    const char* name = "xmlns";
+    NSDumper nsDumper = { os,name };
+    if ( shouldOutput(keys,name,"") ) {
+        SXMPMeta::DumpNamespaces(namespaceDumper,&nsDumper);
+    }
 #endif
 
 #if defined(__linux__)

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list