浏览代码

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
Tatsuhiro Tsujikawa 16 年之前
父节点
当前提交
1fe4932201
共有 4 个文件被更改,包括 25 次插入1 次删除
  1. 7 0
      ChangeLog
  2. 9 0
      src/DefaultBtProgressInfoFile.cc
  3. 2 0
      src/DownloadEngine.cc
  4. 7 1
      src/DownloadEngine.h

+ 7 - 0
ChangeLog

@@ -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

+ 9 - 0
src/DefaultBtProgressInfoFile.cc

@@ -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;

+ 2 - 0
src/DownloadEngine.cc

@@ -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())
 {}
 

+ 7 - 1
src/DownloadEngine.h

@@ -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();