summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2017-02-06 15:34:17 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2017-02-06 15:34:17 +0000
commit1e3e159499532a145cf09af2dbd1de2ae4d8d565 (patch)
tree77ef4131505efaf531c260d52afecba0137a372c
parentExtensions: Support for very old versions of Scour (<= 0.26) (diff)
downloadinkscape-1e3e159499532a145cf09af2dbd1de2ae4d8d565.tar.gz
inkscape-1e3e159499532a145cf09af2dbd1de2ae4d8d565.zip
Remove some unneeded < C++11 fallback code
(bzr r15485)
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/decimal-round.h7
-rw-r--r--src/display/canvas-axonomgrid.cpp1
-rw-r--r--src/display/nr-filter-turbulence.cpp12
-rw-r--r--src/display/nr-filter-utils.h2
-rw-r--r--src/display/nr-filter.cpp5
-rw-r--r--src/isinf.h20
-rw-r--r--src/libcola/gradient_projection.cpp1
-rw-r--r--src/round.h32
-rw-r--r--src/ui/tool/node.h5
-rw-r--r--src/widgets/desktop-widget.cpp5
-rw-r--r--src/widgets/gimp/ruler.cpp5
-rw-r--r--testfiles/src/cxxtests-to-migrate/round-test.h91
13 files changed, 4 insertions, 184 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bb45ffa4a..6df71e17e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -326,7 +326,6 @@ set(inkscape_SRC
id-clash.h
inkscape-version.h
inkscape.h
- isinf.h
knot-enums.h
knot-holder-entity.h
knot-ptr.h
@@ -367,7 +366,6 @@ set(inkscape_SRC
removeoverlap.h
require-config.h
resource-manager.h
- round.h
rubberband.h
satisfied-guide-cns.h
selcue.h
diff --git a/src/decimal-round.h b/src/decimal-round.h
index 6b412685e..b90958cae 100644
--- a/src/decimal-round.h
+++ b/src/decimal-round.h
@@ -3,14 +3,11 @@
#include <cmath>
-#include "round.h"
-
-
namespace Inkscape {
/** Returns x rounded to the nearest \a nplaces decimal places.
- Implemented in terms of Inkscape::round, i.e. we make no guarantees as to what happens if x is
+ Implemented in terms of std::round, i.e. we make no guarantees as to what happens if x is
half way between two rounded numbers. Add a note to the documentation if you care which
candidate is chosen for such case (round towards -infinity, +infinity, 0, or "even").
@@ -25,7 +22,7 @@ inline double
decimal_round(double const x, int const nplaces)
{
double const multiplier = std::pow(10.0, nplaces);
- return Inkscape::round( x * multiplier ) / multiplier;
+ return round( x * multiplier ) / multiplier;
}
}
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 94ee4ccfd..589cc849d 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -42,7 +42,6 @@
#include "2geom/line.h"
#include "2geom/angle.h"
#include "helper/mathfns.h"
-#include "round.h"
#include "util/units.h"
using Inkscape::Util::unit_table;
diff --git a/src/display/nr-filter-turbulence.cpp b/src/display/nr-filter-turbulence.cpp
index 19dedb67c..1397c0f34 100644
--- a/src/display/nr-filter-turbulence.cpp
+++ b/src/display/nr-filter-turbulence.cpp
@@ -286,15 +286,7 @@ private:
static int const BSize = 0x100;
static int const BMask = 0xff;
-#ifdef CPP11 // GCC 4.6.1 (currently used on Windows) does not correctly set __cplusplus in C++11 mode, so configure with -DCPP11 to make this work in C++11 mode
static double constexpr PerlinOffset = 4096.0;
-#else
-#if (__cplusplus < 201103L)
- static double const PerlinOffset;
-#else
- static double constexpr PerlinOffset = 4096.0;
-#endif
-#endif
Geom::Rect _tile;
Geom::Point _baseFreq;
@@ -311,10 +303,6 @@ private:
bool _fractalnoise;
};
-#if !defined(CPP11) && __cplusplus < 201103L
- double const TurbulenceGenerator::PerlinOffset = 4096.0;
-#endif
-
FilterTurbulence::FilterTurbulence()
: gen(new TurbulenceGenerator())
, XbaseFrequency(0)
diff --git a/src/display/nr-filter-utils.h b/src/display/nr-filter-utils.h
index 35a74d7c1..52b6bd11a 100644
--- a/src/display/nr-filter-utils.h
+++ b/src/display/nr-filter-utils.h
@@ -14,8 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "round.h"
-
namespace Inkscape {
namespace Filters {
diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp
index 789758d9c..d430553d4 100644
--- a/src/display/nr-filter.cpp
+++ b/src/display/nr-filter.cpp
@@ -48,11 +48,6 @@
#include "sp-filter-units.h"
#include "preferences.h"
-#if defined (SOLARIS) && (SOLARIS == 8)
-#include "round.h"
-using Inkscape::round;
-#endif
-
namespace Inkscape {
namespace Filters {
diff --git a/src/isinf.h b/src/isinf.h
deleted file mode 100644
index 8d590b972..000000000
--- a/src/isinf.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ISINF_H__
-#define __ISINF_H__
-
-/*
- * Fix for missing std::isinf with SOLARIS8/GCC3.2
- */
-
-#if defined (SOLARIS)
-
- #include <ieeefp.h>
- #define isinf(x) ((fpclass(x) == FP_NINF) || (fpclass(x) == FP_PINF))
-
-#elif defined(__APPLE__) && __GNUC__ == 3
-#define isinf(x) __isinf(x)
-#elif __cplusplus >= 201103L
-# include <cmath>
-# define isinf std::isinf
-#endif
-
-#endif /* __ISINF_H__ */
diff --git a/src/libcola/gradient_projection.cpp b/src/libcola/gradient_projection.cpp
index 3e41aceac..c8488a545 100644
--- a/src/libcola/gradient_projection.cpp
+++ b/src/libcola/gradient_projection.cpp
@@ -18,7 +18,6 @@
#include "gradient_projection.h"
#include <iostream>
#include <2geom/math-utils.h>
-#include "isinf.h"
#include <math.h>
using namespace std;
diff --git a/src/round.h b/src/round.h
deleted file mode 100644
index 16d280566..000000000
--- a/src/round.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef SEEN_ROUND_H
-#define SEEN_ROUND_H
-
-#include <cmath>
-
-namespace Inkscape {
-
-/** Returns x rounded to the nearest integer. It is unspecified what happens
- if x is half way between two integers: we may in future use rint/round
- on platforms that have them. If you depend on a particular rounding
- behaviour, then please change this documentation accordingly.
-**/
-inline double
-round(double const x)
-{
- return std::floor( x + .5 );
-}
-
-}
-
-#endif /* !SEEN_ROUND_H */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h
index 025c460e2..a05f0e3b9 100644
--- a/src/ui/tool/node.h
+++ b/src/ui/tool/node.h
@@ -20,12 +20,7 @@
#include <iosfwd>
#include <stdexcept>
#include <cstddef>
-
-#if __cplusplus >= 201103L
#include <functional>
-#else
-#include <tr1/functional>
-#endif
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 0a43bc7b2..7dae5d12f 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -68,11 +68,6 @@
#include <gtkmm/messagedialog.h>
#include <iomanip>
-#if defined (SOLARIS) && (SOLARIS == 8)
-#include "round.h"
-using Inkscape::round;
-#endif
-
using Inkscape::UI::Widget::UnitTracker;
using Inkscape::UI::UXManager;
using Inkscape::UI::ToolboxFactory;
diff --git a/src/widgets/gimp/ruler.cpp b/src/widgets/gimp/ruler.cpp
index 2a71b5c08..6a1f7f903 100644
--- a/src/widgets/gimp/ruler.cpp
+++ b/src/widgets/gimp/ruler.cpp
@@ -34,11 +34,10 @@
#include <cstdio>
#include "ruler.h"
-#include "round.h"
#include <glibmm/i18n.h>
#include "util/units.h"
-#define ROUND(x) ((int) ((x) + 0.5))
+#define ROUND(x) ((int) round(x))
#define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
@@ -1217,7 +1216,7 @@ sp_ruler_draw_ticks (SPRuler *ruler)
// be e.g. 641.50000000000; rounding behaviour is not defined in such a case (see round.h)
// and jitter will be apparent (upon redrawing some of the lines on the ruler might jump a
// by a pixel, and jump back on the next redraw). This is suppressed by adding 1e-9 (that's only one nanopixel ;-))
- pos = gint(Inkscape::round((cur - lower) * increment + 1e-12));
+ pos = gint(round((cur - lower) * increment + 1e-12));
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
diff --git a/testfiles/src/cxxtests-to-migrate/round-test.h b/testfiles/src/cxxtests-to-migrate/round-test.h
deleted file mode 100644
index 8e9ca69e0..000000000
--- a/testfiles/src/cxxtests-to-migrate/round-test.h
+++ /dev/null
@@ -1,91 +0,0 @@
-
-#ifndef SEEN_ROUND_TEST_H
-#define SEEN_ROUND_TEST_H
-
-#include <cxxtest/TestSuite.h>
-
-#include <vector>
-#include <round.h>
-
-class RoundTest : public CxxTest::TestSuite
-{
-public:
- struct Case {
- double arg0;
- double ret;
- };
-
- std::vector<Case> nonneg_round_cases;
- std::vector<Case> nonpos_round_cases;
-
- RoundTest() :
- TestSuite()
- {
- Case cases[] = {
- { 5.0, 5.0 },
- { 0.0, 0.0 },
- { 5.4, 5.0 },
- { 5.6, 6.0 },
- { 1e-7, 0.0 },
- { 1e7 + .49, 1e7 },
- { 1e7 + .51, 1e7 + 1 },
- { 1e12 + .49, 1e12 },
- { 1e12 + .51, 1e12 + 1 },
- { 1e40, 1e40 }
- };
-
- for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
- {
- nonneg_round_cases.push_back( cases[i] );
-
- Case tmp = {-nonneg_round_cases[i].arg0, -nonneg_round_cases[i].ret};
- nonpos_round_cases.push_back( tmp );
- }
- }
-
- virtual ~RoundTest()
- {
- }
-
- static RoundTest *createSuite() { return new RoundTest(); }
- static void destroySuite( RoundTest *suite ) { delete suite; }
-
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-
-
-
- void testNonNegRound()
- {
- for ( size_t i = 0; i < nonneg_round_cases.size(); i++ )
- {
- double result = Inkscape::round( nonneg_round_cases[i].arg0 );
- TS_ASSERT_EQUALS( result, nonneg_round_cases[i].ret );
- }
- }
-
- void testNonPosRoung()
- {
- for ( size_t i = 0; i < nonpos_round_cases.size(); i++ )
- {
- double result = Inkscape::round( nonpos_round_cases[i].arg0 );
- TS_ASSERT_EQUALS( result, nonpos_round_cases[i].ret );
- }
- }
-
-};
-
-
-#endif // SEEN_ROUND_TEST_H
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
-