mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 03:55:43 +00:00
lt sync 3187
This commit is contained in:
parent
7c349b1fa9
commit
40ba6ea2ba
@ -37,5 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#define LIBTORRENT_VERSION_MINOR 14
|
||||
|
||||
#define LIBTORRENT_VERSION "0.14.2.0"
|
||||
#define LIBTORRENT_REVISION "$Rev: 3169 $"
|
||||
|
||||
#endif
|
||||
|
@ -86,6 +86,7 @@ std::string demangle(char const* name)
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include "libtorrent/version.hpp"
|
||||
|
||||
// execinfo.h is available in the MacOS X 10.5 SDK.
|
||||
#if (defined __linux__ || (defined __APPLE__ && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050))
|
||||
@ -117,10 +118,12 @@ void assert_fail(char const* expr, int line, char const* file, char const* funct
|
||||
fprintf(stderr, "assertion failed. Please file a bugreport at "
|
||||
"http://code.rasterbar.com/libtorrent/newticket\n"
|
||||
"Please include the following information:\n\n"
|
||||
"version: " LIBTORRENT_VERSION "\n"
|
||||
"%s\n"
|
||||
"file: '%s'\n"
|
||||
"line: %d\n"
|
||||
"function: %s\n"
|
||||
"expression: %s\n", file, line, function, expr);
|
||||
"expression: %s\n", LIBTORRENT_REVISION, file, line, function, expr);
|
||||
|
||||
print_backtrace("stack:");
|
||||
|
||||
|
@ -53,9 +53,14 @@ namespace
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
bool is_digit(char c)
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
int decode_digit(char c)
|
||||
{
|
||||
if (std::isdigit(c)) return c - '0';
|
||||
if (is_digit(c)) return c - '0';
|
||||
return unsigned(c) - 'A' + 10;
|
||||
}
|
||||
|
||||
|
@ -970,15 +970,26 @@ namespace libtorrent
|
||||
|
||||
int actual_read = int(in->read(buf + buf_pos, read_bytes, ec));
|
||||
|
||||
if (read_bytes != actual_read || ec)
|
||||
if (ec)
|
||||
{
|
||||
set_error(m_save_path / file_iter->path, ec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (read_bytes != actual_read)
|
||||
{
|
||||
// the file was not big enough
|
||||
if (actual_read > 0) buf_pos += actual_read;
|
||||
if (!fill_zero)
|
||||
{
|
||||
#ifdef TORRENT_WINDOWS
|
||||
ec = error_code(ERROR_READ_FAULT, get_system_category());
|
||||
#else
|
||||
ec = error_code(EIO, get_posix_category());
|
||||
#endif
|
||||
set_error(m_save_path / file_iter->path, ec);
|
||||
return -1;
|
||||
}
|
||||
if (actual_read > 0) buf_pos += actual_read;
|
||||
std::memset(buf + buf_pos, 0, size - buf_pos);
|
||||
return size;
|
||||
}
|
||||
@ -1111,12 +1122,24 @@ namespace libtorrent
|
||||
error_code ec;
|
||||
size_type written = out->write(buf + buf_pos, write_bytes, ec);
|
||||
|
||||
if (written != write_bytes || ec)
|
||||
if (ec)
|
||||
{
|
||||
set_error(m_save_path / file_iter->path, ec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (write_bytes != written)
|
||||
{
|
||||
// the file was not big enough
|
||||
#ifdef TORRENT_WINDOWS
|
||||
ec = error_code(ERROR_READ_FAULT, get_system_category());
|
||||
#else
|
||||
ec = error_code(EIO, get_posix_category());
|
||||
#endif
|
||||
set_error(m_save_path / file_iter->path, ec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
left_to_write -= write_bytes;
|
||||
buf_pos += write_bytes;
|
||||
TORRENT_ASSERT(buf_pos >= 0);
|
||||
|
@ -1174,7 +1174,7 @@ namespace libtorrent
|
||||
const std::vector<piece_picker::downloading_piece>& dl_queue
|
||||
= m_picker->get_download_queue();
|
||||
|
||||
const int blocks_per_piece = piece_size / m_block_size;
|
||||
const int blocks_per_piece = (piece_size + m_block_size - 1) / m_block_size;
|
||||
|
||||
for (std::vector<piece_picker::downloading_piece>::const_iterator i =
|
||||
dl_queue.begin(); i != dl_queue.end(); ++i)
|
||||
|
Loading…
x
Reference in New Issue
Block a user