1
0
Fork 0
forked from lthn/blockchain

fixes for VS2019

This commit is contained in:
cryptozoidberg 2020-06-16 03:44:31 +02:00
parent f78a741ae5
commit 05efd94c69
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 41 additions and 10 deletions

View file

@ -120,20 +120,28 @@
#elif BOOST_VERSION < 106900
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#include <boost/spirit/home/support/detail/endian/endian.hpp>
#elif BOOST_VERSION >= 106900
# define BOOST_MATH_DISABLE_STD_FPCLASSIFY
# include <boost/math/special_functions/fpclassify.hpp>
# include <boost/endian/conversion.hpp>
#else
#include <boost/spirit/home/support/detail/endian/endian.hpp>
# include <boost/spirit/home/support/detail/endian/endian.hpp>
# include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#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<T, sizeof(T)>(&temp);
#endif
}
else t = 0; // zero optimization

View file

@ -123,20 +123,29 @@
#elif BOOST_VERSION < 106900
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#include <boost/spirit/home/support/detail/endian/endian.hpp>
#elif BOOST_VERSION >= 106900
#define BOOST_MATH_DISABLE_STD_FPCLASSIFY
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/endian/conversion.hpp>
#else
#include <boost/spirit/home/support/detail/endian/endian.hpp>
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
#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<T, sizeof(T)>(&temp, t);
#if BOOST_VERSION >= 106900
temp = endian::native_to_little(temp);
#else
endian::store_little_endian<T, sizeof(T)>(&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<T>::has_denorm); // pass
case FP_ZERO: // note that floats can be ±0.0

View file

@ -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<std::string>& /*args*/)

View file

@ -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