Fix compile warning with Mingw64 x86 build

pull/454/head
Tatsuhiro Tsujikawa 2015-06-21 20:53:08 +09:00
parent 318c804504
commit 1adef4db0c
4 changed files with 7 additions and 6 deletions

View File

@ -213,7 +213,7 @@ void BtPieceMessage::send()
void BtPieceMessage::pushPieceData(int64_t offset, int32_t length) const
{
assert(length <= 16_k);
assert(length <= static_cast<int32_t>(16_k));
auto buf = make_unique<unsigned char[]>(length+MESSAGE_HEADER_LENGTH);
createMessageHeader(buf.get());
ssize_t r;

View File

@ -215,7 +215,7 @@ HandshakeExtensionMessage::create(const unsigned char* data, size_t length)
// Only accept metadata smaller than 1MiB. Be aware that broken
// client can send negative size!
if(size > 0 && size <= 1_m) {
if(size > 0 && size <= static_cast<int64_t>(1_m)) {
msg->metadataSize_ = size;
}
}

View File

@ -792,9 +792,9 @@ void checkBegin(int32_t begin, int32_t pieceLength)
void checkLength(int32_t length)
{
if(length > MAX_BLOCK_LENGTH) {
throw DL_ABORT_EX
(fmt("Length too long: %d > %luKB", length, MAX_BLOCK_LENGTH/1024));
if(length > static_cast<int32_t>(MAX_BLOCK_LENGTH)) {
throw DL_ABORT_EX(fmt("Length too long: %d > %dKB", length,
static_cast<int32_t>(MAX_BLOCK_LENGTH / 1024)));
}
if(length == 0) {
throw DL_ABORT_EX(fmt("Invalid length: %d", length));

View File

@ -1405,7 +1405,8 @@ std::string abbrevSize(int64_t size)
int64_t t = size;
size_t uidx = 0;
int r = 0;
while(t >= 1_k && uidx+1 < sizeof(UNITS)/sizeof(UNITS[0])) {
while(t >= static_cast<int64_t>(1_k) &&
uidx + 1 < sizeof(UNITS) / sizeof(UNITS[0])) {
lldiv_t d = lldiv(t, 1_k);
t = d.quot;
r = d.rem;