From 110749df84956cf4c9d2c3f2070a64179d7cd5f1 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 14 Dec 2008 10:21:05 +0000 Subject: [PATCH] 2008-12-14 Tatsuhiro Tsujikawa Removed Dictionary/List/Data and its related classes. * src/BencodeVisitor.cc: Removed. * src/BencodeVisitor.h: Removed. * src/Data.cc: Removed. * src/Data.h: Removed. * src/Dictionary.cc: Removed. * src/Dictionary.h: Removed. * src/List.cc: Removed. * src/List.h: Removed. * src/Makefile.am * src/MetaEntry.h: Removed. * src/MetaEntryVisitor.h: Removed. * src/MetaFileUtil.cc: Removed. * src/MetaFileUtil.h: Removed. * test/BencodeVisitorTest.cc: Removed. * test/DataTest.cc: Removed. * test/DictionaryTest.cc: Removed. * test/ListTest.cc: Removed. * test/Makefile.am * test/MetaFileUtilTest.cc: Removed. --- ChangeLog | 23 ++++ src/BencodeVisitor.cc | 79 -------------- src/BencodeVisitor.h | 69 ------------ src/Data.cc | 86 --------------- src/Data.h | 75 ------------- src/Dictionary.cc | 87 --------------- src/Dictionary.h | 65 ----------- src/List.cc | 64 ----------- src/List.h | 61 ----------- src/Makefile.am | 6 -- src/Makefile.in | 24 +---- src/MetaEntry.h | 59 ---------- src/MetaEntryVisitor.h | 59 ---------- src/MetaFileUtil.cc | 214 ------------------------------------- src/MetaFileUtil.h | 72 ------------- test/BencodeVisitorTest.cc | 74 ------------- test/DataTest.cc | 81 -------------- test/DictionaryTest.cc | 36 ------- test/ListTest.cc | 34 ------ test/Makefile.am | 5 - test/Makefile.in | 24 +---- test/MetaFileUtilTest.cc | 74 ------------- 22 files changed, 30 insertions(+), 1341 deletions(-) delete mode 100644 src/BencodeVisitor.cc delete mode 100644 src/BencodeVisitor.h delete mode 100644 src/Data.cc delete mode 100644 src/Data.h delete mode 100644 src/Dictionary.cc delete mode 100644 src/Dictionary.h delete mode 100644 src/List.cc delete mode 100644 src/List.h delete mode 100644 src/MetaEntry.h delete mode 100644 src/MetaEntryVisitor.h delete mode 100644 src/MetaFileUtil.cc delete mode 100644 src/MetaFileUtil.h delete mode 100644 test/BencodeVisitorTest.cc delete mode 100644 test/DataTest.cc delete mode 100644 test/DictionaryTest.cc delete mode 100644 test/ListTest.cc delete mode 100644 test/MetaFileUtilTest.cc diff --git a/ChangeLog b/ChangeLog index 5c198a2b..b2bcac4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2008-12-14 Tatsuhiro Tsujikawa + + Removed Dictionary/List/Data and its related classes. + * src/BencodeVisitor.cc: Removed. + * src/BencodeVisitor.h: Removed. + * src/Data.cc: Removed. + * src/Data.h: Removed. + * src/Dictionary.cc: Removed. + * src/Dictionary.h: Removed. + * src/List.cc: Removed. + * src/List.h: Removed. + * src/Makefile.am + * src/MetaEntry.h: Removed. + * src/MetaEntryVisitor.h: Removed. + * src/MetaFileUtil.cc: Removed. + * src/MetaFileUtil.h: Removed. + * test/BencodeVisitorTest.cc: Removed. + * test/DataTest.cc: Removed. + * test/DictionaryTest.cc: Removed. + * test/ListTest.cc: Removed. + * test/Makefile.am + * test/MetaFileUtilTest.cc: Removed. + 2008-12-14 Tatsuhiro Tsujikawa Removed include of MetaEntry.h diff --git a/src/BencodeVisitor.cc b/src/BencodeVisitor.cc deleted file mode 100644 index e9cfd66f..00000000 --- a/src/BencodeVisitor.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* */ -#include "BencodeVisitor.h" -#include "Data.h" -#include "List.h" -#include "Dictionary.h" -#include "Util.h" -#include -#include - -namespace aria2 { - -BencodeVisitor::BencodeVisitor() {} - -BencodeVisitor::~BencodeVisitor() {} - -void BencodeVisitor::visit(const Data* d) -{ - if(d->isNumber()) { - _bencodedData += "i"+d->toString()+"e"; - } else { - _bencodedData += Util::itos(d->getLen())+":"+d->toString(); - } -} - -void BencodeVisitor::visit(const List* l) -{ - _bencodedData += "l"; - std::for_each(l->getList().begin(), l->getList().end(), - std::bind2nd(std::mem_fun(&MetaEntry::accept), this)); - _bencodedData += "e"; -} - -void BencodeVisitor::visit(const Dictionary* d) -{ - _bencodedData += "d"; - - for(std::deque::const_iterator itr = d->getOrder().begin(); itr != d->getOrder().end(); ++itr) { - _bencodedData += Util::uitos((*itr).size()); - _bencodedData += ":"; - _bencodedData += *itr; - d->get(*itr)->accept(this); - } - _bencodedData += "e"; -} - -} // namespace aria2 diff --git a/src/BencodeVisitor.h b/src/BencodeVisitor.h deleted file mode 100644 index 8818b3df..00000000 --- a/src/BencodeVisitor.h +++ /dev/null @@ -1,69 +0,0 @@ -/* */ -#ifndef _D_BENCODE_VISITOR_H_ -#define _D_BENCODE_VISITOR_H_ - -#include "MetaEntryVisitor.h" -#include - -namespace aria2 { - -class Data; -class Dictionary; -class List; -class MetaEntry; - -class BencodeVisitor : public MetaEntryVisitor { -private: - std::string _bencodedData; -public: - BencodeVisitor(); - ~BencodeVisitor(); - - virtual void visit(const Data* d); - - virtual void visit(const Dictionary* d); - - virtual void visit(const List* l); - - const std::string& getBencodedData() const - { - return _bencodedData; - } -}; - -} // namespace aria2 - -#endif // _D_BENCODE_VISITOR_H_ diff --git a/src/Data.cc b/src/Data.cc deleted file mode 100644 index 9d584e19..00000000 --- a/src/Data.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* */ -#include "Data.h" -#include "MetaEntryVisitor.h" -#include -#include // <-- TODO remove this if strtoll is replaced with Util::parseLLInt() - -namespace aria2 { - -Data::Data(const unsigned char* data, size_t len, bool number): - _data(reinterpret_cast(data), len), - number(number) {} - -Data::Data(const char* data, size_t len, bool number): - _data(data, len), - number(number) {} - -Data::Data(const std::string& data, bool number):_data(data), number(number) {} - -Data::~Data() {} - -const std::string& Data::toString() const { - return _data; -} - -const unsigned char* Data::getData() const { - if(_data.empty()) { - return 0; - } else { - return reinterpret_cast(_data.c_str()); - } -} - -size_t Data::getLen() const { - return _data.size(); -} - -int32_t Data::toInt() const { - return toLLInt(); -} - -int64_t Data::toLLInt() const { - return strtoll(_data.c_str(), 0, 10); -} - -bool Data::isNumber() const { - return number; -} - -void Data::accept(MetaEntryVisitor* v) const { - v->visit(this); -} - -} // namespace aria2 diff --git a/src/Data.h b/src/Data.h deleted file mode 100644 index 7555acf1..00000000 --- a/src/Data.h +++ /dev/null @@ -1,75 +0,0 @@ -/* */ -#ifndef _D_DATA_H_ -#define _D_DATA_H_ - -#include "MetaEntry.h" -#include - -namespace aria2 { - -class Data : public MetaEntry { -private: - std::string _data; - bool number; - - void init(const unsigned char* data, size_t len); -public: - /** - * This class stores the copy of data. So caller must take care of freeing - * memory of data. - */ - Data(const char* data, size_t len, bool number = false); - - Data(const unsigned char* data, size_t len, bool number = false); - - Data(const std::string& data, bool number = false); - - virtual ~Data(); - - const std::string& toString() const; - int32_t toInt() const; - int64_t toLLInt() const; - - const unsigned char* getData() const; - size_t getLen() const; - bool isNumber() const; - - void accept(MetaEntryVisitor* v) const; -}; - -} // namespace aria2 - -#endif // _D_DATA_H_ diff --git a/src/Dictionary.cc b/src/Dictionary.cc deleted file mode 100644 index 1f6337eb..00000000 --- a/src/Dictionary.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* */ -#include "Dictionary.h" -#include "MetaEntryVisitor.h" -#include - -namespace aria2 { - -Dictionary::Dictionary() {} - -Dictionary::~Dictionary() { - clearTable(); -} - -void Dictionary::clearTable() { - for(std::map::iterator itr = table.begin(); - itr != table.end(); itr++) { - delete itr->second; - } - table.clear(); -} - -const MetaEntry* Dictionary::get(const std::string& name) const { - std::map::const_iterator itr = table.find(name); - if(itr == table.end()) { - return NULL; - } else { - return itr->second; - } -} - -void Dictionary::put(const std::string& name, MetaEntry* entry) { - table[name] = entry; - order.push_back(name); -} - -void Dictionary::remove(const std::string& name) -{ - std::map::iterator i = table.find(name); - if(i != table.end()) { - delete i->second; - table.erase(i); - order.erase(std::remove(order.begin(), order.end(), name), order.end()); - } -} - -void Dictionary::accept(MetaEntryVisitor* v) const { - v->visit(this); -} - -const std::deque& Dictionary::getOrder() const { - return order; -} - -} // namespace aria2 diff --git a/src/Dictionary.h b/src/Dictionary.h deleted file mode 100644 index a8e4cfd9..00000000 --- a/src/Dictionary.h +++ /dev/null @@ -1,65 +0,0 @@ -/* */ -#ifndef _D_DICTIONARY_H_ -#define _D_DICTIONARY_H_ - -#include "MetaEntry.h" -#include -#include -#include - -namespace aria2 { - -class Dictionary : public MetaEntry { -private: - std::map table; - std::deque order; - void clearTable(); -public: - Dictionary(); - ~Dictionary(); - - const MetaEntry* get(const std::string& name) const; - void put(const std::string& name, MetaEntry* entry); - void remove(const std::string& name); - - void accept(MetaEntryVisitor* v) const; - const std::deque& getOrder() const; - -}; - -} // namespace aria2 - -#endif // _D_DICTIONARY_H_ diff --git a/src/List.cc b/src/List.cc deleted file mode 100644 index 25838fa1..00000000 --- a/src/List.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* */ -#include "List.h" -#include "MetaEntryVisitor.h" - -namespace aria2 { - -List::List() {} - -List::~List() { - clearList(); -} - -void List::clearList() { - for(std::deque::iterator itr = mlist.begin(); itr != mlist.end(); itr++) { - delete *itr; - } -} - -void List::add(MetaEntry* entry) { - mlist.push_back(entry); -} - -const std::deque& List::getList() const { - return mlist; -} - -void List::accept(MetaEntryVisitor* v) const { - v->visit(this); -} - -} // namespace aria2 diff --git a/src/List.h b/src/List.h deleted file mode 100644 index b3388fdb..00000000 --- a/src/List.h +++ /dev/null @@ -1,61 +0,0 @@ -/* */ -#ifndef _D_LIST_H_ -#define _D_LIST_H_ - -#include "MetaEntry.h" -#include - -namespace aria2 { - -class List : public MetaEntry { -private: - std::deque mlist; - - void clearList(); -public: - List(); - ~List(); - - void add(MetaEntry* entry); - - const std::deque& getList() const; - - void accept(MetaEntryVisitor* v) const; -}; - -} // namespace aria2 - -#endif // _D_LIST_H_ diff --git a/src/Makefile.am b/src/Makefile.am index 270da0fd..4c15151f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -233,12 +233,6 @@ endif # ENABLE_MESSAGE_DIGEST if ENABLE_BITTORRENT SRCS += MetaEntry.h\ - Data.cc Data.h\ - Dictionary.cc Dictionary.h\ - List.cc List.h\ - MetaFileUtil.cc MetaFileUtil.h\ - MetaEntryVisitor.h\ - BencodeVisitor.cc BencodeVisitor.h\ PeerMessageUtil.cc PeerMessageUtil.h\ PeerAbstractCommand.cc PeerAbstractCommand.h\ PeerInitiateConnectionCommand.cc PeerInitiateConnectionCommand.h\ diff --git a/src/Makefile.in b/src/Makefile.in index a8373ec6..e38b0b80 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -51,12 +51,6 @@ bin_PROGRAMS = aria2c$(EXEEXT) @ENABLE_MESSAGE_DIGEST_TRUE@ ChunkChecksum.h @ENABLE_BITTORRENT_TRUE@am__append_8 = MetaEntry.h\ -@ENABLE_BITTORRENT_TRUE@ Data.cc Data.h\ -@ENABLE_BITTORRENT_TRUE@ Dictionary.cc Dictionary.h\ -@ENABLE_BITTORRENT_TRUE@ List.cc List.h\ -@ENABLE_BITTORRENT_TRUE@ MetaFileUtil.cc MetaFileUtil.h\ -@ENABLE_BITTORRENT_TRUE@ MetaEntryVisitor.h\ -@ENABLE_BITTORRENT_TRUE@ BencodeVisitor.cc BencodeVisitor.h\ @ENABLE_BITTORRENT_TRUE@ PeerMessageUtil.cc PeerMessageUtil.h\ @ENABLE_BITTORRENT_TRUE@ PeerAbstractCommand.cc PeerAbstractCommand.h\ @ENABLE_BITTORRENT_TRUE@ PeerInitiateConnectionCommand.cc PeerInitiateConnectionCommand.h\ @@ -429,11 +423,8 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \ ChecksumCheckIntegrityEntry.cc ChecksumCheckIntegrityEntry.h \ messageDigest.cc messageDigest.h MessageDigestHelper.cc \ MessageDigestHelper.h Checksum.h ChunkChecksum.h MetaEntry.h \ - Data.cc Data.h Dictionary.cc Dictionary.h List.cc List.h \ - MetaFileUtil.cc MetaFileUtil.h MetaEntryVisitor.h \ - BencodeVisitor.cc BencodeVisitor.h PeerMessageUtil.cc \ - PeerMessageUtil.h PeerAbstractCommand.cc PeerAbstractCommand.h \ - PeerInitiateConnectionCommand.cc \ + PeerMessageUtil.cc PeerMessageUtil.h PeerAbstractCommand.cc \ + PeerAbstractCommand.h PeerInitiateConnectionCommand.cc \ PeerInitiateConnectionCommand.h PeerInteractionCommand.cc \ PeerInteractionCommand.h Peer.h PeerListenCommand.cc \ PeerListenCommand.h RequestSlot.cc RequestSlot.h \ @@ -590,11 +581,7 @@ am__objects_1 = @ENABLE_MESSAGE_DIGEST_TRUE@ ChecksumCheckIntegrityEntry.$(OBJEXT) \ @ENABLE_MESSAGE_DIGEST_TRUE@ messageDigest.$(OBJEXT) \ @ENABLE_MESSAGE_DIGEST_TRUE@ MessageDigestHelper.$(OBJEXT) -@ENABLE_BITTORRENT_TRUE@am__objects_8 = Data.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ Dictionary.$(OBJEXT) List.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ MetaFileUtil.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ BencodeVisitor.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ PeerMessageUtil.$(OBJEXT) \ +@ENABLE_BITTORRENT_TRUE@am__objects_8 = PeerMessageUtil.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ PeerAbstractCommand.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ PeerInitiateConnectionCommand.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ PeerInteractionCommand.$(OBJEXT) \ @@ -1258,7 +1245,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AutoSaveCommand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BencodeVisitor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldMan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldManFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtAllowedFastMessage.Po@am__quote@ @@ -1353,7 +1339,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHTTokenUpdateCommand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHTUnknownMessage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHTUtil.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultAuthResolver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtAnnounce.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtContext.Po@am__quote@ @@ -1371,7 +1356,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPieceStorage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultSegmentManFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DelegatingPeerListProcessor.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Dictionary.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DirectDiskAdaptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DiskAdaptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadCommand.Po@am__quote@ @@ -1428,12 +1412,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LanguageMetalinkParserState.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LibgnutlsTLSContext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LibsslTLSContext.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/List.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSEHandshake.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MemoryBufferPreDownloadHandler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageDigestHelper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetaFileUtil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Metalink2RequestGroup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkEntry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkHelper.Po@am__quote@ diff --git a/src/MetaEntry.h b/src/MetaEntry.h deleted file mode 100644 index dbe8c5b1..00000000 --- a/src/MetaEntry.h +++ /dev/null @@ -1,59 +0,0 @@ -/* */ -#ifndef _D_META_ENTRY_H_ -#define _D_META_ENTRY_H_ - -#include "common.h" -#include "SharedHandle.h" - -namespace aria2 { - -class MetaEntryVisitor; - -class MetaEntry { -protected: - MetaEntry() {} -public: - virtual ~MetaEntry() {} - - virtual void accept(MetaEntryVisitor* v) const = 0; - -}; - -typedef SharedHandle MetaEntryHandle; - -} // namespace aria2 - -#endif // _D_META_ENTRY_H_ diff --git a/src/MetaEntryVisitor.h b/src/MetaEntryVisitor.h deleted file mode 100644 index bc23b4fe..00000000 --- a/src/MetaEntryVisitor.h +++ /dev/null @@ -1,59 +0,0 @@ -/* */ -#ifndef _D_META_ENTRY_VISITOR_H_ -#define _D_META_ENTRY_VISITOR_H_ - -#include "common.h" - -namespace aria2 { - -class Data; -class Dictionary; -class List; - -class MetaEntryVisitor { -public: - virtual ~MetaEntryVisitor() {} - - virtual void visit(const Data* d) = 0; - - virtual void visit(const Dictionary* d) = 0; - - virtual void visit(const List* l) = 0; -}; - -} // namespace aria2 - -#endif // _D_META_ENTRY_VISITOR_H_ diff --git a/src/MetaFileUtil.cc b/src/MetaFileUtil.cc deleted file mode 100644 index 27074535..00000000 --- a/src/MetaFileUtil.cc +++ /dev/null @@ -1,214 +0,0 @@ -/* */ -#include "MetaFileUtil.h" -#include "Data.h" -#include "Dictionary.h" -#include "List.h" -#include "File.h" -#include "DlAbortEx.h" -#include "message.h" -#include -#include // <-- TODO remove this if strtoul is replaced with Util::parseUInt() - -namespace aria2 { - -MetaEntry* MetaFileUtil::parseMetaFile(const std::string& file) { - File f(file); - size_t len = f.size(); - unsigned char* buf = new unsigned char[len]; - FILE* fp = fopen(file.c_str(), "r+b"); - try { - if(!fp) { - throw DlAbortEx("cannot open metainfo file"); - } - if(fread(buf, len, 1, fp) != 1) { - fclose(fp); - throw DlAbortEx("cannot read metainfo"); - } - fclose(fp); - fp = 0; - MetaEntry* entry = bdecoding(buf, len); - delete [] buf; - return entry; - } catch(RecoverableException& ex) { - delete [] buf; - if(fp) { - fclose(fp); - } - throw; - } -} - -MetaEntry* MetaFileUtil::bdecoding(const unsigned char* buf, size_t len) -{ - const unsigned char* p = buf; - const unsigned char* end = buf+len; - return bdecodingR(&p, end); -} - -MetaEntry* -MetaFileUtil::bdecodingR(const unsigned char** pp, const unsigned char* end) -{ - if(*pp >= end) { - throw DlAbortEx("Malformed metainfo"); - } - MetaEntry* e; - switch(**pp) { - case 'd': - (*pp)++; - e = parseDictionaryTree(pp, end); - break; - case 'l': - (*pp)++; - e = parseListTree(pp, end); - break; - case 'i': - (*pp)++; - e = decodeInt(pp, end); - break; - default: - e = decodeWord(pp, end); - } - return e; -} - -Dictionary* -MetaFileUtil::parseDictionaryTree(const unsigned char** pp, const unsigned char* end) -{ - if(*pp >= end) { - throw DlAbortEx("Malformed metainfo"); - } - Dictionary* dic = new Dictionary(); - try { - while(1) { - if(**pp == 'e') { - (*pp)++; - break; - } - std::string name = decodeWordAsString(pp, end); - MetaEntry* e = bdecodingR(pp, end); - dic->put(name, e); - } - return dic; - } catch(RecoverableException& ex) { - delete dic; - throw; - } -} - -List* -MetaFileUtil::parseListTree(const unsigned char** pp, const unsigned char* end) -{ - if(*pp >= end) { - throw DlAbortEx("Malformed metainfo"); - } - List* lis = new List(); - try { - while(1) { - if(**pp == 'e') { - (*pp)++; - break; - } - MetaEntry* e = bdecodingR(pp, end); - lis->add(e); - } - return lis; - } catch(RecoverableException& ex) { - delete lis; - throw; - } -} - -Data* -MetaFileUtil::decodeInt(const unsigned char** pp, const unsigned char* end) -{ - if(*pp >= end) { - throw DlAbortEx(EX_MALFORMED_META_INFO); - } - unsigned char* endTerm = reinterpret_cast(memchr(*pp, 'e', end-*pp)); - // TODO if endTerm is null - if(!endTerm) { - throw DlAbortEx(EX_MALFORMED_META_INFO); - } - size_t numSize = endTerm-*pp; - - Data* data = new Data(*pp, numSize, true); - *pp += numSize+1; - return data; -} - -Data* -MetaFileUtil::decodeWord(const unsigned char** pp, const unsigned char* end) -{ - if(*pp >= end) { - throw DlAbortEx("Malformed metainfo"); - } - unsigned char* delim = reinterpret_cast(memchr(*pp, ':', end-*pp)); - // TODO if delim is null - if(delim == *pp || !delim) { - throw DlAbortEx(EX_MALFORMED_META_INFO); - } - size_t numSize = delim-*pp; - unsigned char* temp = new unsigned char[numSize+1]; - memcpy(temp, *pp, numSize); - temp[numSize] = '\0'; - char* endptr; - unsigned long int size = strtoul(reinterpret_cast(temp), - &endptr, 10); - if(*endptr != '\0') { - delete [] temp; - throw DlAbortEx(EX_MALFORMED_META_INFO); - } - delete [] temp; - - if(delim+1+size > end) { - throw DlAbortEx(EX_MALFORMED_META_INFO); - } - - Data* data = new Data(delim+1, size); - *pp = delim+1+size; - return data; -} - -std::string -MetaFileUtil::decodeWordAsString(const unsigned char** pp, const unsigned char* end) -{ - Data* data = decodeWord(pp, end); - std::string str = data->toString(); - delete data; - return str; -} - -} // namespace aria2 diff --git a/src/MetaFileUtil.h b/src/MetaFileUtil.h deleted file mode 100644 index b29b948e..00000000 --- a/src/MetaFileUtil.h +++ /dev/null @@ -1,72 +0,0 @@ -/* */ -#ifndef _D_META_FILE_UTIL_H_ -#define _D_META_FILE_UTIL_H_ - -#include "common.h" -#include - -namespace aria2 { - -class MetaEntry; -class Dictionary; -class List; -class Data; - -class MetaFileUtil { -private: - MetaFileUtil() {} - - static MetaEntry* bdecodingR(const unsigned char** pp, const unsigned char* end); - static Dictionary* parseDictionaryTree(const unsigned char** pp, const unsigned char* end); - static List* parseListTree(const unsigned char** pp, const unsigned char* end); - static Data* decodeWord(const unsigned char** pp, const unsigned char* end); - static Data* decodeInt(const unsigned char** pp, const unsigned char* end); - static std::string decodeWordAsString(const unsigned char** pp, const unsigned char* end); - -public: - static MetaEntry* parseMetaFile(const std::string& file); - static MetaEntry* bdecoding(const unsigned char* buf, size_t len); - - static MetaEntry* bdecoding(const std::string& content) - { - return bdecoding(reinterpret_cast(content.c_str()), - content.size()); - } -}; - -} // namespace aria2 - -#endif // _D_META_FILE_UTIL_H_ diff --git a/test/BencodeVisitorTest.cc b/test/BencodeVisitorTest.cc deleted file mode 100644 index 7b6af005..00000000 --- a/test/BencodeVisitorTest.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "BencodeVisitor.h" -#include "Data.h" -#include "List.h" -#include "Dictionary.h" -#include - -namespace aria2 { - -class BencodeVisitorTest:public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(BencodeVisitorTest); - CPPUNIT_TEST(testVisit_data); - CPPUNIT_TEST(testVisit_list); - CPPUNIT_TEST(testVisit_dictionary); - CPPUNIT_TEST_SUITE_END(); -private: - -public: - void setUp() { - } - - void testVisit_data(); - void testVisit_list(); - void testVisit_dictionary(); -}; - - -CPPUNIT_TEST_SUITE_REGISTRATION( BencodeVisitorTest ); - -void BencodeVisitorTest::testVisit_data() -{ - { - BencodeVisitor v; - std::string str = "apple"; - MetaEntryHandle m(new Data(str.c_str(), str.size())); - m->accept(&v); - CPPUNIT_ASSERT_EQUAL(std::string("5:apple"), v.getBencodedData()); - } - { - BencodeVisitor v; - std::string str = "123"; - MetaEntryHandle m(new Data(str.c_str(), str.size(), true)); - m->accept(&v); - CPPUNIT_ASSERT_EQUAL(std::string("i123e"), v.getBencodedData()); - } -} - -void BencodeVisitorTest::testVisit_list() -{ - BencodeVisitor v; - List l; - std::string s1 = "alpha"; - l.add(new Data(s1.c_str(), s1.size())); - std::string s2 = "bravo"; - l.add(new Data(s2.c_str(), s2.size())); - std::string s3 = "123"; - l.add(new Data(s3.c_str(), s3.size(), true)); - l.accept(&v); - CPPUNIT_ASSERT_EQUAL(std::string("l5:alpha5:bravoi123ee"), v.getBencodedData()); -} - -void BencodeVisitorTest::testVisit_dictionary() -{ - BencodeVisitor v; - Dictionary d; - std::string s1 = "alpha"; - d.put("team", new Data(s1.c_str(), s1.size())); - std::string s2 = "123"; - d.put("score", new Data(s2.c_str(), s2.size(), true)); - d.accept(&v); - CPPUNIT_ASSERT_EQUAL(std::string("d4:team5:alpha5:scorei123ee"), v.getBencodedData()); -} - -} // namespace aria2 diff --git a/test/DataTest.cc b/test/DataTest.cc deleted file mode 100644 index 4985e2e6..00000000 --- a/test/DataTest.cc +++ /dev/null @@ -1,81 +0,0 @@ -#include "Data.h" -#include "A2STR.h" -#include -#include - -namespace aria2 { - -class DataTest:public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(DataTest); - CPPUNIT_TEST(testToString); - CPPUNIT_TEST(testGetData); - CPPUNIT_TEST(testToInt); - CPPUNIT_TEST(testToLLInt); - CPPUNIT_TEST_SUITE_END(); -private: - -public: - void setUp() { - } - - void testToString(); - void testGetData(); - void testToInt(); - void testToLLInt(); -}; - - -CPPUNIT_TEST_SUITE_REGISTRATION( DataTest ); - -void DataTest::testToString() { - Data data("aria2", 5); - CPPUNIT_ASSERT_EQUAL(std::string("aria2"), data.toString()); - - Data null(reinterpret_cast(0), 0); - CPPUNIT_ASSERT_EQUAL(A2STR::NIL, null.toString()); - - Data zeroLengthString(A2STR::NIL); - CPPUNIT_ASSERT_EQUAL(A2STR::NIL, zeroLengthString.toString()); -} - -void DataTest::testGetData() { - Data data("aria2", 5); - CPPUNIT_ASSERT_EQUAL(0, memcmp("aria2", data.getData(), 5)); - CPPUNIT_ASSERT_EQUAL((size_t)5, data.getLen()); - - Data null(reinterpret_cast(0), 0); - CPPUNIT_ASSERT(null.getData() == 0); - CPPUNIT_ASSERT_EQUAL((size_t)0, null.getLen()); - - Data zeroLengthString(A2STR::NIL); - CPPUNIT_ASSERT(zeroLengthString.getData() == 0); - CPPUNIT_ASSERT_EQUAL((size_t)0, zeroLengthString.getLen()); -} - -void DataTest::testToInt() { - Data data("1000", 4); - CPPUNIT_ASSERT_EQUAL((int32_t)1000, data.toInt()); - - Data null(reinterpret_cast(0), 0); - CPPUNIT_ASSERT_EQUAL((int32_t)0, null.toInt()); - - Data alpha("abc", 3); - CPPUNIT_ASSERT_EQUAL((int32_t)0, alpha.toInt()); - - Data zeroLengthString(""); - CPPUNIT_ASSERT_EQUAL(0, (int)zeroLengthString.toLLInt()); -} - -void DataTest::testToLLInt() { - Data data("1000", 4); - CPPUNIT_ASSERT_EQUAL(1000, (int)data.toLLInt()); - - Data null(reinterpret_cast(0), 0); - CPPUNIT_ASSERT_EQUAL(0, (int)null.toLLInt()); - - Data alpha("abc", 3); - CPPUNIT_ASSERT_EQUAL(0, (int)alpha.toLLInt()); -} - -} // namespace aria2 diff --git a/test/DictionaryTest.cc b/test/DictionaryTest.cc deleted file mode 100644 index b1aa7987..00000000 --- a/test/DictionaryTest.cc +++ /dev/null @@ -1,36 +0,0 @@ -#include "Dictionary.h" -#include "Data.h" -#include -#include - -namespace aria2 { - -class DictionaryTest:public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(DictionaryTest); - CPPUNIT_TEST(testGet); - CPPUNIT_TEST_SUITE_END(); -private: - -public: - void setUp() { - } - - void testGet(); -}; - - -CPPUNIT_TEST_SUITE_REGISTRATION( DictionaryTest ); - -void DictionaryTest::testGet() { - Dictionary d; - Data* data1 = new Data("aria2", 5); - d.put("app_name", data1); - Data* data2 = new Data("linux", 5); - d.put("platform", data2); - Data* dataGot = (Data*)d.get("app_name"); - CPPUNIT_ASSERT(dataGot != NULL); - CPPUNIT_ASSERT_EQUAL(std::string("aria2"), dataGot->toString()); -} - -} // namespace aria2 diff --git a/test/ListTest.cc b/test/ListTest.cc deleted file mode 100644 index c36b2515..00000000 --- a/test/ListTest.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include "List.h" -#include "Data.h" -#include -#include - -namespace aria2 { - -class ListTest:public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(ListTest); - CPPUNIT_TEST(testAdd); - CPPUNIT_TEST_SUITE_END(); -private: - -public: - void setUp() { - } - - void testAdd(); -}; - - -CPPUNIT_TEST_SUITE_REGISTRATION( ListTest ); - -void ListTest::testAdd() { - List l; - Data* data1 = new Data("usr", 3); - l.add(data1); - Data* data2 = new Data("local", 5); - l.add(data2); - CPPUNIT_ASSERT_EQUAL(2, (int)l.getList().size()); -} - -} // namespace aria2 diff --git a/test/Makefile.am b/test/Makefile.am index 35baefb7..d2051c9a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -110,10 +110,6 @@ aria2c_SOURCES += BtAllowedFastMessageTest.cc\ AnnounceListTest.cc\ DefaultPeerStorageTest.cc\ MockPeerStorage.h\ - DataTest.cc\ - DictionaryTest.cc\ - ListTest.cc\ - MetaFileUtilTest.cc\ ByteArrayDiskWriterTest.cc\ PeerTest.cc\ PeerSessionResourceTest.cc\ @@ -123,7 +119,6 @@ aria2c_SOURCES += BtAllowedFastMessageTest.cc\ BtDependencyTest.cc\ BtPostDownloadHandlerTest.cc\ TimeSeedCriteriaTest.cc\ - BencodeVisitorTest.cc\ BtExtendedMessageTest.cc\ HandshakeExtensionMessageTest.cc\ UTPexExtensionMessageTest.cc\ diff --git a/test/Makefile.in b/test/Makefile.in index a4ad2f90..3f38f392 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -69,10 +69,6 @@ check_PROGRAMS = $(am__EXEEXT_1) @ENABLE_BITTORRENT_TRUE@ AnnounceListTest.cc\ @ENABLE_BITTORRENT_TRUE@ DefaultPeerStorageTest.cc\ @ENABLE_BITTORRENT_TRUE@ MockPeerStorage.h\ -@ENABLE_BITTORRENT_TRUE@ DataTest.cc\ -@ENABLE_BITTORRENT_TRUE@ DictionaryTest.cc\ -@ENABLE_BITTORRENT_TRUE@ ListTest.cc\ -@ENABLE_BITTORRENT_TRUE@ MetaFileUtilTest.cc\ @ENABLE_BITTORRENT_TRUE@ ByteArrayDiskWriterTest.cc\ @ENABLE_BITTORRENT_TRUE@ PeerTest.cc\ @ENABLE_BITTORRENT_TRUE@ PeerSessionResourceTest.cc\ @@ -82,7 +78,6 @@ check_PROGRAMS = $(am__EXEEXT_1) @ENABLE_BITTORRENT_TRUE@ BtDependencyTest.cc\ @ENABLE_BITTORRENT_TRUE@ BtPostDownloadHandlerTest.cc\ @ENABLE_BITTORRENT_TRUE@ TimeSeedCriteriaTest.cc\ -@ENABLE_BITTORRENT_TRUE@ BencodeVisitorTest.cc\ @ENABLE_BITTORRENT_TRUE@ BtExtendedMessageTest.cc\ @ENABLE_BITTORRENT_TRUE@ HandshakeExtensionMessageTest.cc\ @ENABLE_BITTORRENT_TRUE@ UTPexExtensionMessageTest.cc\ @@ -214,15 +209,14 @@ am__aria2c_SOURCES_DIST = AllTest.cc TestUtil.cc TestUtil.h \ DefaultBtRequestFactoryTest.cc MockBtMessage.h \ MockBtMessageDispatcher.h MockBtMessageFactory.h \ DefaultPeerListProcessorTest.cc AnnounceListTest.cc \ - DefaultPeerStorageTest.cc MockPeerStorage.h DataTest.cc \ - DictionaryTest.cc ListTest.cc MetaFileUtilTest.cc \ + DefaultPeerStorageTest.cc MockPeerStorage.h \ ByteArrayDiskWriterTest.cc PeerTest.cc \ PeerSessionResourceTest.cc PeerMessageUtilTest.cc \ ShareRatioSeedCriteriaTest.cc BtRegistryTest.cc \ BtDependencyTest.cc BtPostDownloadHandlerTest.cc \ - TimeSeedCriteriaTest.cc BencodeVisitorTest.cc \ - BtExtendedMessageTest.cc HandshakeExtensionMessageTest.cc \ - UTPexExtensionMessageTest.cc DefaultBtMessageFactoryTest.cc \ + TimeSeedCriteriaTest.cc BtExtendedMessageTest.cc \ + HandshakeExtensionMessageTest.cc UTPexExtensionMessageTest.cc \ + DefaultBtMessageFactoryTest.cc \ DefaultExtensionMessageFactoryTest.cc DHTNodeTest.cc \ DHTBucketTest.cc DHTRoutingTableTest.cc \ DHTMessageTrackerEntryTest.cc DHTMessageTrackerTest.cc \ @@ -280,10 +274,6 @@ am__aria2c_SOURCES_DIST = AllTest.cc TestUtil.cc TestUtil.h \ @ENABLE_BITTORRENT_TRUE@ DefaultPeerListProcessorTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ AnnounceListTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ DefaultPeerStorageTest.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ DataTest.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ DictionaryTest.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ ListTest.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ MetaFileUtilTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ ByteArrayDiskWriterTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ PeerTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ PeerSessionResourceTest.$(OBJEXT) \ @@ -293,7 +283,6 @@ am__aria2c_SOURCES_DIST = AllTest.cc TestUtil.cc TestUtil.h \ @ENABLE_BITTORRENT_TRUE@ BtDependencyTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ BtPostDownloadHandlerTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ TimeSeedCriteriaTest.$(OBJEXT) \ -@ENABLE_BITTORRENT_TRUE@ BencodeVisitorTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ BtExtendedMessageTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ HandshakeExtensionMessageTest.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ UTPexExtensionMessageTest.$(OBJEXT) \ @@ -694,7 +683,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BNodeTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64Test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BencodeTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BencodeVisitorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldManTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtAllowedFastMessageTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtBitfieldMessageTest.Po@am__quote@ @@ -747,7 +735,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHTTokenTrackerTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHTUnknownMessageTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHTUtilTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DataTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultAuthResolverTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtAnnounceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtContextTest.Po@am__quote@ @@ -760,7 +747,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPeerListProcessorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPeerStorageTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPieceStorageTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DictionaryTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DirectDiskAdaptorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadHandlerFactoryTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadHelperTest.Po@am__quote@ @@ -779,10 +765,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InOrderURISelectorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IteratableChecksumValidatorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IteratableChunkChecksumValidatorTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ListTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSEHandshakeTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageDigestHelperTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetaFileUtilTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Metalink2RequestGroupTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkEntryTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkHelperTest.Po@am__quote@ diff --git a/test/MetaFileUtilTest.cc b/test/MetaFileUtilTest.cc deleted file mode 100644 index 32fab3fb..00000000 --- a/test/MetaFileUtilTest.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "MetaFileUtil.h" -#include "Data.h" -#include "Dictionary.h" -#include "List.h" -#include "DlAbortEx.h" -#include -#include - -namespace aria2 { - -class MetaFileUtilTest:public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(MetaFileUtilTest); - CPPUNIT_TEST(testParseMetaFile); - CPPUNIT_TEST(testBdecoding); - CPPUNIT_TEST_SUITE_END(); -private: - -public: - void setUp() { - } - - void testParseMetaFile(); - void testBdecoding(); -}; - - -CPPUNIT_TEST_SUITE_REGISTRATION( MetaFileUtilTest ); - -void MetaFileUtilTest::testParseMetaFile() { - SharedHandle entry(MetaFileUtil::parseMetaFile("test.torrent")); - SharedHandle d = dynamic_pointer_cast(entry); - CPPUNIT_ASSERT(!d.isNull()); -} - -void MetaFileUtilTest::testBdecoding() { - try { - std::string str = "5:abcd"; - MetaFileUtil::bdecoding(str); - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } catch(DlAbortEx& ex) { - } catch(...) { - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } - - try { - std::string str = "i1234"; - MetaFileUtil::bdecoding(str); - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } catch(DlAbortEx& ex) { - } catch(...) { - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } - - try { - const std::string str = "5abcd"; - MetaFileUtil::bdecoding(str); - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } catch(DlAbortEx& ex) { - } catch(...) { - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } - - try { - const std::string str = "d"; - MetaFileUtil::bdecoding(str); - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } catch(DlAbortEx& ex) { - } catch(...) { - CPPUNIT_FAIL("DlAbortEx exception must be thrown."); - } -} - -} // namespace aria2