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

pull/22/head
Tatsuhiro Tsujikawa 2012-06-25 23:44:52 +09:00
parent 1b874268a0
commit 16d395779a
10 changed files with 20 additions and 24 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -468,10 +468,11 @@ size_t SegmentMan::countFreePieceFrom(size_t index) const
void SegmentMan::ignoreSegmentFor(const SharedHandle<FileEntry>& fileEntry) 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(), fileEntry->getPath().c_str(),
static_cast<int64_t>(fileEntry->getOffset()), fileEntry->getOffset(),
static_cast<int64_t>(fileEntry->getLength()))); fileEntry->getLength()));
ignoreBitfield_.addFilter(fileEntry->getOffset(), fileEntry->getLength()); ignoreBitfield_.addFilter(fileEntry->getOffset(), fileEntry->getLength());
} }