mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 11:23:17 +00:00
remove all pre boost 1.48 workarounds
sicne 1.48 is now needed to build wesnoth (accoring to INSTALL) we can assume BOOST_VERSION >= 104800 in the code.
This commit is contained in:
parent
8741d38c55
commit
7434533b46
@ -28,7 +28,6 @@
|
||||
#include <boost/program_options/positional_options.hpp>
|
||||
#include <boost/program_options/value_semantic.hpp> // for value, etc
|
||||
#include <boost/program_options/variables_map.hpp> // for variables_map, etc
|
||||
#include <boost/version.hpp> // for BOOST_VERSION
|
||||
#include <iostream> // for operator<<, basic_ostream, etc
|
||||
|
||||
namespace po = boost::program_options;
|
||||
@ -40,11 +39,7 @@ static void validate(boost::any& v, const std::vector<std::string>& values,
|
||||
{
|
||||
two_strings ret_val;
|
||||
if (values.size() != 2) {
|
||||
#if BOOST_VERSION >= 104200
|
||||
throw po::validation_error(po::validation_error::invalid_option_value);
|
||||
#else
|
||||
throw po::validation_error("Invalid number of strings provided to option requiring exactly two of them.");
|
||||
#endif
|
||||
}
|
||||
ret_val.first = values.at(0);
|
||||
ret_val.second = values.at(1);
|
||||
|
@ -762,28 +762,6 @@ std::string read_file(const std::string &fname)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
#if BOOST_VERSION < 104800
|
||||
//boost iostream < 1.48 expects boost filesystem v2 paths. This is an adapter
|
||||
struct iostream_path
|
||||
{
|
||||
template<typename stringtype>
|
||||
iostream_path(const stringtype& s)
|
||||
: path_(s)
|
||||
{
|
||||
|
||||
}
|
||||
typedef bfs::path::string_type external_string_type;
|
||||
external_string_type external_file_string() const
|
||||
{
|
||||
return path_.native();
|
||||
}
|
||||
bfs::path path_;
|
||||
};
|
||||
|
||||
#else
|
||||
typedef bfs::path iostream_path;
|
||||
#endif
|
||||
|
||||
std::istream *istream_file(const std::string &fname, bool treat_failure_as_error)
|
||||
{
|
||||
LOG_FS << "Streaming " << fname << " for reading.\n";
|
||||
@ -798,7 +776,7 @@ std::istream *istream_file(const std::string &fname, bool treat_failure_as_error
|
||||
//that why boost::filesystem::fstream.hpp doesnt work with mingw.
|
||||
try
|
||||
{
|
||||
boost::iostreams::file_descriptor_source fd(iostream_path(fname), std::ios_base::binary);
|
||||
boost::iostreams::file_descriptor_source fd(bfs::path(fname), std::ios_base::binary);
|
||||
//TODO: has this still use ?
|
||||
if (!fd.is_open() && treat_failure_as_error) {
|
||||
ERR_FS << "Could not open '" << fname << "' for reading.\n";
|
||||
@ -823,7 +801,7 @@ std::ostream *ostream_file(std::string const &fname, bool create_directory)
|
||||
#if 1
|
||||
try
|
||||
{
|
||||
boost::iostreams::file_descriptor_sink fd(iostream_path(fname), std::ios_base::binary);
|
||||
boost::iostreams::file_descriptor_sink fd(bfs::path(fname), std::ios_base::binary);
|
||||
return new boost::iostreams::stream<boost::iostreams::file_descriptor_sink>(fd, 4096, 0);
|
||||
}
|
||||
catch(BOOST_IOSTREAMS_FAILURE& e)
|
||||
|
@ -156,11 +156,7 @@ std::size_t connection::is_write_complete(
|
||||
if(ec)
|
||||
throw system_error(ec);
|
||||
bytes_written_ = bytes_transferred;
|
||||
#if BOOST_VERSION >= 103700
|
||||
return bytes_to_write_ - bytes_transferred;
|
||||
#else
|
||||
return bytes_to_write_ == bytes_transferred;
|
||||
#endif
|
||||
}
|
||||
|
||||
void connection::handle_write(
|
||||
@ -195,11 +191,7 @@ std::size_t connection::is_read_complete(
|
||||
if (bytes_to_read_ < 4)
|
||||
bytes_to_read_ = bytes_transferred;
|
||||
}
|
||||
#if BOOST_VERSION >= 103700
|
||||
return bytes_to_read_ - bytes_transferred;
|
||||
#else
|
||||
return bytes_to_read_ == bytes_transferred;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,6 @@
|
||||
|
||||
#define SEED_RNG_USE_BOOST_RANDOM_DEVICE
|
||||
|
||||
//Boost does not support random device on windows before v 1.43.0
|
||||
//http://www.boost.org/users/history/version_1_43_0.html
|
||||
#if (defined(_WIN32) && (BOOST_VERSION < 104300))
|
||||
#undef SEED_RNG_USE_BOOST_RANDOM_DEVICE
|
||||
#endif
|
||||
|
||||
/*****
|
||||
End preprocessor checks
|
||||
*****/
|
||||
|
Loading…
x
Reference in New Issue
Block a user