From 1e3e159499532a145cf09af2dbd1de2ae4d8d565 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 6 Feb 2017 15:34:17 +0000 Subject: Remove some unneeded < C++11 fallback code (bzr r15485) --- src/CMakeLists.txt | 2 -- src/decimal-round.h | 7 ++----- src/display/canvas-axonomgrid.cpp | 1 - src/display/nr-filter-turbulence.cpp | 12 ------------ src/display/nr-filter-utils.h | 2 -- src/display/nr-filter.cpp | 5 ----- src/isinf.h | 20 -------------------- src/libcola/gradient_projection.cpp | 1 - src/round.h | 32 -------------------------------- src/ui/tool/node.h | 5 ----- src/widgets/desktop-widget.cpp | 5 ----- src/widgets/gimp/ruler.cpp | 5 ++--- 12 files changed, 4 insertions(+), 93 deletions(-) delete mode 100644 src/isinf.h delete mode 100644 src/round.h (limited to 'src') 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 -#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 - #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 -# 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 #include <2geom/math-utils.h> -#include "isinf.h" #include 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 - -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 #include #include - -#if __cplusplus >= 201103L #include -#else -#include -#endif #include #include 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 #include -#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 #include "ruler.h" -#include "round.h" #include #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) { -- cgit v1.2.3