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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:46:22 UTC 2017


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

The following commit has been merged in the master branch:
commit dbed6f857c8ed87ee1c3ce37dd998c9ba31b0a3f
Author: Robin Mills <robin at clanmills.com>
Date:   Fri Mar 25 08:12:16 2016 +0000

    #1034  Added exiv2 config file support for lens recognition.
---
 samples/ini-test.cpp  |  39 +++++++
 samples/ini-test.ini  |  14 +++
 src/Makefile          |   7 +-
 src/canonmn.cpp       |   8 ++
 src/ini.cpp           | 277 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/ini_int.hpp       | 152 +++++++++++++++++++++++++++
 src/makernote.cpp     |  38 +++++++
 src/makernote_int.hpp |  13 +++
 src/version.cpp       |   2 +
 9 files changed, 547 insertions(+), 3 deletions(-)

diff --git a/samples/ini-test.cpp b/samples/ini-test.cpp
new file mode 100644
index 0000000..1291be7
--- /dev/null
+++ b/samples/ini-test.cpp
@@ -0,0 +1,39 @@
+/*
+670 rmills at rmillsmbp:~/gnu/exiv2/trunk/samples $ gcc ../src/ini.cpp  ini-test.cpp -lstdc++ -o ini-test
+671 rmills at rmillsmbp:~/gnu/exiv2/trunk/samples $ ./ini-test
+Config loaded from : 'initest.ini' version=6, name=Bob Smith, email=bob at smith.com, pi=3.14159, active=1
+169=Sigma 35mm F1.4 DG HSM ART, 170=UNDEFINED
+672 rmills at rmillsmbp:~/gnu/exiv2/trunk/samples $
+*/
+
+
+// Example that shows simple usage of the INIReader class
+
+#include <iostream>
+#include "../src/ini_int.hpp"
+
+int main()
+{
+    int              result = 0 ;
+    const char*      ini    = "ini-test.ini";
+    Exiv2::INIReader reader(ini);
+
+    if (reader.ParseError() < 0) {
+        std::cerr << "Can't load '" << ini << "'" << std::endl ;
+        result = 1;
+    } else {
+        std::cout << "Config loaded from : '" << ini << "' "
+                  << "version="  << reader.GetInteger("protocol", "version", -1)
+                  << ", name="   << reader.Get("user", "name", "UNKNOWN")
+                  << ", email="  << reader.Get("user", "email", "UNKNOWN")
+                  << ", pi="     << reader.GetReal("user", "pi", -1)
+                  << ", active=" << reader.GetBoolean("user", "active", true)
+                  << std::endl ;
+
+        std::cout << "169="      << reader.Get("canon",   "169","UNDEFINED")
+                  << ", 170="    << reader.Get("canon",   "170","UNDEFINED")
+                  << std::endl ;
+    }
+
+    return result ;
+}
diff --git a/samples/ini-test.ini b/samples/ini-test.ini
new file mode 100755
index 0000000..e0b78ab
--- /dev/null
+++ b/samples/ini-test.ini
@@ -0,0 +1,14 @@
+; Test config file for samples/ini-test.cpp
+
+[protocol]             ; Protocol configuration
+version=6              ; IPv6
+
+[user]
+name = Bob Smith       ; Spaces around '=' are stripped
+email = bob at smith.com  ; And comments (like this) ignored
+active = true          ; Test a boolean
+pi = 3.14159           ; Test a floating point number
+
+[canon]
+169=Sigma 35mm F1.4 DG HSM ART
+
diff --git a/src/Makefile b/src/Makefile
index d16962f..7967f39 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -83,6 +83,7 @@ CCSRC =  basicio.cpp           \
 	 gifimage.cpp          \
 	 http.cpp              \
 	 image.cpp             \
+	 ini.cpp               \
 	 iptc.cpp              \
 	 jp2image.cpp          \
 	 jpgimage.cpp          \
@@ -97,10 +98,10 @@ CCSRC =  basicio.cpp           \
 	 pentaxmn.cpp          \
 	 pgfimage.cpp
 ifdef HAVE_LIBZ
-CCSRC += pngimage.cpp          \
+CCSRC += pngimage.cpp      \
 	 pngchunk.cpp
 endif
-CCSRC += preview.cpp           \
+CCSRC += preview.cpp       \
 	 properties.cpp        \
 	 psdimage.cpp          \
 	 rafimage.cpp          \
@@ -109,7 +110,7 @@ CCSRC += preview.cpp           \
 ifdef USE_SSH
 CCSRC += ssh.cpp
 endif
-CCSRC += sigmamn.cpp           \
+CCSRC += sigmamn.cpp       \
 	 sonymn.cpp            \
 	 tags.cpp              \
 	 tgaimage.cpp          \
diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 962ce7b..d06d3fe 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -32,6 +32,7 @@ EXIV2_RCSID("@(#) $Id$")
 // *****************************************************************************
 // included header files
 #include "types.hpp"
+#include "makernote_int.hpp"
 #include "canonmn_int.hpp"
 #include "tags_int.hpp"
 #include "value.hpp"
@@ -1751,6 +1752,13 @@ namespace Exiv2 {
         if (   value.typeId() != unsignedShort
             || value.count() == 0) return os << "(" << value << ")";
 
+		// #1034
+		const std::string undefined("undefined") ;
+		const std::string section  ("canon");
+		if ( Internal::readExiv2Config(section,value.toString(),undefined) != undefined ) {
+			return os << Internal::readExiv2Config(section,value.toString(),undefined);
+		}
+
         const LensIdFct* lif = find(lensIdFct, value.toLong());
         if (!lif) {
             return EXV_PRINT_TAG(canonCsLensType)(os, value, metadata);
diff --git a/src/ini.cpp b/src/ini.cpp
new file mode 100755
index 0000000..7e88c59
--- /dev/null
+++ b/src/ini.cpp
@@ -0,0 +1,277 @@
+// Read an INI file into easy-to-access name/value pairs.
+
+// inih and INIReader are released under the New BSD license (see LICENSE.txt).
+// Go to the project home page for more info:
+//
+// https://github.com/benhoyt/inih
+
+#include <algorithm>
+#include <cctype>
+#include <cstdlib>
+
+#include "ini_int.hpp"
+
+using std::string;
+using namespace Exiv2;
+
+
+/* inih -- simple .INI file parser
+
+inih is released under the New BSD license (see LICENSE.txt). Go to the project
+home page for more info:
+
+https://github.com/benhoyt/inih
+
+*/
+
+#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#if !INI_USE_STACK
+#include <stdlib.h>
+#endif
+
+#define MAX_SECTION 50
+#define MAX_NAME 50
+
+/* Strip whitespace chars off end of given string, in place. Return s. */
+static char* rstrip(char* s)
+{
+    char* p = s + strlen(s);
+    while (p > s && isspace((unsigned char)(*--p)))
+        *p = '

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list