summaryrefslogtreecommitdiff
path: root/src/BitfieldMan.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-03-05 12:31:57 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-03-05 12:31:57 +0000
commitba7f9f765794bc197750253f07211c66afdd69e5 (patch)
tree5b6dacc204d1ef6f3c2d19416d68524e180f98da /src/BitfieldMan.cc
parentcc24f7cdf816a4e127efeaf9b74146e1296467c9 (diff)
2007-03-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/HttpHeader.h (Range.h): New include. (status): New variable. (HttpHeader): Initialized status with 0. (getStatus): New function. (setStatus): New function. (getRange): New function. (HttpHeaderHandle): New function. * src/HttpHeader.cc (getRange): New function. * src/Request.h (RequestWeakHandle): New definition. * src/HttpConnection.h (HttpConnectionHandle): New type definition. * src/HttpConnection.cc (receiveResponse): Set HTTP status to headers. * src/main.cc (showUsage): Fixed typo. * src/Segment.h (SegmentHandle): New type definition. * src/BitfieldMan.h (getMissingUnusedLength): New function. * src/BitfieldMan.cc (getMissingUnusedLength): New function.
Diffstat (limited to 'src/BitfieldMan.cc')
-rw-r--r--src/BitfieldMan.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/BitfieldMan.cc b/src/BitfieldMan.cc
index f142e00a..ef9a4cbe 100644
--- a/src/BitfieldMan.cc
+++ b/src/BitfieldMan.cc
@@ -665,3 +665,18 @@ bool BitfieldMan::isBitSetOffsetRange(int64_t offset, int64_t length) const
}
return true;
}
+
+int64_t BitfieldMan::getMissingUnusedLength(int32_t startingIndex) const
+{
+ if(startingIndex < 0 || blocks <= startingIndex) {
+ return 0;
+ }
+ int64_t length = 0;
+ for(int32_t i = startingIndex; i < blocks; ++i) {
+ if(isBitSet(i) || isUseBitSet(i)) {
+ break;
+ }
+ length += getBlockLength(i);
+ }
+ return length;
+}