Skip to content

Commit

Permalink
use qIsNaN in place of ::isnan
Browse files Browse the repository at this point in the history
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
garybuhrmaster authored and Beirdo committed Jul 5, 2012
1 parent acaccbb commit e4f3d08
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -8,7 +8,6 @@
#include <cstdlib>
#include <cerrno>
#include <ctime>
#include <cmath>

// POSIX headers
#include <unistd.h>
Expand All @@ -26,6 +25,7 @@ using namespace std;
#include <QCoreApplication>
#include <QKeyEvent>
#include <QDir>
#include <QtCore/qnumeric.h>

// MythTV headers
#include "mthread.h"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e4f3d08

Please sign in to comment.