瀏覽代碼

2008-10-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	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
Tatsuhiro Tsujikawa 17 年之前
父節點
當前提交
6ef72a14a2
共有 5 個文件被更改,包括 22 次插入5 次删除
  1. 10 0
      ChangeLog
  2. 2 1
      src/FtpConnection.cc
  3. 1 1
      src/IteratableChunkChecksumValidator.cc
  4. 2 1
      src/MultiDiskAdaptor.cc
  5. 7 2
      test/UtilTest.cc

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+2008-10-13  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	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  <tujikawa at rednoah dot com>
 
 	Added --dht-file-path option to change the path to dht.dat, which is a

+ 2 - 1
src/FtpConnection.cc

@@ -347,7 +347,8 @@ unsigned int FtpConnection::receiveSizeResponse(uint64_t& size)
   std::pair<unsigned int, std::string> 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<long long unsigned int*>(&size));
     }
     return response.first;
   } else {

+ 1 - 1
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<off_t>(curoffset+r)) {
       wlength = max-curoffset-woffset;
     } else {
       wlength = r-woffset;

+ 2 - 1
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<off_t>(pieceStartOffset+pieceLength)) {
 	  (*itr)->needsFileAllocation(true);
 	} else {
 	  break;

+ 7 - 2
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"));
 }