2010-10-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Fixed compiler warning about printf format.
	* src/AdaptiveURISelector.cc
	* src/BtPieceMessage.cc
	* src/DHTAbstractNodeLookupTask.h
	* src/DHTMessageFactoryImpl.cc
	* src/DHTPeerLookupTask.cc
	* src/DHTReplaceNodeTask.cc
	* src/DefaultBtAnnounce.cc
	* src/DefaultBtInteractive.cc
	* src/DefaultBtMessageDispatcher.cc
	* src/DefaultBtProgressInfoFile.cc
	* src/DefaultBtRequestFactory.cc
	* src/DefaultExtensionMessageFactory.cc
	* src/DefaultPieceStorage.cc
	* src/DownloadCommand.cc
	* src/FileAllocationCommand.cc
	* src/FileEntry.cc
	* src/HandshakeExtensionMessage.cc
	* src/IteratableChunkChecksumValidator.cc
	* src/LibgcryptDHKeyExchange.h
	* src/LibsslDHKeyExchange.h
	* src/LpdDispatchMessageCommand.cc
	* src/MSEHandshake.cc
	* src/MessageDigestHelper.cc
	* src/MultiDiskAdaptor.cc
	* src/PeerConnection.cc
	* src/SegmentMan.cc
	* src/TimedHaltCommand.cc
	* src/UTMetadataRequestExtensionMessage.cc
	* src/UTPexExtensionMessage.cc
	* src/bencode2.cc
	* src/bittorrent_helper.cc
	* src/message.h
pull/1/head
Tatsuhiro Tsujikawa 2010-10-28 14:19:29 +00:00
parent 59bc2a7da7
commit b7df39b7ae
33 changed files with 222 additions and 119 deletions

View File

@ -1,3 +1,39 @@
2010-10-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed compiler warning about printf format.
* src/AdaptiveURISelector.cc
* src/BtPieceMessage.cc
* src/DHTAbstractNodeLookupTask.h
* src/DHTMessageFactoryImpl.cc
* src/DHTPeerLookupTask.cc
* src/DHTReplaceNodeTask.cc
* src/DefaultBtAnnounce.cc
* src/DefaultBtInteractive.cc
* src/DefaultBtMessageDispatcher.cc
* src/DefaultBtProgressInfoFile.cc
* src/DefaultBtRequestFactory.cc
* src/DefaultExtensionMessageFactory.cc
* src/DefaultPieceStorage.cc
* src/DownloadCommand.cc
* src/FileAllocationCommand.cc
* src/FileEntry.cc
* src/HandshakeExtensionMessage.cc
* src/IteratableChunkChecksumValidator.cc
* src/LibgcryptDHKeyExchange.h
* src/LibsslDHKeyExchange.h
* src/LpdDispatchMessageCommand.cc
* src/MSEHandshake.cc
* src/MessageDigestHelper.cc
* src/MultiDiskAdaptor.cc
* src/PeerConnection.cc
* src/SegmentMan.cc
* src/TimedHaltCommand.cc
* src/UTMetadataRequestExtensionMessage.cc
* src/UTPexExtensionMessage.cc
* src/bencode2.cc
* src/bittorrent_helper.cc
* src/message.h
2010-10-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-10-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed compiler warning when checking c-ares version. Fixed compiler warning when checking c-ares version.

View File

@ -112,8 +112,9 @@ void AdaptiveURISelector::mayRetryWithIncreasedTimeout(FileEntry* fileEntry)
for(std::deque<std::string>::const_iterator i = uris.begin(), for(std::deque<std::string>::const_iterator i = uris.begin(),
eoi = uris.end(); i != eoi; ++i) { eoi = uris.end(); i != eoi; ++i) {
logger_->debug("AdaptiveURISelector: will retry server with increased" logger_->debug("AdaptiveURISelector: will retry server with increased"
" timeout (%d s): %s", " timeout (%ld s): %s",
requestGroup_->getTimeout(), (*i).c_str()); static_cast<long int>(requestGroup_->getTimeout()),
(*i).c_str());
} }
} }
} }

View File

@ -110,8 +110,10 @@ void BtPieceMessage::doReceivedAction()
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug(MSG_PIECE_RECEIVED, getLogger()->debug(MSG_PIECE_RECEIVED,
util::itos(getCuid()).c_str(), util::itos(getCuid()).c_str(),
index_, begin_, blockLength_, offset, static_cast<unsigned long>(index_),
slot.getBlockIndex()); begin_, blockLength_,
static_cast<long long int>(offset),
static_cast<unsigned long>(slot.getBlockIndex()));
} }
getPieceStorage()->getDiskAdaptor()->writeData getPieceStorage()->getDiskAdaptor()->writeData
(block_, blockLength_, offset); (block_, blockLength_, offset);
@ -133,8 +135,9 @@ void BtPieceMessage::doReceivedAction()
} }
} else { } else {
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug("CUID#%s - RequestSlot not found, index=%d, begin=%d", getLogger()->debug("CUID#%s - RequestSlot not found, index=%lu, begin=%u",
util::itos(getCuid()).c_str(), index_, begin_); util::itos(getCuid()).c_str(),
static_cast<unsigned long>(index_), begin_);
} }
} }
} }
@ -242,7 +245,8 @@ void BtPieceMessage::onNewPiece(const SharedHandle<Piece>& piece)
{ {
if(getLogger()->info()) { if(getLogger()->info()) {
getLogger()->info(MSG_GOT_NEW_PIECE, getLogger()->info(MSG_GOT_NEW_PIECE,
util::itos(getCuid()).c_str(), piece->getIndex()); util::itos(getCuid()).c_str(),
static_cast<unsigned long>(piece->getIndex()));
} }
getPieceStorage()->completePiece(piece); getPieceStorage()->completePiece(piece);
getPieceStorage()->advertisePiece(getCuid(), piece->getIndex()); getPieceStorage()->advertisePiece(getCuid(), piece->getIndex());
@ -252,7 +256,8 @@ void BtPieceMessage::onWrongPiece(const SharedHandle<Piece>& piece)
{ {
if(getLogger()->info()) { if(getLogger()->info()) {
getLogger()->info(MSG_GOT_WRONG_PIECE, getLogger()->info(MSG_GOT_WRONG_PIECE,
util::itos(getCuid()).c_str(), piece->getIndex()); util::itos(getCuid()).c_str(),
static_cast<unsigned long>(piece->getIndex()));
} }
erasePieceOnDisk(piece); erasePieceOnDisk(piece);
piece->clearAllBlock(); piece->clearAllBlock();
@ -284,7 +289,8 @@ void BtPieceMessage::onChokingEvent(const BtChokingEvent& event)
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug(MSG_REJECT_PIECE_CHOKED, getLogger()->debug(MSG_REJECT_PIECE_CHOKED,
util::itos(getCuid()).c_str(), util::itos(getCuid()).c_str(),
index_, begin_, blockLength_); static_cast<unsigned long>(index_),
begin_, blockLength_);
} }
if(getPeer()->isFastExtensionEnabled()) { if(getPeer()->isFastExtensionEnabled()) {
BtMessageHandle rej = BtMessageHandle rej =
@ -307,7 +313,8 @@ void BtPieceMessage::onCancelSendingPieceEvent
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug(MSG_REJECT_PIECE_CANCEL, getLogger()->debug(MSG_REJECT_PIECE_CANCEL,
util::itos(getCuid()).c_str(), util::itos(getCuid()).c_str(),
index_, begin_, blockLength_); static_cast<unsigned long>(index_),
begin_, blockLength_);
} }
if(getPeer()->isFastExtensionEnabled()) { if(getPeer()->isFastExtensionEnabled()) {
BtMessageHandle rej = BtMessageHandle rej =

View File

@ -110,8 +110,8 @@ private:
setFinished(true); setFinished(true);
} else { } else {
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug("%d in flight message for node ID %s", getLogger()->debug("%lu in flight message for node ID %s",
inFlightMessage_, static_cast<unsigned long>(inFlightMessage_),
util::toHex(targetID_, DHT_ID_LENGTH).c_str()); util::toHex(targetID_, DHT_ID_LENGTH).c_str());
} }
} }
@ -199,12 +199,14 @@ public:
} }
} }
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug("%u node lookup entries added.", count); getLogger()->debug("%lu node lookup entries added.",
static_cast<unsigned long>(count));
} }
std::stable_sort(entries_.begin(), entries_.end(), DHTIDCloser(targetID_)); std::stable_sort(entries_.begin(), entries_.end(), DHTIDCloser(targetID_));
entries_.erase(std::unique(entries_.begin(), entries_.end()), entries_.end()); entries_.erase(std::unique(entries_.begin(), entries_.end()), entries_.end());
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug("%u node lookup entries are unique.", entries_.size()); getLogger()->debug("%lu node lookup entries are unique.",
static_cast<unsigned long>(entries_.size()));
} }
if(entries_.size() > DHTBucket::K) { if(entries_.size() > DHTBucket::K) {
entries_.erase(entries_.begin()+DHTBucket::K, entries_.end()); entries_.erase(entries_.begin()+DHTBucket::K, entries_.end());

View File

@ -123,8 +123,8 @@ static const String* getString(const List* list, size_t index)
return c; return c;
} else { } else {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Malformed DHT message. element[%u] is not String.", (StringFormat("Malformed DHT message. element[%lu] is not String.",
index).str()); static_cast<unsigned long>(index)).str());
} }
} }
@ -135,8 +135,8 @@ static const Integer* getInteger(const List* list, size_t index)
return c; return c;
} else { } else {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Malformed DHT message. element[%u] is not Integer.", (StringFormat("Malformed DHT message. element[%lu] is not Integer.",
index).str()); static_cast<unsigned long>(index)).str());
} }
} }
@ -156,8 +156,9 @@ void DHTMessageFactoryImpl::validateID(const String* id) const
if(id->s().size() != DHT_ID_LENGTH) { if(id->s().size() != DHT_ID_LENGTH) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Malformed DHT message. Invalid ID length." (StringFormat("Malformed DHT message. Invalid ID length."
" Expected:%d, Actual:%d", " Expected:%lu, Actual:%lu",
DHT_ID_LENGTH, id->s().size()).str()); static_cast<unsigned long>(DHT_ID_LENGTH),
static_cast<unsigned long>(id->s().size())).str());
} }
} }

View File

@ -75,7 +75,8 @@ void DHTPeerLookupTask::onReceivedInternal
peerStorage_->addPeer(message->getValues()); peerStorage_->addPeer(message->getValues());
peers_.insert(peers_.end(), peers_.insert(peers_.end(),
message->getValues().begin(), message->getValues().end()); message->getValues().begin(), message->getValues().end());
getLogger()->info("Received %u peers.", message->getValues().size()); getLogger()->info("Received %lu peers.",
static_cast<unsigned long>(message->getValues().size()));
} }
SharedHandle<DHTMessage> DHTPeerLookupTask::createMessage SharedHandle<DHTMessage> DHTPeerLookupTask::createMessage

View File

@ -84,8 +84,9 @@ void DHTReplaceNodeTask::onTimeout(const SharedHandle<DHTNode>& node)
{ {
++numRetry_; ++numRetry_;
if(numRetry_ >= MAX_RETRY) { if(numRetry_ >= MAX_RETRY) {
getLogger()->info("ReplaceNode: Ping failed %u times. Replace %s with %s.", getLogger()->info("ReplaceNode: Ping failed %lu times. Replace %s with %s.",
numRetry_, node->toString().c_str(), static_cast<unsigned long>(numRetry_),
node->toString().c_str(),
newNode_->toString().c_str()); newNode_->toString().c_str());
node->markBad(); node->markBad();
bucket_->addNode(newNode_); bucket_->addNode(newNode_);

View File

@ -245,14 +245,14 @@ DefaultBtAnnounce::processAnnounceResponse(const unsigned char* trackerResponse,
if(ival && ival->i() > 0) { if(ival && ival->i() > 0) {
interval_ = ival->i(); interval_ = ival->i();
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Interval:%d", interval_); logger_->debug("Interval:%ld", static_cast<long int>(interval_));
} }
} }
const Integer* mival = asInteger(dict->get(BtAnnounce::MIN_INTERVAL)); const Integer* mival = asInteger(dict->get(BtAnnounce::MIN_INTERVAL));
if(mival && mival->i() > 0) { if(mival && mival->i() > 0) {
minInterval_ = mival->i(); minInterval_ = mival->i();
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Min interval:%d", minInterval_); logger_->debug("Min interval:%ld", static_cast<long int>(minInterval_));
} }
minInterval_ = std::min(minInterval_, interval_); minInterval_ = std::min(minInterval_, interval_);
} else { } else {

View File

@ -462,7 +462,8 @@ void DefaultBtInteractive::checkActiveInteraction()
// TODO change the message // TODO change the message
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Disconnect peer because we are not interested each other" (StringFormat("Disconnect peer because we are not interested each other"
" after %u second(s).", interval).str()); " after %ld second(s).",
static_cast<long int>(interval)).str());
} }
} }
// Since the peers which are *just* connected and do nothing to improve // Since the peers which are *just* connected and do nothing to improve
@ -473,7 +474,8 @@ void DefaultBtInteractive::checkActiveInteraction()
if(inactiveTime >= interval) { if(inactiveTime >= interval) {
peer_->setDisconnectedGracefully(true); peer_->setDisconnectedGracefully(true);
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat(EX_DROP_INACTIVE_CONNECTION, interval).str()); (StringFormat(EX_DROP_INACTIVE_CONNECTION,
static_cast<long int>(interval)).str());
} }
} }
} }

View File

@ -157,9 +157,9 @@ public:
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug(MSG_DELETING_REQUEST_SLOT, logger_->debug(MSG_DELETING_REQUEST_SLOT,
util::itos(cuid_).c_str(), util::itos(cuid_).c_str(),
slot.getIndex(), static_cast<unsigned long>(slot.getIndex()),
slot.getBlockIndex()); slot.getBegin(),
logger_->debug("index=%d, begin=%d", slot.getIndex(), slot.getBegin()); static_cast<unsigned long>(slot.getBlockIndex()));
} }
piece_->cancelBlock(slot.getBlockIndex()); piece_->cancelBlock(slot.getBlockIndex());
} }
@ -210,9 +210,9 @@ public:
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug(MSG_DELETING_REQUEST_SLOT_CHOKED, logger_->debug(MSG_DELETING_REQUEST_SLOT_CHOKED,
util::itos(cuid_).c_str(), util::itos(cuid_).c_str(),
slot.getIndex(), static_cast<unsigned long>(slot.getIndex()),
slot.getBlockIndex()); slot.getBegin(),
logger_->debug("index=%d, begin=%d", slot.getIndex(), slot.getBegin()); static_cast<unsigned long>(slot.getBlockIndex()));
} }
SharedHandle<Piece> piece = pieceStorage_->getPiece(slot.getIndex()); SharedHandle<Piece> piece = pieceStorage_->getPiece(slot.getIndex());
piece->cancelBlock(slot.getBlockIndex()); piece->cancelBlock(slot.getBlockIndex());
@ -289,8 +289,9 @@ public:
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug(MSG_DELETING_REQUEST_SLOT_TIMEOUT, logger_->debug(MSG_DELETING_REQUEST_SLOT_TIMEOUT,
util::itos(cuid_).c_str(), util::itos(cuid_).c_str(),
slot.getBlockIndex()); static_cast<unsigned long>(slot.getIndex()),
logger_->debug("index=%d, begin=%d", slot.getIndex(), slot.getBegin()); slot.getBegin(),
static_cast<unsigned long>(slot.getBlockIndex()));
} }
slot.getPiece()->cancelBlock(slot.getBlockIndex()); slot.getPiece()->cancelBlock(slot.getBlockIndex());
peer_->snubbing(true); peer_->snubbing(true);
@ -298,8 +299,9 @@ public:
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug(MSG_DELETING_REQUEST_SLOT_ACQUIRED, logger_->debug(MSG_DELETING_REQUEST_SLOT_ACQUIRED,
util::itos(cuid_).c_str(), util::itos(cuid_).c_str(),
slot.getBlockIndex()); static_cast<unsigned long>(slot.getIndex()),
logger_->debug("index=%d, begin=%d", slot.getIndex(), slot.getBegin()); slot.getBegin(),
static_cast<unsigned long>(slot.getBlockIndex()));
} }
messageDispatcher_->addMessageToQueue messageDispatcher_->addMessageToQueue
(messageFactory_->createCancelMessage(slot.getIndex(), (messageFactory_->createCancelMessage(slot.getIndex(),

View File

@ -379,8 +379,9 @@ void DefaultBtProgressInfoFile::load()
if(piece->getBitfieldLength() != bitfieldLength) { if(piece->getBitfieldLength() != bitfieldLength) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("piece bitfield length mismatch." (StringFormat("piece bitfield length mismatch."
" expected: %u actual: %u", " expected: %lu actual: %u",
piece->getBitfieldLength(), bitfieldLength).str()); static_cast<unsigned long>(piece->getBitfieldLength()),
bitfieldLength).str());
} }
array_ptr<unsigned char> pieceBitfield array_ptr<unsigned char> pieceBitfield
(new unsigned char[bitfieldLength]); (new unsigned char[bitfieldLength]);

View File

@ -174,11 +174,12 @@ void DefaultBtRequestFactory::createRequestMessages
for(std::vector<size_t>::const_iterator i = blockIndexes.begin(), for(std::vector<size_t>::const_iterator i = blockIndexes.begin(),
eoi2 = blockIndexes.end(); i != eoi2; ++i) { eoi2 = blockIndexes.end(); i != eoi2; ++i) {
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Creating RequestMessage index=%u, begin=%u," logger_->debug
" blockIndex=%u", ("Creating RequestMessage index=%lu, begin=%u,"
piece->getIndex(), " blockIndex=%lu",
(*i)*piece->getBlockLength(), static_cast<unsigned long>(piece->getIndex()),
(*i)); static_cast<unsigned int>((*i)*piece->getBlockLength()),
static_cast<unsigned long>(*i));
} }
requests.push_back requests.push_back
(messageFactory_->createRequestMessage(piece, *i)); (messageFactory_->createRequestMessage(piece, *i));
@ -219,11 +220,12 @@ void DefaultBtRequestFactory::createRequestMessagesOnEndGame
if(!dispatcher_->isOutstandingRequest(piece->getIndex(), if(!dispatcher_->isOutstandingRequest(piece->getIndex(),
blockIndex)) { blockIndex)) {
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Creating RequestMessage index=%u, begin=%u," logger_->debug
" blockIndex=%u", ("Creating RequestMessage index=%lu, begin=%u,"
piece->getIndex(), " blockIndex=%lu",
blockIndex*piece->getBlockLength(), static_cast<unsigned long>(piece->getIndex()),
blockIndex); static_cast<unsigned int>(blockIndex*piece->getBlockLength()),
static_cast<unsigned long>(blockIndex));
} }
requests.push_back(messageFactory_->createRequestMessage requests.push_back(messageFactory_->createRequestMessage
(piece, blockIndex)); (piece, blockIndex));

View File

@ -94,8 +94,10 @@ DefaultExtensionMessageFactory::createMessage(const unsigned char* data, size_t
return m; return m;
} else if(extensionName == "ut_metadata") { } else if(extensionName == "ut_metadata") {
if(length == 0) { if(length == 0) {
throw DL_ABORT_EX(StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE, throw DL_ABORT_EX
"ut_metadata", length).str()); (StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE,
"ut_metadata",
static_cast<unsigned long>(length)).str());
} }
size_t end; size_t end;
SharedHandle<ValueBase> decoded = bencode2::decode(data+1, length-1, end); SharedHandle<ValueBase> decoded = bencode2::decode(data+1, length-1, end);
@ -148,8 +150,9 @@ DefaultExtensionMessageFactory::createMessage(const unsigned char* data, size_t
return m; return m;
} }
default: default:
throw DL_ABORT_EX(StringFormat("Bad ut_metadata: unknown msg_type=%u", throw DL_ABORT_EX
msgType->i()).str()); (StringFormat("Bad ut_metadata: unknown msg_type=%u",
static_cast<unsigned int>(msgType->i())).str());
} }
} else { } else {
throw DL_ABORT_EX throw DL_ABORT_EX

View File

@ -667,7 +667,8 @@ void DefaultPieceStorage::removeAdvertisedPiece(time_t elapsed)
std::find_if(haves_.begin(), haves_.end(), FindElapsedHave(elapsed)); std::find_if(haves_.begin(), haves_.end(), FindElapsedHave(elapsed));
if(itr != haves_.end()) { if(itr != haves_.end()) {
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug(MSG_REMOVED_HAVE_ENTRY, haves_.end()-itr); logger_->debug(MSG_REMOVED_HAVE_ENTRY,
static_cast<unsigned long>(haves_.end()-itr));
} }
haves_.erase(itr, haves_.end()); haves_.erase(itr, haves_.end());
} }

View File

@ -345,14 +345,15 @@ void DownloadCommand::validatePieceHash(const SharedHandle<Segment>& segment,
getSegmentMan()->completeSegment(getCuid(), segment); getSegmentMan()->completeSegment(getCuid(), segment);
} else { } else {
getLogger()->info(EX_INVALID_CHUNK_CHECKSUM, getLogger()->info(EX_INVALID_CHUNK_CHECKSUM,
segment->getIndex(), static_cast<unsigned long>(segment->getIndex()),
util::itos(segment->getPosition(), true).c_str(), util::itos(segment->getPosition(), true).c_str(),
expectedPieceHash.c_str(), expectedPieceHash.c_str(),
actualPieceHash.c_str()); actualPieceHash.c_str());
segment->clear(); segment->clear();
getSegmentMan()->cancelSegment(getCuid()); getSegmentMan()->cancelSegment(getCuid());
throw DL_RETRY_EX throw DL_RETRY_EX
(StringFormat("Invalid checksum index=%d", segment->getIndex()).str()); (StringFormat("Invalid checksum index=%lu",
static_cast<unsigned long>(segment->getIndex())).str());
} }
} }

View File

@ -71,7 +71,7 @@ bool FileAllocationCommand::executeInternal()
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug getLogger()->debug
(MSG_ALLOCATION_COMPLETED, (MSG_ALLOCATION_COMPLETED,
timer_.difference(global::wallclock), static_cast<long int>(timer_.difference(global::wallclock)),
util::itos(getRequestGroup()->getTotalLength(), true).c_str()); util::itos(getRequestGroup()->getTotalLength(), true).c_str());
} }
getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); getDownloadEngine()->getFileAllocationMan()->dropPickedEntry();

View File

@ -272,8 +272,9 @@ void FileEntry::removeURIWhoseHostnameIs(const std::string& hostname)
} }
} }
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Removed %d duplicate hostname URIs for path=%s", logger_->debug("Removed %lu duplicate hostname URIs for path=%s",
uris_.size()-newURIs.size(), getPath().c_str()); static_cast<unsigned long>(uris_.size()-newURIs.size()),
getPath().c_str());
} }
uris_.swap(newURIs); uris_.swap(newURIs);
} }

View File

@ -167,7 +167,8 @@ HandshakeExtensionMessage::create(const unsigned char* data, size_t length)
if(length < 1) { if(length < 1) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE, (StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE,
EXTENSION_NAME.c_str(), length).str()); EXTENSION_NAME.c_str(),
static_cast<unsigned long>(length)).str());
} }
HandshakeExtensionMessageHandle msg(new HandshakeExtensionMessage()); HandshakeExtensionMessageHandle msg(new HandshakeExtensionMessage());
if(LogFactory::getInstance()->debug()) { if(LogFactory::getInstance()->debug()) {

View File

@ -88,7 +88,7 @@ void IteratableChunkChecksumValidator::validateChunk()
} else { } else {
if(logger_->info()) { if(logger_->info()) {
logger_->info(EX_INVALID_CHUNK_CHECKSUM, logger_->info(EX_INVALID_CHUNK_CHECKSUM,
currentIndex_, static_cast<unsigned long>(currentIndex_),
util::itos(getCurrentOffset(), true).c_str(), util::itos(getCurrentOffset(), true).c_str(),
dctx_->getPieceHashes()[currentIndex_].c_str(), dctx_->getPieceHashes()[currentIndex_].c_str(),
actualChecksum.c_str()); actualChecksum.c_str());
@ -97,9 +97,9 @@ void IteratableChunkChecksumValidator::validateChunk()
} }
} catch(RecoverableException& ex) { } catch(RecoverableException& ex) {
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Caught exception while validating piece index=%d." logger_->debug("Caught exception while validating piece index=%lu."
" Some part of file may be missing. Continue operation.", " Some part of file may be missing. Continue operation.",
ex, currentIndex_); ex, static_cast<unsigned long>(currentIndex_));
} }
bitfield_->unsetBit(currentIndex_); bitfield_->unsetBit(currentIndex_);
} }

View File

@ -113,8 +113,10 @@ public:
{ {
if(outLength < keyLength_) { if(outLength < keyLength_) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Insufficient buffer for public key. expect:%u, actual:%u", (StringFormat
keyLength_, outLength).str()); ("Insufficient buffer for public key. expect:%lu, actual:%lu",
static_cast<unsigned long>(keyLength_),
static_cast<unsigned long>(outLength)).str());
} }
memset(out, 0, outLength); memset(out, 0, outLength);
size_t publicKeyBytes = (gcry_mpi_get_nbits(publicKey_)+7)/8; size_t publicKeyBytes = (gcry_mpi_get_nbits(publicKey_)+7)/8;
@ -139,8 +141,9 @@ public:
{ {
if(outLength < keyLength_) { if(outLength < keyLength_) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Insufficient buffer for secret. expect:%u, actual:%u", (StringFormat("Insufficient buffer for secret. expect:%lu, actual:%lu",
keyLength_, outLength).str()); static_cast<unsigned long>(keyLength_),
static_cast<unsigned long>(outLength)).str());
} }
gcry_mpi_t peerPublicKey; gcry_mpi_t peerPublicKey;
{ {

View File

@ -124,8 +124,10 @@ public:
{ {
if(outLength < keyLength_) { if(outLength < keyLength_) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Insufficient buffer for public key. expect:%u, actual:%u", (StringFormat
keyLength_, outLength).str()); ("Insufficient buffer for public key. expect:%lu, actual:%lu",
static_cast<unsigned long>(keyLength_),
static_cast<unsigned long>(outLength)).str());
} }
memset(out, 0, outLength); memset(out, 0, outLength);
size_t publicKeyBytes = BN_num_bytes(publicKey_); size_t publicKeyBytes = BN_num_bytes(publicKey_);
@ -133,7 +135,11 @@ public:
size_t nwritten = BN_bn2bin(publicKey_, out+offset); size_t nwritten = BN_bn2bin(publicKey_, out+offset);
if(nwritten != publicKeyBytes) { if(nwritten != publicKeyBytes) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("BN_bn2bin in DHKeyExchange::getPublicKey, %u bytes written, but %u bytes expected.", nwritten, publicKeyBytes).str()); (StringFormat
("BN_bn2bin in DHKeyExchange::getPublicKey, %lu bytes written,"
" but %lu bytes expected.",
static_cast<unsigned long>(nwritten),
static_cast<unsigned long>(publicKeyBytes)).str());
} }
return nwritten; return nwritten;
} }
@ -151,8 +157,9 @@ public:
{ {
if(outLength < keyLength_) { if(outLength < keyLength_) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Insufficient buffer for secret. expect:%u, actual:%u", (StringFormat("Insufficient buffer for secret. expect:%lu, actual:%lu",
keyLength_, outLength).str()); static_cast<unsigned long>(keyLength_),
static_cast<unsigned long>(outLength)).str());
} }
@ -172,7 +179,11 @@ public:
BN_free(secret); BN_free(secret);
if(nwritten != secretBytes) { if(nwritten != secretBytes) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("BN_bn2bin in DHKeyExchange::getPublicKey, %u bytes written, but %u bytes expected.", nwritten, secretBytes).str()); (StringFormat
("BN_bn2bin in DHKeyExchange::getPublicKey, %lu bytes written,"
" but %lu bytes expected.",
static_cast<unsigned long>(nwritten),
static_cast<unsigned long>(secretBytes)).str());
} }
return nwritten; return nwritten;
} }

View File

@ -73,7 +73,8 @@ bool LpdDispatchMessageCommand::execute()
} else { } else {
++tryCount_; ++tryCount_;
if(tryCount_ >= 5) { if(tryCount_ >= 5) {
getLogger()->info("Sending LPD message %u times but all failed."); getLogger()->info("Sending LPD message %u times but all failed.",
tryCount_);
dispatcher_->resetAnnounceTimer(); dispatcher_->resetAnnounceTimer();
tryCount_ = 0; tryCount_ = 0;
} else { } else {

View File

@ -351,8 +351,9 @@ bool MSEHandshake::findInitiatorVCMarker()
socket_->readData(rbuf_+rbufLength_, toRead); socket_->readData(rbuf_+rbufLength_, toRead);
rbufLength_ += toRead; rbufLength_ += toRead;
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("CUID#%s - VC marker found at %u", logger_->debug("CUID#%s - VC marker found at %lu",
util::itos(cuid_).c_str(), markerIndex_); util::itos(cuid_).c_str(),
static_cast<unsigned long>(markerIndex_));
} }
verifyVC(rbuf_+markerIndex_); verifyVC(rbuf_+markerIndex_);
// reset rbufLength_ // reset rbufLength_
@ -452,8 +453,9 @@ bool MSEHandshake::findReceiverHashMarker()
socket_->readData(rbuf_+rbufLength_, toRead); socket_->readData(rbuf_+rbufLength_, toRead);
rbufLength_ += toRead; rbufLength_ += toRead;
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("CUID#%s - Hash marker found at %u.", logger_->debug("CUID#%s - Hash marker found at %lu.",
util::itos(cuid_).c_str(), markerIndex_); util::itos(cuid_).c_str(),
static_cast<unsigned long>(markerIndex_));
} }
verifyReq1Hash(rbuf_+markerIndex_); verifyReq1Hash(rbuf_+markerIndex_);
// reset rbufLength_ // reset rbufLength_

View File

@ -131,8 +131,11 @@ void MessageDigestHelper::digest(unsigned char* md, size_t mdLength,
{ {
if(mdLength < MessageDigestContext::digestLength(algo)) { if(mdLength < MessageDigestContext::digestLength(algo)) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Insufficient space for storing message digest: %d required, but only %d is allocated", (StringFormat
MessageDigestContext::digestLength(algo), mdLength).str()); ("Insufficient space for storing message digest:"
" %lu required, but only %lu is allocated",
static_cast<unsigned long>(MessageDigestContext::digestLength(algo)),
static_cast<unsigned long>(mdLength)).str());
} }
MessageDigestContext ctx; MessageDigestContext ctx;
ctx.trySetAlgo(algo); ctx.trySetAlgo(algo);

View File

@ -207,7 +207,8 @@ void MultiDiskAdaptor::resetDiskWriterEntries()
getLogger()->debug("Checking adjacent backward file to %s" getLogger()->debug("Checking adjacent backward file to %s"
" whose lastPieceStartOffset+pieceLength_=%lld", " whose lastPieceStartOffset+pieceLength_=%lld",
fileEntry->getPath().c_str(), fileEntry->getPath().c_str(),
lastPieceStartOffset+pieceLength_); static_cast<long long int>
(lastPieceStartOffset+pieceLength_));
} }
++itr; ++itr;
// adjacent backward files are not needed to be allocated. They // adjacent backward files are not needed to be allocated. They
@ -218,7 +219,8 @@ void MultiDiskAdaptor::resetDiskWriterEntries()
if(getLogger()->debug()) { if(getLogger()->debug()) {
getLogger()->debug("file=%s, offset=%lld", getLogger()->debug("file=%s, offset=%lld",
(*itr)->getFileEntry()->getPath().c_str(), (*itr)->getFileEntry()->getPath().c_str(),
(*itr)->getFileEntry()->getOffset()); static_cast<long long int>
((*itr)->getFileEntry()->getOffset()));
} }
if((*itr)->getFileEntry()->getOffset() < if((*itr)->getFileEntry()->getOffset() <
static_cast<off_t>(lastPieceStartOffset+pieceLength_)) { static_cast<off_t>(lastPieceStartOffset+pieceLength_)) {

View File

@ -274,7 +274,7 @@ ssize_t PeerConnection::sendPendingData()
{ {
ssize_t writtenLength = socketBuffer_.send(); ssize_t writtenLength = socketBuffer_.send();
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("sent %d byte(s).", writtenLength); logger_->debug("sent %ld byte(s).", static_cast<long int>(writtenLength));
} }
return writtenLength; return writtenLength;
} }

View File

@ -114,8 +114,9 @@ SharedHandle<Segment> SegmentMan::checkoutSegment
return SharedHandle<Segment>(); return SharedHandle<Segment>();
} }
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Attach segment#%d to CUID#%s.", logger_->debug("Attach segment#%lu to CUID#%s.",
piece->getIndex(), util::itos(cuid).c_str()); static_cast<unsigned long>(piece->getIndex()),
util::itos(cuid).c_str());
} }
SharedHandle<Segment> segment; SharedHandle<Segment> segment;
if(piece->getLength() == 0) { if(piece->getLength() == 0) {
@ -126,11 +127,12 @@ SharedHandle<Segment> SegmentMan::checkoutSegment
SegmentEntryHandle entry(new SegmentEntry(cuid, segment)); SegmentEntryHandle entry(new SegmentEntry(cuid, segment));
usedSegmentEntries_.push_back(entry); usedSegmentEntries_.push_back(entry);
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("index=%d, length=%d, segmentLength=%d, writtenLength=%d", logger_->debug("index=%lu, length=%lu, segmentLength=%lu,"
segment->getIndex(), " writtenLength=%lu",
segment->getLength(), static_cast<unsigned long>(segment->getIndex()),
segment->getSegmentLength(), static_cast<unsigned long>(segment->getLength()),
segment->getWrittenLength()); static_cast<unsigned long>(segment->getSegmentLength()),
static_cast<unsigned long>(segment->getWrittenLength()));
} }
if(piece->getLength() > 0) { if(piece->getLength() > 0) {
std::map<size_t, size_t>::iterator positr = std::map<size_t, size_t>::iterator positr =
@ -138,8 +140,9 @@ SharedHandle<Segment> SegmentMan::checkoutSegment
if(positr != segmentWrittenLengthMemo_.end()) { if(positr != segmentWrittenLengthMemo_.end()) {
const size_t writtenLength = (*positr).second; const size_t writtenLength = (*positr).second;
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("writtenLength(in memo)=%d, writtenLength=%d", logger_->debug("writtenLength(in memo)=%lu, writtenLength=%lu",
writtenLength, segment->getWrittenLength()); static_cast<unsigned long>(writtenLength),
static_cast<unsigned long>(segment->getWrittenLength()));
} }
// If the difference between cached writtenLength and segment's // If the difference between cached writtenLength and segment's
// writtenLength is less than one block, we assume that these // writtenLength is less than one block, we assume that these
@ -247,13 +250,15 @@ SharedHandle<Segment> SegmentMan::getCleanSegmentIfOwnerIsIdle
void SegmentMan::cancelSegment(const SharedHandle<Segment>& segment) void SegmentMan::cancelSegment(const SharedHandle<Segment>& segment)
{ {
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Canceling segment#%d", segment->getIndex()); logger_->debug("Canceling segment#%lu",
static_cast<unsigned long>(segment->getIndex()));
} }
pieceStorage_->cancelPiece(segment->getPiece()); pieceStorage_->cancelPiece(segment->getPiece());
segmentWrittenLengthMemo_[segment->getIndex()] = segment->getWrittenLength(); segmentWrittenLengthMemo_[segment->getIndex()] = segment->getWrittenLength();
if(logger_->debug()) { if(logger_->debug()) {
logger_->debug("Memorized segment index=%u, writtenLength=%u", logger_->debug("Memorized segment index=%lu, writtenLength=%lu",
segment->getIndex(), segment->getWrittenLength()); static_cast<unsigned long>(segment->getIndex()),
static_cast<unsigned long>(segment->getWrittenLength()));
} }
} }

View File

@ -63,7 +63,8 @@ void TimedHaltCommand::preProcess()
void TimedHaltCommand::process() void TimedHaltCommand::process()
{ {
if(!getDownloadEngine()->isHaltRequested()) { if(!getDownloadEngine()->isHaltRequested()) {
getLogger()->notice(MSG_TIME_HAS_PASSED, getInterval()); getLogger()->notice(MSG_TIME_HAS_PASSED,
static_cast<long int>(getInterval()));
if(forceHalt_) { if(forceHalt_) {
getLogger()->notice("This is emergency shutdown."); getLogger()->notice("This is emergency shutdown.");
getDownloadEngine()->requestForceHalt(); getDownloadEngine()->requestForceHalt();

View File

@ -94,7 +94,8 @@ void UTMetadataRequestExtensionMessage::doReceivedAction()
} else { } else {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat (StringFormat
("Metadata piece index is too big. piece=%d", getIndex()).str()); ("Metadata piece index is too big. piece=%lu",
static_cast<unsigned long>(getIndex())).str());
} }
} }

View File

@ -176,7 +176,8 @@ UTPexExtensionMessage::create(const unsigned char* data, size_t len)
{ {
if(len < 1) { if(len < 1) {
throw DL_ABORT_EX(StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE, throw DL_ABORT_EX(StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE,
EXTENSION_NAME.c_str(), len).str()); EXTENSION_NAME.c_str(),
static_cast<unsigned long>(len)).str());
} }
UTPexExtensionMessageHandle msg(new UTPexExtensionMessage(*data)); UTPexExtensionMessageHandle msg(new UTPexExtensionMessage(*data));

View File

@ -73,8 +73,9 @@ static std::string decoderawstring(std::istream& ss)
if(ss.gcount() != static_cast<int>(length)) { if(ss.gcount() != static_cast<int>(length)) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("Bencode decoding failed:" (StringFormat("Bencode decoding failed:"
" Expected %lu bytes of data, but only %d read.", " Expected %lu bytes of data, but only %ld read.",
static_cast<unsigned long>(length), ss.gcount()).str()); static_cast<unsigned long>(length),
static_cast<long int>(ss.gcount())).str());
} }
return str; return str;
} }

View File

@ -862,7 +862,8 @@ void assertPayloadLengthGreater
{ {
if(actual <= threshold) { if(actual <= threshold) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE, msgName.c_str(), actual).str()); (StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE, msgName.c_str(),
static_cast<unsigned long>(actual)).str());
} }
} }
@ -872,7 +873,8 @@ void assertPayloadLengthEqual
if(expected != actual) { if(expected != actual) {
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat(EX_INVALID_PAYLOAD_SIZE, msgName.c_str(), (StringFormat(EX_INVALID_PAYLOAD_SIZE, msgName.c_str(),
actual, expected).str()); static_cast<unsigned long>(actual),
static_cast<unsigned long>(expected)).str());
} }
} }

View File

@ -51,8 +51,8 @@
"CUID#%s - %d times attempted, but no success. Download aborted." "CUID#%s - %d times attempted, but no success. Download aborted."
#define MSG_SEND_PEER_MESSAGE "CUID#%s - To: %s:%d %s" #define MSG_SEND_PEER_MESSAGE "CUID#%s - To: %s:%d %s"
#define MSG_RECEIVE_PEER_MESSAGE "CUID#%s - From: %s:%d %s" #define MSG_RECEIVE_PEER_MESSAGE "CUID#%s - From: %s:%d %s"
#define MSG_GOT_NEW_PIECE "CUID#%s - we got new piece. index=%d" #define MSG_GOT_NEW_PIECE "CUID#%s - we got new piece. index=%lu"
#define MSG_GOT_WRONG_PIECE "CUID#%s - we got wrong piece. index=%d" #define MSG_GOT_WRONG_PIECE "CUID#%s - we got wrong piece. index=%lu"
#define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%s - Download not complete: %s" #define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%s - Download not complete: %s"
#define MSG_DOWNLOAD_ALREADY_COMPLETED _("GID#%s - Download has already completed: %s") #define MSG_DOWNLOAD_ALREADY_COMPLETED _("GID#%s - Download has already completed: %s")
#define MSG_RESOLVING_HOSTNAME "CUID#%s - Resolving hostname %s" #define MSG_RESOLVING_HOSTNAME "CUID#%s - Resolving hostname %s"
@ -63,23 +63,27 @@
#define MSG_DNS_CACHE_HIT "CUID#%s - DNS cache hit: %s -> %s" #define MSG_DNS_CACHE_HIT "CUID#%s - DNS cache hit: %s -> %s"
#define MSG_CONNECTING_TO_PEER "CUID#%s - Connecting to the peer %s" #define MSG_CONNECTING_TO_PEER "CUID#%s - Connecting to the peer %s"
#define MSG_PIECE_RECEIVED \ #define MSG_PIECE_RECEIVED \
"CUID#%s - Piece received. index=%d, begin=%d, length=%d, offset=%llu," \ "CUID#%s - Piece received. index=%lu, begin=%u, length=%u, offset=%lld," \
" blockIndex=%d" " blockIndex=%lu"
#define MSG_PIECE_BITFIELD "CUID#%s - Piece bitfield %s" #define MSG_PIECE_BITFIELD "CUID#%s - Piece bitfield %s"
#define MSG_REJECT_PIECE_CHOKED \ #define MSG_REJECT_PIECE_CHOKED \
"CUID#%s - Reject piece message in queue because the peer has been choked." \ "CUID#%s - Reject piece message in queue because the peer has been choked." \
" index=%d, begin=%d, length=%d" " index=%lu, begin=%u, length=%u"
#define MSG_REJECT_PIECE_CANCEL \ #define MSG_REJECT_PIECE_CANCEL \
"CUID#%s - Reject piece message in queue because cancel message received." \ "CUID#%s - Reject piece message in queue because cancel message received." \
" index=%d, begin=%d, length=%d" " index=%lu, begin=%u, length=%u"
#define MSG_FILE_VALIDATION_FAILURE \ #define MSG_FILE_VALIDATION_FAILURE \
"CUID#%s - Exception caught while validating file integrity." "CUID#%s - Exception caught while validating file integrity."
#define MSG_PEER_INTERESTED "CUID#%s - Interested in the peer" #define MSG_PEER_INTERESTED "CUID#%s - Interested in the peer"
#define MSG_PEER_NOT_INTERESTED "CUID#%s - Not interested in the peer" #define MSG_PEER_NOT_INTERESTED "CUID#%s - Not interested in the peer"
#define MSG_DELETING_REQUEST_SLOT "CUID#%s - Deleting request slot index=%d, blockIndex=%d" #define MSG_DELETING_REQUEST_SLOT "CUID#%s - Deleting request slot index=%lu," \
#define MSG_DELETING_REQUEST_SLOT_CHOKED "CUID#%s - Deleting request slot index=%d, blockIndex=%d because localhost got choked." " begin=%u, blockIndex=%lu"
#define MSG_DELETING_REQUEST_SLOT_TIMEOUT "CUID#%s - Deleting request slot blockIndex=%d because of time out" #define MSG_DELETING_REQUEST_SLOT_CHOKED "CUID#%s - Deleting request slot" \
#define MSG_DELETING_REQUEST_SLOT_ACQUIRED "CUID#%s - Deleting request slot blockIndex=%d because the block has been acquired." " index=%lu, begin=%u, blockIndex=%lu because localhost got choked."
#define MSG_DELETING_REQUEST_SLOT_TIMEOUT "CUID#%s - Deleting request slot" \
" index=%lu, begin=%u, blockIndex=%lu because of time out"
#define MSG_DELETING_REQUEST_SLOT_ACQUIRED "CUID#%s - Deleting request slot" \
" index=%lu, begin=%u, blockIndex=%lu because the block has been acquired."
#define MSG_FAST_EXTENSION_ENABLED "CUID#%s - Fast extension enabled." #define MSG_FAST_EXTENSION_ENABLED "CUID#%s - Fast extension enabled."
#define MSG_EXTENDED_MESSAGING_ENABLED "CUID#%s - Extended Messaging enabled." #define MSG_EXTENDED_MESSAGING_ENABLED "CUID#%s - Extended Messaging enabled."
#define MSG_FILE_ALLOCATION_FAILURE \ #define MSG_FILE_ALLOCATION_FAILURE \
@ -119,9 +123,9 @@
#define MSG_DELETING_USED_PIECE _("Deleting used piece index=%d, fillRate(%%)=%d<=%d") #define MSG_DELETING_USED_PIECE _("Deleting used piece index=%d, fillRate(%%)=%d<=%d")
#define MSG_SELECTIVE_DOWNLOAD_COMPLETED _("Download of selected files was complete.") #define MSG_SELECTIVE_DOWNLOAD_COMPLETED _("Download of selected files was complete.")
#define MSG_DOWNLOAD_COMPLETED _("The download was complete.") #define MSG_DOWNLOAD_COMPLETED _("The download was complete.")
#define MSG_REMOVED_HAVE_ENTRY _("Removed %d have entries.") #define MSG_REMOVED_HAVE_ENTRY _("Removed %lu have entries.")
#define MSG_VALIDATING_FILE _("Validating file %s") #define MSG_VALIDATING_FILE _("Validating file %s")
#define MSG_ALLOCATION_COMPLETED _("%d seconds to allocate %s byte(s)") #define MSG_ALLOCATION_COMPLETED _("%ld seconds to allocate %s byte(s)")
#define MSG_FILE_ALLOCATION_DISPATCH \ #define MSG_FILE_ALLOCATION_DISPATCH \
"Dispatching FileAllocationCommand for CUID#%s." "Dispatching FileAllocationCommand for CUID#%s."
#define MSG_METALINK_QUEUEING _("Metalink: Queueing %s for download.") #define MSG_METALINK_QUEUEING _("Metalink: Queueing %s for download.")
@ -141,13 +145,13 @@
#define MSG_RESOURCE_NOT_FOUND _("Resource not found") #define MSG_RESOURCE_NOT_FOUND _("Resource not found")
#define MSG_FILE_RENAMED _("File already exists. Renamed to %s.") #define MSG_FILE_RENAMED _("File already exists. Renamed to %s.")
#define MSG_CANNOT_PARSE_METALINK _("Cannot parse metalink XML file. XML may be malformed.") #define MSG_CANNOT_PARSE_METALINK _("Cannot parse metalink XML file. XML may be malformed.")
#define MSG_TOO_SMALL_PAYLOAD_SIZE _("Too small payload size for %s, size=%d.") #define MSG_TOO_SMALL_PAYLOAD_SIZE _("Too small payload size for %s, size=%lu.")
#define MSG_REMOVED_DEFUNCT_CONTROL_FILE _("Removed the defunct control file %s because the download file %s doesn't exist.") #define MSG_REMOVED_DEFUNCT_CONTROL_FILE _("Removed the defunct control file %s because the download file %s doesn't exist.")
#define MSG_SHARE_RATIO_REPORT _("Your share ratio was %.1f, uploaded/downloaded=%sB/%sB") #define MSG_SHARE_RATIO_REPORT _("Your share ratio was %.1f, uploaded/downloaded=%sB/%sB")
#define MSG_MISSING_BT_INFO _("Missing %s in torrent metainfo.") #define MSG_MISSING_BT_INFO _("Missing %s in torrent metainfo.")
#define MSG_NULL_TRACKER_RESPONSE _("Tracker returned null data.") #define MSG_NULL_TRACKER_RESPONSE _("Tracker returned null data.")
#define MSG_WINSOCK_INIT_FAILD _("Windows socket library initialization failed") #define MSG_WINSOCK_INIT_FAILD _("Windows socket library initialization failed")
#define MSG_TIME_HAS_PASSED _("%d second(s) has passed. Stopping application.") #define MSG_TIME_HAS_PASSED _("%ld second(s) has passed. Stopping application.")
#define MSG_SIGNATURE_SAVED _("Saved signature as %s. Please note that aria2" \ #define MSG_SIGNATURE_SAVED _("Saved signature as %s. Please note that aria2" \
" doesn't verify signatures.") " doesn't verify signatures.")
#define MSG_SIGNATURE_NOT_SAVED _("Saving signature as %s failed. Maybe file" \ #define MSG_SIGNATURE_NOT_SAVED _("Saving signature as %s failed. Maybe file" \
@ -247,15 +251,18 @@
#define EX_SOCKET_PEEK _("Failed to peek data, cause: %s") #define EX_SOCKET_PEEK _("Failed to peek data, cause: %s")
#define EX_SOCKET_UNKNOWN_ERROR _("Unknown socket error %d (0x%x)") #define EX_SOCKET_UNKNOWN_ERROR _("Unknown socket error %d (0x%x)")
#define EX_FILE_ALREADY_EXISTS _("File %s exists, but %s does not exist.") #define EX_FILE_ALREADY_EXISTS _("File %s exists, but %s does not exist.")
#define EX_INVALID_PAYLOAD_SIZE _("Invalid payload size for %s, size=%d. It should be %d.") #define EX_INVALID_PAYLOAD_SIZE \
_("Invalid payload size for %s, size=%lu. It should be %lu.")
#define EX_INVALID_BT_MESSAGE_ID _("Invalid ID=%d for %s. It should be %d.") #define EX_INVALID_BT_MESSAGE_ID _("Invalid ID=%d for %s. It should be %d.")
#define EX_INVALID_CHUNK_CHECKSUM _("Chunk checksum validation failed. checksumIndex=%d, offset=%s, expectedHash=%s, actualHash=%s") #define EX_INVALID_CHUNK_CHECKSUM _("Chunk checksum validation failed. checksumIndex=%lu, offset=%s, expectedHash=%s, actualHash=%s")
#define EX_DOWNLOAD_ABORTED _("Download aborted.") #define EX_DOWNLOAD_ABORTED _("Download aborted.")
#define EX_DUPLICATE_FILE_DOWNLOAD _("File %s is being downloaded by other command.") #define EX_DUPLICATE_FILE_DOWNLOAD _("File %s is being downloaded by other command.")
#define EX_INSUFFICIENT_CHECKSUM _("Insufficient checksums.") #define EX_INSUFFICIENT_CHECKSUM _("Insufficient checksums.")
#define EX_TRACKER_FAILURE _("Tracker returned failure reason: %s") #define EX_TRACKER_FAILURE _("Tracker returned failure reason: %s")
#define EX_FLOODING_DETECTED _("Flooding detected.") #define EX_FLOODING_DETECTED _("Flooding detected.")
#define EX_DROP_INACTIVE_CONNECTION _("Drop connection because no request/piece messages were exchanged in a certain period(%d seconds).") #define EX_DROP_INACTIVE_CONNECTION \
_("Drop connection because no request/piece messages were exchanged in a" \
" certain period(%ld seconds).")
#define EX_INFOHASH_MISMATCH_IN_SEGFILE _("The infoHash in torrent file doesn't match to one in .aria2 file.") #define EX_INFOHASH_MISMATCH_IN_SEGFILE _("The infoHash in torrent file doesn't match to one in .aria2 file.")
#define EX_NO_SUCH_FILE_ENTRY _("No such file entry %s") #define EX_NO_SUCH_FILE_ENTRY _("No such file entry %s")
#define EX_TOO_SLOW_DOWNLOAD_SPEED _("Too slow Downloading speed: %d <= %d(B/s), host:%s") #define EX_TOO_SLOW_DOWNLOAD_SPEED _("Too slow Downloading speed: %d <= %d(B/s), host:%s")