Jelajahi Sumber

Removed static_cast<int64>()s where they are unnecessary

Tatsuhiro Tsujikawa 13 tahun lalu
induk
melakukan
16d395779a

+ 1 - 1
src/DefaultBtProgressInfoFile.cc

@@ -277,7 +277,7 @@ void DefaultBtProgressInfoFile::load()
   if(totalLength != static_cast<uint64_t>(dctx_->getTotalLength())) {
     throw DL_ABORT_EX
       (fmt("total length mismatch. expected: %" PRId64 ", actual: %" PRId64 "",
-           static_cast<int64_t>(dctx_->getTotalLength()),
+           dctx_->getTotalLength(),
            static_cast<int64_t>(totalLength)));
   }
   uint64_t uploadLength;

+ 1 - 1
src/DownloadCommand.cc

@@ -361,7 +361,7 @@ void DownloadCommand::validatePieceHash(const SharedHandle<Segment>& segment,
   } else {
     A2_LOG_INFO(fmt(EX_INVALID_CHUNK_CHECKSUM,
                     static_cast<unsigned long>(segment->getIndex()),
-                    static_cast<int64_t>(segment->getPosition()),
+                    segment->getPosition(),
                     util::toHex(expectedHash).c_str(),
                     util::toHex(actualHash).c_str()));
     segment->clear();

+ 1 - 1
src/FileAllocationCommand.cc

@@ -71,7 +71,7 @@ bool FileAllocationCommand::executeInternal()
     A2_LOG_DEBUG
       (fmt(MSG_ALLOCATION_COMPLETED,
            static_cast<long int>(timer_.difference(global::wallclock())),
-           static_cast<int64_t>(getRequestGroup()->getTotalLength())));
+           getRequestGroup()->getTotalLength()));
     getDownloadEngine()->getFileAllocationMan()->dropPickedEntry();
     
     std::vector<Command*>* commands = new std::vector<Command*>();

+ 1 - 2
src/FtpConnection.cc

@@ -256,8 +256,7 @@ bool FtpConnection::sendRest(const SharedHandle<Segment>& segment)
     std::string request =
       fmt("REST %" PRId64 "\r\n",
           segment ?
-          static_cast<int64_t>(segment->getPositionToWrite()) :
-          static_cast<int64_t>(0LL));
+          segment->getPositionToWrite() : static_cast<int64_t>(0LL));
     A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
                     cuid_, request.c_str()));
     socketBuffer_.pushStr(request);

+ 1 - 2
src/HttpRequest.cc

@@ -193,8 +193,7 @@ std::string HttpRequest::createRequest()
   }
   if(segment_ && segment_->getLength() > 0 && 
      (request_->isPipeliningEnabled() || getStartByte() > 0)) {
-    std::string rangeHeader(fmt("bytes=%" PRId64 "-",
-                                static_cast<int64_t>(getStartByte())));
+    std::string rangeHeader(fmt("bytes=%" PRId64 "-", getStartByte()));
     if(request_->isPipeliningEnabled()) {
       rangeHeader += util::itos(getEndByte());
     } else if(getProtocol() != Request::PROTO_FTP && endOffsetOverride_ > 0) {

+ 6 - 6
src/HttpResponse.cc

@@ -100,12 +100,12 @@ void HttpResponse::validateResponse() const
       if(!httpRequest_->isRangeSatisfied(responseRange)) {
         throw DL_ABORT_EX2
           (fmt(EX_INVALID_RANGE_HEADER,
-               static_cast<int64_t>(httpRequest_->getStartByte()),
-               static_cast<int64_t>(httpRequest_->getEndByte()),
-               static_cast<int64_t>(httpRequest_->getEntityLength()),
-               static_cast<int64_t>(responseRange->getStartByte()),
-               static_cast<int64_t>(responseRange->getEndByte()),
-               static_cast<int64_t>(responseRange->getEntityLength())),
+               httpRequest_->getStartByte(),
+               httpRequest_->getEndByte(),
+               httpRequest_->getEntityLength(),
+               responseRange->getStartByte(),
+               responseRange->getEndByte(),
+               responseRange->getEntityLength()),
            error_code::CANNOT_RESUME);
       }
     }

+ 1 - 1
src/HttpServerCommand.cc

@@ -219,7 +219,7 @@ bool HttpServerCommand::execute()
             (fmt("Request too long. ContentLength=%" PRId64 "."
                  " See --rpc-max-request-size option to loose"
                  " this limitation.",
-                 static_cast<int64_t>(httpServer_->getContentLength())));
+                 httpServer_->getContentLength()));
           return true;
         }
         Command* command = new HttpServerBodyCommand(getCuid(), httpServer_, e_,

+ 1 - 2
src/MultiDiskAdaptor.cc

@@ -199,8 +199,7 @@ void MultiDiskAdaptor::resetDiskWriterEntries()
           A2_LOG_DEBUG
             (fmt("file=%s, offset=%" PRId64 "",
                  (*itr)->getFileEntry()->getPath().c_str(),
-                 static_cast<int64_t>
-                 ((*itr)->getFileEntry()->getOffset())));
+                 (*itr)->getFileEntry()->getOffset()));
           if((*itr)->getFileEntry()->getOffset() <
              static_cast<off_t>(lastPieceStartOffset+pieceLength_)) {
             A2_LOG_DEBUG

+ 3 - 5
src/RequestGroup.cc

@@ -397,8 +397,8 @@ void RequestGroup::createInitialCommand
           A2_LOG_DEBUG
             (fmt("File size not match. File is opened in writable"
                  " mode. Expected:%" PRId64 " Actual:%" PRId64 "",
-                 static_cast<int64_t>(downloadContext_->getTotalLength()),
-                 static_cast<int64_t>(actualFileSize)));
+                 downloadContext_->getTotalLength(),
+                 actualFileSize));
         }
       }
       // Call Load, Save and file allocation command here
@@ -905,9 +905,7 @@ void RequestGroup::validateTotalLength(int64_t expectedTotalLength,
   }
   if(expectedTotalLength != actualTotalLength) {
     throw DL_ABORT_EX
-      (fmt(EX_SIZE_MISMATCH,
-           static_cast<int64_t>(expectedTotalLength),
-           static_cast<int64_t>(actualTotalLength)));
+      (fmt(EX_SIZE_MISMATCH, expectedTotalLength, actualTotalLength));
   }
 }
 

+ 4 - 3
src/SegmentMan.cc

@@ -468,10 +468,11 @@ size_t SegmentMan::countFreePieceFrom(size_t index) const
 
 void SegmentMan::ignoreSegmentFor(const SharedHandle<FileEntry>& fileEntry)
 {
-  A2_LOG_DEBUG(fmt("ignoring segment for path=%s, offset=%" PRId64 ", length=%" PRId64 "",
+  A2_LOG_DEBUG(fmt("ignoring segment for path=%s, offset=%" PRId64
+                   ", length=%" PRId64 "",
                    fileEntry->getPath().c_str(),
-                   static_cast<int64_t>(fileEntry->getOffset()),
-                   static_cast<int64_t>(fileEntry->getLength())));
+                   fileEntry->getOffset(),
+                   fileEntry->getLength()));
   ignoreBitfield_.addFilter(fileEntry->getOffset(), fileEntry->getLength());
 }