1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Introduced the new macro DISABLE_TEMPLATES_COLLIDING_WITH_STL

This commit is contained in:
Klaus Schmidinger 2017-06-11 10:05:34 +02:00
parent c70d62aeb4
commit 0a2c88c288
2 changed files with 11 additions and 5 deletions

View File

@ -9126,3 +9126,6 @@ Video Disk Recorder Revision History
had an abandoned member of class cSchedulesLock, which, as a side effect, caused an had an abandoned member of class cSchedulesLock, which, as a side effect, caused an
invalid lock sequence to be flagged (reported by Johann Friedrichs). In order to invalid lock sequence to be flagged (reported by Johann Friedrichs). In order to
have the compiler report such things, these macros have been changed. have the compiler report such things, these macros have been changed.
- Introduced the new macro DISABLE_TEMPLATES_COLLIDING_WITH_STL, which can be defined
before including tools.h in case some plugin needs to use the STL and gets error
messages regarding one of the template functions defined in tools.h.

13
tools.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.h 4.11 2017/06/11 08:52:06 kls Exp $ * $Id: tools.h 4.12 2017/06/11 10:00:49 kls Exp $
*/ */
#ifndef __TOOLS_H #ifndef __TOOLS_H
@ -51,16 +51,19 @@ template<class T> inline void DELETENULL(T *&p) { T *q = p; p = NULL; delete q;
#define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls #define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls
#define FATALERRNO (errno && errno != EAGAIN && errno != EINTR) #define FATALERRNO (errno && errno != EAGAIN && errno != EINTR)
#ifndef _STL_ALGOBASE_H // in case some plugin needs to use the STL // 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)
template<class T> inline T min(T a, T b) { return a <= b ? a : b; } 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; } template<class T> inline T max(T a, T b) { return a >= b ? a : b; }
#endif #endif
#ifndef __STL_CONFIG_H // in case some plugin needs to use the STL
template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; } template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; }
#endif #if !defined(DISABLE_TEMPLATES_COLLIDING_WITH_STL) && !defined(_MOVE_H)
#ifndef _MOVE_H // in case some plugin needs to use the STL
template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; } template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; }
#endif #endif
#endif
template<class T> inline T constrain(T v, T l, T h) { return v < l ? l : v > h ? h : v; } template<class T> inline T constrain(T v, T l, T h) { return v < l ? l : v > h ? h : v; }