Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
vdr:2.4
vdr
vdr-2.4.7-gcc11.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File vdr-2.4.7-gcc11.diff of Package vdr
Backport of: From 58e21d8e374206531802b64ae0e5c260e2bf6bf7 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger <vdr@tvdr.de> Date: Wed, 26 May 2021 13:37:53 +0200 Subject: [PATCH] Now using __cplusplus instead of DISABLE_TEMPLATES_COLLIDING_WITH_STL, and using std::min(), std::max() and std::swap() if available Index: b/tools.h =================================================================== --- a/tools.h +++ b/tools.h @@ -51,19 +51,21 @@ template<class T> inline void DELETENULL #define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls #define FATALERRNO (errno && errno != EAGAIN && errno != EINTR) -// In case some plugin needs to use the STL and gets an error message regarding one -// of these functions, you can #define DISABLE_TEMPLATES_COLLIDING_WITH_STL before -// including tools.h. -#if !defined(__STL_CONFIG_H) // for old versions of the STL -#if !defined(DISABLE_TEMPLATES_COLLIDING_WITH_STL) && !defined(_STL_ALGOBASE_H) +#if __cplusplus >= 201103L +// any gcc >= 4.8.1; we have swap, min, max +#include <algorithm> // std::min, std::max, (c++98: also swap) +#include <utility> // std::swap (since c++11) +using std::min; +using std::max; +using std::swap; +#else +// no c++11 and old compiler, let's include our own templates template<class T> inline T min(T a, T b) { return a <= b ? a : b; } template<class T> inline T max(T a, T b) { return a >= b ? a : b; } -#endif -template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; } -#if !defined(DISABLE_TEMPLATES_COLLIDING_WITH_STL) && !defined(_MOVE_H) template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; } #endif -#endif + +template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; } template<class T> inline T constrain(T v, T l, T h) { return v < l ? l : v > h ? h : v; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor