Replaced uint64_t with off_t or int64_t.

Since off_t is int64_t with LFS, we cannot take advantage of extra
capacity of uint64_t.
pull/4/head
Tatsuhiro Tsujikawa 2011-12-07 22:57:34 +09:00
parent f25e67b017
commit 12988e5282
127 changed files with 457 additions and 490 deletions

View File

@ -62,7 +62,7 @@ AbstractDiskWriter::~AbstractDiskWriter()
closeFile();
}
void AbstractDiskWriter::openFile(uint64_t totalLength)
void AbstractDiskWriter::openFile(off_t totalLength)
{
try {
openExistingFile(totalLength);
@ -83,7 +83,7 @@ void AbstractDiskWriter::closeFile()
}
}
void AbstractDiskWriter::openExistingFile(uint64_t totalLength)
void AbstractDiskWriter::openExistingFile(off_t totalLength)
{
int flags = O_BINARY;
if(readOnly_) {
@ -197,7 +197,7 @@ ssize_t AbstractDiskWriter::readData(unsigned char* data, size_t len, off_t offs
return ret;
}
void AbstractDiskWriter::truncate(uint64_t length)
void AbstractDiskWriter::truncate(off_t length)
{
if(fd_ == -1) {
throw DL_ABORT_EX("File not opened.");
@ -223,7 +223,7 @@ void AbstractDiskWriter::truncate(uint64_t length)
#endif
}
void AbstractDiskWriter::allocate(off_t offset, uint64_t length)
void AbstractDiskWriter::allocate(off_t offset, off_t length)
{
#ifdef HAVE_SOME_FALLOCATE
if(fd_ == -1) {
@ -272,7 +272,7 @@ void AbstractDiskWriter::allocate(off_t offset, uint64_t length)
#endif // HAVE_SOME_FALLOCATE
}
uint64_t AbstractDiskWriter::size()
off_t AbstractDiskWriter::size()
{
return File(filename_).size();
}

View File

@ -57,22 +57,22 @@ public:
AbstractDiskWriter(const std::string& filename);
virtual ~AbstractDiskWriter();
virtual void openFile(uint64_t totalLength = 0);
virtual void openFile(off_t totalLength = 0);
virtual void closeFile();
virtual void openExistingFile(uint64_t totalLength = 0);
virtual void openExistingFile(off_t totalLength = 0);
virtual void writeData(const unsigned char* data, size_t len, off_t offset);
virtual ssize_t readData(unsigned char* data, size_t len, off_t offset);
virtual void truncate(uint64_t length);
virtual void truncate(off_t length);
// File must be opened before calling this function.
virtual void allocate(off_t offset, uint64_t length);
virtual void allocate(off_t offset, off_t length);
virtual uint64_t size();
virtual off_t size();
virtual void enableReadOnly();

View File

@ -85,12 +85,12 @@ bool AbstractSingleDiskAdaptor::fileExists()
return File(getFilePath()).exists();
}
uint64_t AbstractSingleDiskAdaptor::size()
off_t AbstractSingleDiskAdaptor::size()
{
return File(getFilePath()).size();
}
void AbstractSingleDiskAdaptor::truncate(uint64_t length)
void AbstractSingleDiskAdaptor::truncate(off_t length)
{
diskWriter_->truncate(length);
}
@ -139,7 +139,7 @@ void AbstractSingleDiskAdaptor::setDiskWriter
diskWriter_ = diskWriter;
}
void AbstractSingleDiskAdaptor::setTotalLength(const uint64_t& totalLength)
void AbstractSingleDiskAdaptor::setTotalLength(const off_t& totalLength)
{
totalLength_ = totalLength;
}

View File

@ -45,7 +45,7 @@ class FileAllocationIterator;
class AbstractSingleDiskAdaptor : public DiskAdaptor {
private:
SharedHandle<DiskWriter> diskWriter_;
uint64_t totalLength_;
off_t totalLength_;
bool readOnly_;
public:
AbstractSingleDiskAdaptor();
@ -67,9 +67,9 @@ public:
virtual bool fileExists();
virtual uint64_t size();
virtual off_t size();
virtual void truncate(uint64_t length);
virtual void truncate(off_t length);
virtual SharedHandle<FileAllocationIterator> fileAllocationIterator();
@ -92,9 +92,9 @@ public:
return diskWriter_;
}
void setTotalLength(const uint64_t& totalLength);
void setTotalLength(const off_t& totalLength);
uint64_t getTotalLength() const
off_t getTotalLength() const
{
return totalLength_;
}

View File

@ -45,7 +45,7 @@
namespace aria2 {
AdaptiveFileAllocationIterator::AdaptiveFileAllocationIterator
(BinaryStream* stream, off_t offset, uint64_t totalLength)
(BinaryStream* stream, off_t offset, off_t totalLength)
: stream_(stream),
offset_(offset),
totalLength_(totalLength)
@ -59,8 +59,8 @@ void AdaptiveFileAllocationIterator::allocateChunk()
#ifdef HAVE_FALLOCATE
try {
A2_LOG_DEBUG("Testing file system supports fallocate.");
if(static_cast<uint64_t>(offset_) < totalLength_) {
off_t len = std::min(totalLength_-offset_, static_cast<uint64_t>(4096));
if(offset_ < totalLength_) {
off_t len = std::min(totalLength_-offset_, static_cast<off_t>(4096));
stream_->allocate(offset_, len);
offset_ += len;
}
@ -89,7 +89,7 @@ void AdaptiveFileAllocationIterator::allocateChunk()
bool AdaptiveFileAllocationIterator::finished()
{
if(!allocator_) {
return (uint64_t)offset_ == totalLength_;
return offset_ == totalLength_;
} else {
return allocator_->finished();
}
@ -104,7 +104,7 @@ off_t AdaptiveFileAllocationIterator::getCurrentLength()
}
}
uint64_t AdaptiveFileAllocationIterator::getTotalLength()
off_t AdaptiveFileAllocationIterator::getTotalLength()
{
return totalLength_;
}

View File

@ -50,10 +50,10 @@ private:
off_t offset_;
uint64_t totalLength_;
off_t totalLength_;
public:
AdaptiveFileAllocationIterator
(BinaryStream* stream, off_t offset, uint64_t totalLength);
(BinaryStream* stream, off_t offset, off_t totalLength);
virtual ~AdaptiveFileAllocationIterator();
@ -63,7 +63,7 @@ public:
virtual off_t getCurrentLength();
virtual uint64_t getTotalLength();
virtual off_t getTotalLength();
};
} // namespace aria2

View File

@ -53,11 +53,11 @@ public:
// Truncates a file to given length. The default implementation does
// nothing.
virtual void truncate(uint64_t length) {}
virtual void truncate(off_t length) {}
// Allocates given length bytes of disk space from given offset. The
// default implementation does nothing.
virtual void allocate(off_t offset, uint64_t length) {}
virtual void allocate(off_t offset, off_t length) {}
};
typedef SharedHandle<BinaryStream> BinaryStreamHandle;

View File

@ -44,7 +44,7 @@ using namespace aria2::expr;
namespace aria2 {
BitfieldMan::BitfieldMan(size_t blockLength, uint64_t totalLength)
BitfieldMan::BitfieldMan(size_t blockLength, off_t totalLength)
:blockLength_(blockLength),
totalLength_(totalLength),
bitfieldLength_(0),
@ -275,8 +275,8 @@ bool getSparseMissingUnusedIndex
} else {
if((!bitfield::test(useBitfield, blocks, maxRange.startIndex-1) &&
bitfield::test(bitfield, blocks, maxRange.startIndex-1)) ||
((uint64_t)(maxRange.endIndex-maxRange.startIndex)*blockLength_
>= minSplitSize)) {
(static_cast<uint64_t>(maxRange.endIndex-maxRange.startIndex)*
blockLength_ >= minSplitSize)) {
index = maxRange.startIndex;
return true;
} else {
@ -663,7 +663,7 @@ void BitfieldMan::ensureFilterBitfield()
}
}
void BitfieldMan::addFilter(uint64_t offset, uint64_t length) {
void BitfieldMan::addFilter(off_t offset, off_t length) {
ensureFilterBitfield();
if(length > 0) {
size_t startBlock = offset/blockLength_;
@ -675,7 +675,7 @@ void BitfieldMan::addFilter(uint64_t offset, uint64_t length) {
updateCache();
}
void BitfieldMan::removeFilter(uint64_t offset, uint64_t length) {
void BitfieldMan::removeFilter(off_t offset, off_t length) {
ensureFilterBitfield();
if(length > 0) {
size_t startBlock = offset/blockLength_;
@ -687,7 +687,7 @@ void BitfieldMan::removeFilter(uint64_t offset, uint64_t length) {
updateCache();
}
void BitfieldMan::addNotFilter(uint64_t offset, uint64_t length)
void BitfieldMan::addNotFilter(off_t offset, off_t length)
{
ensureFilterBitfield();
if(length > 0 && blocks_ > 0) {
@ -726,7 +726,7 @@ void BitfieldMan::clearFilter() {
updateCache();
}
uint64_t BitfieldMan::getFilteredTotalLengthNow() const {
off_t BitfieldMan::getFilteredTotalLengthNow() const {
if(!filterBitfield_) {
return 0;
}
@ -735,13 +735,13 @@ uint64_t BitfieldMan::getFilteredTotalLengthNow() const {
return 0;
}
if(bitfield::test(filterBitfield_, blocks_, blocks_-1)) {
return ((uint64_t)filteredBlocks-1)*blockLength_+getLastBlockLength();
return ((off_t)filteredBlocks-1)*blockLength_+getLastBlockLength();
} else {
return ((uint64_t)filteredBlocks)*blockLength_;
return ((off_t)filteredBlocks)*blockLength_;
}
}
uint64_t BitfieldMan::getCompletedLength(bool useFilter) const {
off_t BitfieldMan::getCompletedLength(bool useFilter) const {
unsigned char* temp;
if(useFilter) {
temp = new unsigned char[bitfieldLength_];
@ -755,14 +755,15 @@ uint64_t BitfieldMan::getCompletedLength(bool useFilter) const {
temp = bitfield_;
}
size_t completedBlocks = bitfield::countSetBit(temp, blocks_);
uint64_t completedLength = 0;
off_t completedLength = 0;
if(completedBlocks == 0) {
completedLength = 0;
} else {
if(bitfield::test(temp, blocks_, blocks_-1)) {
completedLength = ((uint64_t)completedBlocks-1)*blockLength_+getLastBlockLength();
completedLength =
((off_t)completedBlocks-1)*blockLength_+getLastBlockLength();
} else {
completedLength = ((uint64_t)completedBlocks)*blockLength_;
completedLength = ((off_t)completedBlocks)*blockLength_;
}
}
if(useFilter) {
@ -771,11 +772,11 @@ uint64_t BitfieldMan::getCompletedLength(bool useFilter) const {
return completedLength;
}
uint64_t BitfieldMan::getCompletedLengthNow() const {
off_t BitfieldMan::getCompletedLengthNow() const {
return getCompletedLength(false);
}
uint64_t BitfieldMan::getFilteredCompletedLengthNow() const {
off_t BitfieldMan::getFilteredCompletedLengthNow() const {
return getCompletedLength(true);
}
@ -814,7 +815,7 @@ void BitfieldMan::setBitRange(size_t startIndex, size_t endIndex)
updateCache();
}
bool BitfieldMan::isBitSetOffsetRange(uint64_t offset, uint64_t length) const
bool BitfieldMan::isBitSetOffsetRange(off_t offset, off_t length) const
{
if(length <= 0) {
return false;
@ -835,11 +836,11 @@ bool BitfieldMan::isBitSetOffsetRange(uint64_t offset, uint64_t length) const
return true;
}
uint64_t BitfieldMan::getOffsetCompletedLength
(uint64_t offset,
uint64_t length) const
off_t BitfieldMan::getOffsetCompletedLength
(off_t offset,
off_t length) const
{
uint64_t res = 0;
off_t res = 0;
if(length == 0 || totalLength_ <= offset) {
return 0;
}
@ -868,12 +869,12 @@ uint64_t BitfieldMan::getOffsetCompletedLength
return res;
}
uint64_t BitfieldMan::getMissingUnusedLength(size_t startingIndex) const
off_t BitfieldMan::getMissingUnusedLength(size_t startingIndex) const
{
if(startingIndex < 0 || blocks_ <= startingIndex) {
return 0;
}
uint64_t length = 0;
off_t length = 0;
for(size_t i = startingIndex; i < blocks_; ++i) {
if(isBitSet(i) || isUseBitSet(i)) {
break;

View File

@ -46,7 +46,7 @@ namespace aria2 {
class BitfieldMan {
private:
size_t blockLength_;
uint64_t totalLength_;
off_t totalLength_;
size_t bitfieldLength_;
size_t blocks_;
bool filterEnabled_;
@ -57,9 +57,9 @@ private:
// for caching
size_t cachedNumMissingBlock_;
size_t cachedNumFilteredBlock_;
uint64_t cachedCompletedLength_;
uint64_t cachedFilteredCompletedLength_;
uint64_t cachedFilteredTotalLength_;
off_t cachedCompletedLength_;
off_t cachedFilteredCompletedLength_;
off_t cachedFilteredTotalLength_;
bool setBitInternal(unsigned char* bitfield, size_t index, bool on);
bool setFilterBit(size_t index);
@ -67,7 +67,7 @@ private:
size_t getStartIndex(size_t index) const;
size_t getEndIndex(size_t index) const;
uint64_t getCompletedLength(bool useFilter) const;
off_t getCompletedLength(bool useFilter) const;
// If filterBitfield_ is 0, allocate bitfieldLength_ bytes to it and
// set 0 to all bytes.
@ -84,7 +84,7 @@ public:
bool operator==(const Range& range) const;
};
public:
BitfieldMan(size_t blockLength, uint64_t totalLength);
BitfieldMan(size_t blockLength, off_t totalLength);
BitfieldMan(const BitfieldMan& bitfieldMan);
~BitfieldMan();
@ -99,7 +99,7 @@ public:
size_t getBlockLength(size_t index) const;
uint64_t getTotalLength() const { return totalLength_; }
off_t getTotalLength() const { return totalLength_; }
// Returns true iff there is a bit index which is set in bitfield_,
// but not set in this object.
@ -238,10 +238,10 @@ public:
void clearAllUseBit();
void setAllUseBit();
void addFilter(uint64_t offset, uint64_t length);
void removeFilter(uint64_t offset, uint64_t length);
void addFilter(off_t offset, off_t length);
void removeFilter(off_t offset, off_t length);
// Add filter not in the range of [offset, offset+length) bytes
void addNotFilter(uint64_t offset, uint64_t length);
void addNotFilter(off_t offset, off_t length);
// Clears filter and disables filter
void clearFilter();
@ -254,29 +254,29 @@ public:
}
// affected by filter
uint64_t getFilteredTotalLength() const
off_t getFilteredTotalLength() const
{
return cachedFilteredTotalLength_;
}
// affected by filter
uint64_t getFilteredTotalLengthNow() const;
off_t getFilteredTotalLengthNow() const;
uint64_t getCompletedLength() const
off_t getCompletedLength() const
{
return cachedCompletedLength_;
}
uint64_t getCompletedLengthNow() const;
off_t getCompletedLengthNow() const;
// affected by filter
uint64_t getFilteredCompletedLength() const
off_t getFilteredCompletedLength() const
{
return cachedFilteredCompletedLength_;
}
// affected by filter
uint64_t getFilteredCompletedLengthNow() const;
off_t getFilteredCompletedLengthNow() const;
void updateCache();
@ -286,13 +286,13 @@ public:
void setBitRange(size_t startIndex, size_t endIndex);
bool isBitSetOffsetRange(uint64_t offset, uint64_t length) const;
bool isBitSetOffsetRange(off_t offset, off_t length) const;
// Returns completed length in bytes in range [offset,
// offset+length). This function will not affected by filter.
uint64_t getOffsetCompletedLength(uint64_t offset, uint64_t length) const;
off_t getOffsetCompletedLength(off_t offset, off_t length) const;
uint64_t getMissingUnusedLength(size_t startingIndex) const;
off_t getMissingUnusedLength(size_t startingIndex) const;
const unsigned char* getFilterBitfield() const
{

View File

@ -42,7 +42,7 @@ namespace aria2 {
class BtRuntime {
private:
uint64_t uploadLengthAtStartup_;
off_t uploadLengthAtStartup_;
bool halt_;
unsigned int connections_;
bool ready_;
@ -60,11 +60,11 @@ public:
~BtRuntime();
uint64_t getUploadLengthAtStartup() const {
off_t getUploadLengthAtStartup() const {
return uploadLengthAtStartup_;
}
void setUploadLengthAtStartup(uint64_t length) {
void setUploadLengthAtStartup(off_t length) {
uploadLengthAtStartup_ = length;
}

View File

@ -50,16 +50,16 @@ void ByteArrayDiskWriter::clear()
buf_.str(A2STR::NIL);
}
void ByteArrayDiskWriter::initAndOpenFile(uint64_t totalLength)
void ByteArrayDiskWriter::initAndOpenFile(off_t totalLength)
{
clear();
}
void ByteArrayDiskWriter::openFile(uint64_t totalLength) {}
void ByteArrayDiskWriter::openFile(off_t totalLength) {}
void ByteArrayDiskWriter::closeFile() {}
void ByteArrayDiskWriter::openExistingFile(uint64_t totalLength)
void ByteArrayDiskWriter::openExistingFile(off_t totalLength)
{
openFile();
}
@ -70,10 +70,10 @@ void ByteArrayDiskWriter::writeData(const unsigned char* data, size_t dataLength
throw DL_ABORT_EX(fmt("Maximum length(%lu) exceeded.",
static_cast<unsigned long>(maxLength_)));
}
uint64_t length = size();
if(length < (uint64_t)position) {
off_t length = size();
if(length < position) {
buf_.seekp(length, std::ios::beg);
for(uint64_t i = length; i < (uint64_t)position; ++i) {
for(off_t i = length; i < position; ++i) {
buf_.put('\0');
}
} else {
@ -90,7 +90,7 @@ ssize_t ByteArrayDiskWriter::readData(unsigned char* data, size_t len, off_t pos
return buf_.gcount();
}
uint64_t ByteArrayDiskWriter::size()
off_t ByteArrayDiskWriter::size()
{
buf_.seekg(0, std::ios::end);
buf_.clear();

View File

@ -49,18 +49,18 @@ public:
ByteArrayDiskWriter(size_t maxLength = 5*1024*1024);
virtual ~ByteArrayDiskWriter();
virtual void initAndOpenFile(uint64_t totalLength = 0);
virtual void initAndOpenFile(off_t totalLength = 0);
virtual void openFile(uint64_t totalLength = 0);
virtual void openFile(off_t totalLength = 0);
virtual void closeFile();
virtual void openExistingFile(uint64_t totalLength = 0);
virtual void openExistingFile(off_t totalLength = 0);
virtual void writeData(const unsigned char* data, size_t len, off_t position);
virtual ssize_t readData(unsigned char* data, size_t len, off_t position);
virtual uint64_t size();
virtual off_t size();
void setString(const std::string& s);

View File

@ -56,7 +56,7 @@ void CheckIntegrityEntry::validateChunk()
validator_->validateChunk();
}
uint64_t CheckIntegrityEntry::getTotalLength()
off_t CheckIntegrityEntry::getTotalLength()
{
if(!validator_) {
return 0;

View File

@ -61,7 +61,7 @@ public:
virtual ~CheckIntegrityEntry();
virtual uint64_t getTotalLength();
virtual off_t getTotalLength();
virtual off_t getCurrentLength();

View File

@ -56,9 +56,9 @@ bool ChunkChecksum::validateChunk
return !digest.empty() && actualDigest == digest;
}
uint64_t ChunkChecksum::getEstimatedDataLength() const
off_t ChunkChecksum::getEstimatedDataLength() const
{
return static_cast<uint64_t>(pieceLength_)*pieceHashes_.size();
return static_cast<off_t>(pieceLength_)*pieceHashes_.size();
}
size_t ChunkChecksum::countPieceHash() const

View File

@ -60,7 +60,7 @@ public:
bool validateChunk(const std::string& actualDigest,
size_t index) const;
uint64_t getEstimatedDataLength() const;
off_t getEstimatedDataLength() const;
size_t countPieceHash() const;

View File

@ -96,8 +96,11 @@ bool ChunkedDecodingStreamFilter::readChunkSize
if(extPos == std::string::npos || crlfPos < extPos) {
extPos = crlfPos;
}
chunkSize_ = util::parseULLInt
chunkSize_ = util::parseLLInt
(std::string(buf_.begin(), buf_.begin()+extPos), 16);
if(chunkSize_ < 0) {
throw DL_ABORT_EX("Chunk size must be positive");
}
assert(crlfPos+2 > pbufSize);
inbufOffset += crlfPos+2-pbufSize;
buf_.clear();
@ -155,8 +158,8 @@ bool ChunkedDecodingStreamFilter::readData
const SharedHandle<BinaryStream>& out,
const SharedHandle<Segment>& segment)
{
uint64_t readlen =
std::min(chunkSize_, static_cast<uint64_t>(inlen-inbufOffset));
off_t readlen =
std::min(chunkSize_, static_cast<off_t>(inlen-inbufOffset));
outlen += getDelegate()->transform(out, segment, inbuf+inbufOffset, readlen);
chunkSize_ -= readlen;
inbufOffset += readlen;

View File

@ -59,7 +59,7 @@ private:
std::string buf_;
uint64_t chunkSize_;
off_t chunkSize_;
size_t bytesProcessed_;

View File

@ -142,7 +142,7 @@ std::string DefaultBtAnnounce::getAnnounceUrl() {
numWant = 0;
}
TransferStat stat = peerStorage_->calculateStat();
uint64_t left =
off_t left =
pieceStorage_->getTotalLength()-pieceStorage_->getCompletedLength();
// Use last 8 bytes of peer ID as a key
const size_t keyLen = 8;

View File

@ -275,7 +275,7 @@ void DefaultBtProgressInfoFile::load()
if(version >= 1) {
totalLength = ntoh64(totalLength);
}
if(totalLength != dctx_->getTotalLength()) {
if(totalLength != static_cast<uint64_t>(dctx_->getTotalLength())) {
throw DL_ABORT_EX
(fmt("total length mismatch. expected: %lld, actual: %lld",
static_cast<long long int>(dctx_->getTotalLength()),

View File

@ -41,7 +41,7 @@ DefaultDiskWriter::DefaultDiskWriter(const std::string& filename):
DefaultDiskWriter::~DefaultDiskWriter() {}
void DefaultDiskWriter::initAndOpenFile(uint64_t totalLength)
void DefaultDiskWriter::initAndOpenFile(off_t totalLength)
{
createFile();
}

View File

@ -45,7 +45,7 @@ public:
virtual ~DefaultDiskWriter();
virtual void initAndOpenFile(uint64_t totalLength = 0);
virtual void initAndOpenFile(off_t totalLength = 0);
};
typedef SharedHandle<DefaultDiskWriter> DefaultDiskWriterHandle;

View File

@ -60,8 +60,8 @@ const size_t MAX_PEER_LIST_UPDATE = 100;
DefaultPeerStorage::DefaultPeerStorage()
: maxPeerListSize_(MAX_PEER_LIST_SIZE),
removedPeerSessionDownloadLength_(0),
removedPeerSessionUploadLength_(0),
removedPeerSessionDownloadLength_(0LL),
removedPeerSessionUploadLength_(0LL),
seederStateChoke_(new BtSeederStateChoke()),
leecherStateChoke_(new BtLeecherStateChoke()),
lastTransferStatMapUpdated_(0)

View File

@ -56,8 +56,8 @@ private:
size_t maxPeerListSize_;
std::deque<SharedHandle<Peer> > peers_;
std::deque<SharedHandle<Peer> > droppedPeers_;
uint64_t removedPeerSessionDownloadLength_;
uint64_t removedPeerSessionUploadLength_;
int64_t removedPeerSessionDownloadLength_;
int64_t removedPeerSessionUploadLength_;
BtSeederStateChoke* seederStateChoke_;
BtLeecherStateChoke* leecherStateChoke_;

View File

@ -518,28 +518,28 @@ bool DefaultPieceStorage::isPieceUsed(size_t index)
return bitfieldMan_->isUseBitSet(index);
}
uint64_t DefaultPieceStorage::getTotalLength()
off_t DefaultPieceStorage::getTotalLength()
{
return bitfieldMan_->getTotalLength();
}
uint64_t DefaultPieceStorage::getFilteredTotalLength()
off_t DefaultPieceStorage::getFilteredTotalLength()
{
return bitfieldMan_->getFilteredTotalLength();
}
uint64_t DefaultPieceStorage::getCompletedLength()
off_t DefaultPieceStorage::getCompletedLength()
{
uint64_t completedLength =
off_t completedLength =
bitfieldMan_->getCompletedLength()+getInFlightPieceCompletedLength();
uint64_t totalLength = getTotalLength();
off_t totalLength = getTotalLength();
if(completedLength > totalLength) {
completedLength = totalLength;
}
return completedLength;
}
uint64_t DefaultPieceStorage::getFilteredCompletedLength()
off_t DefaultPieceStorage::getFilteredCompletedLength()
{
return bitfieldMan_->getFilteredCompletedLength()+
getInFlightPieceCompletedLength();
@ -712,7 +712,7 @@ void DefaultPieceStorage::markAllPiecesDone()
bitfieldMan_->setAllBit();
}
void DefaultPieceStorage::markPiecesDone(uint64_t length)
void DefaultPieceStorage::markPiecesDone(off_t length)
{
if(length == bitfieldMan_->getTotalLength()) {
bitfieldMan_->setAllBit();

View File

@ -187,13 +187,13 @@ public:
virtual bool isPieceUsed(size_t index);
virtual uint64_t getTotalLength();
virtual off_t getTotalLength();
virtual uint64_t getFilteredTotalLength();
virtual off_t getFilteredTotalLength();
virtual uint64_t getCompletedLength();
virtual off_t getCompletedLength();
virtual uint64_t getFilteredCompletedLength();
virtual off_t getFilteredCompletedLength();
virtual void initStorage();
@ -246,7 +246,7 @@ public:
virtual void markAllPiecesDone();
virtual void markPiecesDone(uint64_t length);
virtual void markPiecesDone(off_t length);
virtual void markPieceMissing(size_t index);

View File

@ -66,7 +66,7 @@ public:
virtual bool fileExists() = 0;
virtual uint64_t size() = 0;
virtual off_t size() = 0;
template<typename InputIterator>
void setFileEntries(InputIterator first, InputIterator last)

View File

@ -51,9 +51,9 @@ public:
/**
* Opens file. If the file exists, then it is truncated to 0 length.
*/
virtual void initAndOpenFile(uint64_t totalLength = 0) = 0;
virtual void initAndOpenFile(off_t totalLength = 0) = 0;
virtual void openFile(uint64_t totalLength = 0) = 0;
virtual void openFile(off_t totalLength = 0) = 0;
/**
* Closes this output stream.
@ -65,10 +65,10 @@ public:
* Opens a file. If the file doesnot exists, an exception may be
* thrown.
*/
virtual void openExistingFile(uint64_t totalLength = 0) = 0;
virtual void openExistingFile(off_t totalLength = 0) = 0;
// Returns file length
virtual uint64_t size() = 0;
virtual off_t size() = 0;
// Enables read-only mode. After this call, openExistingFile() opens
// file in read-only mode. This is an optional functionality. The

View File

@ -146,8 +146,8 @@ bool DownloadCommand::executeInternal() {
size_t bufSize;
if(sinkFilterOnly_) {
if(segment->getLength() > 0) {
if(static_cast<uint64_t>(segment->getPosition()+segment->getLength()) <=
static_cast<uint64_t>(getFileEntry()->getLastOffset())) {
if(static_cast<off_t>(segment->getPosition()+segment->getLength()) <=
getFileEntry()->getLastOffset()) {
bufSize = std::min(segment->getLength()-segment->getWrittenLength(),
getSocketRecvBuffer()->getBufferLength());
} else {

View File

@ -57,7 +57,7 @@ DownloadContext::DownloadContext():
metalinkServerContacted_(false) {}
DownloadContext::DownloadContext(size_t pieceLength,
uint64_t totalLength,
off_t totalLength,
const std::string& path):
pieceLength_(pieceLength),
checksumVerified_(false),
@ -98,9 +98,7 @@ SharedHandle<FileEntry>
DownloadContext::findFileEntryByOffset(off_t offset) const
{
if(fileEntries_.empty() ||
(offset > 0 &&
fileEntries_.back()->getOffset()+fileEntries_.back()->getLength() <=
static_cast<uint64_t>(offset))){
(offset > 0 && fileEntries_.back()->getLastOffset() <= offset)) {
return SharedHandle<FileEntry>();
}
@ -200,7 +198,7 @@ size_t DownloadContext::getNumPieces() const
}
}
uint64_t DownloadContext::getTotalLength() const
off_t DownloadContext::getTotalLength() const
{
if(fileEntries_.empty()) {
return 0;

View File

@ -93,7 +93,7 @@ public:
// Convenient constructor that creates single file download. path
// should be escaped with util::escapePath(...).
DownloadContext(size_t pieceLength,
uint64_t totalLength,
off_t totalLength,
const std::string& path = A2STR::NIL);
~DownloadContext();
@ -114,7 +114,7 @@ public:
pieceHashes_.assign(first, last);
}
uint64_t getTotalLength() const;
off_t getTotalLength() const;
bool knowsTotalLength() const { return knowsTotalLength_; }

View File

@ -79,11 +79,11 @@ struct DownloadResult
SharedHandle<MetadataInfo> metadataInfo;
uint64_t totalLength;
off_t totalLength;
uint64_t completedLength;
off_t completedLength;
uint64_t uploadLength;
off_t uploadLength;
std::string bitfield;

View File

@ -38,12 +38,12 @@
namespace aria2 {
FallocFileAllocationIterator::FallocFileAllocationIterator
(BinaryStream* stream, off_t offset, uint64_t totalLength):
(BinaryStream* stream, off_t offset, off_t totalLength):
stream_(stream), offset_(offset), totalLength_(totalLength) {}
void FallocFileAllocationIterator::allocateChunk()
{
if(static_cast<uint64_t>(offset_) < totalLength_) {
if(offset_ < totalLength_) {
stream_->allocate(offset_, totalLength_-offset_);
offset_ = totalLength_;
} else {
@ -54,7 +54,7 @@ void FallocFileAllocationIterator::allocateChunk()
bool FallocFileAllocationIterator::finished()
{
return static_cast<uint64_t>(offset_) == totalLength_;
return offset_ == totalLength_;
}
off_t FallocFileAllocationIterator::getCurrentLength()
@ -62,7 +62,7 @@ off_t FallocFileAllocationIterator::getCurrentLength()
return offset_;
}
uint64_t FallocFileAllocationIterator::getTotalLength()
off_t FallocFileAllocationIterator::getTotalLength()
{
return totalLength_;
}

View File

@ -45,10 +45,10 @@ class FallocFileAllocationIterator:public FileAllocationIterator {
private:
BinaryStream* stream_;
off_t offset_;
uint64_t totalLength_;
off_t totalLength_;
public:
FallocFileAllocationIterator(BinaryStream* stream, off_t offset,
uint64_t totalLength);
off_t totalLength);
virtual void allocateChunk();
@ -56,7 +56,7 @@ public:
virtual off_t getCurrentLength();
virtual uint64_t getTotalLength();
virtual off_t getTotalLength();
};
} // namespace aria2

View File

@ -103,7 +103,7 @@ bool File::remove() {
}
}
uint64_t File::size() {
off_t File::size() {
a2_struct_stat fstat;
if(fillStat(fstat) < 0) {
return 0;

View File

@ -94,7 +94,7 @@ public:
*/
bool mkdirs();
uint64_t size();
off_t size();
mode_t mode();

View File

@ -54,7 +54,7 @@ off_t FileAllocationEntry::getCurrentLength()
return fileAllocationIterator_->getCurrentLength();
}
uint64_t FileAllocationEntry::getTotalLength()
off_t FileAllocationEntry::getTotalLength()
{
return fileAllocationIterator_->getTotalLength();
}

View File

@ -56,7 +56,7 @@ public:
virtual off_t getCurrentLength();
virtual uint64_t getTotalLength();
virtual off_t getTotalLength();
virtual bool finished();

View File

@ -52,7 +52,7 @@ public:
virtual off_t getCurrentLength() = 0;
virtual uint64_t getTotalLength() = 0;
virtual off_t getTotalLength() = 0;
};
} // namespace aria2

View File

@ -53,7 +53,7 @@ namespace aria2 {
FileEntry::FileEntry
(const std::string& path,
uint64_t length,
off_t length,
off_t offset,
const std::vector<std::string>& uris)
: path_(path),

View File

@ -61,7 +61,7 @@ private:
std::string path_;
std::deque<std::string> uris_;
std::deque<std::string> spentUris_;
uint64_t length_;
off_t length_;
off_t offset_;
bool requested_;
std::deque<SharedHandle<Request> > requestPool_;
@ -79,7 +79,7 @@ private:
public:
FileEntry();
FileEntry(const std::string& path, uint64_t length, off_t offset,
FileEntry(const std::string& path, off_t length, off_t offset,
const std::vector<std::string>& uris = std::vector<std::string>());
~FileEntry();
@ -94,9 +94,9 @@ public:
void setPath(const std::string& path);
uint64_t getLength() const { return length_; }
off_t getLength() const { return length_; }
void setLength(uint64_t length) { length_ = length; }
void setLength(off_t length) { length_ = length; }
off_t getOffset() const { return offset_; }

View File

@ -400,14 +400,17 @@ unsigned int FtpConnection::receiveResponse()
# define ULONGLONG_SCANF "%Lu"
#endif // __MINGW32__
unsigned int FtpConnection::receiveSizeResponse(uint64_t& size)
unsigned int FtpConnection::receiveSizeResponse(off_t& size)
{
std::pair<unsigned int, std::string> response;
if(bulkReceiveResponse(response)) {
if(response.first == 213) {
std::pair<Sip, Sip> rp;
util::divide(rp, response.second.begin(), response.second.end(), ' ');
size = util::parseULLInt(std::string(rp.second.first, rp.second.second));
size = util::parseLLInt(std::string(rp.second.first, rp.second.second));
if(size < 0) {
throw DL_ABORT_EX("Size must be positive");
}
}
return response.first;
} else {

View File

@ -102,7 +102,7 @@ public:
bool sendRetr();
unsigned int receiveResponse();
unsigned int receiveSizeResponse(uint64_t& size);
unsigned int receiveSizeResponse(off_t& size);
// Returns status code of MDTM reply. If the status code is 213, parses
// time-val and store it in time.
// If a code other than 213 is returned, time is not touched.

View File

@ -364,7 +364,7 @@ bool FtpNegotiationCommand::sendSize() {
return false;
}
bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
bool FtpNegotiationCommand::onFileSizeDetermined(off_t totalLength)
{
getFileEntry()->setLength(totalLength);
if(getFileEntry()->getPath().empty()) {
@ -464,7 +464,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
}
bool FtpNegotiationCommand::recvSize() {
uint64_t size = 0;
off_t size = 0;
unsigned int status = ftp_->receiveSizeResponse(size);
if(status == 0) {
return false;

View File

@ -137,7 +137,7 @@ private:
void poolConnection() const;
bool onFileSizeDetermined(uint64_t totalLength);
bool onFileSizeDetermined(off_t totalLength);
void onDryRunFileFound();

View File

@ -108,16 +108,23 @@ HttpHeader::equalRange(const std::string& name) const
return table_.equal_range(name);
}
unsigned int HttpHeader::findAsUInt(const std::string& name) const {
return findAsULLInt(name);
}
uint64_t HttpHeader::findAsULLInt(const std::string& name) const {
int32_t HttpHeader::findAsInt(const std::string& name) const
{
const std::string& value = find(name);
if(value.empty()) {
return 0;
} else {
return util::parseULLInt(value);
return util::parseInt(value);
}
}
int64_t HttpHeader::findAsLLInt(const std::string& name) const
{
const std::string& value = find(name);
if(value.empty()) {
return 0;
} else {
return util::parseLLInt(value);
}
}
@ -129,7 +136,10 @@ RangeHandle HttpHeader::getRange() const
if(clenStr.empty()) {
return SharedHandle<Range>(new Range());
} else {
uint64_t contentLength = util::parseULLInt(clenStr);
off_t contentLength = util::parseLLInt(clenStr);
if(contentLength < 0) {
throw DL_ABORT_EX("Content-Length must be positive");
}
if(contentLength == 0) {
return SharedHandle<Range>(new Range());
} else {
@ -168,8 +178,11 @@ RangeHandle HttpHeader::getRange() const
}
off_t startByte = util::parseLLInt(std::string(byteRangeSpec, minus));
off_t endByte = util::parseLLInt(std::string(minus+1, slash));
uint64_t entityLength =
util::parseULLInt(std::string(slash+1, rangeStr.end()));
off_t entityLength =
util::parseLLInt(std::string(slash+1, rangeStr.end()));
if(startByte < 0 || endByte < 0 || entityLength < 0) {
throw DL_ABORT_EX("byte-range-spec must be positive");
}
return SharedHandle<Range>(new Range(startByte, endByte, entityLength));
}

View File

@ -73,8 +73,8 @@ public:
std::pair<std::multimap<std::string, std::string>::const_iterator,
std::multimap<std::string, std::string>::const_iterator>
equalRange(const std::string& name) const;
unsigned int findAsUInt(const std::string& name) const;
uint64_t findAsULLInt(const std::string& name) const;
int32_t findAsInt(const std::string& name) const;
int64_t findAsLLInt(const std::string& name) const;
SharedHandle<Range> getRange() const;

View File

@ -368,7 +368,7 @@ const SharedHandle<AuthConfig>& HttpRequest::getAuthConfig() const
return authConfig_;
}
uint64_t HttpRequest::getEntityLength() const
off_t HttpRequest::getEntityLength() const
{
assert(fileEntry_);
return fileEntry_->getLength();

View File

@ -105,7 +105,7 @@ public:
void setRequest(const SharedHandle<Request>& request);
uint64_t getEntityLength() const;
off_t getEntityLength() const;
const std::string& getHost() const;

View File

@ -86,7 +86,7 @@ SharedHandle<HttpRequest>
createHttpRequest(const SharedHandle<Request>& req,
const SharedHandle<FileEntry>& fileEntry,
const SharedHandle<Segment>& segment,
uint64_t totalLength,
off_t totalLength,
const SharedHandle<Option>& option,
const RequestGroup* rg,
const SharedHandle<CookieStorage>& cookieStorage,

View File

@ -227,7 +227,7 @@ SharedHandle<StreamFilter> HttpResponse::getContentEncodingStreamFilter() const
return filter;
}
uint64_t HttpResponse::getContentLength() const
off_t HttpResponse::getContentLength() const
{
if(!httpHeader_) {
return 0;
@ -236,7 +236,7 @@ uint64_t HttpResponse::getContentLength() const
}
}
uint64_t HttpResponse::getEntityLength() const
off_t HttpResponse::getEntityLength() const
{
if(!httpHeader_) {
return 0;
@ -279,7 +279,7 @@ bool HttpResponse::hasRetryAfter() const
time_t HttpResponse::getRetryAfter() const
{
return httpHeader_->findAsUInt(HttpHeader::RETRY_AFTER);
return httpHeader_->findAsInt(HttpHeader::RETRY_AFTER);
}
Time HttpResponse::getLastModifiedTime() const

View File

@ -96,9 +96,9 @@ public:
SharedHandle<StreamFilter> getContentEncodingStreamFilter() const;
uint64_t getContentLength() const;
off_t getContentLength() const;
uint64_t getEntityLength() const;
off_t getEntityLength() const;
// Returns type "/" subtype. The parameter is removed.
std::string getContentType() const;

View File

@ -180,7 +180,7 @@ bool HttpResponseCommand::executeInternal()
int statusCode = httpResponse->getStatusCode();
if(statusCode == 304) {
uint64_t totalLength = httpResponse->getEntityLength();
off_t totalLength = httpResponse->getEntityLength();
getFileEntry()->setLength(totalLength);
getRequestGroup()->initPieceStorage();
getPieceStorage()->markAllPiecesDone();
@ -245,7 +245,7 @@ bool HttpResponseCommand::executeInternal()
}
if(!getPieceStorage()) {
util::removeMetalinkContentTypes(getRequestGroup());
uint64_t totalLength = httpResponse->getEntityLength();
off_t totalLength = httpResponse->getEntityLength();
getFileEntry()->setLength(totalLength);
if(getFileEntry()->getPath().empty()) {
getFileEntry()->setPath

View File

@ -90,7 +90,10 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest()
lastBody_.clear();
lastBody_.str("");
lastContentLength_ =
lastRequestHeader_->findAsUInt(HttpHeader::CONTENT_LENGTH);
lastRequestHeader_->findAsLLInt(HttpHeader::CONTENT_LENGTH);
if(lastContentLength_ < 0) {
throw DL_ABORT_EX("Content-Length must be positive.");
}
headerProcessor_->clear();
const std::string& connection =
@ -144,7 +147,7 @@ bool HttpServer::receiveBody()
lastBody_.write(reinterpret_cast<const char*>(socketRecvBuffer_->getBuffer()),
length);
socketRecvBuffer_->shiftBuffer(length);
return lastContentLength_ == static_cast<uint64_t>(lastBody_.tellp());
return lastContentLength_ == lastBody_.tellp();
}
std::string HttpServer::getBody() const

View File

@ -60,7 +60,7 @@ private:
DownloadEngine* e_;
SharedHandle<HttpHeaderProcessor> headerProcessor_;
SharedHandle<HttpHeader> lastRequestHeader_;
uint64_t lastContentLength_;
off_t lastContentLength_;
std::stringstream lastBody_;
bool keepAlive_;
bool gzip_;
@ -118,7 +118,7 @@ public:
void disableGZip() { gzip_ = false; }
uint64_t getContentLength() const { return lastContentLength_; }
off_t getContentLength() const { return lastContentLength_; }
const SharedHandle<SocketRecvBuffer>& getSocketRecvBuffer() const
{

View File

@ -133,8 +133,7 @@ bool HttpServerCommand::execute()
e_->setNoWait(true);
return true;
}
if(static_cast<uint64_t>
(e_->getOption()->getAsInt(PREF_RPC_MAX_REQUEST_SIZE)) <
if(e_->getOption()->getAsInt(PREF_RPC_MAX_REQUEST_SIZE) <
httpServer_->getContentLength()) {
A2_LOG_INFO
(fmt("Request too long. ContentLength=%lld."

View File

@ -127,7 +127,7 @@ bool HttpSkipResponseCommand::executeInternal()
if(totalLength_ > 0) {
bufSize = std::min
(totalLength_-receivedBytes_,
static_cast<uint64_t>(getSocketRecvBuffer()->getBufferLength()));
static_cast<off_t>(getSocketRecvBuffer()->getBufferLength()));
} else {
bufSize = getSocketRecvBuffer()->getBufferLength();
}

View File

@ -53,9 +53,9 @@ private:
bool sinkFilterOnly_;
uint64_t totalLength_;
off_t totalLength_;
uint64_t receivedBytes_;
off_t receivedBytes_;
bool processResponse();

View File

@ -84,14 +84,14 @@ void IteratableChecksumValidator::validateChunk()
bool IteratableChecksumValidator::finished() const
{
if((uint64_t)currentOffset_ >= dctx_->getTotalLength()) {
if(currentOffset_ >= dctx_->getTotalLength()) {
return true;
} else {
return false;
}
}
uint64_t IteratableChecksumValidator::getTotalLength() const
off_t IteratableChecksumValidator::getTotalLength() const
{
return dctx_->getTotalLength();
}

View File

@ -70,7 +70,7 @@ public:
return currentOffset_;
}
virtual uint64_t getTotalLength() const;
virtual off_t getTotalLength() const;
};
typedef SharedHandle<IteratableChecksumValidator> IteratableChecksumValidatorHandle;

View File

@ -149,10 +149,10 @@ bool IteratableChunkChecksumValidator::finished() const
off_t IteratableChunkChecksumValidator::getCurrentOffset() const
{
return (off_t)currentIndex_*dctx_->getPieceLength();
return static_cast<off_t>(currentIndex_)*dctx_->getPieceLength();
}
uint64_t IteratableChunkChecksumValidator::getTotalLength() const
off_t IteratableChunkChecksumValidator::getTotalLength() const
{
return dctx_->getTotalLength();
}

View File

@ -73,7 +73,7 @@ public:
virtual off_t getCurrentOffset() const;
virtual uint64_t getTotalLength() const;
virtual off_t getTotalLength() const;
};
typedef SharedHandle<IteratableChunkChecksumValidator> IteratableChunkChecksumValidatorHandle;

View File

@ -62,7 +62,7 @@ public:
virtual off_t getCurrentOffset() const = 0;
virtual uint64_t getTotalLength() const = 0;
virtual off_t getTotalLength() const = 0;
};
typedef SharedHandle<IteratableValidator> IteratableValidatorHandle;

View File

@ -97,7 +97,7 @@ SharedHandle<LpdMessage> LpdMessageReceiver::receiveMessage()
static const std::string A2_INFOHASH = "infohash";
static const std::string A2_PORT = "port";
const std::string& infoHashString = header->find(A2_INFOHASH);
uint16_t port = header->findAsUInt(A2_PORT);
uint16_t port = header->findAsInt(A2_PORT);
A2_LOG_INFO(fmt("LPD message received infohash=%s, port=%u from %s",
infoHashString.c_str(),
port,

View File

@ -101,7 +101,7 @@ const std::string& MetalinkEntry::getPath() const
return file->getPath();
}
uint64_t MetalinkEntry::getLength() const
off_t MetalinkEntry::getLength() const
{
return file->getLength();
}

View File

@ -79,7 +79,7 @@ public:
const std::string& getPath() const;
uint64_t getLength() const;
off_t getLength() const;
const SharedHandle<FileEntry>& getFile() const
{

View File

@ -87,7 +87,7 @@ void MetalinkParserController::setFileNameOfEntry(const std::string& filename)
}
}
void MetalinkParserController::setFileLengthOfEntry(uint64_t length)
void MetalinkParserController::setFileLengthOfEntry(off_t length)
{
if(!tEntry_) {
return;

View File

@ -96,7 +96,7 @@ public:
void setFileNameOfEntry(const std::string& filename);
void setFileLengthOfEntry(uint64_t length);
void setFileLengthOfEntry(off_t length);
void setVersionOfEntry(const std::string& version);

View File

@ -262,7 +262,7 @@ void MetalinkParserStateMachine::setFileNameOfEntry(const std::string& filename)
ctrl_->setFileNameOfEntry(filename);
}
void MetalinkParserStateMachine::setFileLengthOfEntry(uint64_t length)
void MetalinkParserStateMachine::setFileLengthOfEntry(off_t length)
{
ctrl_->setFileLengthOfEntry(length);
}

View File

@ -159,7 +159,7 @@ public:
void setFileNameOfEntry(const std::string& filename);
void setFileLengthOfEntry(uint64_t length);
void setFileLengthOfEntry(off_t length);
void setVersionOfEntry(const std::string& version);

View File

@ -148,8 +148,8 @@ void SizeMetalinkParserState::endElement
const std::string& characters)
{
// current metalink specification doesn't require size element.
uint64_t size;
if(util::parseULLIntNoThrow(size, characters)) {
off_t size;
if(util::parseLLIntNoThrow(size, characters) && size >= 0) {
psm->setFileLengthOfEntry(size);
}
}

View File

@ -253,8 +253,8 @@ void SizeMetalinkParserStateV4::endElement
const char* nsUri,
const std::string& characters)
{
uint64_t size;
if(util::parseULLIntNoThrow(size, characters)) {
off_t size;
if(util::parseLLIntNoThrow(size, characters) && size >= 0) {
psm->setFileLengthOfEntry(size);
} else {
psm->cancelEntryTransaction();

View File

@ -101,7 +101,7 @@ bool DiskWriterEntry::fileExists()
return fileEntry_->exists();
}
uint64_t DiskWriterEntry::size() const
off_t DiskWriterEntry::size() const
{
return File(getFilePath()).size();
}
@ -169,8 +169,7 @@ void MultiDiskAdaptor::resetDiskWriterEntries()
itr-1; true; --i) {
const SharedHandle<FileEntry>& fileEntry = (*i)->getFileEntry();
if(pieceStartOffset <= fileEntry->getOffset() ||
(uint64_t)pieceStartOffset <
fileEntry->getOffset()+fileEntry->getLength()) {
pieceStartOffset < fileEntry->getLastOffset()) {
(*i)->needsFileAllocation(true);
} else {
break;
@ -306,22 +305,19 @@ namespace {
bool isInRange(const DiskWriterEntryHandle entry, off_t offset)
{
return entry->getFileEntry()->getOffset() <= offset &&
(uint64_t)offset <
entry->getFileEntry()->getOffset()+entry->getFileEntry()->getLength();
offset < entry->getFileEntry()->getLastOffset();
}
} // namespace
namespace {
size_t calculateLength(const DiskWriterEntryHandle entry,
off_t fileOffset, size_t rem)
ssize_t calculateLength(const DiskWriterEntryHandle entry,
off_t fileOffset, ssize_t rem)
{
size_t length;
if(entry->getFileEntry()->getLength() < (uint64_t)fileOffset+rem) {
length = entry->getFileEntry()->getLength()-fileOffset;
if(entry->getFileEntry()->getLength() < fileOffset+rem) {
return entry->getFileEntry()->getLength()-fileOffset;
} else {
length = rem;
return rem;
}
return length;
}
} // namespace
@ -371,11 +367,11 @@ void MultiDiskAdaptor::writeData(const unsigned char* data, size_t len,
DiskWriterEntries::const_iterator first =
findFirstDiskWriterEntry(diskWriterEntries_, offset);
size_t rem = len;
ssize_t rem = len;
off_t fileOffset = offset-(*first)->getFileEntry()->getOffset();
for(DiskWriterEntries::const_iterator i = first,
eoi = diskWriterEntries_.end(); i != eoi; ++i) {
size_t writeLength = calculateLength(*i, fileOffset, rem);
ssize_t writeLength = calculateLength(*i, fileOffset, rem);
openIfNot(*i, &DiskWriterEntry::openFile);
@ -398,12 +394,12 @@ ssize_t MultiDiskAdaptor::readData
DiskWriterEntries::const_iterator first =
findFirstDiskWriterEntry(diskWriterEntries_, offset);
size_t rem = len;
size_t totalReadLength = 0;
ssize_t rem = len;
ssize_t totalReadLength = 0;
off_t fileOffset = offset-(*first)->getFileEntry()->getOffset();
for(DiskWriterEntries::const_iterator i = first,
eoi = diskWriterEntries_.end(); i != eoi; ++i) {
size_t readLength = calculateLength(*i, fileOffset, rem);
ssize_t readLength = calculateLength(*i, fileOffset, rem);
openIfNot(*i, &DiskWriterEntry::openFile);
@ -429,9 +425,9 @@ bool MultiDiskAdaptor::fileExists()
getFileEntries().end();
}
uint64_t MultiDiskAdaptor::size()
off_t MultiDiskAdaptor::size()
{
uint64_t size = 0;
off_t size = 0;
for(std::vector<SharedHandle<FileEntry> >::const_iterator i =
getFileEntries().begin(), eoi = getFileEntries().end(); i != eoi; ++i) {
size += File((*i)->getPath()).size();
@ -460,9 +456,9 @@ void MultiDiskAdaptor::cutTrailingGarbage()
for(std::vector<SharedHandle<DiskWriterEntry> >::const_iterator i =
diskWriterEntries_.begin(), eoi = diskWriterEntries_.end();
i != eoi; ++i) {
uint64_t length = (*i)->getFileEntry()->getLength();
off_t length = (*i)->getFileEntry()->getLength();
if(File((*i)->getFilePath()).size() > length) {
// We need open file before calling DiskWriter::truncate(uint64_t)
// We need open file before calling DiskWriter::truncate(off_t)
openIfNot(*i, &DiskWriterEntry::openFile);
(*i)->getDiskWriter()->truncate(length);
}

View File

@ -69,7 +69,7 @@ public:
bool fileExists();
uint64_t size() const;
off_t size() const;
const SharedHandle<FileEntry>& getFileEntry() const
{
@ -139,7 +139,7 @@ public:
virtual bool fileExists();
virtual uint64_t size();
virtual off_t size();
virtual SharedHandle<FileAllocationIterator> fileAllocationIterator();

View File

@ -104,7 +104,7 @@ off_t MultiFileAllocationIterator::getCurrentLength()
}
}
uint64_t MultiFileAllocationIterator::getTotalLength()
off_t MultiFileAllocationIterator::getTotalLength()
{
if(!fileAllocationIterator_) {
return 0;

View File

@ -61,7 +61,7 @@ public:
virtual off_t getCurrentLength();
virtual uint64_t getTotalLength();
virtual off_t getTotalLength();
const std::deque<SharedHandle<DiskWriterEntry> >&
getDiskWriterEntries() const;

View File

@ -73,7 +73,7 @@ void Peer::usedBy(cuid_t cuid)
cuid_ = cuid;
}
void Peer::allocateSessionResource(size_t pieceLength, uint64_t totalLength)
void Peer::allocateSessionResource(size_t pieceLength, off_t totalLength)
{
delete res_;
res_ = new PeerSessionResource(pieceLength, totalLength);
@ -81,7 +81,7 @@ void Peer::allocateSessionResource(size_t pieceLength, uint64_t totalLength)
updateSeeder();
}
void Peer::reconfigureSessionResource(size_t pieceLength, uint64_t totalLength)
void Peer::reconfigureSessionResource(size_t pieceLength, off_t totalLength)
{
assert(res_);
res_->reconfigure(pieceLength, totalLength);
@ -228,13 +228,13 @@ unsigned int Peer::calculateDownloadSpeed()
return res_->getPeerStat().calculateDownloadSpeed();
}
uint64_t Peer::getSessionUploadLength() const
off_t Peer::getSessionUploadLength() const
{
assert(res_);
return res_->uploadLength();
}
uint64_t Peer::getSessionDownloadLength() const
off_t Peer::getSessionDownloadLength() const
{
assert(res_);
return res_->downloadLength();
@ -388,7 +388,7 @@ const Timer& Peer::getLastAmUnchoking() const
return res_->getLastAmUnchoking();
}
uint64_t Peer::getCompletedLength() const
off_t Peer::getCompletedLength() const
{
assert(res_);
return res_->getCompletedLength();

View File

@ -160,9 +160,9 @@ public:
bool isGood() const;
void allocateSessionResource(size_t pieceLength, uint64_t totalLength);
void allocateSessionResource(size_t pieceLength, off_t totalLength);
void reconfigureSessionResource(size_t pieceLength, uint64_t totalLength);
void reconfigureSessionResource(size_t pieceLength, off_t totalLength);
void releaseSessionResource();
@ -234,12 +234,12 @@ public:
/**
* Returns the number of bytes uploaded to the remote host.
*/
uint64_t getSessionUploadLength() const;
off_t getSessionUploadLength() const;
/**
* Returns the number of bytes downloaded from the remote host.
*/
uint64_t getSessionDownloadLength() const;
off_t getSessionDownloadLength() const;
void setBitfield(const unsigned char* bitfield, size_t bitfieldLength);
@ -293,7 +293,7 @@ public:
const Timer& getLastAmUnchoking() const;
uint64_t getCompletedLength() const;
off_t getCompletedLength() const;
bool isIncomingPeer() const
{

View File

@ -44,7 +44,7 @@
namespace aria2 {
PeerSessionResource::PeerSessionResource(size_t pieceLength, uint64_t totalLength):
PeerSessionResource::PeerSessionResource(size_t pieceLength, off_t totalLength):
amChoking_(true),
amInterested_(false),
peerChoking_(true),
@ -237,7 +237,7 @@ void PeerSessionResource::dhtEnabled(bool b)
dhtEnabled_ = b;
}
uint64_t PeerSessionResource::uploadLength() const
off_t PeerSessionResource::uploadLength() const
{
return peerStat_.getSessionUploadLength();
}
@ -247,7 +247,7 @@ void PeerSessionResource::updateUploadLength(size_t bytes)
peerStat_.updateUploadLength(bytes);
}
uint64_t PeerSessionResource::downloadLength() const
off_t PeerSessionResource::downloadLength() const
{
return peerStat_.getSessionDownloadLength();
}
@ -259,7 +259,7 @@ void PeerSessionResource::updateDownloadLength(size_t bytes)
lastDownloadUpdate_ = global::wallclock();
}
uint64_t PeerSessionResource::getCompletedLength() const
off_t PeerSessionResource::getCompletedLength() const
{
return bitfieldMan_->getCompletedLength();
}
@ -275,7 +275,7 @@ size_t PeerSessionResource::countOutstandingUpload() const
return dispatcher_->countOutstandingUpload();
}
void PeerSessionResource::reconfigure(size_t pieceLength, uint64_t totalLenth)
void PeerSessionResource::reconfigure(size_t pieceLength, off_t totalLenth)
{
delete bitfieldMan_;
bitfieldMan_ = new BitfieldMan(pieceLength, totalLenth);

View File

@ -83,7 +83,7 @@ private:
BtMessageDispatcher* dispatcher_;
public:
PeerSessionResource(size_t pieceLength, uint64_t totalLength);
PeerSessionResource(size_t pieceLength, off_t totalLength);
~PeerSessionResource();
@ -155,7 +155,7 @@ public:
size_t getBitfieldLength() const;
void reconfigure(size_t index, uint64_t totalLength);
void reconfigure(size_t index, off_t totalLength);
bool hasPiece(size_t index) const;
@ -210,11 +210,11 @@ public:
return peerStat_;
}
uint64_t uploadLength() const;
off_t uploadLength() const;
void updateUploadLength(size_t bytes);
uint64_t downloadLength() const;
off_t downloadLength() const;
void updateDownloadLength(size_t bytes);
@ -228,7 +228,7 @@ public:
return lastAmUnchoking_;
}
uint64_t getCompletedLength() const;
off_t getCompletedLength() const;
void setBtMessageDispatcher(BtMessageDispatcher* dpt);

View File

@ -61,8 +61,8 @@ private:
PeerStat::STATUS status_;
unsigned int avgDownloadSpeed_;
unsigned int avgUploadSpeed_;
uint64_t sessionDownloadLength_;
uint64_t sessionUploadLength_;
int64_t sessionDownloadLength_;
int64_t sessionUploadLength_;
public:
PeerStat
(cuid_t cuid, const std::string& hostname, const::std::string& protocol);

View File

@ -179,13 +179,13 @@ public:
virtual bool isPieceUsed(size_t index) = 0;
virtual uint64_t getTotalLength() = 0;
virtual off_t getTotalLength() = 0;
virtual uint64_t getFilteredTotalLength() = 0;
virtual off_t getFilteredTotalLength() = 0;
virtual uint64_t getCompletedLength() = 0;
virtual off_t getCompletedLength() = 0;
virtual uint64_t getFilteredCompletedLength() = 0;
virtual off_t getFilteredCompletedLength() = 0;
virtual void setupFileFilter() = 0;
@ -258,7 +258,7 @@ public:
/**
* Sets all bits in bitfield(0 to length) to 1.
*/
virtual void markPiecesDone(uint64_t length) = 0;
virtual void markPiecesDone(off_t length) = 0;
virtual void
addInFlightPiece(const std::vector<SharedHandle<Piece> >& pieces) = 0;

View File

@ -50,7 +50,7 @@ public:
virtual off_t getCurrentLength() = 0;
virtual uint64_t getTotalLength() = 0;
virtual off_t getTotalLength() = 0;
virtual bool finished() = 0;
};

View File

@ -38,7 +38,7 @@ namespace aria2 {
Range::Range():startByte_(0), endByte_(0), entityLength_(0) {}
Range::Range(off_t startByte, off_t endByte, uint64_t entityLength)
Range::Range(off_t startByte, off_t endByte, off_t entityLength)
: startByte_(startByte), endByte_(endByte), entityLength_(entityLength)
{}
@ -72,7 +72,7 @@ bool Range::operator!=(const Range& range) const
return !(*this == range);
}
uint64_t Range::getContentLength() const
off_t Range::getContentLength() const
{
if(endByte_ >= startByte_) {
return endByte_-startByte_+1;

View File

@ -47,11 +47,11 @@ class Range {
private:
off_t startByte_;
off_t endByte_;
uint64_t entityLength_;
off_t entityLength_;
public:
Range();
Range(off_t startByte, off_t endByte, uint64_t entityLength);
Range(off_t startByte, off_t endByte, off_t entityLength);
Range(const Range& c);
@ -73,12 +73,12 @@ public:
return endByte_;
}
uint64_t getEntityLength() const
off_t getEntityLength() const
{
return entityLength_;
}
uint64_t getContentLength() const;
off_t getContentLength() const;
};
typedef SharedHandle<Range> RangeHandle;

View File

@ -390,7 +390,7 @@ void RequestGroup::createInitialCommand
}
removeDefunctControlFile(progressInfoFile);
{
uint64_t actualFileSize = pieceStorage_->getDiskAdaptor()->size();
off_t actualFileSize = pieceStorage_->getDiskAdaptor()->size();
if(actualFileSize == downloadContext_->getTotalLength()) {
// First, make DiskAdaptor read-only mode to allow the
// program to seed file in read-only media.
@ -555,7 +555,7 @@ void RequestGroup::processCheckIntegrityEntry
const SharedHandle<CheckIntegrityEntry>& entry,
DownloadEngine* e)
{
uint64_t actualFileSize = pieceStorage_->getDiskAdaptor()->size();
off_t actualFileSize = pieceStorage_->getDiskAdaptor()->size();
if(actualFileSize > downloadContext_->getTotalLength()) {
entry->cutTrailingGarbage();
}
@ -863,7 +863,7 @@ std::string RequestGroup::getFirstFilePath() const
}
}
uint64_t RequestGroup::getTotalLength() const
off_t RequestGroup::getTotalLength() const
{
if(!pieceStorage_) {
return 0;
@ -876,7 +876,7 @@ uint64_t RequestGroup::getTotalLength() const
}
}
uint64_t RequestGroup::getCompletedLength() const
off_t RequestGroup::getCompletedLength() const
{
if(!pieceStorage_) {
return 0;
@ -902,8 +902,8 @@ void RequestGroup::validateFilename(const std::string& expectedFilename,
}
}
void RequestGroup::validateTotalLength(uint64_t expectedTotalLength,
uint64_t actualTotalLength) const
void RequestGroup::validateTotalLength(off_t expectedTotalLength,
off_t actualTotalLength) const
{
if(expectedTotalLength <= 0) {
return;
@ -921,7 +921,7 @@ void RequestGroup::validateFilename(const std::string& actualFilename) const
validateFilename(downloadContext_->getFileEntries().front()->getBasename(), actualFilename);
}
void RequestGroup::validateTotalLength(uint64_t actualTotalLength) const
void RequestGroup::validateTotalLength(off_t actualTotalLength) const
{
validateTotalLength(getTotalLength(), actualTotalLength);
}
@ -1155,7 +1155,7 @@ void RequestGroup::setProgressInfoFile(const BtProgressInfoFileHandle& progressI
bool RequestGroup::needsFileAllocation() const
{
return isFileAllocationEnabled() &&
(uint64_t)option_->getAsLLInt(PREF_NO_FILE_ALLOCATION_LIMIT) <= getTotalLength() &&
option_->getAsLLInt(PREF_NO_FILE_ALLOCATION_LIMIT) <= getTotalLength() &&
!pieceStorage_->getDiskAdaptor()->fileAllocationIterator()->finished();
}
@ -1204,7 +1204,7 @@ void RequestGroup::reportDownloadFinished()
#ifdef ENABLE_BITTORRENT
if(downloadContext_->hasAttribute(bittorrent::BITTORRENT)) {
TransferStat stat = calculateStat();
uint64_t completedLength = getCompletedLength();
off_t completedLength = getCompletedLength();
double shareRatio = completedLength == 0 ? 0.0 :
1.0*stat.getAllTimeUploadLength()/completedLength;
SharedHandle<TorrentAttribute> attrs =

View File

@ -230,9 +230,9 @@ public:
std::string getFirstFilePath() const;
uint64_t getTotalLength() const;
off_t getTotalLength() const;
uint64_t getCompletedLength() const;
off_t getCompletedLength() const;
/**
* Compares expected filename with specified actualFilename.
@ -241,10 +241,10 @@ public:
*/
void validateFilename(const std::string& actualFilename) const;
void validateTotalLength(uint64_t expectedTotalLength,
uint64_t actualTotalLength) const;
void validateTotalLength(off_t expectedTotalLength,
off_t actualTotalLength) const;
void validateTotalLength(uint64_t actualTotalLength) const;
void validateTotalLength(off_t actualTotalLength) const;
void setNumConcurrentCommand(unsigned int num)
{

View File

@ -711,7 +711,7 @@ void RequestGroupMan::formatDownloadResultFull
if((*i)->getLength() == 0 || downloadResult->bitfield.empty()) {
o << " -|";
} else {
uint64_t completedLength =
off_t completedLength =
bt.getOffsetCompletedLength((*i)->getOffset(), (*i)->getLength());
o << std::setw(3) << 100*completedLength/(*i)->getLength() << "|";
}

View File

@ -585,9 +585,9 @@ void createFileEntry
entry->put(KEY_PATH, (*first)->getPath());
entry->put(KEY_SELECTED, (*first)->isRequested()?VLB_TRUE:VLB_FALSE);
entry->put(KEY_LENGTH, util::uitos((*first)->getLength()));
uint64_t completedLength = bf->getOffsetCompletedLength
off_t completedLength = bf->getOffsetCompletedLength
((*first)->getOffset(), (*first)->getLength());
entry->put(KEY_COMPLETED_LENGTH, util::uitos(completedLength));
entry->put(KEY_COMPLETED_LENGTH, util::itos(completedLength));
SharedHandle<List> uriList = List::g();
createUriEntry(uriList, *first);
@ -602,7 +602,7 @@ template<typename InputIterator>
void createFileEntry
(const SharedHandle<List>& files,
InputIterator first, InputIterator last,
uint64_t totalLength,
off_t totalLength,
size_t pieceLength,
const std::string& bitfield)
{
@ -618,7 +618,7 @@ template<typename InputIterator>
void createFileEntry
(const SharedHandle<List>& files,
InputIterator first, InputIterator last,
uint64_t totalLength,
off_t totalLength,
size_t pieceLength,
const SharedHandle<PieceStorage>& ps)
{

View File

@ -94,7 +94,7 @@ void SegmentMan::init()
// PieceStorage here?
}
uint64_t SegmentMan::getTotalLength() const
off_t SegmentMan::getTotalLength() const
{
if(!pieceStorage_) {
return 0;
@ -342,7 +342,7 @@ bool SegmentMan::hasSegment(size_t index) const {
return pieceStorage_->hasPiece(index);
}
uint64_t SegmentMan::getDownloadLength() const {
off_t SegmentMan::getDownloadLength() const {
if(!pieceStorage_) {
return 0;
} else {
@ -444,14 +444,14 @@ void SegmentMan::updateDownloadSpeedFor(const SharedHandle<PeerStat>& pstat)
namespace {
class PeerStatDownloadLengthOperator {
public:
uint64_t operator()(uint64_t total, const SharedHandle<PeerStat>& ps)
off_t operator()(off_t total, const SharedHandle<PeerStat>& ps)
{
return ps->getSessionDownloadLength()+total;
}
};
} // namespace
uint64_t SegmentMan::calculateSessionDownloadLength() const
off_t SegmentMan::calculateSessionDownloadLength() const
{
return std::accumulate(fastestPeerStats_.begin(), fastestPeerStats_.end(),
0LL, PeerStatDownloadLengthOperator());

View File

@ -124,7 +124,7 @@ public:
* If Transfer-Encoding is Chunked or Content-Length header is not provided,
* then this value is set to be 0.
*/
uint64_t getTotalLength() const;
off_t getTotalLength() const;
/**
* Returs true when the download has finished.
@ -202,7 +202,7 @@ public:
/**
* Returns the length of bytes downloaded.
*/
uint64_t getDownloadLength() const;
off_t getDownloadLength() const;
// If there is inactive PeerStat in peerStats_, it is replaced with
@ -238,7 +238,7 @@ public:
/**
* Returns the downloaded bytes in this session.
*/
uint64_t calculateSessionDownloadLength() const;
off_t calculateSessionDownloadLength() const;
size_t countFreePieceFrom(size_t index) const;

View File

@ -51,7 +51,7 @@ void ShareRatioSeedCriteria::reset() {}
bool ShareRatioSeedCriteria::evaluate()
{
uint64_t completedLength = pieceStorage_->getCompletedLength();
off_t completedLength = pieceStorage_->getCompletedLength();
if(completedLength == 0) {
return true;
}

View File

@ -51,7 +51,7 @@ namespace aria2 {
SingleFileAllocationIterator::SingleFileAllocationIterator
(BinaryStream* stream,
off_t offset,
uint64_t totalLength)
off_t totalLength)
: stream_(stream),
offset_(offset),
totalLength_(totalLength),
@ -90,7 +90,7 @@ void SingleFileAllocationIterator::allocateChunk()
stream_->writeData(buffer_, BUFSIZE, offset_);
offset_ += BUFSIZE;
if(totalLength_ < (uint64_t)offset_) {
if(totalLength_ < offset_) {
stream_->truncate(totalLength_);
offset_ = totalLength_;
}
@ -98,7 +98,7 @@ void SingleFileAllocationIterator::allocateChunk()
bool SingleFileAllocationIterator::finished()
{
return (uint64_t)offset_ == totalLength_;
return offset_ == totalLength_;
}
} // namespace aria2

View File

@ -48,11 +48,14 @@ private:
off_t offset_;
uint64_t totalLength_;
off_t totalLength_;
unsigned char* buffer_;
public:
SingleFileAllocationIterator(BinaryStream* stream, off_t offset, uint64_t totalLength);
SingleFileAllocationIterator
(BinaryStream* stream,
off_t offset,
off_t totalLength);
virtual ~SingleFileAllocationIterator();
@ -65,7 +68,7 @@ public:
return offset_;
}
virtual uint64_t getTotalLength()
virtual off_t getTotalLength()
{
return totalLength_;
}

View File

@ -79,7 +79,7 @@ unsigned int SpeedCalc::calculateSpeed() {
void SpeedCalc::update(size_t bytes) {
accumulatedLength_ += bytes;
std::transform(&lengthArray_[0], &lengthArray_[2], &lengthArray_[0],
std::bind1st(std::plus<uint64_t>(), (uint64_t)bytes));
std::bind1st(std::plus<int64_t>(), (int64_t)bytes));
if(isIntervalOver()) {
changeSw();
}
@ -103,7 +103,7 @@ void SpeedCalc::changeSw() {
}
unsigned int SpeedCalc::calculateAvgSpeed() const {
uint64_t milliElapsed = start_.differenceInMillis(global::wallclock());
int64_t milliElapsed = start_.differenceInMillis(global::wallclock());
// if milliElapsed is too small, the average speed is rubish, better return 0
if(milliElapsed > 4) {

View File

@ -42,13 +42,13 @@ namespace aria2 {
class SpeedCalc {
private:
uint64_t lengthArray_[2];
int64_t lengthArray_[2];
int sw_;
Timer cpArray_[2];
unsigned int maxSpeed_;
unsigned int prevSpeed_;
Timer start_;
uint64_t accumulatedLength_;
int64_t accumulatedLength_;
time_t nextInterval_;
bool isIntervalOver() const;

View File

@ -44,9 +44,9 @@ class TransferStat {
public:
unsigned int downloadSpeed;
unsigned int uploadSpeed;
uint64_t sessionDownloadLength;
uint64_t sessionUploadLength;
uint64_t allTimeUploadLength;
int64_t sessionDownloadLength;
int64_t sessionUploadLength;
int64_t allTimeUploadLength;
void copy(const TransferStat& stat)
{
@ -98,28 +98,28 @@ public:
* Returns the number of bytes downloaded since the program started.
* This is not the total number of bytes downloaded.
*/
uint64_t getSessionDownloadLength() const {
int64_t getSessionDownloadLength() const {
return sessionDownloadLength;
}
void setSessionDownloadLength(uint64_t s) { sessionDownloadLength = s; }
void setSessionDownloadLength(int64_t s) { sessionDownloadLength = s; }
/**
* Returns the number of bytes uploaded since the program started.
* This is not the total number of bytes uploaded.
*/
uint64_t getSessionUploadLength() const {
int64_t getSessionUploadLength() const {
return sessionUploadLength;
}
void setSessionUploadLength(uint64_t s) { sessionUploadLength = s; }
void setSessionUploadLength(int64_t s) { sessionUploadLength = s; }
void setAllTimeUploadLength(uint64_t s)
void setAllTimeUploadLength(int64_t s)
{
allTimeUploadLength = s;
}
uint64_t getAllTimeUploadLength() const
int64_t getAllTimeUploadLength() const
{
return allTimeUploadLength;
}

View File

@ -238,7 +238,7 @@ void UnknownLengthPieceStorage::markAllPiecesDone()
downloadFinished_ = true;
}
void UnknownLengthPieceStorage::markPiecesDone(uint64_t length)
void UnknownLengthPieceStorage::markPiecesDone(off_t length)
{
// TODO not implemented yet
abort();

View File

@ -54,7 +54,7 @@ private:
SharedHandle<DiskWriterFactory> diskWriterFactory_;
uint64_t totalLength_;
off_t totalLength_;
bool downloadFinished_;
@ -152,23 +152,23 @@ public:
virtual bool isPieceUsed(size_t index);
virtual uint64_t getTotalLength()
virtual off_t getTotalLength()
{
return totalLength_;
}
virtual uint64_t getFilteredTotalLength()
virtual off_t getFilteredTotalLength()
{
return totalLength_;
}
virtual uint64_t getCompletedLength()
virtual off_t getCompletedLength()
{
// TODO we have to return actual completed length here?
return totalLength_;
}
virtual uint64_t getFilteredCompletedLength()
virtual off_t getFilteredCompletedLength()
{
return getCompletedLength();
}
@ -259,7 +259,7 @@ public:
*/
virtual void markAllPiecesDone();
virtual void markPiecesDone(uint64_t length);
virtual void markPiecesDone(off_t length);
virtual void markPieceMissing(size_t index);

View File

@ -232,7 +232,7 @@ void extractFileEntries
const List* filesList = downcast<List>(infoDict->get(C_FILES));
if(filesList) {
fileEntries.reserve(filesList->size());
uint64_t length = 0;
off_t length = 0;
off_t offset = 0;
// multi-file mode
torrent->mode = MULTI;
@ -304,7 +304,7 @@ void extractFileEntries
throw DL_ABORT_EX2(fmt(MSG_MISSING_BT_INFO, C_LENGTH.c_str()),
error_code::BITTORRENT_PARSE_ERROR);
}
uint64_t totalLength = lengthData->i();
off_t totalLength = lengthData->i();
// For each uri in urlList, if it ends with '/', then
// concatenate name to it. Specification just says so.

Some files were not shown because too many files have changed in this diff Show More