changeset 1601:a090221caeda bqaudiostream

Fix incorrect number formatting results for 32-bit MinGW build
author Chris Cannam
date Wed, 30 Jan 2019 11:00:45 +0000
parents ce185d4dd408
children 08a389e96582
files base/test/svcore-base-test.cpp data/fileio/test/svcore-data-fileio-test.cpp data/model/test/svcore-data-model-test.cpp system/Init.cpp
diffstat 4 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/base/test/svcore-base-test.cpp	Wed Jan 23 14:43:43 2019 +0000
+++ b/base/test/svcore-base-test.cpp	Wed Jan 30 11:00:45 2019 +0000
@@ -21,6 +21,8 @@
 #include "TestColumnOp.h"
 #include "TestMovingMedian.h"
 
+#include "system/Init.h"
+
 #include <QtTest>
 
 #include <iostream>
@@ -29,6 +31,10 @@
 {
     int good = 0, bad = 0;
 
+    // This is necessary to ensure correct behaviour of snprintf with
+    // older MinGW implementations
+    svSystemSpecificInitialisation();
+
     QCoreApplication app(argc, argv);
     app.setOrganizationName("sonic-visualiser");
     app.setApplicationName("test-svcore-base");
--- a/data/fileio/test/svcore-data-fileio-test.cpp	Wed Jan 23 14:43:43 2019 +0000
+++ b/data/fileio/test/svcore-data-fileio-test.cpp	Wed Jan 30 11:00:45 2019 +0000
@@ -19,6 +19,8 @@
 #include "CSVFormatTest.h"
 #include "CSVStreamWriterTest.h"
 
+#include "system/Init.h"
+
 #include <QtTest>
 
 #include <iostream>
@@ -27,6 +29,8 @@
 {
     int good = 0, bad = 0;
 
+    svSystemSpecificInitialisation();
+
     QString testDir;
 
 #ifdef Q_OS_WIN
--- a/data/model/test/svcore-data-model-test.cpp	Wed Jan 23 14:43:43 2019 +0000
+++ b/data/model/test/svcore-data-model-test.cpp	Wed Jan 30 11:00:45 2019 +0000
@@ -15,6 +15,8 @@
 #include "TestZoomConstraints.h"
 #include "TestWaveformOversampler.h"
 
+#include "system/Init.h"
+
 #include <QtTest>
 
 #include <iostream>
@@ -25,6 +27,8 @@
 {
     int good = 0, bad = 0;
 
+    svSystemSpecificInitialisation();
+
     QCoreApplication app(argc, argv);
     app.setOrganizationName("sonic-visualiser");
     app.setApplicationName("test-model");
--- a/system/Init.cpp	Wed Jan 23 14:43:43 2019 +0000
+++ b/system/Init.cpp	Wed Jan 30 11:00:45 2019 +0000
@@ -63,9 +63,11 @@
     // Remove the CWD from the DLL search path, just in case
     SetDllDirectory(L"");
     putenv("PATH=");
+
+    // Some older versions of MinGW require this in order to get
+    // C99/POSIX-standard behaviour for (s)printf formatting
+    putenv("PRINTF_EXPONENT_DIGITS=2");
 #else
 #endif
 }
 
-
-