Convert uses of boost integer types to their stdlib equivalents
This commit is contained in:
parent
8fa73053b8
commit
d778db8af6
38 changed files with 96 additions and 112 deletions
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
|
@ -34,8 +33,6 @@
|
|||
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
|
||||
using boost::uint32_t;
|
||||
|
||||
static lg::log_domain log_desktop("desktop");
|
||||
#define ERR_DU LOG_STREAM(err, log_desktop)
|
||||
#define LOG_DU LOG_STREAM(info, log_desktop)
|
||||
|
|
|
@ -25,15 +25,12 @@
|
|||
#include "mp_ui_alerts.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <SDL_timer.h>
|
||||
#include <SDL_video.h>
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define ERR_NG LOG_STREAM(err, log_engine)
|
||||
|
||||
using boost::uint32_t;
|
||||
|
||||
namespace {
|
||||
const int chat_message_border = 5;
|
||||
const int chat_message_x = 10;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "chat_events.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -52,7 +52,7 @@ private:
|
|||
|
||||
int speaker_handle;
|
||||
int handle;
|
||||
boost::uint32_t created_at;
|
||||
uint32_t created_at;
|
||||
};
|
||||
|
||||
void prune_chat_messages(bool remove_all=false);
|
||||
|
|
|
@ -72,19 +72,19 @@ size_t cave_map_generator::cave_map_generator_job::translate_y(size_t y) const
|
|||
return y;
|
||||
}
|
||||
|
||||
std::string cave_map_generator::create_map(boost::optional<boost::uint32_t> randomseed)
|
||||
std::string cave_map_generator::create_map(boost::optional<uint32_t> randomseed)
|
||||
{
|
||||
const config res = create_scenario(randomseed);
|
||||
return res["map_data"];
|
||||
}
|
||||
|
||||
config cave_map_generator::create_scenario(boost::optional<boost::uint32_t> randomseed)
|
||||
config cave_map_generator::create_scenario(boost::optional<uint32_t> randomseed)
|
||||
{
|
||||
cave_map_generator_job job(*this, randomseed);
|
||||
return job.res_;
|
||||
}
|
||||
|
||||
cave_map_generator::cave_map_generator_job::cave_map_generator_job(const cave_map_generator& pparams, boost::optional<boost::uint32_t> randomseed)
|
||||
cave_map_generator::cave_map_generator_job::cave_map_generator_job(const cave_map_generator& pparams, boost::optional<uint32_t> randomseed)
|
||||
: params(pparams)
|
||||
, flipx_(false)
|
||||
, flipy_(false)
|
||||
|
|
|
@ -34,13 +34,13 @@ public:
|
|||
|
||||
std::string config_name() const;
|
||||
|
||||
std::string create_map(boost::optional<boost::uint32_t> randomseed = boost::none);
|
||||
config create_scenario(boost::optional<boost::uint32_t> randomseed = boost::none);
|
||||
std::string create_map(boost::optional<uint32_t> randomseed = boost::none);
|
||||
config create_scenario(boost::optional<uint32_t> randomseed = boost::none);
|
||||
|
||||
private:
|
||||
struct cave_map_generator_job
|
||||
{
|
||||
cave_map_generator_job(const cave_map_generator& params, boost::optional<boost::uint32_t> randomseed = boost::none);
|
||||
cave_map_generator_job(const cave_map_generator& params, boost::optional<uint32_t> randomseed = boost::none);
|
||||
|
||||
struct chamber {
|
||||
chamber()
|
||||
|
|
|
@ -346,15 +346,15 @@ std::string default_map_generator::config_name() const
|
|||
return std::string();
|
||||
}
|
||||
|
||||
std::string default_map_generator::create_map(boost::optional<boost::uint32_t> randomseed)
|
||||
std::string default_map_generator::create_map(boost::optional<uint32_t> randomseed)
|
||||
{
|
||||
return generate_map(nullptr, randomseed);
|
||||
}
|
||||
|
||||
std::string default_map_generator::generate_map(std::map<map_location,std::string>* labels, boost::optional<boost::uint32_t> randomseed)
|
||||
std::string default_map_generator::generate_map(std::map<map_location,std::string>* labels, boost::optional<uint32_t> randomseed)
|
||||
{
|
||||
boost::uint32_t seed;
|
||||
if(const boost::uint32_t* pseed = randomseed.get_ptr()) {
|
||||
uint32_t seed;
|
||||
if(const uint32_t* pseed = randomseed.get_ptr()) {
|
||||
seed = *pseed;
|
||||
}
|
||||
else {
|
||||
|
@ -427,7 +427,7 @@ std::string default_map_generator::generate_map(std::map<map_location,std::strin
|
|||
return map;
|
||||
}
|
||||
|
||||
config default_map_generator::create_scenario(boost::optional<boost::uint32_t> randomseed)
|
||||
config default_map_generator::create_scenario(boost::optional<uint32_t> randomseed)
|
||||
{
|
||||
DBG_NG << "creating scenario...\n";
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ public:
|
|||
|
||||
std::string config_name() const;
|
||||
|
||||
std::string create_map(boost::optional<boost::uint32_t> randomseed);
|
||||
config create_scenario(boost::optional<boost::uint32_t> randomseed);
|
||||
std::string create_map(boost::optional<uint32_t> randomseed);
|
||||
config create_scenario(boost::optional<uint32_t> randomseed);
|
||||
|
||||
private:
|
||||
|
||||
std::string generate_map(std::map<map_location,std::string>* labels, boost::optional<boost::uint32_t> randomseed);
|
||||
std::string generate_map(std::map<map_location,std::string>* labels, boost::optional<uint32_t> randomseed);
|
||||
|
||||
size_t default_width_, default_height_, width_, height_, island_size_, iterations_, hill_size_, max_lakes_, nvillages_, castle_size_, nplayers_;
|
||||
bool link_castles_, show_labels_;
|
||||
|
|
|
@ -26,7 +26,7 @@ class config;
|
|||
#include "utils/name_generator.hpp"
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
|
@ -34,7 +34,7 @@ class default_map_generator_job
|
|||
{
|
||||
public:
|
||||
default_map_generator_job();
|
||||
default_map_generator_job(boost::uint32_t seed);
|
||||
default_map_generator_job(uint32_t seed);
|
||||
|
||||
/** Generate the map. */
|
||||
std::string default_generate_map(size_t width, size_t height, size_t island_size, size_t island_off_center,
|
||||
|
|
|
@ -53,7 +53,7 @@ void lua_map_generator::user_config(CVideo & v)
|
|||
}
|
||||
}
|
||||
|
||||
std::string lua_map_generator::create_map(boost::optional<boost::uint32_t> seed)
|
||||
std::string lua_map_generator::create_map(boost::optional<uint32_t> seed)
|
||||
{
|
||||
try {
|
||||
return lk_.create_map(create_map_.c_str(), generator_data_, seed);
|
||||
|
@ -65,7 +65,7 @@ std::string lua_map_generator::create_map(boost::optional<boost::uint32_t> seed)
|
|||
}
|
||||
}
|
||||
|
||||
config lua_map_generator::create_scenario(boost::optional<boost::uint32_t> seed)
|
||||
config lua_map_generator::create_scenario(boost::optional<uint32_t> seed)
|
||||
{
|
||||
if (!create_scenario_.size()) {
|
||||
return map_generator::create_scenario();
|
||||
|
|
|
@ -42,8 +42,8 @@ public:
|
|||
std::string config_name() const { return config_name_; }
|
||||
|
||||
virtual void user_config(CVideo & v);
|
||||
virtual std::string create_map(boost::optional<boost::uint32_t> randomseed);
|
||||
virtual config create_scenario(boost::optional<boost::uint32_t> randomseed);
|
||||
virtual std::string create_map(boost::optional<uint32_t> randomseed);
|
||||
virtual config create_scenario(boost::optional<uint32_t> randomseed);
|
||||
|
||||
private:
|
||||
std::string id_, config_name_;
|
||||
|
|
|
@ -28,7 +28,7 @@ static lg::log_domain log_mapgen("mapgen");
|
|||
#define ERR_NG LOG_STREAM(err, log_mapgen)
|
||||
#define LOG_NG LOG_STREAM(info, log_mapgen)
|
||||
|
||||
config map_generator::create_scenario(boost::optional<boost::uint32_t> randomseed)
|
||||
config map_generator::create_scenario(boost::optional<uint32_t> randomseed)
|
||||
{
|
||||
config res;
|
||||
res["map_data"] = create_map(randomseed);
|
||||
|
|
|
@ -24,7 +24,7 @@ class CVideo;
|
|||
#include "map/location.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
struct mapgen_exception : public game::error
|
||||
{
|
||||
|
@ -67,9 +67,9 @@ public:
|
|||
* Creates a new map and returns it.
|
||||
* args may contain arguments to the map generator.
|
||||
*/
|
||||
virtual std::string create_map(boost::optional<boost::uint32_t> randomseed = boost::none) = 0;
|
||||
virtual std::string create_map(boost::optional<uint32_t> randomseed = boost::none) = 0;
|
||||
|
||||
virtual config create_scenario(boost::optional<boost::uint32_t> randomseed = boost::none);
|
||||
virtual config create_scenario(boost::optional<uint32_t> randomseed = boost::none);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,10 +142,10 @@ void teditor_generate_map::pre_show(twindow& window)
|
|||
std::ref(window)));
|
||||
}
|
||||
|
||||
boost::optional<boost::uint32_t> teditor_generate_map::get_seed()
|
||||
boost::optional<uint32_t> teditor_generate_map::get_seed()
|
||||
{
|
||||
try {
|
||||
return lexical_cast<boost::uint32_t>(random_seed_);
|
||||
return lexical_cast<uint32_t>(random_seed_);
|
||||
}
|
||||
catch(const bad_lexical_cast& ) {
|
||||
return boost::none;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
class map_generator;
|
||||
class display;
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
void select_map_generator(map_generator* mg);
|
||||
|
||||
boost::optional<boost::uint32_t> get_seed();
|
||||
boost::optional<uint32_t> get_seed();
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -70,7 +70,7 @@ unsigned decode_font_style(const std::string& style)
|
|||
return TTF_STYLE_NORMAL;
|
||||
}
|
||||
|
||||
boost::uint32_t decode_color(const std::string& color)
|
||||
uint32_t decode_color(const std::string& color)
|
||||
{
|
||||
std::vector<std::string> fields = utils::split(color);
|
||||
|
||||
|
@ -78,7 +78,7 @@ boost::uint32_t decode_color(const std::string& color)
|
|||
while(fields.size() < 4)
|
||||
fields.push_back("0");
|
||||
|
||||
boost::uint32_t result = 0;
|
||||
uint32_t result = 0;
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
// shift the previous value before adding, since it's a nop on the
|
||||
// first run there's no need for an if.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <pango/pango-layout.h>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -64,7 +64,7 @@ SDL_Rect create_rect(const tpoint& origin, const tpoint& size);
|
|||
*
|
||||
* @returns The color.
|
||||
*/
|
||||
boost::uint32_t decode_color(const std::string& color);
|
||||
uint32_t decode_color(const std::string& color);
|
||||
|
||||
/**
|
||||
* Converts a text alignment string to a text alignment.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#ifndef KEY_HPP_INCLUDED
|
||||
#define KEY_HPP_INCLUDED
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* Class that keeps track of all the keys on the keyboard.
|
||||
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
class CKey
|
||||
{
|
||||
const boost::uint8_t *key_list;
|
||||
const uint8_t *key_list;
|
||||
|
||||
public:
|
||||
CKey();
|
||||
|
|
|
@ -37,7 +37,7 @@ mt_rng::mt_rng() :
|
|||
}
|
||||
|
||||
|
||||
mt_rng::mt_rng(boost::uint32_t seed)
|
||||
mt_rng::mt_rng(uint32_t seed)
|
||||
: random_seed_(seed)
|
||||
, mt_(random_seed_)
|
||||
, random_calls_(0)
|
||||
|
|
|
@ -15,11 +15,9 @@
|
|||
#ifndef MT_RNG_HPP_INCLUDED
|
||||
#define MT_RNG_HPP_INCLUDED
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
|
||||
using boost::uint32_t;
|
||||
|
||||
class config;
|
||||
|
||||
namespace rand_rng
|
||||
|
@ -35,7 +33,7 @@ class mt_rng
|
|||
public:
|
||||
mt_rng();
|
||||
explicit mt_rng(const config& cfg);
|
||||
explicit mt_rng(boost::uint32_t seed);
|
||||
explicit mt_rng(uint32_t seed);
|
||||
/** Get a new random number. */
|
||||
uint32_t get_next_random();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#else
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
/***** ***** ***** ***** types ***** ***** ***** *****/
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <deque>
|
||||
#include "utils/functional.hpp"
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/version.hpp>
|
||||
#include "log.hpp"
|
||||
#include "network_asio.hpp"
|
||||
|
@ -94,7 +94,7 @@ void connection::handle_connect(
|
|||
|
||||
void connection::handshake()
|
||||
{
|
||||
static const boost::uint32_t handshake = 0;
|
||||
static const uint32_t handshake = 0;
|
||||
boost::asio::async_write(socket_,
|
||||
boost::asio::buffer(reinterpret_cast<const char*>(&handshake), 4),
|
||||
std::bind(&connection::handle_write, this, _1, _2)
|
||||
|
@ -188,7 +188,7 @@ std::size_t connection::is_read_complete(
|
|||
} else {
|
||||
if(!bytes_to_read_) {
|
||||
std::istream is(&read_buf_);
|
||||
union { char binary[4]; boost::uint32_t num; } data_size;
|
||||
union { char binary[4]; uint32_t num; } data_size;
|
||||
is.read(data_size.binary, 4);
|
||||
bytes_to_read_ = ntohl(data_size.num) + 4;
|
||||
//Close immediately if we receive an invalid length
|
||||
|
|
|
@ -72,7 +72,7 @@ class connection
|
|||
);
|
||||
union {
|
||||
char binary[4];
|
||||
boost::uint32_t num;
|
||||
uint32_t num;
|
||||
} handshake_response_;
|
||||
|
||||
std::size_t is_write_complete(
|
||||
|
@ -92,7 +92,7 @@ class connection
|
|||
std::size_t bytes_transferred,
|
||||
config& response
|
||||
);
|
||||
boost::uint32_t payload_size_;
|
||||
uint32_t payload_size_;
|
||||
std::size_t bytes_to_write_;
|
||||
std::size_t bytes_written_;
|
||||
std::size_t bytes_to_read_;
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#define RANDOM_NEW_H_INCLUDED
|
||||
|
||||
#include <cstdlib> //needed for RAND_MAX
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
using boost::uint32_t;
|
||||
#include <cstdint>
|
||||
|
||||
namespace random_new
|
||||
{
|
||||
|
|
|
@ -767,7 +767,7 @@ lua_kernel_base*& lua_kernel_base::get_lua_kernel_base_ptr(lua_State *L)
|
|||
return *reinterpret_cast<lua_kernel_base**>(reinterpret_cast<char*>(L) - LUA_KERNEL_BASE_OFFSET);
|
||||
}
|
||||
|
||||
boost::uint32_t lua_kernel_base::get_random_seed()
|
||||
uint32_t lua_kernel_base::get_random_seed()
|
||||
{
|
||||
return seed_rng::next_seed();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "utils/functional.hpp"
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
struct lua_State;
|
||||
class CVideo;
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
return *static_cast<T*>(get_lua_kernel_base_ptr(L));
|
||||
}
|
||||
|
||||
virtual boost::uint32_t get_random_seed();
|
||||
virtual uint32_t get_random_seed();
|
||||
lua_State * get_state() { return mState; }
|
||||
protected:
|
||||
lua_State *mState;
|
||||
|
|
|
@ -36,7 +36,7 @@ static const char * Rng = "Rng";
|
|||
|
||||
int impl_rng_create(lua_State* L)
|
||||
{
|
||||
boost::uint32_t seed = lua_kernel_base::get_lua_kernel<lua_kernel_base>(L).get_random_seed();
|
||||
uint32_t seed = lua_kernel_base::get_lua_kernel<lua_kernel_base>(L).get_random_seed();
|
||||
new ( lua_newuserdata(L, sizeof(mt_rng)) ) mt_rng(seed);
|
||||
luaL_setmetatable(L, Rng);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ void mapgen_lua_kernel::user_config(const char * prog, const config & generator)
|
|||
run_generator(prog, generator);
|
||||
}
|
||||
|
||||
std::string mapgen_lua_kernel::create_map(const char * prog, const config & generator, boost::optional<boost::uint32_t> seed) // throws game::lua_error
|
||||
std::string mapgen_lua_kernel::create_map(const char * prog, const config & generator, boost::optional<uint32_t> seed) // throws game::lua_error
|
||||
{
|
||||
random_seed_ = seed;
|
||||
run_generator(prog, generator);
|
||||
|
@ -166,7 +166,7 @@ std::string mapgen_lua_kernel::create_map(const char * prog, const config & gene
|
|||
return lua_tostring(mState, -1);
|
||||
}
|
||||
|
||||
config mapgen_lua_kernel::create_scenario(const char * prog, const config & generator, boost::optional<boost::uint32_t> seed) // throws game::lua_error
|
||||
config mapgen_lua_kernel::create_scenario(const char * prog, const config & generator, boost::optional<uint32_t> seed) // throws game::lua_error
|
||||
{
|
||||
random_seed_ = seed;
|
||||
run_generator(prog, generator);
|
||||
|
@ -185,9 +185,9 @@ config mapgen_lua_kernel::create_scenario(const char * prog, const config & gene
|
|||
}
|
||||
return result;
|
||||
}
|
||||
boost::uint32_t mapgen_lua_kernel::get_random_seed()
|
||||
uint32_t mapgen_lua_kernel::get_random_seed()
|
||||
{
|
||||
if(boost::uint32_t* pint = random_seed_.get_ptr()) {
|
||||
if(uint32_t* pint = random_seed_.get_ptr()) {
|
||||
return (*pint)++;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "scripting/lua_kernel_base.hpp"
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
|
||||
class config;
|
||||
|
@ -31,14 +31,14 @@ public:
|
|||
virtual std::string my_name() { return "Mapgen Lua Kernel"; }
|
||||
|
||||
void user_config(const char * prog, const config & generator); // throws game::lua_error
|
||||
std::string create_map(const char * prog, const config & generator, boost::optional<boost::uint32_t> seed); // throws game::lua_error
|
||||
config create_scenario(const char * prog, const config & generator, boost::optional<boost::uint32_t> seed); // throws game::lua_error
|
||||
std::string create_map(const char * prog, const config & generator, boost::optional<uint32_t> seed); // throws game::lua_error
|
||||
config create_scenario(const char * prog, const config & generator, boost::optional<uint32_t> seed); // throws game::lua_error
|
||||
|
||||
virtual boost::uint32_t get_random_seed();
|
||||
virtual uint32_t get_random_seed();
|
||||
boost::mt19937& get_default_rng();
|
||||
private:
|
||||
void run_generator(const char * prog, const config & generator);
|
||||
boost::optional<boost::uint32_t> random_seed_;
|
||||
boost::optional<uint32_t> random_seed_;
|
||||
boost::optional<boost::mt19937> default_rng_;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,11 +22,9 @@
|
|||
anywhere except for default constructors of prg classes, or similar.
|
||||
*/
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
using boost::uint32_t;
|
||||
|
||||
#ifndef SEED_RNG_HPP_INCLUDED
|
||||
#define SEED_RNG_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <exception>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ucs4 {
|
||||
typedef boost::uint32_t char_t;
|
||||
typedef uint32_t char_t;
|
||||
typedef std::vector<char_t> string;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,13 +131,13 @@ struct handle_doc
|
|||
socket_ptr socket;
|
||||
union DataSize
|
||||
{
|
||||
boost::uint32_t size;
|
||||
uint32_t size;
|
||||
char buf[4];
|
||||
};
|
||||
std::shared_ptr<DataSize> data_size;
|
||||
std::shared_ptr<simple_wml::document> doc;
|
||||
boost::shared_array<char> buffer;
|
||||
handle_doc(socket_ptr socket, Handler handler, ErrorHandler error_handler, boost::uint32_t size, std::shared_ptr<simple_wml::document> doc) :
|
||||
handle_doc(socket_ptr socket, Handler handler, ErrorHandler error_handler, uint32_t size, std::shared_ptr<simple_wml::document> doc) :
|
||||
handler(handler), error_handler(error_handler), socket(socket), data_size(new DataSize), doc(doc)
|
||||
{
|
||||
data_size->size = htonl(size);
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
void accept_connection(const boost::system::error_code& error, socket_ptr socket);
|
||||
|
||||
union {
|
||||
boost::uint32_t connection_num;
|
||||
uint32_t connection_num;
|
||||
char buf[4];
|
||||
} handshake_response_;
|
||||
void serverside_handshake(socket_ptr socket);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "util.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE( util )
|
||||
|
||||
|
@ -78,15 +78,15 @@ BOOST_AUTO_TEST_CASE( test_lexical_cast_default )
|
|||
|
||||
BOOST_AUTO_TEST_CASE( test_bit_width )
|
||||
{
|
||||
BOOST_CHECK( bit_width<boost::uint8_t>() == 8 );
|
||||
BOOST_CHECK( bit_width<boost::uint16_t>() == 16 );
|
||||
BOOST_CHECK( bit_width<boost::uint32_t>() == 32 );
|
||||
BOOST_CHECK( bit_width<boost::uint64_t>() == 64 );
|
||||
BOOST_CHECK( bit_width<uint8_t>() == 8 );
|
||||
BOOST_CHECK( bit_width<uint16_t>() == 16 );
|
||||
BOOST_CHECK( bit_width<uint32_t>() == 32 );
|
||||
BOOST_CHECK( bit_width<uint64_t>() == 64 );
|
||||
|
||||
BOOST_CHECK( bit_width(static_cast<boost::uint8_t>(0)) == 8 );
|
||||
BOOST_CHECK( bit_width(static_cast<boost::uint16_t>(0)) == 16 );
|
||||
BOOST_CHECK( bit_width(static_cast<boost::uint32_t>(0)) == 32 );
|
||||
BOOST_CHECK( bit_width(static_cast<boost::uint64_t>(0)) == 64 );
|
||||
BOOST_CHECK( bit_width(static_cast<uint8_t>(0)) == 8 );
|
||||
BOOST_CHECK( bit_width(static_cast<uint16_t>(0)) == 16 );
|
||||
BOOST_CHECK( bit_width(static_cast<uint32_t>(0)) == 32 );
|
||||
BOOST_CHECK( bit_width(static_cast<uint64_t>(0)) == 64 );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_count_ones )
|
||||
|
@ -106,11 +106,11 @@ BOOST_AUTO_TEST_CASE( test_count_ones )
|
|||
|
||||
BOOST_AUTO_TEST_CASE( test_count_leading_zeros )
|
||||
{
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<boost::uint8_t>(1)) == 7 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<boost::uint16_t>(1)) == 15 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<boost::uint32_t>(1)) == 31 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<boost::uint64_t>(1)) == 63 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<boost::uint8_t>(0xFF)) == 0 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<uint8_t>(1)) == 7 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<uint16_t>(1)) == 15 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<uint32_t>(1)) == 31 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<uint64_t>(1)) == 63 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<uint8_t>(0xFF)) == 0 );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<unsigned int>(0))
|
||||
== bit_width<unsigned int>() );
|
||||
BOOST_CHECK( count_leading_zeros(static_cast<unsigned long int>(0))
|
||||
|
@ -131,13 +131,13 @@ BOOST_AUTO_TEST_CASE( test_count_leading_ones )
|
|||
{
|
||||
BOOST_CHECK( count_leading_ones(0) == 0 );
|
||||
BOOST_CHECK( count_leading_ones(1) == 0 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<boost::uint8_t>(0xFF)) == 8 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<boost::uint16_t>(0xFFFF)) == 16 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<boost::uint32_t>(0xFFFFFFFF)) == 32 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<boost::uint64_t>(0xFFFFFFFFFFFFFFFF))
|
||||
BOOST_CHECK( count_leading_ones(static_cast<uint8_t>(0xFF)) == 8 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<uint16_t>(0xFFFF)) == 16 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<uint32_t>(0xFFFFFFFF)) == 32 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<uint64_t>(0xFFFFFFFFFFFFFFFF))
|
||||
== 64 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<boost::uint8_t>(0xF8)) == 5 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<boost::uint16_t>(54321)) == 2 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<uint8_t>(0xF8)) == 5 );
|
||||
BOOST_CHECK( count_leading_ones(static_cast<uint16_t>(54321)) == 2 );
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4: */
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
#define ERR_G LOG_STREAM(err, lg::general())
|
||||
|
||||
boost::uint32_t threading::thread::get_id() { return SDL_GetThreadID(thread_); }
|
||||
uint32_t threading::thread::get_id() { return SDL_GetThreadID(thread_); }
|
||||
|
||||
boost::uint32_t threading::get_current_thread_id() { return SDL_ThreadID(); }
|
||||
uint32_t threading::get_current_thread_id() { return SDL_ThreadID(); }
|
||||
|
||||
static int run_async_operation(void* data)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
struct SDL_Thread;
|
||||
|
@ -68,13 +68,13 @@ public:
|
|||
|
||||
void detach();
|
||||
|
||||
boost::uint32_t get_id();
|
||||
uint32_t get_id();
|
||||
private:
|
||||
|
||||
SDL_Thread* thread_;
|
||||
};
|
||||
|
||||
boost::uint32_t get_current_thread_id();
|
||||
uint32_t get_current_thread_id();
|
||||
// Binary mutexes.
|
||||
//
|
||||
// Implements an interface to binary mutexes. This class only defines the
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <deque>
|
||||
#include "utils/functional.hpp"
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/version.hpp>
|
||||
#include "log.hpp"
|
||||
#include "wesnothd_connection.hpp"
|
||||
|
@ -91,7 +91,7 @@ void twesnothd_connection::handle_connect(
|
|||
|
||||
void twesnothd_connection::handshake()
|
||||
{
|
||||
static const boost::uint32_t handshake = 0;
|
||||
static const uint32_t handshake = 0;
|
||||
boost::asio::async_write(socket_,
|
||||
boost::asio::buffer(reinterpret_cast<const char*>(&handshake), 4),
|
||||
[](const error_code& ec, std::size_t) { if (ec) throw system_error(ec); }
|
||||
|
@ -171,7 +171,7 @@ std::size_t twesnothd_connection::is_read_complete(
|
|||
} else {
|
||||
if(!bytes_to_read_) {
|
||||
std::istream is(&read_buf_);
|
||||
union { char binary[4]; boost::uint32_t num; } data_size;
|
||||
union { char binary[4]; uint32_t num; } data_size;
|
||||
is.read(data_size.binary, 4);
|
||||
bytes_to_read_ = ntohl(data_size.num) + 4;
|
||||
//Close immediately if we receive an invalid length
|
||||
|
|
|
@ -119,7 +119,7 @@ private:
|
|||
);
|
||||
union {
|
||||
char binary[4];
|
||||
boost::uint32_t num;
|
||||
uint32_t num;
|
||||
} handshake_response_;
|
||||
|
||||
std::size_t is_write_complete(const boost::system::error_code& error, std::size_t bytes_transferred);
|
||||
|
@ -133,7 +133,7 @@ private:
|
|||
std::list<boost::asio::streambuf> send_queue_;
|
||||
std::list<config> recv_queue_;
|
||||
|
||||
boost::uint32_t payload_size_;
|
||||
uint32_t payload_size_;
|
||||
std::size_t bytes_to_write_;
|
||||
std::size_t bytes_written_;
|
||||
std::size_t bytes_to_read_;
|
||||
|
|
|
@ -39,11 +39,7 @@
|
|||
#define XBRZ_HEADER_3847894708239054
|
||||
|
||||
#include <cstddef> //size_t
|
||||
//#include <cstdint> //uint32_t
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
typedef boost::uint32_t uint32_t;
|
||||
|
||||
#include <cstdint> //uint32_t
|
||||
#include <limits>
|
||||
#include "config.hpp"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue