forked from premiere/premiere-libtorrent
fix windows and linux build
This commit is contained in:
parent
58aa4e5ae7
commit
6c67694d22
|
@ -233,8 +233,9 @@ struct bdecode_token
|
||||||
// There are 5 different types of nodes, see type_t.
|
// There are 5 different types of nodes, see type_t.
|
||||||
struct TORRENT_EXPORT bdecode_node
|
struct TORRENT_EXPORT bdecode_node
|
||||||
{
|
{
|
||||||
friend int bdecode(char const* start, char const* end, bdecode_node& ret
|
TORRENT_EXPORT friend int bdecode(char const* start, char const* end, bdecode_node& ret
|
||||||
, error_code& ec, int* error_pos, int depth_limit, int token_limit);
|
, error_code& ec, int* error_pos, int depth_limit
|
||||||
|
, int token_limit);
|
||||||
|
|
||||||
// creates a default constructed node, it will have the type ``none_t``.
|
// creates a default constructed node, it will have the type ``none_t``.
|
||||||
bdecode_node();
|
bdecode_node();
|
||||||
|
|
|
@ -61,6 +61,9 @@ namespace libtorrent
|
||||||
typedef boost::asio::detail::mutex mutex;
|
typedef boost::asio::detail::mutex mutex;
|
||||||
typedef boost::asio::detail::event event;
|
typedef boost::asio::detail::event event;
|
||||||
|
|
||||||
|
// internal
|
||||||
|
void sleep(int milliseconds);
|
||||||
|
|
||||||
struct TORRENT_EXTRA_EXPORT condition_variable
|
struct TORRENT_EXTRA_EXPORT condition_variable
|
||||||
{
|
{
|
||||||
condition_variable();
|
condition_variable();
|
||||||
|
|
|
@ -34,8 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/string_util.hpp"
|
#include "libtorrent/string_util.hpp"
|
||||||
#include "libtorrent/random.hpp"
|
#include "libtorrent/random.hpp"
|
||||||
|
|
||||||
#include <stdlib.h> // for malloc/free
|
#include <cstdlib> // for malloc
|
||||||
#include <string.h> // for strcpy/strlen
|
#include <cstring> // for memmov/strcpy/strlen
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
@ -138,9 +138,9 @@ namespace libtorrent
|
||||||
char* allocate_string_copy(char const* str)
|
char* allocate_string_copy(char const* str)
|
||||||
{
|
{
|
||||||
if (str == 0) return 0;
|
if (str == 0) return 0;
|
||||||
char* tmp = (char*)malloc(strlen(str) + 1);
|
char* tmp = (char*)std::malloc(std::strlen(str) + 1);
|
||||||
if (tmp == 0) return 0;
|
if (tmp == 0) return 0;
|
||||||
strcpy(tmp, str);
|
std::strcpy(tmp, str);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void sleep(int milliseconds)
|
||||||
|
{
|
||||||
|
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
|
||||||
|
Sleep(milliseconds);
|
||||||
|
#elif defined TORRENT_BEOS
|
||||||
|
snooze_until(system_time() + boost::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE);
|
||||||
|
#else
|
||||||
|
usleep(milliseconds * 1000);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef BOOST_HAS_PTHREADS
|
#ifdef BOOST_HAS_PTHREADS
|
||||||
|
|
||||||
condition_variable::condition_variable()
|
condition_variable::condition_variable()
|
||||||
|
|
Loading…
Reference in New Issue