summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-06-21 20:53:08 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-06-21 20:53:08 +0900
commit1adef4db0ce26d9943a8a7d1a0f266455c1902b7 (patch)
tree24756797adfa9f3aa5d4c80b2182573f7c23ff4c /src
parent318c804504e32b7a0bbdbb35336d2e918000d80a (diff)
Fix compile warning with Mingw64 x86 build
Diffstat (limited to 'src')
-rw-r--r--src/BtPieceMessage.cc2
-rw-r--r--src/HandshakeExtensionMessage.cc2
-rw-r--r--src/bittorrent_helper.cc6
-rw-r--r--src/util.cc3
4 files changed, 7 insertions, 6 deletions
diff --git a/src/BtPieceMessage.cc b/src/BtPieceMessage.cc
index e21321cc..010e31c5 100644
--- a/src/BtPieceMessage.cc
+++ b/src/BtPieceMessage.cc
@@ -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;
diff --git a/src/HandshakeExtensionMessage.cc b/src/HandshakeExtensionMessage.cc
index a1bbf634..f7eddf65 100644
--- a/src/HandshakeExtensionMessage.cc
+++ b/src/HandshakeExtensionMessage.cc
@@ -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;
}
}
diff --git a/src/bittorrent_helper.cc b/src/bittorrent_helper.cc
index 77bbd457..2929aab5 100644
--- a/src/bittorrent_helper.cc
+++ b/src/bittorrent_helper.cc
@@ -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));
diff --git a/src/util.cc b/src/util.cc
index b94be42d..5e42389d 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -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;