globa: Change unsigned int to size_t where it is the size of a byte array or an index/offset into it.
diff --git a/ndn-cpp/util/blob.hpp b/ndn-cpp/util/blob.hpp
index d71808d..ef13433 100644
--- a/ndn-cpp/util/blob.hpp
+++ b/ndn-cpp/util/blob.hpp
@@ -35,7 +35,7 @@
* @param value A pointer to the byte array which is copied.
* @param valueLength The length of value.
*/
- Blob(const uint8_t* value, unsigned int valueLength)
+ Blob(const uint8_t* value, size_t valueLength)
: ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(value, value + valueLength))
{
}
@@ -68,7 +68,7 @@
/**
* Return the length of the immutable byte array.
*/
- unsigned int
+ size_t
size() const
{
if (*this)
diff --git a/ndn-cpp/util/changed-event.cpp b/ndn-cpp/util/changed-event.cpp
index 1d12c75..63b4569 100644
--- a/ndn-cpp/util/changed-event.cpp
+++ b/ndn-cpp/util/changed-event.cpp
@@ -13,7 +13,7 @@
void
ChangedEvent::fire()
{
- for (unsigned int i = 0; i < listeners_.size(); ++i)
+ for (size_t i = 0; i < listeners_.size(); ++i)
listeners_[i]();
}
diff --git a/ndn-cpp/util/dynamic-uint8-vector.cpp b/ndn-cpp/util/dynamic-uint8-vector.cpp
index 240baa6..ae1b621 100644
--- a/ndn-cpp/util/dynamic-uint8-vector.cpp
+++ b/ndn-cpp/util/dynamic-uint8-vector.cpp
@@ -10,14 +10,14 @@
namespace ndn {
-DynamicUInt8Vector::DynamicUInt8Vector(unsigned int initialLength)
+DynamicUInt8Vector::DynamicUInt8Vector(size_t initialLength)
: vector_(new vector<uint8_t>(initialLength))
{
ndn_DynamicUInt8Array_initialize(this, &vector_->front(), initialLength, DynamicUInt8Vector::realloc);
}
uint8_t*
-DynamicUInt8Vector::realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length)
+DynamicUInt8Vector::realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length)
{
// Because this method is private, assume there is not a problem with upcasting.
DynamicUInt8Vector *thisObject = (DynamicUInt8Vector *)self;
diff --git a/ndn-cpp/util/dynamic-uint8-vector.hpp b/ndn-cpp/util/dynamic-uint8-vector.hpp
index 2c6247e..9550899 100644
--- a/ndn-cpp/util/dynamic-uint8-vector.hpp
+++ b/ndn-cpp/util/dynamic-uint8-vector.hpp
@@ -23,7 +23,7 @@
* Create a new DynamicUInt8Vector with an initial length.
* @param initialLength The initial size of the allocated vector.
*/
- DynamicUInt8Vector(unsigned int initialLength);
+ DynamicUInt8Vector(size_t initialLength);
/**
* Get the shared_ptr to the allocated vector.
@@ -41,7 +41,7 @@
* @return The front of the allocated vector.
*/
static uint8_t*
- realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length);
+ realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length);
ptr_lib::shared_ptr<std::vector<uint8_t> > vector_;
};
diff --git a/ndn-cpp/util/signed-blob.hpp b/ndn-cpp/util/signed-blob.hpp
index 62e6ee2..dd94ae0 100644
--- a/ndn-cpp/util/signed-blob.hpp
+++ b/ndn-cpp/util/signed-blob.hpp
@@ -34,7 +34,7 @@
* @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
*/
SignedBlob
- (const uint8_t* value, unsigned int valueLength, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+ (const uint8_t* value, size_t valueLength, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
: Blob(value, valueLength), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
@@ -48,7 +48,7 @@
* @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
*/
SignedBlob
- (const std::vector<uint8_t> &value, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+ (const std::vector<uint8_t> &value, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
: Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
@@ -62,13 +62,13 @@
*/
SignedBlob
(const ptr_lib::shared_ptr<std::vector<uint8_t> > &value,
- unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+ size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
: Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
SignedBlob
(const ptr_lib::shared_ptr<const std::vector<uint8_t> > &value,
- unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+ size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
: Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
@@ -76,7 +76,7 @@
/**
* Return the length of the signed portion of the immutable byte array, or 0 of the pointer to the array is null.
*/
- unsigned int
+ size_t
signedSize() const
{
if (*this)
@@ -101,18 +101,18 @@
/**
* Return the offset in the array of the beginning of the signed portion.
*/
- unsigned int
+ size_t
getSignedPortionBeginOffset() { return signedPortionBeginOffset_; }
/**
* Return the offset in the array of the end of the signed portion.
*/
- unsigned int
+ size_t
getSignedPortionEndOffset() { return signedPortionEndOffset_; }
private:
- unsigned int signedPortionBeginOffset_;
- unsigned int signedPortionEndOffset_;
+ size_t signedPortionBeginOffset_;
+ size_t signedPortionEndOffset_;
};
}