mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now using __cplusplus instead of DISABLE_TEMPLATES_COLLIDING_WITH_STL, and using std::min(), std::max() and std::swap() if available
This commit is contained in:
parent
e1f04cd6fa
commit
58e21d8e37
@ -2780,6 +2780,8 @@ Winfried K
|
|||||||
for improving handling missing VDRPluginDestroyer()
|
for improving handling missing VDRPluginDestroyer()
|
||||||
for fixing a compiler warning
|
for fixing a compiler warning
|
||||||
for fixing handling $(PKG_CONFIG) in newplugin
|
for fixing handling $(PKG_CONFIG) in newplugin
|
||||||
|
for using __cplusplus instead of DISABLE_TEMPLATES_COLLIDING_WITH_STL, and using
|
||||||
|
std::min(), std::max() and std::swap() is available
|
||||||
|
|
||||||
Hans-Werner Hilse <hilse@web.de>
|
Hans-Werner Hilse <hilse@web.de>
|
||||||
for adding the command line option --userdump to enable core dumps in case VDR
|
for adding the command line option --userdump to enable core dumps in case VDR
|
||||||
|
4
HISTORY
4
HISTORY
@ -9706,9 +9706,11 @@ Video Disk Recorder Revision History
|
|||||||
order to restore this functionality. However, it is recommended to use the function
|
order to restore this functionality. However, it is recommended to use the function
|
||||||
with the TimerActive parameter instead.
|
with the TimerActive parameter instead.
|
||||||
|
|
||||||
2021-05-25:
|
2021-05-26:
|
||||||
|
|
||||||
- cRecordingInfo::Errors() now returns -1 for old recordings; added a missing 'const'
|
- cRecordingInfo::Errors() now returns -1 for old recordings; added a missing 'const'
|
||||||
(suggested by Christoph Haubrich).
|
(suggested by Christoph Haubrich).
|
||||||
- The error counter of a recording is now copied as is when editing a recording.
|
- The error counter of a recording is now copied as is when editing a recording.
|
||||||
- Added missing initialization of cRecorder::lastErrors.
|
- Added missing initialization of cRecorder::lastErrors.
|
||||||
|
- Now using __cplusplus instead of DISABLE_TEMPLATES_COLLIDING_WITH_STL, and using
|
||||||
|
std::min(), std::max() and std::swap() if available (thanks to Winfried Köhler).
|
||||||
|
16
tools.h
16
tools.h
@ -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 5.5 2021/05/20 10:13:43 kls Exp $
|
* $Id: tools.h 5.6 2021/05/26 13:37:53 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TOOLS_H
|
#ifndef __TOOLS_H
|
||||||
@ -51,14 +51,20 @@ 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)
|
||||||
|
|
||||||
// In case some plugin needs to use the STL and gets an error message regarding one
|
#if __cplusplus >= 201103L
|
||||||
// of these functions, you can #define DISABLE_TEMPLATES_COLLIDING_WITH_STL before
|
// any gcc >= 4.8.1; we have swap, min, max
|
||||||
// including any VDR header files.
|
#include <algorithm> // std::min, std::max, (c++98: also swap)
|
||||||
#if !defined(DISABLE_TEMPLATES_COLLIDING_WITH_STL)
|
#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 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; }
|
||||||
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
|
||||||
|
|
||||||
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; }
|
||||||
|
|
||||||
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; }
|
||||||
|
Loading…
Reference in New Issue
Block a user