2007-11-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Eliminated g++-4.2 warning
	* src/DownloadHandlerConstants.{h, cc}
	* src/Util.cc
	* test/MetaFileUtilTest.cc
	* test/PStringBuildVisitorTest.cc
	
	Fixed bug: --check-integrity dones't work for multi file 
torrent.
	* src/RequestGroup.cc
	* src/BtCheckIntegrityEntry.cc
pull/1/head
Tatsuhiro Tsujikawa 2007-11-29 11:33:50 +00:00
parent 6a0961f2bf
commit 4a59e5899a
8 changed files with 30 additions and 17 deletions

View File

@ -1,3 +1,15 @@
2007-11-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Eliminated g++-4.2 warning
* src/DownloadHandlerConstants.{h, cc}
* src/Util.cc
* test/MetaFileUtilTest.cc
* test/PStringBuildVisitorTest.cc
Fixed bug: --check-integrity dones't work for multi file torrent.
* src/RequestGroup.cc
* src/BtCheckIntegrityEntry.cc
2007-11-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> 2007-11-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed a2io.h Fixed a2io.h

View File

@ -40,6 +40,7 @@
#include "PieceStorage.h" #include "PieceStorage.h"
#include "DownloadEngine.h" #include "DownloadEngine.h"
#include "FileAllocationMan.h" #include "FileAllocationMan.h"
#include "DiskAdaptor.h"
BtCheckIntegrityEntry::BtCheckIntegrityEntry(RequestGroup* requestGroup): BtCheckIntegrityEntry::BtCheckIntegrityEntry(RequestGroup* requestGroup):
PieceHashCheckIntegrityEntry(requestGroup, 0) {} PieceHashCheckIntegrityEntry(requestGroup, 0) {}
@ -60,6 +61,7 @@ Commands BtCheckIntegrityEntry::onDownloadIncomplete(DownloadEngine* e)
Commands BtCheckIntegrityEntry::onDownloadFinished(DownloadEngine* e) Commands BtCheckIntegrityEntry::onDownloadFinished(DownloadEngine* e)
{ {
_requestGroup->getPieceStorage()->getDiskAdaptor()->onDownloadComplete();
// TODO Currently,when all the checksums // TODO Currently,when all the checksums
// are valid, then aira2 goes to seeding mode. Sometimes it is better // are valid, then aira2 goes to seeding mode. Sometimes it is better
// to exit rather than doing seeding. So, it would be good to toggle this // to exit rather than doing seeding. So, it would be good to toggle this

View File

@ -34,15 +34,15 @@
/* copyright --> */ /* copyright --> */
#include "DownloadHandlerConstants.h" #include "DownloadHandlerConstants.h"
char* DownloadHandlerConstants::METALINK_EXTENSIONS[] = { ".metalink" }; const char* DownloadHandlerConstants::METALINK_EXTENSIONS[] = { ".metalink" };
char* DownloadHandlerConstants::METALINK_CONTENT_TYPES[] = { const char* DownloadHandlerConstants::METALINK_CONTENT_TYPES[] = {
"application/metalink+xml" "application/metalink+xml"
}; };
char* DownloadHandlerConstants::BT_EXTENSIONS[] = { ".torrent" }; const char* DownloadHandlerConstants::BT_EXTENSIONS[] = { ".torrent" };
char* DownloadHandlerConstants::BT_CONTENT_TYPES[] = { const char* DownloadHandlerConstants::BT_CONTENT_TYPES[] = {
"application/x-bittorrent" "application/x-bittorrent"
}; };

View File

@ -41,19 +41,19 @@
class DownloadHandlerConstants class DownloadHandlerConstants
{ {
public: public:
static char* METALINK_EXTENSIONS[]; static const char* METALINK_EXTENSIONS[];
static Strings getMetalinkExtensions(); static Strings getMetalinkExtensions();
static char* METALINK_CONTENT_TYPES[]; static const char* METALINK_CONTENT_TYPES[];
static Strings getMetalinkContentTypes(); static Strings getMetalinkContentTypes();
static char* BT_EXTENSIONS[]; static const char* BT_EXTENSIONS[];
static Strings getBtExtensions(); static Strings getBtExtensions();
static char* BT_CONTENT_TYPES[]; static const char* BT_CONTENT_TYPES[];
static Strings getBtContentTypes(); static Strings getBtContentTypes();
}; };

View File

@ -237,8 +237,7 @@ Commands RequestGroup::createInitialCommand(DownloadEngine* e)
Commands RequestGroup::processCheckIntegrityEntry(const CheckIntegrityEntryHandle& entry, DownloadEngine* e) Commands RequestGroup::processCheckIntegrityEntry(const CheckIntegrityEntryHandle& entry, DownloadEngine* e)
{ {
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
if(//File(getFilePath()).size() > 0 && if(e->option->get(PREF_CHECK_INTEGRITY) == V_TRUE &&
e->option->get(PREF_CHECK_INTEGRITY) == V_TRUE &&
entry->isValidationReady()) { entry->isValidationReady()) {
entry->initValidator(); entry->initValidator();
CheckIntegrityCommand* command = CheckIntegrityCommand* command =

View File

@ -581,7 +581,7 @@ int32_t Util::countBit(uint32_t n) {
} }
string Util::randomAlpha(int32_t length, const RandomizerHandle& randomizer) { string Util::randomAlpha(int32_t length, const RandomizerHandle& randomizer) {
static char *random_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static const char *random_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
string str; string str;
for(int32_t i = 0; i < length; i++) { for(int32_t i = 0; i < length; i++) {
int32_t index = randomizer->getRandomNumber(strlen(random_chars)); int32_t index = randomizer->getRandomNumber(strlen(random_chars));

View File

@ -35,7 +35,7 @@ void MetaFileUtilTest::testParseMetaFile() {
void MetaFileUtilTest::testBdecoding() { void MetaFileUtilTest::testBdecoding() {
try { try {
char* str = "5:abcd"; const char* str = "5:abcd";
MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str)); MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str));
CPPUNIT_FAIL("DlAbortEx exception must be thrown."); CPPUNIT_FAIL("DlAbortEx exception must be thrown.");
} catch(DlAbortEx* ex) { } catch(DlAbortEx* ex) {
@ -45,7 +45,7 @@ void MetaFileUtilTest::testBdecoding() {
} }
try { try {
char* str = "i1234"; const char* str = "i1234";
MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str)); MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str));
CPPUNIT_FAIL("DlAbortEx exception must be thrown."); CPPUNIT_FAIL("DlAbortEx exception must be thrown.");
} catch(DlAbortEx* ex) { } catch(DlAbortEx* ex) {
@ -55,7 +55,7 @@ void MetaFileUtilTest::testBdecoding() {
} }
try { try {
char* str = "5abcd"; const char* str = "5abcd";
MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str)); MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str));
CPPUNIT_FAIL("DlAbortEx exception must be thrown."); CPPUNIT_FAIL("DlAbortEx exception must be thrown.");
} catch(DlAbortEx* ex) { } catch(DlAbortEx* ex) {
@ -65,7 +65,7 @@ void MetaFileUtilTest::testBdecoding() {
} }
try { try {
char* str = "d"; const char* str = "d";
MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str)); MetaEntry* entry = MetaFileUtil::bdecoding(str, strlen(str));
CPPUNIT_FAIL("DlAbortEx exception must be thrown."); CPPUNIT_FAIL("DlAbortEx exception must be thrown.");
} catch(DlAbortEx* ex) { } catch(DlAbortEx* ex) {

View File

@ -30,7 +30,7 @@ void PStringBuildVisitorTest::testVisit_select()
{ {
PStringSegmentHandle segment1 = new PStringSegment("/tango"); PStringSegmentHandle segment1 = new PStringSegment("/tango");
char* select1data[] = { "alpha", "bravo", "charlie" }; const char* select1data[] = { "alpha", "bravo", "charlie" };
PStringSelectHandle select1 = PStringSelectHandle select1 =
new PStringSelect(Strings(&select1data[0], &select1data[3]), segment1); new PStringSelect(Strings(&select1data[0], &select1data[3]), segment1);
@ -66,7 +66,7 @@ void PStringBuildVisitorTest::testVisit_select_numLoop()
{ {
PStringSegmentHandle segment1 = new PStringSegment("/tango"); PStringSegmentHandle segment1 = new PStringSegment("/tango");
char* select1data[] = { "alpha", "bravo", "charlie" }; const char* select1data[] = { "alpha", "bravo", "charlie" };
PStringSelectHandle select1 = PStringSelectHandle select1 =
new PStringSelect(Strings(&select1data[0], &select1data[3]), segment1); new PStringSelect(Strings(&select1data[0], &select1data[3]), segment1);