mirror of https://github.com/aria2/aria2
2007-08-10 Ross Smith II <aria2spam at smithii dot com>
gcc 3.4.4 support: * src/DefaultBtContext.cc: int32_t -> int * src/main.cc: int -> int32_t, int32_t -> int * src/messageDigest.h: uint32_t -> unsigned int * src/NameResolver.h: int32_t -> int * src/PeerConnection.cc: int -> int32_t * src/SpeedCalc.cc: int32_t -> int * src/TrackerUpdateCommand.h: int -> int32_t * src/Util.cc: int32_t -> int * src/Util.h: int32_t -> int * src/Xml2MetalinkProcessor.cc: int -> uint32_t, int64_t -> uint64_t * test/AnnounceListTest.cc: int -> int32_t * test/ChunkedEncodingTest.cc: int -> int32_t * test/DataTest.cc: int -> int32_t * test/DefaultBtRequestFactoryTest.cc: int -> int32_t * test/DefaultPeerListProcessorTest.cc: int -> int32_t * test/DefaultPieceStorageTest.cc: int -> int32_t * test/FeatureConfigTest.cc: int -> int32_t * test/MetalinkEntryTest.cc: int -> int32_t * test/MockBtRequestFactory.h: int -> int32_t * test/MockPieceStorage.h: int -> int32_t * test/OptionTest.cc: int -> int32_t * test/RequestTest.cc: int -> int32_t * test/SegmentManTest.cc: int -> int32_t * test/Xml2MetalinkProcessorTest.cc: int -> int32_tpull/1/head
parent
6aa98f9b9f
commit
3cc1ed5e09
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
|||
2007-08-10 Ross Smith II <aria2spam at smithii dot com>
|
||||
|
||||
gcc 3.4.4 support:
|
||||
* src/DefaultBtContext.cc: int32_t -> int
|
||||
* src/main.cc: int -> int32_t, int32_t -> int
|
||||
* src/messageDigest.h: uint32_t -> unsigned int
|
||||
* src/NameResolver.h: int32_t -> int
|
||||
* src/PeerConnection.cc: int -> int32_t
|
||||
* src/SpeedCalc.cc: int32_t -> int
|
||||
* src/TrackerUpdateCommand.h: int -> int32_t
|
||||
* src/Util.cc: int32_t -> int
|
||||
* src/Util.h: int32_t -> int
|
||||
* src/Xml2MetalinkProcessor.cc: int -> uint32_t, int64_t -> uint64_t
|
||||
* test/AnnounceListTest.cc: int -> int32_t
|
||||
* test/ChunkedEncodingTest.cc: int -> int32_t
|
||||
* test/DataTest.cc: int -> int32_t
|
||||
* test/DefaultBtRequestFactoryTest.cc: int -> int32_t
|
||||
* test/DefaultPeerListProcessorTest.cc: int -> int32_t
|
||||
* test/DefaultPieceStorageTest.cc: int -> int32_t
|
||||
* test/FeatureConfigTest.cc: int -> int32_t
|
||||
* test/MetalinkEntryTest.cc: int -> int32_t
|
||||
* test/MockBtRequestFactory.h: int -> int32_t
|
||||
* test/MockPieceStorage.h: int -> int32_t
|
||||
* test/OptionTest.cc: int -> int32_t
|
||||
* test/RequestTest.cc: int -> int32_t
|
||||
* test/SegmentManTest.cc: int -> int32_t
|
||||
* test/Xml2MetalinkProcessorTest.cc: int -> int32_t
|
||||
|
||||
2007-08-10 Ross Smith II <aria2spam at smithii dot com>
|
||||
|
||||
Move sleep functions to Util class:
|
||||
|
|
|
@ -185,7 +185,7 @@ void DefaultBtContext::load(const string& torrentFile) {
|
|||
// retrieve infoHash
|
||||
ShaVisitor v;
|
||||
infoDic->accept(&v);
|
||||
int32_t len;
|
||||
int len;
|
||||
v.getHash(infoHash, len);
|
||||
infoHashString = Util::toHex(infoHash, INFO_HASH_LENGTH);
|
||||
// calculate the number of pieces
|
||||
|
|
|
@ -48,10 +48,10 @@ extern "C" {
|
|||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
void callback(void* arg, int32_t status, struct hostent* host);
|
||||
void callback(void* arg, int status, struct hostent* host);
|
||||
|
||||
class NameResolver {
|
||||
friend void callback(void* arg, int32_t status, struct hostent* host);
|
||||
friend void callback(void* arg, int status, struct hostent* host);
|
||||
|
||||
public:
|
||||
enum STATUS {
|
||||
|
|
|
@ -79,7 +79,7 @@ bool PeerConnection::receiveMessage(unsigned char* data, int32_t& dataLength) {
|
|||
int32_t remain = 4-lenbufLength;
|
||||
int32_t temp = remain;
|
||||
// TODO fix this
|
||||
socket->readData((char*)lenbuf+lenbufLength, (int&)temp);
|
||||
socket->readData((char*)lenbuf+lenbufLength, temp);
|
||||
if(temp == 0) {
|
||||
// we got EOF
|
||||
throw new DlAbortEx(EX_EOF_FROM_PEER);
|
||||
|
@ -103,7 +103,7 @@ bool PeerConnection::receiveMessage(unsigned char* data, int32_t& dataLength) {
|
|||
// we have currentPayloadLen-resbufLen bytes to read
|
||||
int32_t remaining = currentPayloadLength-resbufLength;
|
||||
if(remaining > 0) {
|
||||
socket->readData((char*)resbuf+resbufLength, (int&)remaining);
|
||||
socket->readData((char*)resbuf+resbufLength, remaining);
|
||||
if(remaining == 0) {
|
||||
// we got EOF
|
||||
throw new DlAbortEx(EX_EOF_FROM_PEER);
|
||||
|
@ -129,7 +129,7 @@ bool PeerConnection::receiveHandshake(unsigned char* data, int32_t& dataLength)
|
|||
}
|
||||
int32_t remain = BtHandshakeMessage::MESSAGE_LENGTH-resbufLength;
|
||||
int32_t temp = remain;
|
||||
socket->readData((char*)resbuf+resbufLength, (int&)temp);
|
||||
socket->readData((char*)resbuf+resbufLength, temp);
|
||||
if(temp == 0) {
|
||||
// we got EOF
|
||||
throw new DlAbortEx(EX_EOF_FROM_PEER);
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void SpeedCalc::update(int32_t bytes) {
|
||||
void SpeedCalc::update(int bytes) {
|
||||
accumulatedLength += bytes;
|
||||
for_each(&lengthArray[0], &lengthArray[2], Plus(bytes));
|
||||
if(isIntervalOver()) {
|
||||
|
|
|
@ -46,7 +46,7 @@ private:
|
|||
bool prepareForRetry();
|
||||
string getTrackerResponse();
|
||||
public:
|
||||
TrackerUpdateCommand(int cuid,
|
||||
TrackerUpdateCommand(int32_t cuid,
|
||||
TorrentDownloadEngine* e,
|
||||
const BtContextHandle& btContext);
|
||||
|
||||
|
|
|
@ -560,7 +560,7 @@ bool Util::isNumbersAndDotsNotation(const string& name) {
|
|||
}
|
||||
}
|
||||
|
||||
void Util::setGlobalSignalHandler(int32_t sig, void (*handler)(int32_t), int32_t flags) {
|
||||
void Util::setGlobalSignalHandler(int32_t sig, void (*handler)(int), int32_t flags) {
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction sigact;
|
||||
sigact.sa_handler = handler;
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
static bool isNumbersAndDotsNotation(const string& name);
|
||||
|
||||
static void setGlobalSignalHandler(int32_t signal, void (*handler)(int32_t), int32_t flags);
|
||||
static void setGlobalSignalHandler(int32_t signal, void (*handler)(int), int32_t flags);
|
||||
|
||||
static void indexRange(int32_t& startIndex, int32_t& endIndex,
|
||||
int64_t offset,
|
||||
|
|
|
@ -75,8 +75,8 @@ MetalinkerHandle Xml2MetalinkProcessor::parseFile(const string& filename) {
|
|||
|
||||
string xpath = "/m:metalink/m:files/m:file";
|
||||
MetalinkerHandle metalinker(new Metalinker());
|
||||
for(int index = 1; 1; index++) {
|
||||
MetalinkEntryHandle entry = getEntry(xpath+"["+Util::itos(index)+"]");
|
||||
for(uint32_t index = 1; 1; index++) {
|
||||
MetalinkEntryHandle entry = getEntry(xpath+"["+Util::uitos(index)+"]");
|
||||
if(!entry.get()) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -151,8 +151,8 @@ MetalinkEntryHandle Xml2MetalinkProcessor::getEntry(const string& xpath) {
|
|||
}
|
||||
*/
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
for(int index = 1; 1; index++) {
|
||||
MetalinkResourceHandle resource(getResource(xpath+"/m:resources/m:url["+Util::itos(index)+"]"));
|
||||
for(uint32_t index = 1; 1; index++) {
|
||||
MetalinkResourceHandle resource(getResource(xpath+"/m:resources/m:url["+Util::uitos(index)+"]"));
|
||||
if(!resource.get()) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -183,11 +183,11 @@ ChunkChecksumHandle Xml2MetalinkProcessor::getPieceHash(const string& xpath,
|
|||
}
|
||||
|
||||
Strings checksums;
|
||||
int64_t numPiece = (totalSize+checksumLength-1)/checksumLength;
|
||||
for(int64_t i = 0; i < numPiece; ++i) {
|
||||
uint64_t numPiece = (totalSize+checksumLength-1)/checksumLength;
|
||||
for(uint64_t i = 0; i < numPiece; ++i) {
|
||||
string pieceHash = Util::trim(xpathContent(xpath+"/m:hash[@piece=\""+Util::ullitos(i)+"\"]"));
|
||||
if(pieceHash == "") {
|
||||
throw new DlAbortEx("Piece hash missing. index=%d", i);
|
||||
throw new DlAbortEx("Piece hash missing. index=%s", Util::ullitos(i));
|
||||
}
|
||||
checksums.push_back(pieceHash);
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ int main(int argc, char* argv[]) {
|
|||
op->put(PREF_DIR, ".");
|
||||
op->put(PREF_SPLIT, "1");
|
||||
op->put(PREF_DAEMON, V_FALSE);
|
||||
op->put(PREF_SEGMENT_SIZE, Util::itos(1024*1024));
|
||||
op->put(PREF_SEGMENT_SIZE, Util::itos((int32_t)(1024*1024)));
|
||||
op->put(PREF_HTTP_KEEP_ALIVE, V_FALSE);
|
||||
op->put(PREF_LISTEN_PORT, "-1");
|
||||
op->put(PREF_METALINK_SERVERS, "5");
|
||||
|
@ -401,8 +401,8 @@ int main(int argc, char* argv[]) {
|
|||
op->put(PREF_MAX_CONCURRENT_DOWNLOADS, "5");
|
||||
op->put(PREF_DIRECT_DOWNLOAD_TIMEOUT, "15");
|
||||
while(1) {
|
||||
int32_t optIndex = 0;
|
||||
int32_t lopt;
|
||||
int optIndex = 0;
|
||||
int lopt;
|
||||
static struct option longOpts[] = {
|
||||
#ifdef HAVE_DAEMON
|
||||
{ "daemon", no_argument, NULL, 'D' },
|
||||
|
|
|
@ -121,8 +121,8 @@ public:
|
|||
void digestReset() {EVP_DigestInit(&ctx, algo);}
|
||||
void digestUpdate(const void* data, int32_t length) {EVP_DigestUpdate(&ctx, data, length);}
|
||||
void digestFinal(unsigned char* md) {
|
||||
int32_t len;
|
||||
EVP_DigestFinal(&ctx, md, (uint32_t*)&len);
|
||||
unsigned int len;
|
||||
EVP_DigestFinal(&ctx, md, &len);
|
||||
}
|
||||
void digestFree() {/*empty*/}
|
||||
int32_t digestLength() const {
|
||||
|
@ -144,8 +144,8 @@ public:
|
|||
EVP_DigestUpdate(&ctx, data, length);
|
||||
}
|
||||
void digestFinal(unsigned char* md) {
|
||||
int32_t len;
|
||||
EVP_DigestFinal_ex(&ctx, md, (uint32_t*)&len);
|
||||
unsigned int len;
|
||||
EVP_DigestFinal_ex(&ctx, md, &len);
|
||||
}
|
||||
void digestFree() {
|
||||
EVP_MD_CTX_cleanup(&ctx);
|
||||
|
|
|
@ -174,22 +174,22 @@ void AnnounceListTest::testCountStoppedAllowedTier() {
|
|||
// [ [ tracker1 ], [ tracker2 ], [ tracker3 ] ]
|
||||
AnnounceList announceList(announces);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countStoppedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::STARTED);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countStoppedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::STARTED_AFTER_COMPLETION);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countStoppedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::HALTED);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countStoppedAllowedTier());
|
||||
|
||||
announceList.setEvent(AnnounceTier::DOWNLOADING);
|
||||
CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, announceList.countStoppedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::STOPPED);
|
||||
CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, announceList.countStoppedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::COMPLETED);
|
||||
CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, announceList.countStoppedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::SEEDING);
|
||||
CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, announceList.countStoppedAllowedTier());
|
||||
|
||||
}
|
||||
|
||||
|
@ -201,22 +201,22 @@ void AnnounceListTest::testCountCompletedAllowedTier() {
|
|||
// [ [ tracker1 ], [ tracker2 ], [ tracker3 ] ]
|
||||
AnnounceList announceList(announces);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countCompletedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::STARTED);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countCompletedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::STARTED_AFTER_COMPLETION);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countCompletedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::STOPPED);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countCompletedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::SEEDING);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countCompletedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::HALTED);
|
||||
CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, announceList.countCompletedAllowedTier());
|
||||
|
||||
announceList.setEvent(AnnounceTier::DOWNLOADING);
|
||||
CPPUNIT_ASSERT_EQUAL(1, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, announceList.countCompletedAllowedTier());
|
||||
announceList.setEvent(AnnounceTier::COMPLETED);
|
||||
CPPUNIT_ASSERT_EQUAL(1, announceList.countCompletedAllowedTier());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, announceList.countCompletedAllowedTier());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( ChunkedEncodingTest );
|
|||
void ChunkedEncodingTest::testInflate1() {
|
||||
string msg = "a\r\n1234567890\r\n";
|
||||
char buf[100];
|
||||
int len = sizeof(buf);
|
||||
int32_t len = sizeof(buf);
|
||||
enc->inflate(buf, len, msg.c_str(), msg.size());
|
||||
buf[len] = '\0';
|
||||
CPPUNIT_ASSERT_EQUAL(string("1234567890"), string(buf));
|
||||
|
@ -54,7 +54,7 @@ void ChunkedEncodingTest::testInflateLargeChunk() {
|
|||
string body;
|
||||
is >> body;
|
||||
char buf[4097];
|
||||
int len = sizeof(buf);
|
||||
int32_t len = sizeof(buf);
|
||||
for(int i = 0; i < 2; i++) {
|
||||
string msg = "1000\r\n"+body+"\r\n";
|
||||
len = sizeof(buf);
|
||||
|
@ -63,7 +63,7 @@ void ChunkedEncodingTest::testInflateLargeChunk() {
|
|||
CPPUNIT_ASSERT_EQUAL(body, string(buf));
|
||||
}
|
||||
enc->inflate(buf, len, "0\r\n", 3);
|
||||
CPPUNIT_ASSERT_EQUAL(0, len);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, len);
|
||||
CPPUNIT_ASSERT(enc->finished());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,23 +39,23 @@ void DataTest::testGetData() {
|
|||
Data data("aria2", 5);
|
||||
int len;
|
||||
CPPUNIT_ASSERT_EQUAL(0, memcmp("aria2", data.getData(), 5));
|
||||
CPPUNIT_ASSERT_EQUAL(5, data.getLen());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)5, data.getLen());
|
||||
|
||||
Data null(NULL, 0);
|
||||
CPPUNIT_ASSERT_EQUAL((const char*)NULL, null.getData());
|
||||
CPPUNIT_ASSERT_EQUAL(0, null.getLen());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, null.getLen());
|
||||
|
||||
}
|
||||
|
||||
void DataTest::testToInt() {
|
||||
Data data("1000", 4);
|
||||
CPPUNIT_ASSERT_EQUAL(1000, data.toInt());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1000, data.toInt());
|
||||
|
||||
Data null(NULL, 0);
|
||||
CPPUNIT_ASSERT_EQUAL(0, null.toInt());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, null.toInt());
|
||||
|
||||
Data alpha("abc", 3);
|
||||
CPPUNIT_ASSERT_EQUAL(0, alpha.toInt());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, alpha.toInt());
|
||||
}
|
||||
|
||||
void DataTest::testToLLInt() {
|
||||
|
|
|
@ -106,7 +106,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(DefaultBtRequestFactoryTest);
|
|||
void DefaultBtRequestFactoryTest::testAddTargetPiece() {
|
||||
PieceHandle piece = new Piece(0, 16*1024);
|
||||
btRequestFactory->addTargetPiece(piece);
|
||||
CPPUNIT_ASSERT_EQUAL(1, btRequestFactory->countTargetPiece());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, btRequestFactory->countTargetPiece());
|
||||
}
|
||||
|
||||
void DefaultBtRequestFactoryTest::testRemoveCompletedPiece() {
|
||||
|
@ -115,10 +115,10 @@ void DefaultBtRequestFactoryTest::testRemoveCompletedPiece() {
|
|||
piece2->setAllBlock();
|
||||
btRequestFactory->addTargetPiece(piece1);
|
||||
btRequestFactory->addTargetPiece(piece2);
|
||||
CPPUNIT_ASSERT_EQUAL(2, btRequestFactory->countTargetPiece());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)2, btRequestFactory->countTargetPiece());
|
||||
btRequestFactory->removeCompletedPiece();
|
||||
CPPUNIT_ASSERT_EQUAL(1, btRequestFactory->countTargetPiece());
|
||||
CPPUNIT_ASSERT_EQUAL(0, btRequestFactory->getTargetPieces().front()->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, btRequestFactory->countTargetPiece());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, btRequestFactory->getTargetPieces().front()->getIndex());
|
||||
}
|
||||
|
||||
void DefaultBtRequestFactoryTest::testCreateRequestMessages() {
|
||||
|
|
|
@ -36,7 +36,7 @@ void DefaultPeerListProcessorTest::testExtractPeer() {
|
|||
CPPUNIT_ASSERT_EQUAL((size_t)1, peers.size());
|
||||
PeerHandle peer = *peers.begin();
|
||||
CPPUNIT_ASSERT_EQUAL(string("192.168.0.1"), peer->ipaddr);
|
||||
CPPUNIT_ASSERT_EQUAL(2006, peer->port);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)2006, peer->port);
|
||||
}
|
||||
|
||||
void DefaultPeerListProcessorTest::testExtract2Peers() {
|
||||
|
@ -49,9 +49,9 @@ void DefaultPeerListProcessorTest::testExtract2Peers() {
|
|||
CPPUNIT_ASSERT_EQUAL((size_t)2, peers.size());
|
||||
PeerHandle peer = *peers.begin();
|
||||
CPPUNIT_ASSERT_EQUAL(string("192.168.0.1"), peer->ipaddr);
|
||||
CPPUNIT_ASSERT_EQUAL(2006, peer->port);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)2006, peer->port);
|
||||
|
||||
peer = *(peers.begin()+1);
|
||||
CPPUNIT_ASSERT_EQUAL(string("192.168.0.2"), peer->ipaddr);
|
||||
CPPUNIT_ASSERT_EQUAL(2007, peer->port);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)2007, peer->port);
|
||||
}
|
||||
|
|
|
@ -125,8 +125,8 @@ void DefaultPieceStorageTest::testGetPiece() {
|
|||
DefaultPieceStorage pss(btContext, option);
|
||||
|
||||
PieceHandle pieceGot = pss.getPiece(0);
|
||||
CPPUNIT_ASSERT_EQUAL(0, pieceGot->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL(128, pieceGot->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, pieceGot->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)128, pieceGot->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL(false, pieceGot->pieceComplete());
|
||||
}
|
||||
|
||||
|
@ -136,9 +136,9 @@ void DefaultPieceStorageTest::testGetPieceInUsedPieces() {
|
|||
piece->completeBlock(0);
|
||||
pss.addUsedPiece(piece);
|
||||
PieceHandle pieceGot = pss.getPiece(0);
|
||||
CPPUNIT_ASSERT_EQUAL(0, pieceGot->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL(128, pieceGot->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL(1, pieceGot->countCompleteBlock());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, pieceGot->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)128, pieceGot->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, pieceGot->countCompleteBlock());
|
||||
}
|
||||
|
||||
void DefaultPieceStorageTest::testGetPieceCompletedPiece() {
|
||||
|
@ -146,7 +146,7 @@ void DefaultPieceStorageTest::testGetPieceCompletedPiece() {
|
|||
PieceHandle piece = PieceHandle(new Piece(0, 128));
|
||||
pss.completePiece(piece);
|
||||
PieceHandle pieceGot = pss.getPiece(0);
|
||||
CPPUNIT_ASSERT_EQUAL(0, pieceGot->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL(128, pieceGot->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, pieceGot->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)128, pieceGot->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL(true, pieceGot->pieceComplete());
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ public:
|
|||
CPPUNIT_TEST_SUITE_REGISTRATION(FeatureConfigTest);
|
||||
|
||||
void FeatureConfigTest::testGetDefaultPort() {
|
||||
CPPUNIT_ASSERT_EQUAL(80,
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80,
|
||||
FeatureConfig::getInstance()->getDefaultPort("http"));
|
||||
CPPUNIT_ASSERT_EQUAL(443,
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)443,
|
||||
FeatureConfig::getInstance()->getDefaultPort("https"));
|
||||
CPPUNIT_ASSERT_EQUAL(21,
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)21,
|
||||
FeatureConfig::getInstance()->getDefaultPort("ftp"));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,9 @@ void MetalinkEntryTest::testReorderResourcesByPreference() {
|
|||
|
||||
entry->reorderResourcesByPreference();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(100, entry->resources.at(0)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL(90, entry->resources.at(1)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL(60, entry->resources.at(2)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL(50, entry->resources.at(3)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL(10, entry->resources.at(4)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)100, entry->resources.at(0)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)90, entry->resources.at(1)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)60, entry->resources.at(2)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)50, entry->resources.at(3)->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)10, entry->resources.at(4)->preference);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public:
|
|||
|
||||
virtual void removeAllTargetPiece() {}
|
||||
|
||||
virtual int countTargetPiece() { return 0; }
|
||||
virtual int32_t countTargetPiece() { return 0; }
|
||||
|
||||
virtual void removeCompletedPiece() {}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
return new Piece();
|
||||
}
|
||||
|
||||
virtual PieceHandle getPiece(int index) {
|
||||
virtual PieceHandle getPiece(int32_t index) {
|
||||
return new Piece();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
virtual void cancelPiece(const PieceHandle& piece) {}
|
||||
|
||||
virtual bool hasPiece(int index) {
|
||||
virtual bool hasPiece(int32_t index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void OptionTest::testPutAndGetAsInt() {
|
|||
op.put("key", "1000");
|
||||
|
||||
CPPUNIT_ASSERT(op.defined("key"));
|
||||
CPPUNIT_ASSERT_EQUAL(1000, op.getAsInt("key"));
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1000, op.getAsInt("key"));
|
||||
}
|
||||
|
||||
void OptionTest::testPutAndGetAsDouble() {
|
||||
|
|
|
@ -72,7 +72,7 @@ void RequestTest::testSetUrl1() {
|
|||
CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com/"), req.getCurrentUrl());
|
||||
CPPUNIT_ASSERT_EQUAL(string(""), req.getPreviousUrl());
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string(""), req.getFile());
|
||||
|
@ -90,7 +90,7 @@ void RequestTest::testSetUrl2() {
|
|||
// previousUrl must equal to referer;
|
||||
CPPUNIT_ASSERT_EQUAL(req.getReferer(), req.getPreviousUrl());
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(8080, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)8080, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string("index.html"), req.getFile());
|
||||
|
@ -102,7 +102,7 @@ void RequestTest::testSetUrl3() {
|
|||
|
||||
CPPUNIT_ASSERT(v);
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/aria2"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string("index.html"), req.getFile());
|
||||
|
@ -114,7 +114,7 @@ void RequestTest::testSetUrl4() {
|
|||
|
||||
CPPUNIT_ASSERT(v);
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/aria2/aria3"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string("index.html"), req.getFile());
|
||||
|
@ -126,7 +126,7 @@ void RequestTest::testSetUrl5() {
|
|||
|
||||
CPPUNIT_ASSERT(v);
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/aria2/aria3"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string(""), req.getFile());
|
||||
|
@ -138,7 +138,7 @@ void RequestTest::testSetUrl6() {
|
|||
|
||||
CPPUNIT_ASSERT(v);
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/aria2"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria3"), req.getFile());
|
||||
|
@ -212,7 +212,7 @@ void RequestTest::testSetUrl14() {
|
|||
CPPUNIT_ASSERT(v);
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(string("host"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(8080, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)8080, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string("abc?query"), req.getFile());
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ void RequestTest::testRedirectUrl() {
|
|||
CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com:8080/aria2/index.html"), req.getPreviousUrl());
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.co.jp"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string(""), req.getFile());
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ void RequestTest::testResetUrl() {
|
|||
// referer is unchanged
|
||||
CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com:8080/"), req.getReferer());
|
||||
CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol());
|
||||
CPPUNIT_ASSERT_EQUAL(8080, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)8080, req.getPort());
|
||||
CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.com"), req.getHost());
|
||||
CPPUNIT_ASSERT_EQUAL(string("/aria2"), req.getDir());
|
||||
CPPUNIT_ASSERT_EQUAL(string("index.html"), req.getFile());
|
||||
|
|
|
@ -83,15 +83,15 @@ void SegmentManTest::testSaveAndLoad() {
|
|||
void SegmentManTest::testNullBitfield() {
|
||||
SegmentMan segmentMan;
|
||||
Option op;
|
||||
op.put(PREF_SEGMENT_SIZE, Util::itos(1024*1024));
|
||||
op.put(PREF_SEGMENT_SIZE, Util::itos((int32_t)(1024*1024)));
|
||||
segmentMan.option = &op;
|
||||
|
||||
SegmentHandle segment = segmentMan.getSegment(1);
|
||||
CPPUNIT_ASSERT(!segment.isNull());
|
||||
CPPUNIT_ASSERT_EQUAL(0, segment->index);
|
||||
CPPUNIT_ASSERT_EQUAL(0, segment->length);
|
||||
CPPUNIT_ASSERT_EQUAL(0, segment->segmentLength);
|
||||
CPPUNIT_ASSERT_EQUAL(0, segment->writtenLength);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, segment->index);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, segment->length);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, segment->segmentLength);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, segment->writtenLength);
|
||||
|
||||
SegmentHandle segment2 = segmentMan.getSegment(2);
|
||||
CPPUNIT_ASSERT(segment2.isNull());
|
||||
|
@ -145,8 +145,8 @@ void SegmentManTest::testMarkPieceDone_usedSegment()
|
|||
|
||||
SegmentHandle segment = segmentMan.getSegment(0, 5);
|
||||
CPPUNIT_ASSERT(!segment.isNull());
|
||||
CPPUNIT_ASSERT_EQUAL(5, segment->index);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)5, segment->index);
|
||||
CPPUNIT_ASSERT_EQUAL(pieceLength, (int32_t) segment->length);
|
||||
CPPUNIT_ASSERT_EQUAL(pieceLength, (int32_t) segment->segmentLength);
|
||||
CPPUNIT_ASSERT_EQUAL(100, segment->writtenLength);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)100, segment->writtenLength);
|
||||
}
|
||||
|
|
|
@ -46,14 +46,14 @@ void Xml2MetalinkProcessorTest::testParseFile() {
|
|||
MetalinkResourceHandle resource1 = *resourceItr1;
|
||||
CPPUNIT_ASSERT_EQUAL(MetalinkResource::TYPE_FTP, resource1->type);
|
||||
CPPUNIT_ASSERT_EQUAL(string("jp"), resource1->location);
|
||||
CPPUNIT_ASSERT_EQUAL(100, resource1->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)100, resource1->preference);
|
||||
CPPUNIT_ASSERT_EQUAL(string("ftp://ftphost/aria2-0.5.2.tar.bz2"),
|
||||
resource1->url);
|
||||
resourceItr1++;
|
||||
MetalinkResourceHandle resource2 = *resourceItr1;
|
||||
CPPUNIT_ASSERT_EQUAL(MetalinkResource::TYPE_HTTP, resource2->type);
|
||||
CPPUNIT_ASSERT_EQUAL(string("us"), resource2->location);
|
||||
CPPUNIT_ASSERT_EQUAL(100, resource2->preference);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)100, resource2->preference);
|
||||
CPPUNIT_ASSERT_EQUAL(string("http://httphost/aria2-0.5.2.tar.bz2"),
|
||||
resource2->url);
|
||||
|
||||
|
|
Loading…
Reference in New Issue