From 05efd94c6968f51e8b4cf5f5d6200b4d1ddec301 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Tue, 16 Jun 2020 03:44:31 +0200 Subject: [PATCH] fixes for VS2019 --- .../eos/portable_iarchive.hpp | 20 ++++++++++++--- .../eos/portable_oarchive.hpp | 25 ++++++++++++++++--- contrib/epee/include/console_handler.h | 2 +- contrib/epee/include/string_coding.h | 4 ++- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/contrib/eos_portable_archive/eos/portable_iarchive.hpp b/contrib/eos_portable_archive/eos/portable_iarchive.hpp index 6f60c93d..cd087f34 100644 --- a/contrib/eos_portable_archive/eos/portable_iarchive.hpp +++ b/contrib/eos_portable_archive/eos/portable_iarchive.hpp @@ -120,20 +120,28 @@ #elif BOOST_VERSION < 106900 #include #include +#elif BOOST_VERSION >= 106900 +# define BOOST_MATH_DISABLE_STD_FPCLASSIFY +# include +# include #else -#include +# include +# include #endif - // namespace alias -#if BOOST_VERSION < 103800 || BOOST_VERSION >= 106900 +#if BOOST_VERSION < 103800 namespace fp = boost::math; +#elif BOOST_VERSION >= 106900 +namespace fp = boost::math; #else -namespace fp = boost::spirit::math; +namespace fp = boost::spirit::math; #endif // namespace alias endian #if BOOST_VERSION < 104800 namespace endian = boost::detail; +#elif BOOST_VERSION >= 106900 +namespace endian = boost::endian; #else namespace endian = boost::spirit::detail; #endif @@ -352,7 +360,11 @@ namespace eos { // load the value from little endian - it is then converted // to the target type T and fits it because size <= sizeof(T) +#if BOOST_VERSION >= 106900 + t = endian::little_to_native(temp); +#else t = endian::load_little_endian(&temp); +#endif } else t = 0; // zero optimization diff --git a/contrib/eos_portable_archive/eos/portable_oarchive.hpp b/contrib/eos_portable_archive/eos/portable_oarchive.hpp index 20d4c29c..fce2bd26 100644 --- a/contrib/eos_portable_archive/eos/portable_oarchive.hpp +++ b/contrib/eos_portable_archive/eos/portable_oarchive.hpp @@ -123,20 +123,29 @@ #elif BOOST_VERSION < 106900 #include #include +#elif BOOST_VERSION >= 106900 +#define BOOST_MATH_DISABLE_STD_FPCLASSIFY +#include +#include #else #include +#include #endif // namespace alias fp_classify -#if BOOST_VERSION < 103800 || BOOST_VERSION >= 106900 +#if BOOST_VERSION < 103800 namespace fp = boost::math; +#elif BOOST_VERSION >= 106900 +namespace fp = boost::math; #else -namespace fp = boost::spirit::math; +namespace fp = boost::spirit::math; #endif // namespace alias endian #if BOOST_VERSION < 104800 namespace endian = boost::detail; +#elif BOOST_VERSION >= 106900 +namespace endian = boost::endian; #else namespace endian = boost::spirit::detail; #endif @@ -330,7 +339,11 @@ namespace eos { // we choose to use little endian because this way we just // save the first size bytes to the stream and skip the rest - endian::store_little_endian(&temp, t); +#if BOOST_VERSION >= 106900 + temp = endian::native_to_little(temp); +#else + endian::store_little_endian(&temp, t); +#endif save_binary(&temp, size); } // zero optimization @@ -388,7 +401,11 @@ namespace eos { switch (fp::fpclassify(t)) { //case FP_ZERO: bits = 0; break; - case FP_NAN: bits = traits::exponent | traits::mantissa; break; +#if BOOST_VERSION >= 106900 + case FP_NAN: bits = traits::exponent | traits::significand; break; +#else + case FP_NAN: bits = traits::exponent | traits::mantissa; break; +#endif case FP_INFINITE: bits = traits::exponent | (t<0) * traits::sign; break; case FP_SUBNORMAL: assert(std::numeric_limits::has_denorm); // pass case FP_ZERO: // note that floats can be ±0.0 diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 2dbec160..4887c7ca 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -478,7 +478,7 @@ namespace epee bool run_handling(const std::string& prompt, const std::string& usage_string) { - return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string); + return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, boost::placeholders::_1), prompt, usage_string); } bool help(const std::vector& /*args*/) diff --git a/contrib/epee/include/string_coding.h b/contrib/epee/include/string_coding.h index a6d2acf4..a12af007 100644 --- a/contrib/epee/include/string_coding.h +++ b/contrib/epee/include/string_coding.h @@ -59,8 +59,10 @@ namespace string_encoding inline std::string convert_to_ansii(const std::wstring& str_from) { - + PUSH_VS_WARNINGS + DISABLE_VS_WARNINGS(4244) std::string res(str_from.begin(), str_from.end()); + POP_VS_WARNINGS return res; } #ifdef WIN32