diff options
Diffstat (limited to '01-add-pr-3287.patch')
-rw-r--r-- | 01-add-pr-3287.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/01-add-pr-3287.patch b/01-add-pr-3287.patch new file mode 100644 index 000000000000..3aa079b97c7c --- /dev/null +++ b/01-add-pr-3287.patch @@ -0,0 +1,137 @@ +From ea861fe86743c8402bbad77d8d1dd9de8dce447e Mon Sep 17 00:00:00 2001 +From: Mikkel Krautz <mikkel@krautz.dk> +Date: Fri, 29 Dec 2017 14:47:25 +0100 +Subject: [PATCH 1/3] AudioOutput: do not use non-existant template version of + std::abs. + +This change fixes AudioOutput to use the float overload of std::abs: + + float std::abs(float); + +instead of a non-existant template version. + +Fixes mumble-voip/mumble#3281 + +Needs-Backport: 1.2.x +--- + src/mumble/AudioOutput.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp +index cbe0c0e2b..7a0a5e2ab 100644 +--- a/src/mumble/AudioOutput.cpp ++++ b/src/mumble/AudioOutput.cpp +@@ -437,7 +437,7 @@ bool AudioOutput::mix(void *outbuff, unsigned int nsamp) { + top[2] = 0.0f; + } + +- if (std::abs<float>(front[0] * top[0] + front[1] * top[1] + front[2] * top[2]) > 0.01f) { ++ if (std::abs(front[0] * top[0] + front[1] * top[1] + front[2] * top[2]) > 0.01f) { + // Not perpendicular. Assume Y up and rotate 90 degrees. + + float azimuth = 0.0f; + +From a221fedfd3ebc4e722077f56e057c11260839e44 Mon Sep 17 00:00:00 2001 +From: Mikkel Krautz <mikkel@krautz.dk> +Date: Sun, 31 Dec 2017 01:33:51 +0100 +Subject: [PATCH 2/3] mumble_pch.hpp: explicitly include <cmath>. + +Previously, we implicitly relied on <cmath> being included +by some other header. + +Make it explicit. +--- + src/mumble/mumble_pch.hpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/mumble/mumble_pch.hpp b/src/mumble/mumble_pch.hpp +index ba87eab3b..dac5ba629 100644 +--- a/src/mumble/mumble_pch.hpp ++++ b/src/mumble/mumble_pch.hpp +@@ -82,6 +82,7 @@ + #include <boost/weak_ptr.hpp> + + #include <algorithm> ++#include <cmath> + + #ifdef Q_OS_WIN + #include "../qos2_mingw.h" + +From 6ca110a2226b0559fca85d22f287ec8a14eee1d1 Mon Sep 17 00:00:00 2001 +From: Mikkel Krautz <mikkel@krautz.dk> +Date: Fri, 29 Dec 2017 15:05:03 +0100 +Subject: [PATCH 3/3] src/tests: add TestStdAbs test. + +This adds a 'just-in-case' test for correct runtime behavior of std::abs's +float overload. +--- + src/tests/TestStdAbs/TestStdAbs.cpp | 31 +++++++++++++++++++++++++++++++ + src/tests/TestStdAbs/TestStdAbs.pro | 9 +++++++++ + src/tests/tests.pro | 3 ++- + 3 files changed, 42 insertions(+), 1 deletion(-) + create mode 100644 src/tests/TestStdAbs/TestStdAbs.cpp + create mode 100644 src/tests/TestStdAbs/TestStdAbs.pro + +diff --git a/src/tests/TestStdAbs/TestStdAbs.cpp b/src/tests/TestStdAbs/TestStdAbs.cpp +new file mode 100644 +index 000000000..ae06787a9 +--- /dev/null ++++ b/src/tests/TestStdAbs/TestStdAbs.cpp +@@ -0,0 +1,31 @@ ++// Copyright 2005-2017 The Mumble Developers. All rights reserved. ++// Use of this source code is governed by a BSD-style license ++// that can be found in the LICENSE file at the root of the ++// Mumble source tree or at <https://www.mumble.info/LICENSE>. ++ ++#include <QtCore> ++#include <QtTest> ++ ++#include <cmath> ++ ++/// Test the std::abs works with floats. ++/// In fixing mumble-voip/mumble#3281, I ++/// stumbled upon http://eigen.tuxfamily.org/bz/show_bug.cgi?id=619. ++/// It seems that, on some platforms, std::abs ++/// might not call through to the correct libc ++/// function. ++/// Test that it works for us. ++class TestStdAbs : public QObject { ++ Q_OBJECT ++ private slots: ++ void floatWorks(); ++}; ++ ++void TestStdAbs::floatWorks() { ++ const float in = -1.5; ++ float out = std::abs(in); ++ QVERIFY(out > 1.2 && out < 1.8); ++} ++ ++QTEST_MAIN(TestStdAbs) ++#include "TestStdAbs.moc" +diff --git a/src/tests/TestStdAbs/TestStdAbs.pro b/src/tests/TestStdAbs/TestStdAbs.pro +new file mode 100644 +index 000000000..6fbff2969 +--- /dev/null ++++ b/src/tests/TestStdAbs/TestStdAbs.pro +@@ -0,0 +1,9 @@ ++# Copyright 2005-2017 The Mumble Developers. All rights reserved. ++# Use of this source code is governed by a BSD-style license ++# that can be found in the LICENSE file at the root of the ++# Mumble source tree or at <https://www.mumble.info/LICENSE>. ++ ++include(../test.pri) ++ ++TARGET = TestStdAbs ++SOURCES = TestStdAbs.cpp +diff --git a/src/tests/tests.pro b/src/tests/tests.pro +index ee778fb1b..1b55d0ae7 100644 +--- a/src/tests/tests.pro ++++ b/src/tests/tests.pro +@@ -18,4 +18,5 @@ SUBDIRS += \ + TestServerResolver \ + TestSelfSignedCertificate \ + TestSSLLocks \ +- TestFFDHE ++ TestFFDHE \ ++ TestStdAbs |