]> git.vomp.tv Git - vompclient.git/commitdiff
Remove deprecated max() function
authorChris Tallon <chris@vomp.tv>
Mon, 15 Nov 2021 17:28:36 +0000 (17:28 +0000)
committerChris Tallon <chris@vomp.tv>
Mon, 15 Nov 2021 17:28:36 +0000 (17:28 +0000)
GNUmakefile
audioomx.cc
defines.h
imageomx.cc
inputlinux.cc
util.cc
util.h
videoomx.cc

index 2d556938c87cfa02a10dc5350e6bfae745bd4e00..fd5c01b8da863900fa0b286238b0bec95fd2f79b 100644 (file)
@@ -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)
index 1c5cb3dbf213d7ff6419d49cabb27c02e12a0d64..2ba6bb9cca70efb813b6f84024194d4fd352ecfd 100644 (file)
@@ -17,6 +17,7 @@
     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
+#include <algorithm>
 #include <bcm_host.h>
 
 #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<int>(port_def_type.nBufferSize),50000); // for transcoder important
 
                error=OMX_SetParameter(omx_aud_rend/*dec*/,OMX_IndexParamPortDefinition, &port_def_type);
 
index eca1dac453c31e0ea0c5dd94cae32a2a0607dc58..fb003f771f2dd619b890ffa53caf1fa8db73aef3 100644 (file)
--- 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
index a511c40652412d29ede769fb0b7ce97e60f52cfd..23a5784132bd3ebbda029e17121eaadfec987dab 100644 (file)
@@ -17,6 +17,7 @@
     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
+#include <algorithm>
 #include <bcm_host.h>
 
 #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);
 
index 9a81fb8b08d50cac5bc63f64ff43a91703a6bfa2..0dff75e58bb942b403fb2c25353c034b9b5dc713 100644 (file)
@@ -29,6 +29,7 @@
 #include <cstdio>
 #include <iostream>
 #include <ostream>
+#include <algorithm>
 
 #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 e0b762e7df081c890d6e271013bcbe93c8119628..e3084cd2e9e02e7762c3042bfa63b8e94350488a 100644 (file)
--- 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 25be8ad954069f2f8cd495291eb34af24bee34d5..432d6c744f4279f4daf39215efa24b1d42efef9f 100644 (file)
--- 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
index 681f2b3a0209b576a6e36d3d779c854320b07f09..b071026931ae972b4581da35deba87ec132dbc46 100644 (file)
     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
+#include <algorithm>
+#include <chrono>
+
 #include <bcm_host.h>
 #include <linux/fb.h>
 
-#include <chrono>
 
 #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<int>(port_def_type.nBufferSize),150000); // for transcoder important
 
        error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamPortDefinition, &port_def_type);