summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-06-05 12:53:30 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-06-05 12:53:30 +0000
commitba158dbfc141aea20e1ce62eafdb5ab41f66ce6f (patch)
tree3063e63e9b0b2d84f082c5013ec9ebdb4eadd0c5
parent7d63daed2238fbf5018788662550d605d49884ec (diff)
2008-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made `begin' unsigned int. * src/GrowSegment.h * src/Piece.cc * src/Piece.h * src/PiecedSegment.cc * src/PiecedSegment.h * src/Segment.h
-rw-r--r--ChangeLog10
-rw-r--r--src/GrowSegment.h2
-rw-r--r--src/Piece.cc2
-rw-r--r--src/Piece.h2
-rw-r--r--src/PiecedSegment.cc2
-rw-r--r--src/PiecedSegment.h2
-rw-r--r--src/Segment.h2
7 files changed, 16 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e0223c9..39a3fee2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2008-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
+ Made `begin' unsigned int.
+ * src/GrowSegment.h
+ * src/Piece.cc
+ * src/Piece.h
+ * src/PiecedSegment.cc
+ * src/PiecedSegment.h
+ * src/Segment.h
+
+2008-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
+
Calculate piece hash when data is arrived if the data is arrived in
order. This removes additional read operation for hash calculation.
If the data is arrived in out of order, the hash is calucated when the
diff --git a/src/GrowSegment.h b/src/GrowSegment.h
index b2a66097..d589d1aa 100644
--- a/src/GrowSegment.h
+++ b/src/GrowSegment.h
@@ -92,7 +92,7 @@ public:
#ifdef ENABLE_MESSAGE_DIGEST
- virtual bool updateHash(size_t begin,
+ virtual bool updateHash(uint32_t begin,
const unsigned char* data, size_t dataLength)
{
return false;
diff --git a/src/Piece.cc b/src/Piece.cc
index fd743b34..4745a08d 100644
--- a/src/Piece.cc
+++ b/src/Piece.cc
@@ -225,7 +225,7 @@ void Piece::setHashAlgo(const std::string& algo)
_hashAlgo = algo;
}
-bool Piece::updateHash(size_t begin, const unsigned char* data, size_t dataLength)
+bool Piece::updateHash(uint32_t begin, const unsigned char* data, size_t dataLength)
{
if(_hashAlgo.empty()) {
return false;
diff --git a/src/Piece.h b/src/Piece.h
index 6b1f7c62..dcd9429c 100644
--- a/src/Piece.h
+++ b/src/Piece.h
@@ -140,7 +140,7 @@ public:
// Updates hash value. This function compares begin and private variable
// _nextBegin and only when they are equal, hash is updated eating data and
// returns true. Otherwise returns false.
- bool updateHash(size_t begin, const unsigned char* data, size_t dataLength);
+ bool updateHash(uint32_t begin, const unsigned char* data, size_t dataLength);
bool isHashCalculated() const;
diff --git a/src/PiecedSegment.cc b/src/PiecedSegment.cc
index e0c15d42..1c79a43a 100644
--- a/src/PiecedSegment.cc
+++ b/src/PiecedSegment.cc
@@ -92,7 +92,7 @@ void PiecedSegment::updateWrittenLength(size_t bytes)
#ifdef ENABLE_MESSAGE_DIGEST
-bool PiecedSegment::updateHash(size_t begin,
+bool PiecedSegment::updateHash(uint32_t begin,
const unsigned char* data, size_t dataLength)
{
return _piece->updateHash(begin, data, dataLength);
diff --git a/src/PiecedSegment.h b/src/PiecedSegment.h
index 9f6f34f9..74d68e04 100644
--- a/src/PiecedSegment.h
+++ b/src/PiecedSegment.h
@@ -85,7 +85,7 @@ public:
#ifdef ENABLE_MESSAGE_DIGEST
// `begin' is a offset inside this segment.
- virtual bool updateHash(size_t begin,
+ virtual bool updateHash(uint32_t begin,
const unsigned char* data, size_t dataLength);
virtual bool isHashCalculated() const;
diff --git a/src/Segment.h b/src/Segment.h
index edc5a36a..917bf236 100644
--- a/src/Segment.h
+++ b/src/Segment.h
@@ -71,7 +71,7 @@ public:
#ifdef ENABLE_MESSAGE_DIGEST
// `begin' is a offset inside this segment.
- virtual bool updateHash(size_t begin,
+ virtual bool updateHash(uint32_t begin,
const unsigned char* data, size_t dataLength) = 0;
virtual bool isHashCalculated() const = 0;