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>
Added missing '=' in Download Results

View File

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

View File

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

View File

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