From 6ef72a14a29e497d0039a23d622b9a7875eaa3c7 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 12 Oct 2008 16:09:12 +0000 Subject: [PATCH] 2008-10-13 Tatsuhiro Tsujikawa Fixed compile warning on linux-amd64 * src/FtpConnection.cc * src/IteratableChunkChecksumValidator.cc * src/MultiDiskAdaptor.cc Fixed the bug that unit test fails on linux-amd64 * test/UtilTest.cc --- ChangeLog | 10 ++++++++++ src/FtpConnection.cc | 3 ++- src/IteratableChunkChecksumValidator.cc | 2 +- src/MultiDiskAdaptor.cc | 3 ++- test/UtilTest.cc | 9 +++++++-- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49a4378d..8d5a7854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-10-13 Tatsuhiro Tsujikawa + + Fixed compile warning on linux-amd64 + * src/FtpConnection.cc + * src/IteratableChunkChecksumValidator.cc + * src/MultiDiskAdaptor.cc + + Fixed the bug that unit test fails on linux-amd64 + * test/UtilTest.cc + 2008-10-10 Tatsuhiro Tsujikawa Added --dht-file-path option to change the path to dht.dat, which is a diff --git a/src/FtpConnection.cc b/src/FtpConnection.cc index e05e07ce..fef343e4 100644 --- a/src/FtpConnection.cc +++ b/src/FtpConnection.cc @@ -347,7 +347,8 @@ unsigned int FtpConnection::receiveSizeResponse(uint64_t& size) std::pair response; if(bulkReceiveResponse(response)) { if(response.first == 213) { - sscanf(response.second.c_str(), "%*u " LONGLONG_SCANF, &size); + sscanf(response.second.c_str(), "%*u " ULONGLONG_SCANF, + reinterpret_cast(&size)); } return response.first; } else { diff --git a/src/IteratableChunkChecksumValidator.cc b/src/IteratableChunkChecksumValidator.cc index 00429479..f6420f34 100644 --- a/src/IteratableChunkChecksumValidator.cc +++ b/src/IteratableChunkChecksumValidator.cc @@ -155,7 +155,7 @@ std::string IteratableChunkChecksumValidator::digest(off_t offset, size_t length strerror(errno)).str()); } size_t wlength; - if(max < curoffset+r) { + if(max < static_cast(curoffset+r)) { wlength = max-curoffset-woffset; } else { wlength = r-woffset; diff --git a/src/MultiDiskAdaptor.cc b/src/MultiDiskAdaptor.cc index 7edad19a..ad5657af 100644 --- a/src/MultiDiskAdaptor.cc +++ b/src/MultiDiskAdaptor.cc @@ -222,7 +222,8 @@ void MultiDiskAdaptor::resetDiskWriterEntries() ++itr; for(; itr != diskWriterEntries.end(); ++itr) { - if((*itr)->getFileEntry()->getOffset() < pieceStartOffset+pieceLength) { + if((*itr)->getFileEntry()->getOffset() < + static_cast(pieceStartOffset+pieceLength)) { (*itr)->needsFileAllocation(true); } else { break; diff --git a/test/UtilTest.cc b/test/UtilTest.cc index 95f9d6d7..d1019748 100644 --- a/test/UtilTest.cc +++ b/test/UtilTest.cc @@ -677,8 +677,13 @@ void UtilTest::testHttpGMT() CPPUNIT_ASSERT_EQUAL((time_t)0, Util::httpGMT("Thu, 1970-01-01 0:0:0 GMT")); CPPUNIT_ASSERT_EQUAL((time_t)2147483647, Util::httpGMT("Tue, 2038-01-19 3:14:7 GMT")); - CPPUNIT_ASSERT_EQUAL((time_t)2147483647, - Util::httpGMT("Tue, 2038-01-19 3:14:8 GMT")); + if(sizeof(time_t) == 4) { + CPPUNIT_ASSERT_EQUAL((time_t)2147483647, + Util::httpGMT("Tue, 2038-01-19 3:14:8 GMT")); + } else if(sizeof(time_t) == 8) { + CPPUNIT_ASSERT_EQUAL((time_t)2147483648, + Util::httpGMT("Tue, 2038-01-19 3:14:8 GMT")); + } CPPUNIT_ASSERT_EQUAL((time_t)-1, Util::httpGMT("Tue, 2008/10/10 23:33:33 UTC")); }