Permalink
Browse files

use qIsNaN in place of ::isnan

Feature patch for g++ C++0x/C++11 standards compliance

When compiling with g++ and specifing -std=c++0x the compilation fails in
mythplayer.cpp due to a namespace collision for isnan (std:: and math::).

Patch attached which changes mythplayer to use the Qt function qIsNaN,
providing a platform neutral implementation now that Qt has made that
function available (in Qt 4.6).

Since MythTV does not currently specify use of the new C++ standards, this
patch is not necessary at this time, but may useful be at some future date
(when gcc defaults to the C++11 standards?)

Fixes #10524

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
  • Loading branch information...
1 parent acaccbb commit e4f3d088815b7f08650eec915da97acacf565d21 @garybuhrmaster garybuhrmaster committed with Beirdo Jul 5, 2012
Showing with 2 additions and 8 deletions.
  1. +2 −8 mythtv/libs/libmythtv/mythplayer.cpp
View
10 mythtv/libs/libmythtv/mythplayer.cpp
@@ -8,7 +8,6 @@
#include <cstdlib>
#include <cerrno>
#include <ctime>
-#include <cmath>
// POSIX headers
#include <unistd.h>
@@ -26,6 +25,7 @@ using namespace std;
#include <QCoreApplication>
#include <QKeyEvent>
#include <QDir>
+#include <QtCore/qnumeric.h>
// MythTV headers
#include "mthread.h"
@@ -76,12 +76,6 @@ extern "C" {
#define round(x) ((int) ((x) + 0.5))
#endif
-#if CONFIG_DARWIN
-extern "C" {
-int isnan(double);
-}
-#endif
-
static unsigned dbg_ident(const MythPlayer*);
#define LOC QString("Player(%1): ").arg(dbg_ident(this),0,36)
@@ -811,7 +805,7 @@ void MythPlayer::SetScanType(FrameScanType scan)
void MythPlayer::SetVideoParams(int width, int height, double fps,
FrameScanType scan)
{
- if (width < 1 || height < 1 || isnan(fps))
+ if (width < 1 || height < 1 || qIsNaN(fps))
return;
video_dim = QSize((width + 15) & ~0xf, (height + 15) & ~0xf);

0 comments on commit e4f3d08

Please sign in to comment.