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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:39:32 UTC 2017


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

The following commit has been merged in the master branch:
commit c463cdd283599830913b5243df1a0e155d8a358f
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Thu Jun 5 15:45:07 2008 +0000

    Tried to improve GPSTimeStamp conversions, extended tests.
---
 src/convert.cpp           | 30 ++++++++++++++++----
 test/conversions.sh       |  3 ++
 test/data/conversions.out | 70 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 97 insertions(+), 6 deletions(-)

diff --git a/src/convert.cpp b/src/convert.cpp
index 406a98c..2aceefe 100644
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -546,7 +546,14 @@ namespace Exiv2 {
         else { // "Exif.GPSInfo.GPSTimeStamp"
             double dhour = pos->value().toFloat(0);
             double dmin = pos->value().toFloat(1);
-            double dsec = pos->value().toFloat(2);
+            // Hack: Need Value::toDouble
+            URational r = pos->value().toRational(2);
+            if (r.second == 0) {
+#ifndef SUPPRESS_WARNINGS
+                std::cerr << "Warning: Failed to convert " << from << " to " << to << "
";
+#endif
+            }
+            double dsec = static_cast<double>(r.first)/r.second;
 
             if (!pos->value().ok()) {
 #ifndef SUPPRESS_WARNINGS
@@ -812,11 +819,22 @@ namespace Exiv2 {
             }
         }
         else { // "Exif.GPSInfo.GPSTimeStamp"
-            Rational rhour(datetime.hour, 1);
-            Rational rmin(datetime.minute, 1);
-            Rational rsec = floatToRationalCast(
-                static_cast<float>(datetime.second + datetime.nanoSecond / 1000000000.0)
-            );
+
+            // Ignore the time zone, assuming the time is in UTC as it should be
+
+            URational rhour(datetime.hour, 1);
+            URational rmin(datetime.minute, 1);
+            URational rsec(datetime.second, 1);
+            if (datetime.nanoSecond != 0) {
+                if (datetime.second != 0) {
+                    // Add the seconds to rmin so that the ns fit into rsec
+                    rmin.second = 60;
+                    rmin.first *= 60;
+                    rmin.first += datetime.second;
+                }
+                rsec.second = 1000000000;
+                rsec.first = datetime.nanoSecond;
+            }
 
             std::ostringstream array;
             array << rhour << " " << rmin << " " << rsec;
diff --git a/test/conversions.sh b/test/conversions.sh
index bf7ee6b..e16f1b1 100755
--- a/test/conversions.sh
+++ b/test/conversions.sh
@@ -183,12 +183,14 @@ echo Testcase 14
 echo ===========
 
-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list