merged mingw fix from RC_0_16

This commit is contained in:
Arvid Norberg 2014-02-15 02:45:04 +00:00
parent 68f2e3f1ff
commit 2d5f0dddf7
4 changed files with 14 additions and 13 deletions

View File

@ -262,15 +262,6 @@ POSSIBILITY OF SUCH DAMAGE.
# define TORRENT_USE_UNC_PATHS 1
#endif
// this is necessary to enable 64-bit
// time_t, specifically used for the stat
// struct. Without this, modification times
// returned by stat may be incorrect and
// consistently fail resume data
#ifndef __MINGW_USE_VC2005_COMPAT
# define __MINGW_USE_VC2005_COMPAT
#endif
// ==== WINDOWS ===
#elif defined WIN32
#define TORRENT_WINDOWS

View File

@ -86,9 +86,9 @@ namespace libtorrent
struct file_status
{
size_type file_size;
time_t atime;
time_t mtime;
time_t ctime;
boost::uint64_t atime;
boost::uint64_t mtime;
boost::uint64_t ctime;
enum {
#if defined TORRENT_WINDOWS
fifo = 0x1000, // named pipe (fifo)

View File

@ -37,6 +37,13 @@ POSSIBILITY OF SUCH DAMAGE.
#define _FILE_OFFSET_BITS 64
#define _LARGE_FILES 1
// on mingw this is necessary to enable 64-bit time_t, specifically used for
// the stat struct. Without this, modification times returned by stat may be
// incorrect and consistently fail resume data
#ifndef __MINGW_USE_VC2005_COMPAT
# define __MINGW_USE_VC2005_COMPAT
#endif
#include "libtorrent/pch.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/alloca.hpp"

View File

@ -1591,6 +1591,8 @@ private:
// if ack is true, we need to send a packet regardless of if there's
// any data. Returns true if we could send more data (i.e. call
// send_pkt() again)
// returns true if there is more space for payload in our
// congestion window, false if there is no more space.
bool utp_socket_impl::send_pkt(int flags)
{
INVARIANT_CHECK;
@ -1726,7 +1728,8 @@ bool utp_socket_impl::send_pkt(int flags)
// this alloca() statement won't necessarily produce
// correctly aligned memory. That's why we ask for 7 more bytes
// and adjust our pointer to be aligned later
p = (packet*)TORRENT_ALLOCA(char, sizeof(packet) + packet_size + 7);
p = (packet*)TORRENT_ALLOCA(char, sizeof(packet) + packet_size
+ sizeof(packet*) - 1);
p = (packet*)align_pointer(p);
UTP_LOGV("%8p: allocating %d bytes on the stack\n", this, packet_size);
p->allocated = packet_size;