mirror of https://github.com/aria2/aria2
Fix compile error and warning with clang
parent
3aaa5a7344
commit
7fbd8a50ef
|
@ -55,7 +55,6 @@ Piece::Piece()
|
||||||
wrCache_(nullptr),
|
wrCache_(nullptr),
|
||||||
index_(0),
|
index_(0),
|
||||||
length_(0),
|
length_(0),
|
||||||
blockLength_(BLOCK_LENGTH),
|
|
||||||
nextBegin_(0),
|
nextBegin_(0),
|
||||||
usedBySegment_(false)
|
usedBySegment_(false)
|
||||||
{}
|
{}
|
||||||
|
@ -65,7 +64,6 @@ Piece::Piece(size_t index, int64_t length, int32_t blockLength)
|
||||||
wrCache_(nullptr),
|
wrCache_(nullptr),
|
||||||
index_(index),
|
index_(index),
|
||||||
length_(length),
|
length_(length),
|
||||||
blockLength_(blockLength),
|
|
||||||
nextBegin_(0),
|
nextBegin_(0),
|
||||||
usedBySegment_(false)
|
usedBySegment_(false)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -63,7 +63,6 @@ private:
|
||||||
size_t index_;
|
size_t index_;
|
||||||
|
|
||||||
int64_t length_;
|
int64_t length_;
|
||||||
int32_t blockLength_;
|
|
||||||
int64_t nextBegin_;
|
int64_t nextBegin_;
|
||||||
|
|
||||||
bool usedBySegment_;
|
bool usedBySegment_;
|
||||||
|
|
|
@ -148,7 +148,7 @@ void DefaultBtProgressInfoFileTest::testLoad_compat()
|
||||||
|
|
||||||
std::shared_ptr<Piece> piece1 = inFlightPieces[0];
|
std::shared_ptr<Piece> piece1 = inFlightPieces[0];
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, piece1->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)1024, piece1->getLength());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getBitfieldLength());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getBitfieldLength());
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("00"), util::toHex(piece1->getBitfield(),
|
CPPUNIT_ASSERT_EQUAL(std::string("00"), util::toHex(piece1->getBitfield(),
|
||||||
piece1->getBitfieldLength()));
|
piece1->getBitfieldLength()));
|
||||||
|
@ -156,7 +156,7 @@ void DefaultBtProgressInfoFileTest::testLoad_compat()
|
||||||
// piece index 2
|
// piece index 2
|
||||||
std::shared_ptr<Piece> piece2 = inFlightPieces[1];
|
std::shared_ptr<Piece> piece2 = inFlightPieces[1];
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)2, piece2->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)2, piece2->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(512, piece2->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)512, piece2->getLength());
|
||||||
}
|
}
|
||||||
#endif // !WORDS_BIGENDIAN
|
#endif // !WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void DefaultBtProgressInfoFileTest::testLoad()
|
||||||
|
|
||||||
std::shared_ptr<Piece> piece1 = inFlightPieces[0];
|
std::shared_ptr<Piece> piece1 = inFlightPieces[0];
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, piece1->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)1024, piece1->getLength());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getBitfieldLength());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, piece1->getBitfieldLength());
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("00"), util::toHex(piece1->getBitfield(),
|
CPPUNIT_ASSERT_EQUAL(std::string("00"), util::toHex(piece1->getBitfield(),
|
||||||
piece1->getBitfieldLength()));
|
piece1->getBitfieldLength()));
|
||||||
|
@ -205,7 +205,7 @@ void DefaultBtProgressInfoFileTest::testLoad()
|
||||||
// piece index 2
|
// piece index 2
|
||||||
std::shared_ptr<Piece> piece2 = inFlightPieces[1];
|
std::shared_ptr<Piece> piece2 = inFlightPieces[1];
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)2, piece2->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)2, piece2->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(512, piece2->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)512, piece2->getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultBtProgressInfoFileTest::testSave()
|
void DefaultBtProgressInfoFileTest::testSave()
|
||||||
|
|
|
@ -238,7 +238,7 @@ void DefaultPieceStorageTest::testGetPiece() {
|
||||||
|
|
||||||
auto pieceGot = pss.getPiece(0);
|
auto pieceGot = pss.getPiece(0);
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, pieceGot->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)0, pieceGot->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(128, pieceGot->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)128, pieceGot->getLength());
|
||||||
CPPUNIT_ASSERT_EQUAL(false, pieceGot->pieceComplete());
|
CPPUNIT_ASSERT_EQUAL(false, pieceGot->pieceComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ void DefaultPieceStorageTest::testGetPieceInUsedPieces() {
|
||||||
pss.addUsedPiece(piece);
|
pss.addUsedPiece(piece);
|
||||||
auto pieceGot = pss.getPiece(0);
|
auto pieceGot = pss.getPiece(0);
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, pieceGot->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)0, pieceGot->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(128, pieceGot->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)128, pieceGot->getLength());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, pieceGot->countCompleteBlock());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, pieceGot->countCompleteBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ void DefaultPieceStorageTest::testGetPieceCompletedPiece() {
|
||||||
pss.completePiece(piece);
|
pss.completePiece(piece);
|
||||||
auto pieceGot = pss.getPiece(0);
|
auto pieceGot = pss.getPiece(0);
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)0, pieceGot->getIndex());
|
CPPUNIT_ASSERT_EQUAL((size_t)0, pieceGot->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(128, pieceGot->getLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)128, pieceGot->getLength());
|
||||||
CPPUNIT_ASSERT_EQUAL(true, pieceGot->pieceComplete());
|
CPPUNIT_ASSERT_EQUAL(true, pieceGot->pieceComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ void DefaultPieceStorageTest::testGetCompletedLength()
|
||||||
p->completeBlock(j);
|
p->completeBlock(j);
|
||||||
}
|
}
|
||||||
inFlightPieces.push_back(p);
|
inFlightPieces.push_back(p);
|
||||||
CPPUNIT_ASSERT_EQUAL(512*1024, p->getCompletedLength());
|
CPPUNIT_ASSERT_EQUAL((int64_t)512*1024, p->getCompletedLength());
|
||||||
}
|
}
|
||||||
ps.addInFlightPiece(inFlightPieces);
|
ps.addInFlightPiece(inFlightPieces);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue