global: Rename unsigned char to uint8, DynamicUCharArray to DynamicUInt8Array and DynamicUCharVector to DynamicUInt8Vector.
diff --git a/ndn-cpp/util/blob.hpp b/ndn-cpp/util/blob.hpp
index 0572301..d71808d 100644
--- a/ndn-cpp/util/blob.hpp
+++ b/ndn-cpp/util/blob.hpp
@@ -12,16 +12,16 @@
namespace ndn {
/**
- * A Blob holds a pointer to an immutable byte array implemented as const std::vector<unsigned char>.
+ * A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
* This is like a JavaScript string which is a pointer to an immutable string.
* It is OK to pass a pointer to the string because the new owner can't change the bytes
* of the string. However, like a JavaScript string, it is possible to change the pointer, and so this does allow
* the copy constructor and assignment to change the pointer. Also remember that the pointer can be null.
- * (Note that we could have made Blob derive directly from vector<unsigned char> and then explicitly use
+ * (Note that we could have made Blob derive directly from vector<uint8_t> and then explicitly use
* a pointer to it like shared_ptr<Blob>, but this does not enforce immutability because we can't declare
- * Blob as derived from const vector<unsigned char>.)
+ * Blob as derived from const vector<uint8_t>.)
*/
-class Blob : public ptr_lib::shared_ptr<const std::vector<unsigned char> > {
+class Blob : public ptr_lib::shared_ptr<const std::vector<uint8_t> > {
public:
/**
* Create a new Blob with a null pointer.
@@ -35,19 +35,19 @@
* @param value A pointer to the byte array which is copied.
* @param valueLength The length of value.
*/
- Blob(const unsigned char* value, unsigned int valueLength)
- : ptr_lib::shared_ptr<const std::vector<unsigned char> >(new std::vector<unsigned char>(value, value + valueLength))
+ Blob(const uint8_t* value, unsigned int valueLength)
+ : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(value, value + valueLength))
{
}
/**
* Create a new Blob with an immutable copy of the array in the given vector.
* If you want to transfer the array without copying, the the vector has to start as a
- * ptr_lib::shared_ptr<std::vector<unsigned char> > and you can use the Blob constructor with this type.
+ * ptr_lib::shared_ptr<std::vector<uint8_t> > and you can use the Blob constructor with this type.
* @param value A reference to a vector which is copied.
*/
- Blob(const std::vector<unsigned char> &value)
- : ptr_lib::shared_ptr<const std::vector<unsigned char> >(new std::vector<unsigned char>(value))
+ Blob(const std::vector<uint8_t> &value)
+ : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(value))
{
}
@@ -56,12 +56,12 @@
* if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.
* @param value A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
- Blob(const ptr_lib::shared_ptr<std::vector<unsigned char> > &value)
- : ptr_lib::shared_ptr<const std::vector<unsigned char> >(value)
+ Blob(const ptr_lib::shared_ptr<std::vector<uint8_t> > &value)
+ : ptr_lib::shared_ptr<const std::vector<uint8_t> >(value)
{
}
- Blob(const ptr_lib::shared_ptr<const std::vector<unsigned char> > &value)
- : ptr_lib::shared_ptr<const std::vector<unsigned char> >(value)
+ Blob(const ptr_lib::shared_ptr<const std::vector<uint8_t> > &value)
+ : ptr_lib::shared_ptr<const std::vector<uint8_t> >(value)
{
}
@@ -80,7 +80,7 @@
/**
* Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null.
*/
- const unsigned char*
+ const uint8_t*
buf() const
{
if (*this)
diff --git a/ndn-cpp/util/dynamic-uchar-vector.cpp b/ndn-cpp/util/dynamic-uchar-vector.cpp
deleted file mode 100644
index 4b17e63..0000000
--- a/ndn-cpp/util/dynamic-uchar-vector.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "dynamic-uchar-vector.hpp"
-
-using namespace std;
-
-namespace ndn {
-
-DynamicUCharVector::DynamicUCharVector(unsigned int initialLength)
-: vector_(new vector<unsigned char>(initialLength))
-{
- ndn_DynamicUCharArray_initialize(this, &vector_->front(), initialLength, DynamicUCharVector::realloc);
-}
-
-unsigned char*
-DynamicUCharVector::realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length)
-{
- // Because this method is private, assume there is not a problem with upcasting.
- DynamicUCharVector *thisObject = (DynamicUCharVector *)self;
-
- if (array != &thisObject->vector_->front())
- // We don't expect this to ever happen. The caller didn't pass the array from this object.
- return 0;
-
- thisObject->vector_->resize(length);
- return &thisObject->vector_->front();
-}
-
-}
diff --git a/ndn-cpp/util/dynamic-uchar-vector.hpp b/ndn-cpp/util/dynamic-uchar-vector.hpp
deleted file mode 100644
index 68950a9..0000000
--- a/ndn-cpp/util/dynamic-uchar-vector.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_DYNAMIC_UCHAR_VECTOR_HPP
-#define NDN_DYNAMIC_UCHAR_VECTOR_HPP
-
-#include <vector>
-#include "../common.hpp"
-#include "../c/util/dynamic-uchar-array.h"
-
-namespace ndn {
-
-/**
- * A DynamicUCharVector extends ndn_DynamicUCharArray to hold a shared_ptr<vector<unsigned char> > for use with
- * C functions which need an ndn_DynamicUCharArray.
- */
-class DynamicUCharVector : public ndn_DynamicUCharArray {
-public:
- /**
- * Create a new DynamicUCharVector with an initial length.
- * @param initialLength The initial size of the allocated vector.
- */
- DynamicUCharVector(unsigned int initialLength);
-
- /**
- * Get the shared_ptr to the allocated vector.
- * @return The shared_ptr to the allocated vector.
- */
- const ptr_lib::shared_ptr<std::vector<unsigned char> >&
- get() { return vector_; }
-
-private:
- /**
- * Implement the static realloc function using vector resize.
- * @param self A pointer to this object.
- * @param array Should be the front of the vector.
- * @param length The new length for the vector.
- * @return The front of the allocated vector.
- */
- static unsigned char*
- realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length);
-
- ptr_lib::shared_ptr<std::vector<unsigned char> > vector_;
-};
-
-}
-
-#endif
diff --git a/ndn-cpp/util/dynamic-uint8-vector.cpp b/ndn-cpp/util/dynamic-uint8-vector.cpp
new file mode 100644
index 0000000..240baa6
--- /dev/null
+++ b/ndn-cpp/util/dynamic-uint8-vector.cpp
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "dynamic-uint8-vector.hpp"
+
+using namespace std;
+
+namespace ndn {
+
+DynamicUInt8Vector::DynamicUInt8Vector(unsigned int 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)
+{
+ // Because this method is private, assume there is not a problem with upcasting.
+ DynamicUInt8Vector *thisObject = (DynamicUInt8Vector *)self;
+
+ if (array != &thisObject->vector_->front())
+ // We don't expect this to ever happen. The caller didn't pass the array from this object.
+ return 0;
+
+ thisObject->vector_->resize(length);
+ return &thisObject->vector_->front();
+}
+
+}
diff --git a/ndn-cpp/util/dynamic-uint8-vector.hpp b/ndn-cpp/util/dynamic-uint8-vector.hpp
new file mode 100644
index 0000000..2c6247e
--- /dev/null
+++ b/ndn-cpp/util/dynamic-uint8-vector.hpp
@@ -0,0 +1,51 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_DYNAMIC_UCHAR_VECTOR_HPP
+#define NDN_DYNAMIC_UCHAR_VECTOR_HPP
+
+#include <vector>
+#include "../common.hpp"
+#include "../c/util/dynamic-uint8-array.h"
+
+namespace ndn {
+
+/**
+ * A DynamicUInt8Vector extends ndn_DynamicUInt8Array to hold a shared_ptr<vector<uint8_t> > for use with
+ * C functions which need an ndn_DynamicUInt8Array.
+ */
+class DynamicUInt8Vector : public ndn_DynamicUInt8Array {
+public:
+ /**
+ * Create a new DynamicUInt8Vector with an initial length.
+ * @param initialLength The initial size of the allocated vector.
+ */
+ DynamicUInt8Vector(unsigned int initialLength);
+
+ /**
+ * Get the shared_ptr to the allocated vector.
+ * @return The shared_ptr to the allocated vector.
+ */
+ const ptr_lib::shared_ptr<std::vector<uint8_t> >&
+ get() { return vector_; }
+
+private:
+ /**
+ * Implement the static realloc function using vector resize.
+ * @param self A pointer to this object.
+ * @param array Should be the front of the vector.
+ * @param length The new length for the vector.
+ * @return The front of the allocated vector.
+ */
+ static uint8_t*
+ realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length);
+
+ ptr_lib::shared_ptr<std::vector<uint8_t> > vector_;
+};
+
+}
+
+#endif
diff --git a/ndn-cpp/util/logging.hpp b/ndn-cpp/util/logging.hpp
index 84ad405..e6a402f 100644
--- a/ndn-cpp/util/logging.hpp
+++ b/ndn-cpp/util/logging.hpp
@@ -9,7 +9,7 @@
#ifndef NDN_LOGGING_HPP
#define NDN_LOGGING_HPP
-#include "../../config.h"
+#include "../common.hpp"
#ifdef HAVE_LOG4CXX
diff --git a/ndn-cpp/util/signed-blob.hpp b/ndn-cpp/util/signed-blob.hpp
index 0b6cdda..62e6ee2 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 unsigned char* value, unsigned int valueLength, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+ (const uint8_t* value, unsigned int valueLength, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
: Blob(value, valueLength), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
@@ -42,13 +42,13 @@
/**
* Create a new SignedBlob with an immutable copy of the array in the given vector.
* If you want to transfer the array without copying, the the vector has to start as a
- * ptr_lib::shared_ptr<std::vector<unsigned char> > and you can use the SignedBlob constructor with this type.
+ * ptr_lib::shared_ptr<std::vector<uint8_t> > and you can use the SignedBlob constructor with this type.
* @param value A reference to a vector which is copied.
* @param signedPortionBeginOffset The offset in the encoding of the beginning of the signed portion.
* @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
*/
SignedBlob
- (const std::vector<unsigned char> &value, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+ (const std::vector<uint8_t> &value, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
: Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
@@ -61,13 +61,13 @@
* @param signedPortionEndOffset The offset in the array of the end of the signed portion.
*/
SignedBlob
- (const ptr_lib::shared_ptr<std::vector<unsigned char> > &value,
+ (const ptr_lib::shared_ptr<std::vector<uint8_t> > &value,
unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
: Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
}
SignedBlob
- (const ptr_lib::shared_ptr<const std::vector<unsigned char> > &value,
+ (const ptr_lib::shared_ptr<const std::vector<uint8_t> > &value,
unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
: Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
{
@@ -89,7 +89,7 @@
* Return a const pointer to the first byte of the signed portion of the immutable byte array, or 0 if the
* pointer to the array is null.
*/
- const unsigned char*
+ const uint8_t*
signedBuf() const
{
if (*this)