From e7800d9ba2694631fffdc1cd2ca64be8109720ba Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 15 Nov 2021 17:28:36 +0000 Subject: [PATCH] Remove deprecated max() function --- GNUmakefile | 3 ++- audioomx.cc | 3 ++- defines.h | 1 - imageomx.cc | 3 ++- inputlinux.cc | 5 +++-- util.cc | 6 ------ util.h | 3 --- videoomx.cc | 6 ++++-- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 2d55693..fd5c01b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -106,7 +106,8 @@ endif ifeq ($(ALL_THE_WARNINGS_OFF),1) CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -std=c++14 -Wno-deprecated $(CXXFLAGS_EXTRA) $(INCLUDES) else -CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-format-attribute -Wdisabled-optimization -Wmissing-declarations -Wmissing-noreturn -Winit-self -Woverloaded-virtual -Wold-style-cast -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) +# -Wold-style-cast +CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-format-attribute -Wdisabled-optimization -Wmissing-declarations -Wmissing-noreturn -Winit-self -Woverloaded-virtual -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) endif CXXFLAGS_REL = $(DEFINES) -O3 -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) diff --git a/audioomx.cc b/audioomx.cc index 1c5cb3d..2ba6bb9 100644 --- a/audioomx.cc +++ b/audioomx.cc @@ -17,6 +17,7 @@ along with VOMP. If not, see . */ +#include #include #include "videoomx.h" @@ -1200,7 +1201,7 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc if (setportdef) { port_def_type.nBufferCountActual=2; - port_def_type.nBufferSize=max(port_def_type.nBufferSize,50000); // for transcoder important + port_def_type.nBufferSize=std::max(static_cast(port_def_type.nBufferSize),50000); // for transcoder important error=OMX_SetParameter(omx_aud_rend/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); diff --git a/defines.h b/defines.h index eca1dac..fb003f7 100644 --- a/defines.h +++ b/defines.h @@ -89,7 +89,6 @@ const std::string& getCommandLineServer(); #else - int max(int, int); int min(UINT, int); /*#ifdef _MIPS_ARCH #define Surface_TYPE SurfaceDirectFB diff --git a/imageomx.cc b/imageomx.cc index a511c40..23a5784 100644 --- a/imageomx.cc +++ b/imageomx.cc @@ -17,6 +17,7 @@ along with VOMP. If not, see . */ +#include #include #include "log.h" @@ -676,7 +677,7 @@ int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsig if (setportdef) { port_def_type.nBufferCountActual=port_def_type.nBufferCountMin; - port_def_type.nBufferSize=max(port_def_type.nBufferSize,length); // for transcoder important + port_def_type.nBufferSize=std::max(port_def_type.nBufferSize,length); // for transcoder important error=OMX_SetParameter(omx_imag_decode/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); diff --git a/inputlinux.cc b/inputlinux.cc index 9a81fb8..0dff75e 100644 --- a/inputlinux.cc +++ b/inputlinux.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include "i18n.h" #include "vdr.h" @@ -566,12 +567,12 @@ void InputLinux::listenLoop() for (unsigned int i = 0; i < devices.size(); i++) { int cur_fd = devices[i]; - maxfd = max(cur_fd, maxfd); + maxfd = std::max(cur_fd, maxfd); FD_SET(cur_fd, &readfds); } FD_SET(pfds[0], &readfds); - maxfd = max(pfds[0], maxfd); + maxfd = std::max(pfds[0], maxfd); // 0 = nothing happened and timeout expired // >0 = num of descriptors that changed diff --git a/util.cc b/util.cc index e0b762e..e3084cd 100644 --- a/util.cc +++ b/util.cc @@ -128,9 +128,3 @@ int min(UINT a, int b) else return a; } -int max(int a, int b) -{ - if (a > b) return a; - else return b; -} - diff --git a/util.h b/util.h index 25be8ad..432d6c7 100644 --- a/util.h +++ b/util.h @@ -35,7 +35,4 @@ void dump(void* data, int length); [[deprecated]] int min(UINT a, int b); -[[deprecated]] -int max(int a, int b); - #endif diff --git a/videoomx.cc b/videoomx.cc index 681f2b3..b071026 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -17,10 +17,12 @@ along with VOMP. If not, see . */ +#include +#include + #include #include -#include #include "log.h" #include "audioomx.h" @@ -1970,7 +1972,7 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex port_def_type.bBuffersContiguous,port_def_type.nBufferAlignment);*/ port_def_type.nBufferCountActual=100; - port_def_type.nBufferSize=max(port_def_type.nBufferSize,150000); // for transcoder important + port_def_type.nBufferSize=std::max(static_cast(port_def_type.nBufferSize),150000); // for transcoder important error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamPortDefinition, &port_def_type); -- 2.39.5