From 128b30f939ebe90ee3cbb24e2f62a231a9c8df09 Mon Sep 17 00:00:00 2001 From: Kang Lin Date: Thu, 25 Jul 2024 11:32:48 +0800 Subject: [PATCH] Use std::min replace min (cherry picked from commit 9aaea93b2d1012b05ea24a15f4269cb9f356c3d9) --- common/rdr/CMakeLists.txt | 5 +++++ common/rdr/HexInStream.cxx | 6 ++---- common/rdr/HexOutStream.cxx | 7 ++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt index 30c2403a..2897119b 100644 --- a/common/rdr/CMakeLists.txt +++ b/common/rdr/CMakeLists.txt @@ -20,6 +20,11 @@ target_include_directories(rdr PUBLIC ${CMAKE_SOURCE_DIR}/common) target_include_directories(rdr SYSTEM PUBLIC ${ZLIB_INCLUDE_DIRS}) target_link_libraries(rdr ${ZLIB_LIBRARIES} os rfb) +if(MSVC) + # undef min and max macro + target_compile_definitions(rfb PRIVATE NOMINMAX) +endif() + if(GNUTLS_FOUND) target_include_directories(rdr SYSTEM PUBLIC ${GNUTLS_INCLUDE_DIR}) target_link_libraries(rdr ${GNUTLS_LIBRARIES}) diff --git a/common/rdr/HexInStream.cxx b/common/rdr/HexInStream.cxx index e23974e1..11f98498 100644 --- a/common/rdr/HexInStream.cxx +++ b/common/rdr/HexInStream.cxx @@ -21,14 +21,13 @@ #include #endif +#include #include #include #include using namespace rdr; -static inline int min(int a, int b) {return a #endif - +#include #include #include using namespace rdr; -static inline size_t min(size_t a, size_t b) {return a