changeset 1302:9d443c13c5d1 3.0-integration

Merge
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 28 Nov 2016 14:41:45 +0000
parents 6681027ff2ff (current diff) 4a2bc07ec0fb (diff)
children 47ee4706055c
files
diffstat 3 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/base/Debug.cpp	Mon Nov 28 14:40:45 2016 +0000
+++ b/base/Debug.cpp	Mon Nov 28 14:41:45 2016 +0000
@@ -82,7 +82,7 @@
                              << "Failed to open debug log file "
                              << fileName << " for writing";
     } else {
-        cerr << m_prefix << ": Log file is " << fileName << endl;
+//        cerr << m_prefix << ": Log file is " << fileName << endl;
         m_ok = true;
     }
 }
--- a/base/RealTimeSV.cpp	Mon Nov 28 14:40:45 2016 +0000
+++ b/base/RealTimeSV.cpp	Mon Nov 28 14:41:45 2016 +0000
@@ -85,6 +85,9 @@
     int year = 0, month = 0, day = 0, hour = 0, minute = 0;
     double second = 0.0;
 
+    char *loc = setlocale(LC_NUMERIC, 0);
+    (void)setlocale(LC_NUMERIC, "C"); // avoid strtod expecting ,-separator in DE
+
     int i = 0;
 
     const char *s = xsdd.c_str();
@@ -151,6 +154,8 @@
 
     t = t + fromSeconds(second);
 
+    setlocale(LC_NUMERIC, loc);
+    
     if (negative) {
         return -t;
     } else {
--- a/transform/CSVFeatureWriter.cpp	Mon Nov 28 14:40:45 2016 +0000
+++ b/transform/CSVFeatureWriter.cpp	Mon Nov 28 14:41:45 2016 +0000
@@ -276,7 +276,20 @@
     }
     
     for (unsigned int j = 0; j < f.values.size(); ++j) {
-        stream << m_separator << QString("%1").arg(f.values[j], 0, 'g', m_digits);
+
+        QString number = QString("%1").arg(f.values[j], 0, 'g', m_digits);
+
+        // Qt pre-5.6 zero pads single-digit exponents to two digits;
+        // Qt 5.7+ doesn't by default. But we want both to produce the
+        // same output. Getting the new behaviour from standard APIs
+        // in Qt 5.6 isn't possible I think; getting the old behaviour
+        // from Qt 5.7 is possible but fiddly, involving setting up an
+        // appropriate locale and using the %L specifier. We could
+        // doubtless do it with sprintf but Qt is a known quantity at
+        // this point. Let's just convert the old format to the new.
+        number.replace("e-0", "e-");
+        
+        stream << m_separator << number;
     }
     
     if (f.label != "") {