Group :: Development/C++
RPM: Inventor
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: Inventor-2.1.5-abs-c++17.patch
Download
Download
From e32ce7bb173cb7e1b7bebe315e04ac73ea43c089 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Aumu=CC=88ller?= <aumuell@reserv.at>
Date: Mon, 20 Feb 2017 00:41:05 +0100
Subject: [PATCH] consistently use <cmath> instead of <math.h>
---
lib/database/src/so/nodes/nurbs/clients/gl4base.h | 4 ++--
lib/database/src/so/nodes/nurbs/clients/softsurfeval.c++ | 4 ++--
lib/database/src/so/nodes/nurbs/head/mymath.h | 2 +-
lib/database/src/so/nodes/nurbs/libnurbs/quilt.c++ | 2 +-
lib/database/src/so/nodes/nurbs/libnurbs/varray.c++ | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/database/src/so/nodes/nurbs/clients/gl4base.h b/lib/database/src/so/nodes/nurbs/clients/gl4base.h
index 4d6a4c2..466f32c 100644
--- a/lib/database/src/so/nodes/nurbs/clients/gl4base.h
+++ b/lib/database/src/so/nodes/nurbs/clients/gl4base.h
@@ -43,8 +43,8 @@
#include <inttypes.h> /* defines long and brethren */
-#include "math.h"
-#include "stdlib.h"
+#include <cmath>
+#include <cstdlib>
#include "nurbstess.h"
#include "gl4types.h"
#include "gl4surfeval.h"
diff --git a/lib/database/src/so/nodes/nurbs/clients/softsurfeval.c++ b/lib/database/src/so/nodes/nurbs/clients/softsurfeval.c++
index 9604b3a..a1e7bea 100644
--- a/lib/database/src/so/nodes/nurbs/clients/softsurfeval.c++
+++ b/lib/database/src/so/nodes/nurbs/clients/softsurfeval.c++
@@ -43,6 +43,7 @@
#include "../SoAddPrefix.h"
#include "myassert.h"
#include <cstdio>
+#include <algorithm>
#include <GL/gl.h>
#include "mystdio.h"
#include "mymath.h"
@@ -50,8 +51,7 @@
#include "softsurfeval.h"
#include "nurbsconsts.h"
-inline REAL abs( REAL x ) { return (x < 0.0) ? -x : x; }
-inline int equal( REAL x, REAL y ) { return (abs(x-y) < 1.0E-6) ? 1 : 0; }
+inline int equal( REAL x, REAL y ) { return (std::abs(x-y) < 1.0E-6) ? 1 : 0; }
_SoNurbsSurfaceEvaluator::~_SoNurbsSurfaceEvaluator()
{
diff --git a/lib/database/src/so/nodes/nurbs/head/mymath.h b/lib/database/src/so/nodes/nurbs/head/mymath.h
index fa4af8c..2f04875 100644
--- a/lib/database/src/so/nodes/nurbs/head/mymath.h
+++ b/lib/database/src/so/nodes/nurbs/head/mymath.h
@@ -58,7 +58,7 @@ extern "C" float floorf(float);
#endif
#ifdef LIBRARYBUILD
-#include <math.h>
+#include <cmath>
#endif
#ifdef _DOUBLE_MATH_ONLY
diff --git a/lib/database/src/so/nodes/nurbs/libnurbs/quilt.c++ b/lib/database/src/so/nodes/nurbs/libnurbs/quilt.c++
index a72face..d5f2ed6 100644
--- a/lib/database/src/so/nodes/nurbs/libnurbs/quilt.c++
+++ b/lib/database/src/so/nodes/nurbs/libnurbs/quilt.c++
@@ -48,7 +48,7 @@
#include "flist.h"
#include "knotvector.h"
#include "patchlist.h"
-#include "math.h" //fabs()
+#include <cmath> //fabs()
#include "simplemath.h" //min()
/* local preprocessor definitions */
diff --git a/lib/database/src/so/nodes/nurbs/libnurbs/varray.c++ b/lib/database/src/so/nodes/nurbs/libnurbs/varray.c++
index ee65869..d82bf1b 100644
--- a/lib/database/src/so/nodes/nurbs/libnurbs/varray.c++
+++ b/lib/database/src/so/nodes/nurbs/libnurbs/varray.c++
@@ -44,7 +44,7 @@
#include "mystdio.h"
#include "varray.h"
#include "arc.h"
-#include "math.h" // fabs()
+#include <cmath> // fabs()
#define TINY 0.0001
inline long sgn( REAL x )
diff --git a/inventor/lib/database/src/so/nodes/nurbs/head/simplemath.h b/inventor/lib/database/src/so/nodes/nurbs/head/simplemath.h
index 2b87e01..3543057 100644
--- a/lib/database/src/so/nodes/nurbs/head/simplemath.h
+++ b/lib/database/src/so/nodes/nurbs/head/simplemath.h
@@ -53,7 +53,7 @@ min( REAL x, REAL y ) { return ( x > y ) ? y : x; }
inline int
absi( int x ) { return ( x < 0 ) ? -x : x; }
-inline REAL
-abs( REAL x ) { return ( x < 0.0 ) ? -x : x; }
+//inline REAL
+//abs( REAL x ) { return ( x < 0.0 ) ? -x : x; }
#endif /* __glusimplemath_h_ */