[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:52 UTC 2017


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

The following commit has been merged in the master branch:
commit 19f165629fa98bb9b7a47bbd59a93326160ae1ce
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Jan 20 13:19:16 2012 +0000

    Allow to add/set tags without a value with the command line tool.
---
 src/exiv2.1   |  4 ++++
 src/exiv2.cpp | 33 +++++++++++++++++++--------------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/exiv2.1 b/src/exiv2.1
index e11c289..29b8954 100644
--- a/src/exiv2.1
+++ b/src/exiv2.1
@@ -384,6 +384,10 @@ is determined based on 
Ikey
P.
 The remaining text on the line is the value. It can optionally be
 enclosed in single quotes ('
Ivalue
P') or double quotes ("
Ivalue
P").
 .sp 1
+The value is optional. Not providing any value is equivalent to an
+empty value ("") and is mainly useful to create an XMP array property,
+e.g., a bag.
+.sp 1
 The format of Exif 
BComment
P values includes an optional charset
 specification at the beginning:
 .sp 1
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
index f3abf1a..582ab6b 100644
--- a/src/exiv2.cpp
+++ b/src/exiv2.cpp
@@ -1098,21 +1098,24 @@ namespace {
         bool explicitType = false;
         if (cmdId != del) {
             // Get type and value
-            std::string::size_type typeStart
-                = line.find_first_not_of(delim, keyEnd+1);
-            std::string::size_type typeEnd
-                = line.find_first_of(delim, typeStart+1);
+            std::string::size_type typeStart = std::string::npos;
+            if (keyEnd != std::string::npos) typeStart = line.find_first_not_of(delim, keyEnd+1);
+            std::string::size_type typeEnd = std::string::npos;
+            if (typeStart != std::string::npos) typeEnd = line.find_first_of(delim, typeStart+1);
             std::string::size_type valStart = typeStart;
-            std::string::size_type valEnd = line.find_last_not_of(delim);
+            std::string::size_type valEnd = std::string::npos;
+            if (valStart != std::string::npos) valEnd = line.find_last_not_of(delim);
 
-            if (   keyEnd == std::string::npos
-                || typeStart == std::string::npos
-                || valStart == std::string::npos) {
+            if (   cmdId == reg
+                && (   keyEnd == std::string::npos
+                    || valStart == std::string::npos)) {
                 throw Exiv2::Error(1, Exiv2::toString(num)
                                    + ": " + _("Invalid command line") + " " );
             }
 
-            if (cmdId != reg && typeEnd != std::string::npos) {
+            if (   cmdId != reg
+                && typeStart != std::string::npos
+                && typeEnd != std::string::npos) {
                 std::string typeStr(line.substr(typeStart, typeEnd-typeStart));
                 Exiv2::TypeId tmpType = Exiv2::TypeInfo::typeId(typeStr);
                 if (tmpType != Exiv2::invalidTypeId) {
@@ -1126,11 +1129,13 @@ namespace {
                 }
             }
 
-            value = parseEscapes(line.substr(valStart, valEnd+1-valStart));
-            std::string::size_type last = value.length()-1;
-            if (   (value[0] == '"' && value[last] == '"')
-                || (value[0] == '\'' && value[last] == '\'')) {
-                value = value.substr(1, value.length()-2);
+            if (valStart != std::string::npos) {
+                value = parseEscapes(line.substr(valStart, valEnd+1-valStart));
+                std::string::size_type last = value.length()-1;
+                if (   (value[0] == '"' && value[last] == '"')
+                       || (value[0] == '\'' && value[last] == '\'')) {
+                    value = value.substr(1, value.length()-2);
+                }
             }
         }
 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list