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


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

The following commit has been merged in the master branch:
commit 3b839183206c0c7493cc0fd9f7a30938ef05d00c
Author: Robin Mills <robin at clanmills.com>
Date:   Sun Aug 21 08:16:30 2016 +0000

    #1207 Added samples/mt-test.cpp
---
 Makefile            |  2 +-
 config/Makefile.in  |  2 +-
 samples/Makefile    |  8 +++++
 samples/mt-test.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index b19a1f6..5c1e982 100644
--- a/Makefile
+++ b/Makefile
@@ -105,7 +105,7 @@ webp-test webptest:
 addmoddel		exifcomment		exifvalue	httptest	iptctest		mmap-test	stringto-test \
 exifdata		iotest			key-test	path-test	taglist			write2-test write-test	\
 convert-test	exifdata-test	exiv2json	iptceasy	largeiptc-test	prevtest	tiff-test	\
-easyaccess-test	geotag			iptcprint	metacopy	toexv           werror-test	\
+easyaccess-test	geotag			iptcprint	metacopy	mt-test         toexv       werror-test	\
 xmpparser-test 	xmpsample 		xmpparse :
 	cd samples && $(MAKE) $(MAKECMDGOALS)
 
diff --git a/config/Makefile.in b/config/Makefile.in
index 44a3ca1..2cc77de 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -105,7 +105,7 @@ webp-test webptest:
 addmoddel		exifcomment		exifvalue	httptest	iptctest		mmap-test	stringto-test \
 exifdata		iotest			key-test	path-test	taglist			write2-test write-test	\
 convert-test	exifdata-test	exiv2json	iptceasy	largeiptc-test	prevtest	tiff-test	\
-easyaccess-test	geotag			iptcprint	metacopy	toexv           werror-test	\
+easyaccess-test	geotag			iptcprint	metacopy	mt-test         toexv       werror-test	\
 xmpparser-test 	xmpsample 		xmpparse :
 	cd samples && $(MAKE) $(MAKECMDGOALS)
 
diff --git a/samples/Makefile b/samples/Makefile
index 805b95e..245c820 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -87,6 +87,7 @@ BINSRC = addmoddel.cpp        \
 OTHERSRC = exiv2json.cpp      \
            geotag.cpp         \
            metacopy.cpp       \
+           mt-test.cpp        \
            path-test.cpp      \
            toexv.cpp
 
@@ -181,6 +182,13 @@ exiv2json: %: %.cpp Jzon.o
 	@$(POSTDEPEND)
 	$(LIBTOOL) --mode=link $(LINK.cc) Jzon.o $@.o -o ../bin/$@
 
+# mt-test requires C++11
+mt-test: %: %.cpp
+	$(COMPILE.cc) -std=c++11 -stdlib=libc++  -o $@.o $<
+	@$(MAKEDEPEND)
+	@$(POSTDEPEND)
+	$(LIBTOOL) --mode=link $(LINK.cc) $@.o -o ../bin/$@
+
 # Remove binaries, e.g., to relink them
 binclean:
 	$(RM) $(EXECUTABLE)
diff --git a/samples/mt-test.cpp b/samples/mt-test.cpp
new file mode 100644
index 0000000..1771156
--- /dev/null
+++ b/samples/mt-test.cpp
@@ -0,0 +1,87 @@
+// ***************************************************************** -*- C++ -*-
+// mt-test.cpp $Rev: 3090 $
+// Sample multi-threading program
+
+// requires C++11
+// On Mac               #define  __cplusplus 201103L
+// Older compilers      #define __cplusplus  199711
+// Compiler switches:   -std=c++11 -stdlib=libc++ (set in samples/Makefile)
+// Discussion:          http://dev.exiv2.org/issues/1207
+// Caution:             This code isn't currently exercised any bash script in the test suite
+
+#include <exiv2/exiv2.hpp>
+#include <iostream>
+#include <iomanip>
+#include <cassert>
+#include <string>
+#include <thread>
+#include <mutex>
+
+// mutex to for exclusive reporting
+std::mutex m;
+
+void reportExifMetadataCount(int n,const char* argv[])
+{
+	int count = 0 ;
+	std::string what;
+
+	// count the exif metadata in the file
+	try {
+		Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[n]);
+		assert(image.get() != 0);
+		image->readMetadata();
+
+		Exiv2::ExifData &exifData = image->exifData();
+		if (!exifData.empty()) {
+			Exiv2::ExifData::const_iterator end = exifData.end();
+			for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i)
+				count++;
+		}
+	} catch (Exiv2::Error& e) {
+		what = e.what() ;
+		count = -1;
+	}
+
+	// report to the user
+	m.lock();
+	std::cout << "file: "  << argv[n] << " "
+	          << "n: "     << n       << " "
+	          << "count: " << count   << " "
+	          << (count < 0 ? "exception: " : what)
+	          << what                 << std::endl;
+	m.unlock();
+}
+
+int main(int argc,const char* argv[])
+{
+	int result = 0;
+
+	if ( argc < 2 ) {
+		std::cerr << "syntax: " << argv[0] << " [path]+" << std::endl;
+		result = 1 ;
+	} else {
+		// Initialize XmpParser before starting threads
+		Exiv2::XmpParser::initialize();
+
+		// bucket of threads
+		const int           TMAX=1000;
+		std::thread threads[TMAX];
+		int           argm = argc > TMAX ? TMAX : argc;
+
+		// spin up the treads
+		for ( int arg = 1 ; arg < argm ; arg++ ) {
+			threads[arg] = std::thread(reportExifMetadataCount,arg,argv);
+		}
+
+		// wait for them to finish
+		for ( int arg = 1 ; arg < argm ; arg++ ) {
+			if ( threads[arg].joinable() )
+				threads[arg].join();
+		}
+	}
+
+	return result;
+}
+
+// That's all Folks!
+////

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list