mirror of https://github.com/aria2/aria2
2008-10-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Replaced '%zu' with '%lu' since mingw32 doesn't recognize '%zu'. * src/BtPieceMessage.cc * src/DHTPeerAnnounceStorage.cc * src/DefaultPieceStorage.cc * src/DownloadCommand.cc * src/DownloadEngine.cc * src/FtpConnection.cc * src/PeerConnection.cc * src/PeerMessageUtil.cc * src/RequestGroup.cc * src/RequestGroupMan.cc * src/SimpleBtMessage.ccpull/1/head
parent
859193c50b
commit
9c946467c9
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2008-10-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Replaced '%zu' with '%lu' since mingw32 doesn't recognize '%zu'.
|
||||
* src/BtPieceMessage.cc
|
||||
* src/DHTPeerAnnounceStorage.cc
|
||||
* src/DefaultPieceStorage.cc
|
||||
* src/DownloadCommand.cc
|
||||
* src/DownloadEngine.cc
|
||||
* src/FtpConnection.cc
|
||||
* src/PeerConnection.cc
|
||||
* src/PeerMessageUtil.cc
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroupMan.cc
|
||||
* src/SimpleBtMessage.cc
|
||||
|
||||
2008-10-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Use seek() and SetEndOfFile() for mingw32 build instead of ftruncate(),
|
||||
|
|
|
@ -150,8 +150,9 @@ void BtPieceMessage::send() {
|
|||
off_t pieceDataOffset =
|
||||
(off_t)index*btContext->getPieceLength()+begin;
|
||||
size_t writtenLength = sendPieceData(pieceDataOffset, blockLength);
|
||||
logger->debug("msglength = %zu bytes",
|
||||
getMessageHeaderLength()+blockLength);
|
||||
logger->debug("msglength = %lu bytes",
|
||||
static_cast<unsigned long>(getMessageHeaderLength()+
|
||||
blockLength));
|
||||
peer->updateUploadLength(writtenLength);
|
||||
} else {
|
||||
ssize_t writtenLength = peerConnection->sendPendingData();
|
||||
|
@ -178,7 +179,8 @@ std::string BtPieceMessage::toString() const {
|
|||
|
||||
bool BtPieceMessage::checkPieceHash(const PieceHandle& piece) {
|
||||
if(piece->isHashCalculated()) {
|
||||
logger->debug("Hash is available!! index=%zu", piece->getIndex());
|
||||
logger->debug("Hash is available!! index=%lu",
|
||||
static_cast<unsigned long>(piece->getIndex()));
|
||||
return piece->getHashString() == btContext->getPieceHash(piece->getIndex());
|
||||
} else {
|
||||
off_t offset = (off_t)piece->getIndex()*btContext->getPieceLength();
|
||||
|
|
|
@ -147,14 +147,15 @@ public:
|
|||
|
||||
void DHTPeerAnnounceStorage::handleTimeout()
|
||||
{
|
||||
_logger->debug("Now purge peer announces(%zu entries) which are timed out.",
|
||||
_entries.size());
|
||||
_logger->debug("Now purge peer announces(%lu entries) which are timed out.",
|
||||
static_cast<unsigned long>(_entries.size()));
|
||||
|
||||
std::for_each(_entries.begin(), _entries.end(), RemoveStalePeerAddrEntry());
|
||||
_entries.erase(std::remove_if(_entries.begin(), _entries.end(),
|
||||
mem_fun_sh(&DHTPeerAnnounceEntry::empty)),
|
||||
_entries.end());
|
||||
_logger->debug("Currently %zu peer announce entries", _entries.size());
|
||||
_logger->debug("Currently %lu peer announce entries",
|
||||
static_cast<unsigned long>(_entries.size()));
|
||||
}
|
||||
|
||||
void DHTPeerAnnounceStorage::announcePeer()
|
||||
|
|
|
@ -151,7 +151,8 @@ void DefaultPieceStorage::addUsedPiece(const PieceHandle& piece)
|
|||
std::deque<SharedHandle<Piece> >::iterator i =
|
||||
std::lower_bound(usedPieces.begin(), usedPieces.end(), piece);
|
||||
usedPieces.insert(i, piece);
|
||||
logger->debug("usedPieces.size()=%zu", usedPieces.size());
|
||||
logger->debug("usedPieces.size()=%lu",
|
||||
static_cast<unsigned long>(usedPieces.size()));
|
||||
}
|
||||
|
||||
PieceHandle DefaultPieceStorage::findUsedPiece(size_t index) const
|
||||
|
|
|
@ -199,7 +199,8 @@ bool DownloadCommand::executeInternal() {
|
|||
_requestGroup->getDownloadContext()->getPieceHash(segment->getIndex());
|
||||
if(_pieceHashValidationEnabled && !expectedPieceHash.empty()) {
|
||||
if(segment->isHashCalculated()) {
|
||||
logger->debug("Hash is available! index=%zu", segment->getIndex());
|
||||
logger->debug("Hash is available! index=%lu",
|
||||
static_cast<unsigned long>(segment->getIndex()));
|
||||
validatePieceHash(segment, expectedPieceHash, segment->getHashString());
|
||||
} else {
|
||||
_messageDigestContext->digestReset();
|
||||
|
|
|
@ -911,7 +911,9 @@ void DownloadEngine::poolSocket(const std::string& ipaddr,
|
|||
newPool.insert(*i);
|
||||
}
|
||||
}
|
||||
logger->debug("%zu entries removed.", _socketPool.size()-newPool.size());
|
||||
logger->debug
|
||||
("%lu entries removed.",
|
||||
static_cast<unsigned long>(_socketPool.size()-newPool.size()));
|
||||
_socketPool = newPool;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,8 +291,9 @@ bool FtpConnection::bulkReceiveResponse(std::pair<unsigned int, std::string>& re
|
|||
throw DlRetryEx(EX_GOT_EOF);
|
||||
}
|
||||
if(strbuf.size()+size > MAX_RECV_BUFFER) {
|
||||
throw DlRetryEx(StringFormat("Max FTP recv buffer reached. length=%zu",
|
||||
strbuf.size()+size).str());
|
||||
throw DlRetryEx
|
||||
(StringFormat("Max FTP recv buffer reached. length=%lu",
|
||||
static_cast<unsigned long>(strbuf.size()+size)).str());
|
||||
}
|
||||
strbuf.append(&buf[0], &buf[size]);
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength) {
|
|||
return false;
|
||||
}
|
||||
// we got EOF
|
||||
logger->debug("CUID#%d - In PeerConnection::receiveMessage(), remain=%zu",
|
||||
cuid, temp);
|
||||
logger->debug("CUID#%d - In PeerConnection::receiveMessage(), remain=%lu",
|
||||
cuid, static_cast<unsigned long>(temp));
|
||||
throw DlAbortEx(EX_EOF_FROM_PEER);
|
||||
}
|
||||
lenbufLength += remaining;
|
||||
|
@ -116,8 +116,11 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength) {
|
|||
return false;
|
||||
}
|
||||
// we got EOF
|
||||
logger->debug("CUID#%d - In PeerConnection::receiveMessage(), payloadlen=%zu, remaining=%zu",
|
||||
cuid, currentPayloadLength, temp);
|
||||
logger->debug("CUID#%d - In PeerConnection::receiveMessage(),"
|
||||
" payloadlen=%lu, remaining=%lu",
|
||||
cuid,
|
||||
static_cast<unsigned long>(currentPayloadLength),
|
||||
static_cast<unsigned long>(temp));
|
||||
throw DlAbortEx(EX_EOF_FROM_PEER);
|
||||
}
|
||||
resbufLength += remaining;
|
||||
|
@ -162,8 +165,9 @@ bool PeerConnection::receiveHandshake(unsigned char* data, size_t& dataLength,
|
|||
return false;
|
||||
}
|
||||
// we got EOF
|
||||
logger->debug("CUID#%d - In PeerConnection::receiveHandshake(), remain=%zu",
|
||||
cuid, temp);
|
||||
logger->debug
|
||||
("CUID#%d - In PeerConnection::receiveHandshake(), remain=%lu",
|
||||
cuid, static_cast<unsigned long>(temp));
|
||||
throw DlAbortEx(EX_EOF_FROM_PEER);
|
||||
}
|
||||
resbufLength += remaining;
|
||||
|
|
|
@ -60,7 +60,8 @@ uint16_t PeerMessageUtil::getShortIntParam(const unsigned char* msg, size_t pos)
|
|||
|
||||
void PeerMessageUtil::checkIndex(size_t index, size_t pieces) {
|
||||
if(!(index < pieces)) {
|
||||
throw DlAbortEx(StringFormat("Invalid index: %zu", index).str());
|
||||
throw DlAbortEx(StringFormat("Invalid index: %lu",
|
||||
static_cast<unsigned long>(index)).str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,23 +73,27 @@ void PeerMessageUtil::checkBegin(uint32_t begin, size_t pieceLength) {
|
|||
|
||||
void PeerMessageUtil::checkLength(size_t length) {
|
||||
if(length > MAX_BLOCK_LENGTH) {
|
||||
throw DlAbortEx(StringFormat("Length too long: %zu > %uKB", length,
|
||||
throw DlAbortEx(StringFormat("Length too long: %lu > %uKB",
|
||||
static_cast<unsigned long>(length),
|
||||
MAX_BLOCK_LENGTH/1024).str());
|
||||
}
|
||||
if(length == 0) {
|
||||
throw DlAbortEx(StringFormat("Invalid length: %zu", length).str());
|
||||
throw DlAbortEx(StringFormat("Invalid length: %lu",
|
||||
static_cast<unsigned long>(length)).str());
|
||||
}
|
||||
}
|
||||
|
||||
void PeerMessageUtil::checkRange(uint32_t begin, size_t length, size_t pieceLength) {
|
||||
if(!(0 < length)) {
|
||||
throw DlAbortEx(StringFormat("Invalid range: begin=%u, length=%zu",
|
||||
begin, length).str());
|
||||
throw DlAbortEx(StringFormat("Invalid range: begin=%u, length=%lu",
|
||||
begin,
|
||||
static_cast<unsigned long>(length)).str());
|
||||
}
|
||||
uint32_t end = begin+length;
|
||||
if(!(end <= pieceLength)) {
|
||||
throw DlAbortEx(StringFormat("Invalid range: begin=%u, length=%zu",
|
||||
begin, length).str());
|
||||
throw DlAbortEx(StringFormat("Invalid range: begin=%u, length=%lu",
|
||||
begin,
|
||||
static_cast<unsigned long>(length)).str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,8 +101,9 @@ void PeerMessageUtil::checkBitfield(const unsigned char* bitfield,
|
|||
size_t bitfieldLength,
|
||||
size_t pieces) {
|
||||
if(!(bitfieldLength == (pieces+7)/8)) {
|
||||
throw DlAbortEx(StringFormat("Invalid bitfield length: %zu",
|
||||
bitfieldLength).str());
|
||||
throw DlAbortEx
|
||||
(StringFormat("Invalid bitfield length: %lu",
|
||||
static_cast<unsigned long>(bitfieldLength)).str());
|
||||
}
|
||||
char lastbyte = bitfield[bitfieldLength-1];
|
||||
for(size_t i = 0; i < 8-pieces%8 && pieces%8 != 0; ++i) {
|
||||
|
|
|
@ -1035,7 +1035,8 @@ void RequestGroup::applyLastModifiedTimeToLocalFiles()
|
|||
ctime(&t));
|
||||
size_t n =
|
||||
_pieceStorage->getDiskAdaptor()->utime(Time(), _lastModifiedTime);
|
||||
_logger->info("Last-Modified attrs of %zu files were updated.", n);
|
||||
_logger->info("Last-Modified attrs of %lu files were updated.",
|
||||
static_cast<unsigned long>(n));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,9 @@ public:
|
|||
RequestGroups nextGroups;
|
||||
group->postDownloadProcessing(nextGroups);
|
||||
if(!nextGroups.empty()) {
|
||||
_logger->debug("Adding %zu RequestGroups as a result of PostDownloadHandler.", nextGroups.size());
|
||||
_logger->debug
|
||||
("Adding %lu RequestGroups as a result of PostDownloadHandler.",
|
||||
static_cast<unsigned long>(nextGroups.size()));
|
||||
_reservedGroups.insert(_reservedGroups.begin(),
|
||||
nextGroups.begin(), nextGroups.end());
|
||||
}
|
||||
|
@ -241,7 +243,8 @@ void RequestGroupMan::removeStoppedGroup()
|
|||
|
||||
size_t numRemoved = numPrev-_requestGroups.size();
|
||||
if(numRemoved > 0) {
|
||||
_logger->debug("%zu RequestGroup(s) deleted.", numRemoved);
|
||||
_logger->debug("%lu RequestGroup(s) deleted.",
|
||||
static_cast<unsigned long>(numRemoved));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ void SimpleBtMessage::send() {
|
|||
size_t msgLength = getMessageLength();
|
||||
logger->info(MSG_SEND_PEER_MESSAGE,
|
||||
cuid, peer->ipaddr.c_str(), peer->port, toString().c_str());
|
||||
logger->debug("msglength = %zu bytes", msgLength);
|
||||
logger->debug("msglength = %lu bytes",
|
||||
static_cast<unsigned long>(msgLength));
|
||||
peerConnection->sendMessage(msg, msgLength);
|
||||
} else {
|
||||
peerConnection->sendPendingData();
|
||||
|
|
Loading…
Reference in New Issue