Browse Source

fixes to compile and run under OSX 10.9.1

miguelfreitas
toyg 11 years ago
parent
commit
83dcd048bb
  1. 7
      src/net.cpp
  2. 7
      src/netbase.cpp
  3. 2
      src/rpcdump.cpp
  4. 13
      src/serialize.h
  5. 12
      src/twister.cpp
  6. 4
      src/twister_utils.cpp

7
src/net.cpp

@ -22,6 +22,13 @@ @@ -22,6 +22,13 @@
#include <miniupnpc/upnperrors.h>
#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

7
src/netbase.cpp

@ -15,6 +15,13 @@ @@ -15,6 +15,13 @@
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/predicate.hpp> // 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

2
src/rpcdump.cpp

@ -28,7 +28,7 @@ std::string static EncodeDumpTime(int64 nTime) { @@ -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);

13
src/serialize.h

@ -895,19 +895,6 @@ public: @@ -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<char>::const_iterator first, std::vector<char>::const_iterator last)
{
assert(last - first >= 0);

12
src/twister.cpp

@ -88,7 +88,7 @@ torrent_handle startTorrentUser(std::string const &username) @@ -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) @@ -156,7 +156,7 @@ int loadGlobalData(std::string const& filename)
std::vector<char> 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() @@ -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 @@ -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 ) @@ -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) @@ -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);

4
src/twister_utils.cpp

@ -68,7 +68,7 @@ int save_file(std::string const& filename, std::vector<char>& v) @@ -68,7 +68,7 @@ int save_file(std::string const& filename, std::vector<char>& 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<std::string,UserData> &us @@ -180,7 +180,7 @@ int loadUserData(std::string const& filename, std::map<std::string,UserData> &us
std::vector<char> 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;

Loading…
Cancel
Save