merged SetFileValidData fix from RC_0_16

This commit is contained in:
Arvid Norberg 2014-02-23 19:13:53 +00:00
parent a943fec777
commit bfdb445890
3 changed files with 11 additions and 2 deletions

View File

@ -41,6 +41,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* SetFileValidData fix on windows (prevents zero-fill)
* fix minor lock_files issue on unix
0.16.15 release

View File

@ -322,6 +322,8 @@ namespace libtorrent
#endif
#if defined TORRENT_WINDOWS
mutable int m_cluster_size;
static bool has_manage_volume_privs;
#endif
};

View File

@ -946,6 +946,14 @@ namespace libtorrent
};
#endif // TORRENT_WINDOWS
#ifdef TORRENT_WINDOWS
bool get_manage_volume_privs();
// this needs to be run before CreateFile
bool file::has_manage_volume_privs = get_manage_volume_privs();
#endif
file::file()
#ifdef TORRENT_WINDOWS
: m_file_handle(INVALID_HANDLE_VALUE)
@ -2025,8 +2033,6 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
void set_file_valid_data(HANDLE f, boost::int64_t size)
{
static bool has_privs = get_manage_volume_privs();
typedef BOOL (WINAPI *SetFileValidData_t)(HANDLE, LONGLONG);
static SetFileValidData_t pSetFileValidData = NULL;
static bool failed_kernel32 = false;