summaryrefslogtreecommitdiff
path: root/src/BitfieldMan.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-03-24 14:32:49 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-03-24 14:32:49 +0000
commita37aaa9c0c43c1013b323f28545eb9330d56dee3 (patch)
tree0aef46aad2dee8da1dd5f95d9a9d90100caa90b7 /src/BitfieldMan.cc
parent5649cf6cda777cff7749b12f5286272959520a4f (diff)
2007-03-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add the ability to resume downloading a partially downloaded file which is downloaded from the beginning: * src/FileAllocator.h: Made abstract class. New DefaultFileAllocator takes this role. * src/main.cc: Added -c option. * src/BitfieldMan.h, src/BitfieldMan.cc (setBitRange): New function. * src/DiskWriter.h (openExistingFile): Added totalLength argument. * src/prefs.h (PREF_CONTINUE): New definition. * src/SegmentMan.h, src/SegmentMan.cc (markPieceDone): New function. * src/DefaultDiskWriter.cc (createNewDiskWriter): Add GlowFileAllocator to the new object. * src/AbstractDiskWriter.h (glowFileAllocator): New variable. * src/AbstractDiskWriter.cc (openExistingFile): Now preallocate file space from the end of the existing file if totalLength argument is specified and grater than 0. * src/UrlRequestInfo.cc: If -c option is specified and the file to download exists in local, continue the download of the file. --allow-overwrite=true is assumed in this context. * src/DefaultFileAllocator.h, src/DefaultFileAllocator.cc: New class. * src/GlowFileAllocator.h, src/GlowFileAllocator.cc: New class. Throw exception if --check-integrity=true is specified but chunk checksums are not provided: * src/UrlRequestInfo.cc
Diffstat (limited to 'src/BitfieldMan.cc')
-rw-r--r--src/BitfieldMan.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/BitfieldMan.cc b/src/BitfieldMan.cc
index ef9a4cbe..afcf027a 100644
--- a/src/BitfieldMan.cc
+++ b/src/BitfieldMan.cc
@@ -645,6 +645,14 @@ void BitfieldMan::unsetBitRange(int32_t startIndex, int32_t endIndex)
updateCache();
}
+void BitfieldMan::setBitRange(int32_t startIndex, int32_t endIndex)
+{
+ for(int32_t i = startIndex; i <= endIndex; ++i) {
+ setBit(i);
+ }
+ updateCache();
+}
+
bool BitfieldMan::isBitSetOffsetRange(int64_t offset, int64_t length) const
{
if(length <= 0) {