fix beos build

This commit is contained in:
Arvid Norberg 2011-07-20 05:14:25 +00:00
parent bd4948064f
commit 1b353ce5af
9 changed files with 50 additions and 10 deletions

View File

@ -100,7 +100,7 @@ rule linking ( properties * )
if <target-os>beos in $(properties)
{
result += <library>netkit ;
result += <library>netkit <library>gcc ;
}
if <target-os>solaris in $(properties)
@ -342,6 +342,7 @@ lib gdi32 : : <name>gdi32 ;
# required for networking on beos
lib netkit : : <name>net <search>/boot/system/lib <link>shared ;
lib gcc : : <name>gcc <link>static ;
# when using iconv
lib libiconv : : <name>iconv <link>shared ;

View File

@ -1877,7 +1877,7 @@ int main(int argc, char* argv[])
, esc("37"), s.distributed_copies, esc("0")
, s.sparse_regions
, esc("32"), add_suffix(s.download_rate, "/s").c_str(), esc("0")
, esc("37"), t.hours(), t.minutes(), t.seconds(), esc("0")
, esc("37"), int(t.hours()), int(t.minutes()), int(t.seconds()), esc("0")
, esc("36"), s.current_tracker.c_str(), esc("0"));
out += str;
++lines_printed;

View File

@ -3,6 +3,7 @@
#include "libtorrent/session.hpp"
#include "libtorrent/bencode.hpp"
#include <signal.h>
#include <stdio.h>
using namespace libtorrent;
@ -65,7 +66,7 @@ int main(int argc, char* argv[])
{
if ((argc == 2 && strcmp(argv[1], "--help") == 0) || argc > 2)
{
std::cerr << "usage: rss_reader [rss-url]\n";
fprintf(stderr, "usage: rss_reader [rss-url]\n");
return 0;
}

View File

@ -182,8 +182,6 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_USE_GETADAPTERSADDRESSES 1
#define TORRENT_HAS_SALEN 0
// windows has its own functions to convert
// apple uses utf-8 as its locale, so no conversion
// is necessary
#ifndef TORRENT_USE_ICONV
#define TORRENT_USE_ICONV 0
#define TORRENT_USE_LOCALE 1

View File

@ -40,6 +40,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h>
#endif
#if defined TORRENT_BEOS
#include <kernel/OS.h>
#endif
#include <memory> // for auto_ptr required by asio
#include <boost/asio/detail/thread.hpp>
@ -67,6 +71,10 @@ namespace libtorrent
HANDLE m_sem;
mutex m_mutex;
int m_num_waiters;
#elif defined TORRENT_BEOS
sem_id m_sem;
mutex m_mutex;
int m_num_waiters;
#else
#error not implemented
#endif

View File

@ -36,6 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cctype>
#include <cstring>
#include "libtorrent/escape_string.hpp"
namespace libtorrent
{
enum

View File

@ -131,10 +131,13 @@ namespace
{
using namespace std;
printf("%s (%d,%d) %x %x %x %x %x\n"
, msg, context->count[0], context->count[1]
, context->state[0], context->state[1]
, context->state[2], context->state[3]
, context->state[4]);
, msg, (unsigned int)context->count[0]
, (unsigned int)context->count[1]
, (unsigned int)context->state[0]
, (unsigned int)context->state[1]
, (unsigned int)context->state[2]
, (unsigned int)context->state[3]
, (unsigned int)context->state[4]);
}
template <class BlkFun>

View File

@ -101,6 +101,33 @@ namespace libtorrent
TORRENT_ASSERT(l.locked());
ReleaseSemaphore(m_sem, m_num_waiters, 0);
}
#elif defined TORRENT_BEOS
condition::condition()
: m_num_waiters(0)
{
m_sem = create_sem(0, 0);
}
condition::~condition()
{
delete_sem(m_sem);
}
void condition::wait(mutex::scoped_lock& l)
{
TORRENT_ASSERT(l.locked());
++m_num_waiters;
l.unlock();
acquire_sem(m_sem);
l.lock();
--m_num_waiters;
}
void condition::signal_all(mutex::scoped_lock& l)
{
TORRENT_ASSERT(l.locked());
release_sem_etc(m_sem, m_num_waiters, 0);
}
#else
#error not implemented
#endif

View File

@ -2670,7 +2670,7 @@ namespace libtorrent
for (std::map<piece_block, int>::iterator i = downloading_piece.begin();
i != downloading_piece.end(); ++i)
{
fprintf(stderr, " %d:%d %d\n", i->first.piece_index, i->first.block_index, i->second);
fprintf(stderr, " %d:%d %d\n", int(i->first.piece_index), int(i->first.block_index), i->second);
}
}