diff --git a/src/net.cpp b/src/net.cpp index 19877bc1..2863525a 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -22,6 +22,13 @@ #include #endif +// MSG_NOSIGNAL does not exists on OS X +#if defined(__APPLE__) || defined(__MACH__) +# ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL SO_NOSIGPIPE +# endif +#endif + // Dump addresses to peers.dat every 15 minutes (900s) #define DUMP_ADDRESSES_INTERVAL 900 diff --git a/src/netbase.cpp b/src/netbase.cpp index c1c089b0..8b82a40d 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -15,6 +15,13 @@ #include // for to_lower() #include // for startswith() and endswith() +// MSG_NOSIGNAL does not exists on OS X +#if defined(__APPLE__) || defined(__MACH__) +# ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL SO_NOSIGPIPE +# endif +#endif + using namespace std; // Settings diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index b3693e66..c1cce38d 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -28,7 +28,7 @@ std::string static EncodeDumpTime(int64 nTime) { } int64 static DecodeDumpTime(const std::string &str) { - static const boost::posix_time::time_input_facet facet("%Y-%m-%dT%H:%M:%SZ"); + static boost::posix_time::time_input_facet facet("%Y-%m-%dT%H:%M:%SZ"); static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0); const std::locale loc(std::locale::classic(), &facet); std::istringstream iss(str); diff --git a/src/serialize.h b/src/serialize.h index e3d9939b..eac4e06c 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -895,19 +895,6 @@ public: iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); } void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); } - void insert(iterator it, const_iterator first, const_iterator last) - { - assert(last - first >= 0); - if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos) - { - // special case for inserting at the front when there's room - nReadPos -= (last - first); - memcpy(&vch[nReadPos], &first[0], last - first); - } - else - vch.insert(it, first, last); - } - void insert(iterator it, std::vector::const_iterator first, std::vector::const_iterator last) { assert(last - first >= 0); diff --git a/src/twister.cpp b/src/twister.cpp index 08283a56..8a6d9d66 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -88,7 +88,7 @@ torrent_handle startTorrentUser(std::string const &username) boost::filesystem::path torrentPath = GetDataDir() / "swarm"; tparams.save_path= torrentPath.string(); - error_code ec; + libtorrent::error_code ec; create_directory(tparams.save_path, ec); std::string filename = combine_path(tparams.save_path, to_hex(ih.to_string()) + ".resume"); @@ -156,7 +156,7 @@ int loadGlobalData(std::string const& filename) std::vector in; if (load_file(filename, in) == 0) { lazy_entry userDict; - error_code ec; + libtorrent::error_code ec; if (lazy_bdecode(&in[0], &in[0] + in.size(), userDict, ec) == 0) { if( userDict.type() != lazy_entry::dict_t ) goto data_error; @@ -207,7 +207,7 @@ void ThreadWaitExtIP() MilliSleep(500); } - error_code ec; + libtorrent::error_code ec; int listen_port = GetListenPort() + LIBTORRENT_PORT_OFFSET; std::string bind_to_interface = ""; @@ -833,7 +833,7 @@ bool acceptSignedPost(char const *data, int data_size, std::string username, int lazy_entry v; int pos; - error_code ec; + libtorrent::error_code ec; if (lazy_bdecode(data, data + data_size, v, ec, &pos) == 0) { if( v.type() == lazy_entry::dict_t ) { @@ -1230,7 +1230,7 @@ int findLastPublicPostLocalUser( std::string strUsername ) string const& piece = pieces.front(); lazy_entry v; int pos; - error_code ec; + libtorrent::error_code ec; if (lazy_bdecode(piece.data(), piece.data()+piece.size(), v, ec, &pos) == 0) { lazy_entry const* post = v.dict_find_dict("userpost"); lastk = post->dict_find_int_value("k",-1); @@ -1471,7 +1471,7 @@ Value getposts(const Array& params, bool fHelp) BOOST_FOREACH(string const& piece, pieces) { lazy_entry v; int pos; - error_code ec; + libtorrent::error_code ec; if (lazy_bdecode(piece.data(), piece.data()+piece.size(), v, ec, &pos) == 0) { lazy_entry const* post = v.dict_find_dict("userpost"); int64 time = post->dict_find_int_value("time",-1); diff --git a/src/twister_utils.cpp b/src/twister_utils.cpp index a8c71470..1fe48efd 100644 --- a/src/twister_utils.cpp +++ b/src/twister_utils.cpp @@ -68,7 +68,7 @@ int save_file(std::string const& filename, std::vector& v) // TODO: don't use internal file type here. use fopen() file f; - error_code ec; + libtorrent::error_code ec; if (!f.open(filename, file::write_only, ec)) return -1; if (ec) return -1; file::iovec_t b = {&v[0], v.size()}; @@ -180,7 +180,7 @@ int loadUserData(std::string const& filename, std::map &us std::vector in; if (load_file(filename, in) == 0) { lazy_entry userDict; - error_code ec; + libtorrent::error_code ec; if (lazy_bdecode(&in[0], &in[0] + in.size(), userDict, ec) == 0) { if( userDict.type() != lazy_entry::dict_t ) goto data_error;