2009-07-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Fixed compile error without BitTorrent support
	* src/DefaultBtProgressInfoFile.cc
	* src/DownloadEngine.cc
	* src/DownloadEngine.h
pull/1/head
Tatsuhiro Tsujikawa 2009-07-25 14:07:46 +00:00
parent 6191e909d2
commit 1fe4932201
4 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2009-07-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed compile error without BitTorrent support
* src/DefaultBtProgressInfoFile.cc
* src/DownloadEngine.cc
* src/DownloadEngine.h
2009-07-24 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2009-07-24 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added missing '=' in Download Results Added missing '=' in Download Results

View File

@ -112,7 +112,12 @@ void DefaultBtProgressInfoFile::save()
throw DL_ABORT_EX(StringFormat(EX_SEGMENT_FILE_WRITE, throw DL_ABORT_EX(StringFormat(EX_SEGMENT_FILE_WRITE,
_filename.c_str(), strerror(errno)).str()); _filename.c_str(), strerror(errno)).str());
} }
#ifdef ENABLE_BITTORRENT
bool torrentDownload = isTorrentDownload(); bool torrentDownload = isTorrentDownload();
#else // !ENABLE_BITTORRENT
bool torrentDownload = false;
#endif // !ENABLE_BITTORRENT
// file version: 16 bits // file version: 16 bits
// values: '1' // values: '1'
char version[] = { 0x00, 0x01 }; char version[] = { 0x00, 0x01 };
@ -127,6 +132,7 @@ void DefaultBtProgressInfoFile::save()
} }
o.write(reinterpret_cast<const char*>(&extension), sizeof(extension)); o.write(reinterpret_cast<const char*>(&extension), sizeof(extension));
if(torrentDownload) { if(torrentDownload) {
#ifdef ENABLE_BITTORRENT
// infoHashLength: // infoHashLength:
// length: 32 bits // length: 32 bits
const unsigned char* infoHash = bittorrent::getInfoHash(_dctx); const unsigned char* infoHash = bittorrent::getInfoHash(_dctx);
@ -135,6 +141,7 @@ void DefaultBtProgressInfoFile::save()
sizeof(infoHashLengthNL)); sizeof(infoHashLengthNL));
// infoHash: // infoHash:
o.write(reinterpret_cast<const char*>(infoHash), INFO_HASH_LENGTH); o.write(reinterpret_cast<const char*>(infoHash), INFO_HASH_LENGTH);
#endif // ENABLE_BITTORRENT
} else { } else {
// infoHashLength: // infoHashLength:
// length: 32 bits // length: 32 bits
@ -259,6 +266,7 @@ void DefaultBtProgressInfoFile::load()
in.read(reinterpret_cast<char*> in.read(reinterpret_cast<char*>
(static_cast<unsigned char*>(savedInfoHash)), infoHashLength); (static_cast<unsigned char*>(savedInfoHash)), infoHashLength);
CHECK_STREAM(in, static_cast<int>(infoHashLength)); CHECK_STREAM(in, static_cast<int>(infoHashLength));
#ifdef ENABLE_BITTORRENT
if(infoHashCheckEnabled) { if(infoHashCheckEnabled) {
const unsigned char* infoHash = bittorrent::getInfoHash(_dctx); const unsigned char* infoHash = bittorrent::getInfoHash(_dctx);
if(infoHashLength != INFO_HASH_LENGTH || if(infoHashLength != INFO_HASH_LENGTH ||
@ -270,6 +278,7 @@ void DefaultBtProgressInfoFile::load()
).str()); ).str());
} }
} }
#endif // ENABLE_BITTORRENT
} }
uint32_t pieceLength; uint32_t pieceLength;

View File

@ -91,7 +91,9 @@ DownloadEngine::DownloadEngine(const SharedHandle<EventPoll>& eventPoll):
_noWait(false), _noWait(false),
_refreshInterval(DEFAULT_REFRESH_INTERVAL), _refreshInterval(DEFAULT_REFRESH_INTERVAL),
_cookieStorage(new CookieStorage()), _cookieStorage(new CookieStorage()),
#ifdef ENABLE_BITTORRENT
_btRegistry(new BtRegistry()), _btRegistry(new BtRegistry()),
#endif // ENABLE_BITTORRENT
_dnsCache(new DNSCache()) _dnsCache(new DNSCache())
{} {}

View File

@ -60,12 +60,14 @@ class RequestGroupMan;
class StatCalc; class StatCalc;
class SocketCore; class SocketCore;
class CookieStorage; class CookieStorage;
class BtRegistry;
class DNSCache; class DNSCache;
class AuthConfigFactory; class AuthConfigFactory;
class Request; class Request;
class EventPoll; class EventPoll;
class Command; class Command;
#ifdef ENABLE_BITTORRENT
class BtRegistry;
#endif // ENABLE_BITTORRENT
class DownloadEngine { class DownloadEngine {
private: private:
@ -123,7 +125,9 @@ private:
SharedHandle<CookieStorage> _cookieStorage; SharedHandle<CookieStorage> _cookieStorage;
#ifdef ENABLE_BITTORRENT
SharedHandle<BtRegistry> _btRegistry; SharedHandle<BtRegistry> _btRegistry;
#endif // ENABLE_BITTORRENT
CUIDCounter _cuidCounter; CUIDCounter _cuidCounter;
@ -237,10 +241,12 @@ public:
return _cookieStorage; return _cookieStorage;
} }
#ifdef ENABLE_BITTORRENT
const SharedHandle<BtRegistry>& getBtRegistry() const const SharedHandle<BtRegistry>& getBtRegistry() const
{ {
return _btRegistry; return _btRegistry;
} }
#endif // ENABLE_BITTORRENT
cuid_t newCUID(); cuid_t newCUID();