summaryrefslogtreecommitdiff
path: root/src/DefaultBtProgressInfoFile.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-03-08 08:04:28 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-03-08 08:04:28 +0000
commit518a200d57509016cfb886df01912a8f4cdadbc0 (patch)
tree98dc56246a1d75ea9ca4eb72ea631299b2b7f919 /src/DefaultBtProgressInfoFile.cc
parentaa669e8646d5cb89d1e4aaba45b66b64932153ed (diff)
2008-03-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Type clarification: size_t for length or size, uint64_t for file length, off_t for file offset. * src/PiecedSegment.cc * src/GrowSegment.h * src/DefaultBtRequestFactory.h * src/DefaultBtProgressInfoFile.cc * src/UnknownLengthPieceStorage.h * src/DefaultPieceStorage.cc * src/UnknownLengthPieceStorage.cc * src/DefaultBtInteractive.cc * src/GrowSegment.cc * src/BitfieldMan.h * src/DownloadCommand.cc * src/BtRequestFactory.h * src/PiecedSegment.h * src/DefaultPieceStorage.h * src/Piece.cc * src/DefaultBtRequestFactory.cc * src/PieceStorage.h * src/Segment.h * src/Piece.h * src/BitfieldMan.cc * src/Util.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultPieceStorageTest.cc * test/MockPieceStorage.h * test/BtRequestMessageTest.cc * test/DefaultBtMessageDispatcherTest.cc * test/BitfieldManTest.cc * test/GrowSegmentTest.cc * test/PieceTest.cc * test/SegmentTest.cc * test/SegmentManTest.cc * test/DefaultBtRequestFactoryTest.cc * test/MockBtRequestFactory.h
Diffstat (limited to 'src/DefaultBtProgressInfoFile.cc')
-rw-r--r--src/DefaultBtProgressInfoFile.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/DefaultBtProgressInfoFile.cc b/src/DefaultBtProgressInfoFile.cc
index 0c11f33b..7fc1291b 100644
--- a/src/DefaultBtProgressInfoFile.cc
+++ b/src/DefaultBtProgressInfoFile.cc
@@ -233,26 +233,26 @@ void DefaultBtProgressInfoFile::load()
delete [] savedBitfield;
savedBitfield = 0;
- int32_t numInFlightPiece;
+ uint32_t numInFlightPiece;
in.read(reinterpret_cast<char*>(&numInFlightPiece), sizeof(numInFlightPiece));
Pieces inFlightPieces;
while(numInFlightPiece--) {
- int32_t index;
+ uint32_t index;
in.read(reinterpret_cast<char*>(&index), sizeof(index));
- if(!(0 <= index && index < _dctx->getNumPieces())) {
- throw new DlAbortEx("piece index out of range: %d", index);
+ if(!(index < _dctx->getNumPieces())) {
+ throw new DlAbortEx("piece index out of range: %u", index);
}
- int32_t length;
+ uint32_t length;
in.read(reinterpret_cast<char*>(&length), sizeof(length));
- if(!(0 < length && length <=_dctx->getPieceLength())) {
- throw new DlAbortEx("piece length out of range: %d", length);
+ if(!(length <=_dctx->getPieceLength())) {
+ throw new DlAbortEx("piece length out of range: %u", length);
}
PieceHandle piece = new Piece(index, length);
- int32_t bitfieldLength;
+ uint32_t bitfieldLength;
in.read(reinterpret_cast<char*>(&bitfieldLength), sizeof(bitfieldLength));
if(piece->getBitfieldLength() != bitfieldLength) {
- throw new DlAbortEx("piece bitfield length mismatch. expected: %d actual: %d",
+ throw new DlAbortEx("piece bitfield length mismatch. expected: %u actual: %u",
piece->getBitfieldLength(), bitfieldLength);
}
savedBitfield = new unsigned char[bitfieldLength];
@@ -265,7 +265,7 @@ void DefaultBtProgressInfoFile::load()
}
_pieceStorage->addInFlightPiece(inFlightPieces);
} else {
- int32_t numInFlightPiece;
+ uint32_t numInFlightPiece;
in.read(reinterpret_cast<char*>(&numInFlightPiece), sizeof(numInFlightPiece));
BitfieldMan src(pieceLength, totalLength);
src.setBitfield(savedBitfield, bitfieldLength);