diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index 77f4685a4e..dad571c119 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -330,4 +330,8 @@ vp_glob_module_copy_data("test/math/data/*.pgm" "modules/core" NO_INSTALL) # copy font vp_glob_module_copy_data("src/image/private/Rubik-Regular.ttf" "data/font") -vp_set_source_file_compile_flag(src/tools/file/vpIoTools_npy.cpp -Wno-misleading-indentation) +if(UNIX) + vp_set_source_file_compile_flag(src/tools/file/vpIoTools_npy.cpp -Wno-misleading-indentation) +else() + vp_set_source_file_compile_flag(src/tools/file/vpIoTools_npy.cpp /wd4333) +endif() diff --git a/modules/core/src/math/random-generator/vpUniRand.cpp b/modules/core/src/math/random-generator/vpUniRand.cpp index 79157f99e8..b6829b8c3a 100644 --- a/modules/core/src/math/random-generator/vpUniRand.cpp +++ b/modules/core/src/math/random-generator/vpUniRand.cpp @@ -121,7 +121,7 @@ uint32_t vpUniRand::boundedRand(uint32_t bound) // because this version will calculate the same modulus, but the LHS // value is less than 2^32. - uint32_t threshold = -bound % bound; + uint32_t threshold = static_cast(-static_cast(bound) % bound); // Uniformity guarantees that this loop will terminate. In practice, it // should usually terminate quickly; on average (assuming all bounds are @@ -148,7 +148,7 @@ uint32_t vpUniRand::next() m_rng.state = (oldstate * 6364136223846793005ULL) + m_rng.inc; uint32_t xorshifted = static_cast(((oldstate >> 18u) ^ oldstate) >> 27u); uint32_t rot = oldstate >> 59u; - return (xorshifted >> rot) | (xorshifted << ((-rot) & 31)); + return (xorshifted >> rot) | (xorshifted << (static_cast((-static_cast(rot)) & 31))); } /*! diff --git a/modules/core/src/tools/network/vpClient.cpp b/modules/core/src/tools/network/vpClient.cpp index c57366dd24..12fc072ba3 100644 --- a/modules/core/src/tools/network/vpClient.cpp +++ b/modules/core/src/tools/network/vpClient.cpp @@ -1,5 +1,4 @@ -/**************************************************************************** - * +/* * ViSP, open source Visual Servoing Platform software. * Copyright (C) 2005 - 2023 by Inria. All rights reserved. * @@ -30,17 +29,22 @@ * * Description: * TCP Client - * - * Authors: - * Aurelien Yol - * -*****************************************************************************/ + */ -#include +#include + +// Specific case for UWP to introduce a workaround +// error C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings +#if defined(WINRT) +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif +#endif // inet_ntop() not supported on win XP #ifdef VISP_HAVE_FUNC_INET_NTOP +#include #include BEGIN_VISP_NAMESPACE @@ -97,18 +101,18 @@ bool vpClient::connectToHostname(const std::string &hostname, const unsigned int serv.receptorIP = inet_ntoa(*(in_addr *)server->h_addr); return connectServer(serv); -} + } -/*! - Connect to the server represented by the given ip, and at a given port. + /*! + Connect to the server represented by the given ip, and at a given port. - \sa vpClient::connectToHostname() + \sa vpClient::connectToHostname() - \param ip : IP of the server. - \param port_serv : Port used for the connection. + \param ip : IP of the server. + \param port_serv : Port used for the connection. - \return True if the connection has been etablished, false otherwise. -*/ + \return True if the connection has been etablished, false otherwise. + */ bool vpClient::connectToIP(const std::string &ip, const unsigned int &port_serv) { vpNetwork::vpReceptor serv; @@ -130,13 +134,13 @@ bool vpClient::connectToIP(const std::string &ip, const unsigned int &port_serv) serv.receptorAddress.sin_port = htons((unsigned short)port_serv); return connectServer(serv); -} + } -/*! - Deconnect from the server at a specific index. + /*! + Deconnect from the server at a specific index. - \param index : Index of the server. -*/ + \param index : Index of the server. + */ void vpClient::deconnect(const unsigned int &index) { if (index < receptor_list.size()) { diff --git a/modules/core/src/tools/network/vpNetwork.cpp b/modules/core/src/tools/network/vpNetwork.cpp index 77feb13bd2..194c6d631b 100644 --- a/modules/core/src/tools/network/vpNetwork.cpp +++ b/modules/core/src/tools/network/vpNetwork.cpp @@ -1,5 +1,4 @@ -/**************************************************************************** - * +/* * ViSP, open source Visual Servoing Platform software. * Copyright (C) 2005 - 2023 by Inria. All rights reserved. * @@ -30,17 +29,22 @@ * * Description: * TCP Network - * - * Authors: - * Aurelien Yol - * -*****************************************************************************/ + */ -#include +#include + +// Specific case for UWP to introduce a workaround +// error C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings +#if defined(WINRT) +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif +#endif // inet_ntop() not supported on win XP #ifdef VISP_HAVE_FUNC_INET_NTOP +#include #include BEGIN_VISP_NAMESPACE vpNetwork::vpNetwork() diff --git a/modules/core/src/tools/network/vpServer.cpp b/modules/core/src/tools/network/vpServer.cpp index b8f23c8663..4b71f22158 100644 --- a/modules/core/src/tools/network/vpServer.cpp +++ b/modules/core/src/tools/network/vpServer.cpp @@ -1,5 +1,4 @@ -/**************************************************************************** - * +/* * ViSP, open source Visual Servoing Platform software. * Copyright (C) 2005 - 2023 by Inria. All rights reserved. * @@ -30,16 +29,24 @@ * * Description: * TCP Server - * -*****************************************************************************/ + */ -#include +#include -#include +// Specific case for UWP to introduce a workaround +// error C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings +#if defined(WINRT) +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif +#endif // inet_ntop() not supported on win XP #ifdef VISP_HAVE_FUNC_INET_NTOP +#include + +#include #include #if defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin) diff --git a/modules/visual_features/src/visual-feature/vpFeatureLuminanceMapping.cpp b/modules/visual_features/src/visual-feature/vpFeatureLuminanceMapping.cpp index 71a4e77f08..a7ff48337e 100644 --- a/modules/visual_features/src/visual-feature/vpFeatureLuminanceMapping.cpp +++ b/modules/visual_features/src/visual-feature/vpFeatureLuminanceMapping.cpp @@ -470,7 +470,7 @@ void vpLuminanceDCT::inverse(const vpColVector &s, vpImage &I) I.resize(Ir.getRows(), Ir.getCols()); for (unsigned int i = 0; i < I.getRows(); ++i) { for (unsigned int j = 0; j < I.getCols(); ++j) { - I[i][j] = std::max(0.0, std::min(Ir[i][j], 255.0)); + I[i][j] = static_cast(std::max(0.0, std::min(Ir[i][j], 255.0))); } } }