From a9b804e18c811c781a099a70b960f5bbde61257d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 18 Jul 2016 12:14:51 +0200 Subject: some: replace hardcoded pi values with the same pi constant We can't depend on M_PI existing after including cmath. --- tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tracker-freepie-udp') diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp index 621e601a..9a5697dd 100644 --- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -1,13 +1,11 @@ #include "ftnoir_tracker_freepie-udp.h" #include "opentrack/plugin-api.hpp" +#include "opentrack-compat/pi-constant.hpp" #include #include #include -#ifndef M_PI -# define M_PI 3.14159265358979323846 -#endif TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false) { @@ -43,7 +41,7 @@ void TrackerImpl::run() { Mask = flag_Raw | flag_Orient }; - (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); + sock.bind(QHostAddress::Any, (unsigned short) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); while (!should_quit) { int order[] = { @@ -92,7 +90,7 @@ void TrackerImpl::run() { }; int indices[] = { s.add_yaw, s.add_pitch, s.add_roll }; QMutexLocker foo(&mtx); - static constexpr double r2d = 180 / M_PI; + static constexpr double r2d = 180 / OPENTRACK_PI; for (int i = 0; i < 3; i++) { int val = 0; -- cgit v1.2.3