global: Rename unsigned char to uint8, DynamicUCharArray to DynamicUInt8Array and DynamicUCharVector to DynamicUInt8Vector.
diff --git a/Makefile.am b/Makefile.am
index ecbc19a..e5c3026 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,7 @@
ndn-cpp/c/transport/udp-transport.h \
ndn-cpp/c/util/blob.h \
ndn-cpp/c/util/crypto.c ndn-cpp/c/util/crypto.h \
- ndn-cpp/c/util/dynamic-uchar-array.c ndn-cpp/c/util/dynamic-uchar-array.h \
+ ndn-cpp/c/util/dynamic-uint8-array.c ndn-cpp/c/util/dynamic-uint8-array.h \
ndn-cpp/c/util/ndn_memory.c ndn-cpp/c/util/ndn_memory.h \
ndn-cpp/c/util/ndn_realloc.c ndn-cpp/c/util/ndn_realloc.h
@@ -60,7 +60,7 @@
ndn-cpp/c/encoding/binary-xml.h \
ndn-cpp/c/encoding/binary-xml-decoder.h ndn-cpp/encoding/binary-xml-decoder.hpp \
ndn-cpp/c/encoding/binary-xml-element-reader.h ndn-cpp/encoding/binary-xml-element-reader.cpp ndn-cpp/encoding/binary-xml-element-reader.hpp \
- ndn-cpp/c/encoding/binary-xml-encoder.h ndn-cpp/encoding/binary-xml-encoder.hpp ndn-cpp/c/util/dynamic-uchar-array.h \
+ ndn-cpp/c/encoding/binary-xml-encoder.h ndn-cpp/encoding/binary-xml-encoder.hpp ndn-cpp/c/util/dynamic-uint8-array.h \
ndn-cpp/c/encoding/binary-xml-structure-decoder.h ndn-cpp/encoding/binary-xml-structure-decoder.hpp \
ndn-cpp/encoding/binary-xml-wire-format.cpp ndn-cpp/c/encoding/binary-xml-name.h ndn-cpp/encoding/binary-xml-wire-format.hpp \
ndn-cpp/encoding/wire-format.cpp ndn-cpp/encoding/wire-format.hpp \
@@ -79,7 +79,7 @@
ndn-cpp/c/transport/socket-transport.h ndn-cpp/c/transport/udp-transport.h ndn-cpp/transport/udp-transport.cpp ndn-cpp/transport/udp-transport.hpp \
ndn-cpp/util/blob.hpp \
ndn-cpp/util/changed-event.cpp ndn-cpp/util/changed-event.hpp \
- ndn-cpp/util/dynamic-uchar-vector.cpp ndn-cpp/util/dynamic-uchar-vector.hpp \
+ ndn-cpp/util/dynamic-uint8-vector.cpp ndn-cpp/util/dynamic-uint8-vector.hpp \
ndn-cpp/util/logging.cpp ndn-cpp/util/logging.hpp \
ndn-cpp/util/signed-blob.hpp
diff --git a/Makefile.in b/Makefile.in
index 4200d9e..5da1931 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -145,7 +145,7 @@
ndn-cpp/c/encoding/binary-xml-publisher-public-key-digest.lo \
ndn-cpp/c/encoding/binary-xml-structure-decoder.lo \
ndn-cpp/c/transport/socket-transport.lo \
- ndn-cpp/c/util/crypto.lo ndn-cpp/c/util/dynamic-uchar-array.lo \
+ ndn-cpp/c/util/crypto.lo ndn-cpp/c/util/dynamic-uint8-array.lo \
ndn-cpp/c/util/ndn_memory.lo ndn-cpp/c/util/ndn_realloc.lo
libndn_c_la_OBJECTS = $(am_libndn_c_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -170,7 +170,7 @@
ndn-cpp/transport/transport.lo \
ndn-cpp/transport/udp-transport.lo \
ndn-cpp/util/changed-event.lo \
- ndn-cpp/util/dynamic-uchar-vector.lo ndn-cpp/util/logging.lo
+ ndn-cpp/util/dynamic-uint8-vector.lo ndn-cpp/util/logging.lo
libndn_cpp_la_OBJECTS = $(am_libndn_cpp_la_OBJECTS)
PROGRAMS = $(bin_PROGRAMS)
am_bin_test_encode_decode_data_OBJECTS = \
@@ -504,7 +504,7 @@
ndn-cpp/c/transport/udp-transport.h \
ndn-cpp/c/util/blob.h \
ndn-cpp/c/util/crypto.c ndn-cpp/c/util/crypto.h \
- ndn-cpp/c/util/dynamic-uchar-array.c ndn-cpp/c/util/dynamic-uchar-array.h \
+ ndn-cpp/c/util/dynamic-uint8-array.c ndn-cpp/c/util/dynamic-uint8-array.h \
ndn-cpp/c/util/ndn_memory.c ndn-cpp/c/util/ndn_memory.h \
ndn-cpp/c/util/ndn_realloc.c ndn-cpp/c/util/ndn_realloc.h
@@ -524,7 +524,7 @@
ndn-cpp/c/encoding/binary-xml.h \
ndn-cpp/c/encoding/binary-xml-decoder.h ndn-cpp/encoding/binary-xml-decoder.hpp \
ndn-cpp/c/encoding/binary-xml-element-reader.h ndn-cpp/encoding/binary-xml-element-reader.cpp ndn-cpp/encoding/binary-xml-element-reader.hpp \
- ndn-cpp/c/encoding/binary-xml-encoder.h ndn-cpp/encoding/binary-xml-encoder.hpp ndn-cpp/c/util/dynamic-uchar-array.h \
+ ndn-cpp/c/encoding/binary-xml-encoder.h ndn-cpp/encoding/binary-xml-encoder.hpp ndn-cpp/c/util/dynamic-uint8-array.h \
ndn-cpp/c/encoding/binary-xml-structure-decoder.h ndn-cpp/encoding/binary-xml-structure-decoder.hpp \
ndn-cpp/encoding/binary-xml-wire-format.cpp ndn-cpp/c/encoding/binary-xml-name.h ndn-cpp/encoding/binary-xml-wire-format.hpp \
ndn-cpp/encoding/wire-format.cpp ndn-cpp/encoding/wire-format.hpp \
@@ -543,7 +543,7 @@
ndn-cpp/c/transport/socket-transport.h ndn-cpp/c/transport/udp-transport.h ndn-cpp/transport/udp-transport.cpp ndn-cpp/transport/udp-transport.hpp \
ndn-cpp/util/blob.hpp \
ndn-cpp/util/changed-event.cpp ndn-cpp/util/changed-event.hpp \
- ndn-cpp/util/dynamic-uchar-vector.cpp ndn-cpp/util/dynamic-uchar-vector.hpp \
+ ndn-cpp/util/dynamic-uint8-vector.cpp ndn-cpp/util/dynamic-uint8-vector.hpp \
ndn-cpp/util/logging.cpp ndn-cpp/util/logging.hpp \
ndn-cpp/util/signed-blob.hpp
@@ -713,7 +713,7 @@
@: > ndn-cpp/c/util/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/c/util/crypto.lo: ndn-cpp/c/util/$(am__dirstamp) \
ndn-cpp/c/util/$(DEPDIR)/$(am__dirstamp)
-ndn-cpp/c/util/dynamic-uchar-array.lo: ndn-cpp/c/util/$(am__dirstamp) \
+ndn-cpp/c/util/dynamic-uint8-array.lo: ndn-cpp/c/util/$(am__dirstamp) \
ndn-cpp/c/util/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/c/util/ndn_memory.lo: ndn-cpp/c/util/$(am__dirstamp) \
ndn-cpp/c/util/$(DEPDIR)/$(am__dirstamp)
@@ -818,7 +818,7 @@
@: > ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/util/changed-event.lo: ndn-cpp/util/$(am__dirstamp) \
ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
-ndn-cpp/util/dynamic-uchar-vector.lo: ndn-cpp/util/$(am__dirstamp) \
+ndn-cpp/util/dynamic-uint8-vector.lo: ndn-cpp/util/$(am__dirstamp) \
ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/util/logging.lo: ndn-cpp/util/$(am__dirstamp) \
ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
@@ -967,7 +967,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/binary-xml-structure-decoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/transport/$(DEPDIR)/socket-transport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/crypto.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/dynamic-uchar-array.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/dynamic-uint8-array.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/ndn_memory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/ndn_realloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/binary-xml-element-reader.Plo@am__quote@
@@ -984,7 +984,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/transport/$(DEPDIR)/transport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/transport/$(DEPDIR)/udp-transport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/util/$(DEPDIR)/changed-event.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/util/$(DEPDIR)/dynamic-uchar-vector.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/util/$(DEPDIR)/dynamic-uint8-vector.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/util/$(DEPDIR)/logging.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-encode-decode-data.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-encode-decode-forwarding-entry.Po@am__quote@
diff --git a/ndn-cpp/c/data.h b/ndn-cpp/c/data.h
index 44d345e..81489f5 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -19,12 +19,12 @@
* An ndn_Signature struct holds the signature bits and other info representing the signature in a data packet.
*/
struct ndn_Signature {
- unsigned char *digestAlgorithm; /**< pointer to pre-allocated buffer. 0 for none.
+ uint8_t *digestAlgorithm; /**< pointer to pre-allocated buffer. 0 for none.
* If none, default is 2.16.840.1.101.3.4.2.1 (sha-256). */
unsigned int digestAlgorithmLength; /**< length of digestAlgorithm. 0 for none */
- unsigned char *witness; /**< pointer to pre-allocated buffer. 0 for none. */
+ uint8_t *witness; /**< pointer to pre-allocated buffer. 0 for none. */
unsigned int witnessLength; /**< length of witness. 0 for none */
- unsigned char *signature;
+ uint8_t *signature;
unsigned int signatureLength;
struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
struct ndn_KeyLocator keyLocator;
@@ -81,7 +81,7 @@
struct ndn_Signature signature;
struct ndn_Name name;
struct ndn_MetaInfo metaInfo;
- unsigned char *content; /**< pointer to the content */
+ uint8_t *content; /**< pointer to the content */
unsigned int contentLength; /**< length of content */
};
diff --git a/ndn-cpp/c/encoding/binary-xml-data.c b/ndn-cpp/c/encoding/binary-xml-data.c
index de34f9d..98dde11 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -76,7 +76,7 @@
if (!(metaInfo->type < 0 || metaInfo->type == ndn_ContentType_DATA)) {
// Not the default of DATA, so we need to encode the type.
- unsigned char *typeBytes;
+ uint8_t *typeBytes;
unsigned int typeBytesLength = 3;
if (metaInfo->type == ndn_ContentType_ENCR)
typeBytes = "\x10\xD0\x91";
@@ -127,7 +127,7 @@
(decoder, ndn_BinaryXml_DTag_Timestamp, &metaInfo->timestampMilliseconds))
return error;
- unsigned char *typeBytes;
+ uint8_t *typeBytes;
unsigned int typeBytesLength;
if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
(decoder, ndn_BinaryXml_DTag_Type, 0, &typeBytes, &typeBytesLength)))
diff --git a/ndn-cpp/c/encoding/binary-xml-decoder.c b/ndn-cpp/c/encoding/binary-xml-decoder.c
index 1ccaccc..4be2450 100644
--- a/ndn-cpp/c/encoding/binary-xml-decoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-decoder.c
@@ -34,13 +34,13 @@
* @param resultOut output the parsed integer.
* @return 0 for success, else an error code, including if an element of value is not a decimal digit.
*/
-static ndn_Error parseUnsignedDecimalInt(unsigned char *value, unsigned int valueLength, unsigned int *resultOut)
+static ndn_Error parseUnsignedDecimalInt(uint8_t *value, unsigned int valueLength, unsigned int *resultOut)
{
unsigned int result = 0;
unsigned int i;
for (i = 0; i < valueLength; ++i) {
- unsigned char digit = value[i];
+ uint8_t digit = value[i];
if (!(digit >= '0' && digit <= '9'))
return NDN_ERROR_element_of_value_is_not_a_decimal_digit;
@@ -140,7 +140,7 @@
}
ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag)))
@@ -173,7 +173,7 @@
}
ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength)
{
ndn_Error error;
int gotExpectedTag;
@@ -192,7 +192,7 @@
}
ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength)
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag)))
@@ -213,7 +213,7 @@
}
ndn_Error ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength)
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength)
{
ndn_Error error;
int gotExpectedTag;
@@ -234,7 +234,7 @@
ndn_Error ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement
(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned int *value)
{
- unsigned char *udataValue;
+ uint8_t *udataValue;
unsigned int udataValueLength;
ndn_Error error;
if ((error = ndn_BinaryXmlDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength)))
@@ -271,7 +271,7 @@
(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, double *milliseconds)
{
ndn_Error error;
- unsigned char *bytes;
+ uint8_t *bytes;
unsigned int bytesLength;
if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes, &bytesLength)))
return error;
@@ -299,7 +299,7 @@
return NDN_ERROR_success;
}
-double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(unsigned char *bytes, unsigned int bytesLength)
+double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, unsigned int bytesLength)
{
double result = 0.0;
unsigned int i;
diff --git a/ndn-cpp/c/encoding/binary-xml-decoder.h b/ndn-cpp/c/encoding/binary-xml-decoder.h
index 3b58787..dfa9b97 100644
--- a/ndn-cpp/c/encoding/binary-xml-decoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-decoder.h
@@ -7,6 +7,7 @@
#ifndef NDN_BINARYXMLDECODER_H
#define NDN_BINARYXMLDECODER_H
+#include "../common.h"
#include "../errors.h"
#ifdef __cplusplus
@@ -14,12 +15,12 @@
#endif
struct ndn_BinaryXmlDecoder {
- unsigned char *input;
+ uint8_t *input;
unsigned int inputLength;
unsigned int offset;
};
-static inline void ndn_BinaryXmlDecoder_initialize(struct ndn_BinaryXmlDecoder *self, unsigned char *input, unsigned int inputLength)
+static inline void ndn_BinaryXmlDecoder_initialize(struct ndn_BinaryXmlDecoder *self, uint8_t *input, unsigned int inputLength)
{
self->input = input;
self->inputLength = inputLength;
@@ -77,7 +78,7 @@
* and the binary data is absent
*/
ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength);
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength);
/**
* Peek at the next element and if it is the expectedTag, call ndn_BinaryXmlDecoder_readBinaryDTagElement.
@@ -92,7 +93,7 @@
* @return 0 for success, else an error code, including if allowNull is 0 and the binary data is absent
*/
ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength);
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength);
/**
* Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
@@ -105,7 +106,7 @@
* @return 0 for success, else an error code, including an error if not the expected tag, or if the item is not UDATA.
*/
ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength);
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength);
/**
* Peek at the next element and if it is the expectedTag, call ndn_BinaryXmlDecoder_readUDataDTagElement.
@@ -119,7 +120,7 @@
* @return 0 for success, else an error code.
*/
ndn_Error ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
- (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength);
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength);
/**
* Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
@@ -176,7 +177,7 @@
* @param bytesLength the length of bytes
* @return the result
*/
-double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(unsigned char *bytes, unsigned int bytesLength);
+double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, unsigned int bytesLength);
/**
* Set the offset into the input, used for the next read.
diff --git a/ndn-cpp/c/encoding/binary-xml-element-reader.c b/ndn-cpp/c/encoding/binary-xml-element-reader.c
index 837363c..51f635f 100644
--- a/ndn-cpp/c/encoding/binary-xml-element-reader.c
+++ b/ndn-cpp/c/encoding/binary-xml-element-reader.c
@@ -7,7 +7,7 @@
#include "binary-xml-element-reader.h"
ndn_Error ndn_BinaryXmlElementReader_onReceivedData
- (struct ndn_BinaryXmlElementReader *self, unsigned char *data, unsigned int dataLength)
+ (struct ndn_BinaryXmlElementReader *self, uint8_t *data, unsigned int dataLength)
{
// Process multiple objects in the data.
while(1) {
@@ -21,7 +21,7 @@
// Got the remainder of an element. Report to the caller.
if (self->usePartialData) {
// We have partial data from a previous call, so append this data and point to partialData.
- if ((error = ndn_DynamicUCharArray_set(&self->partialData, data, self->structureDecoder.offset, self->partialDataLength)))
+ if ((error = ndn_DynamicUInt8Array_set(&self->partialData, data, self->structureDecoder.offset, self->partialDataLength)))
return error;
self->partialDataLength += dataLength;
@@ -50,7 +50,7 @@
self->partialDataLength = 0;
}
- if ((error = ndn_DynamicUCharArray_set(&self->partialData, data, dataLength, self->partialDataLength)))
+ if ((error = ndn_DynamicUInt8Array_set(&self->partialData, data, dataLength, self->partialDataLength)))
return error;
self->partialDataLength += dataLength;
diff --git a/ndn-cpp/c/encoding/binary-xml-element-reader.h b/ndn-cpp/c/encoding/binary-xml-element-reader.h
index 666d15f..cb962cd 100644
--- a/ndn-cpp/c/encoding/binary-xml-element-reader.h
+++ b/ndn-cpp/c/encoding/binary-xml-element-reader.h
@@ -9,7 +9,7 @@
#include "../errors.h"
#include "binary-xml-structure-decoder.h"
-#include "../util/dynamic-uchar-array.h"
+#include "../util/dynamic-uint8-array.h"
#ifdef __cplusplus
extern "C" {
@@ -19,7 +19,7 @@
* will be passed to onReceivedElement.
*/
struct ndn_ElementListener {
- void (*onReceivedElement)(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength); /**< see ndn_ElementListener_initialize */
+ void (*onReceivedElement)(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength); /**< see ndn_ElementListener_initialize */
};
/**
@@ -29,7 +29,7 @@
* self is the pointer to this ndn_ElementListener struct. See ndn_BinaryXmlElementReader_onReceivedData.
*/
static inline void ndn_ElementListener_initialize
- (struct ndn_ElementListener *self, void (*onReceivedElement)(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength))
+ (struct ndn_ElementListener *self, void (*onReceivedElement)(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength))
{
self->onReceivedElement = onReceivedElement;
}
@@ -44,7 +44,7 @@
struct ndn_ElementListener *elementListener;
struct ndn_BinaryXmlStructureDecoder structureDecoder;
int usePartialData;
- struct ndn_DynamicUCharArray partialData;
+ struct ndn_DynamicUInt8Array partialData;
unsigned int partialDataLength;
};
@@ -54,16 +54,16 @@
* @param elementListener pointer to the ndn_ElementListener used by ndn_BinaryXmlElementReader_onReceivedData.
* @param buffer the allocated buffer. If reallocFunction is null, this should be large enough to save a full element, perhaps 8000 bytes.
* @param bufferLength the length of the buffer
- * @param reallocFunction see ndn_DynamicUCharArray_ensureLength. This may be 0.
+ * @param reallocFunction see ndn_DynamicUInt8Array_ensureLength. This may be 0.
*/
static inline void ndn_BinaryXmlElementReader_initialize
(struct ndn_BinaryXmlElementReader *self, struct ndn_ElementListener *elementListener,
- unsigned char *buffer, unsigned int bufferLength, unsigned char * (*reallocFunction)(struct ndn_DynamicUCharArray *self, unsigned char *, unsigned int))
+ uint8_t *buffer, unsigned int bufferLength, uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, unsigned int))
{
self->elementListener = elementListener;
ndn_BinaryXmlStructureDecoder_initialize(&self->structureDecoder);
self->usePartialData = 0;
- ndn_DynamicUCharArray_initialize(&self->partialData, buffer, bufferLength, reallocFunction);
+ ndn_DynamicUInt8Array_initialize(&self->partialData, buffer, bufferLength, reallocFunction);
}
/**
@@ -75,7 +75,7 @@
* @return 0 for success, else an error code
*/
ndn_Error ndn_BinaryXmlElementReader_onReceivedData
- (struct ndn_BinaryXmlElementReader *self, unsigned char *data, unsigned int dataLength);
+ (struct ndn_BinaryXmlElementReader *self, uint8_t *data, unsigned int dataLength);
#ifdef __cplusplus
}
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.c b/ndn-cpp/c/encoding/binary-xml-encoder.c
index ae6eb26..fce9b2d 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.c
@@ -17,17 +17,17 @@
};
/**
- * Call ndn_DynamicUCharArray_ensureLength to ensure that there is enough room in the output, and copy
+ * Call ndn_DynamicUInt8Array_ensureLength to ensure that there is enough room in the output, and copy
* array to the output. This does not write a header.
* @param self pointer to the ndn_BinaryXmlEncoder struct
* @param array the array to copy
* @param arrayLength the length of the array
* @return 0 for success, else an error code
*/
-static ndn_Error writeArray(struct ndn_BinaryXmlEncoder *self, unsigned char *array, unsigned int arrayLength)
+static ndn_Error writeArray(struct ndn_BinaryXmlEncoder *self, uint8_t *array, unsigned int arrayLength)
{
ndn_Error error;
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + arrayLength)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + arrayLength)))
return error;
ndn_memcpy(self->output->array + self->offset, array, arrayLength);
@@ -67,16 +67,16 @@
* @param array
* @param length
*/
-static void reverse(unsigned char *array, unsigned int length)
+static void reverse(uint8_t *array, unsigned int length)
{
if (length == 0)
return;
- unsigned char *left = array;
- unsigned char *right = array + length - 1;
+ uint8_t *left = array;
+ uint8_t *right = array + length - 1;
while (left < right) {
// Swap.
- unsigned char temp = *left;
+ uint8_t temp = *left;
*left = *right;
*right = temp;
@@ -86,7 +86,7 @@
}
/**
- * Write x as an unsigned decimal integer to the output with the digits in reverse order, using ndn_DynamicUCharArray_ensureLength.
+ * Write x as an unsigned decimal integer to the output with the digits in reverse order, using ndn_DynamicUInt8Array_ensureLength.
* This does not write a header.
* We encode in reverse order, because this is the natural way to encode the digits, and the caller can reverse as needed.
* @param self pointer to the ndn_BinaryXmlEncoder struct
@@ -97,10 +97,10 @@
{
while (1) {
ndn_Error error;
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + 1)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
return error;
- self->output->array[self->offset++] = (unsigned char)(x % 10 + '0');
+ self->output->array[self->offset++] = (uint8_t)(x % 10 + '0');
x /= 10;
if (x == 0)
@@ -126,14 +126,14 @@
unsigned int nBufferBytes = self->offset - startOffset;
unsigned int nHeaderBytes = getNHeaderEncodingBytes(nBufferBytes);
ndn_Error error;
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + nHeaderBytes)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + nHeaderBytes)))
return error;
// To reverse and shift at the same time, we first shift nHeaderBytes to the destination while reversing,
// then reverse the remaining bytes in place.
- unsigned char *from = self->output->array + startOffset;
- unsigned char *fromEnd = from + nHeaderBytes;
- unsigned char *to = self->output->array + startOffset + nBufferBytes + nHeaderBytes - 1;
+ uint8_t *from = self->output->array + startOffset;
+ uint8_t *fromEnd = from + nHeaderBytes;
+ uint8_t *to = self->output->array + startOffset + nBufferBytes + nHeaderBytes - 1;
while (from < fromEnd)
*(to--) = *(from++);
// Reverse the remaining bytes in place (if any).
@@ -179,7 +179,7 @@
// Encode backwards. Calculate how many bytes we need.
unsigned int nEncodingBytes = getNHeaderEncodingBytes(value);
ndn_Error error;
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + nEncodingBytes)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + nEncodingBytes)))
return error;
// Bottom 4 bits of value go in last byte with tag.
@@ -208,7 +208,7 @@
ndn_Error ndn_BinaryXmlEncoder_writeElementClose(struct ndn_BinaryXmlEncoder *self)
{
ndn_Error error;
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + 1)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
return error;
self->output->array[self->offset] = ndn_BinaryXml_CLOSE;
@@ -217,7 +217,7 @@
return NDN_ERROR_success;
}
-ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, uint8_t *value, unsigned int valueLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_BLOB, valueLength)))
@@ -229,7 +229,7 @@
return NDN_ERROR_success;
}
-ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, unsigned int valueLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
@@ -244,7 +244,7 @@
return NDN_ERROR_success;
}
-ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, uint8_t *value, unsigned int valueLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_UDATA, valueLength)))
@@ -256,7 +256,7 @@
return NDN_ERROR_success;
}
-ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, unsigned int valueLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
@@ -311,17 +311,17 @@
ndn_Error error;
while (lo32 != 0) {
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + 1)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
return error;
- self->output->array[self->offset++] = (unsigned char)(lo32 & 0xff);
+ self->output->array[self->offset++] = (uint8_t)(lo32 & 0xff);
lo32 >>= 8;
}
if (hi32 != 0) {
// Pad the lo values out to 4 bytes.
while (self->offset - startOffset < 4) {
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + 1)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
return error;
self->output->array[self->offset++] = 0;
@@ -329,10 +329,10 @@
// Encode hi32
while (hi32 != 0) {
- if ((error = ndn_DynamicUCharArray_ensureLength(self->output, self->offset + 1)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
return error;
- self->output->array[self->offset++] = (unsigned char)(hi32 & 0xff);
+ self->output->array[self->offset++] = (uint8_t)(hi32 & 0xff);
hi32 >>= 8;
}
}
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.h b/ndn-cpp/c/encoding/binary-xml-encoder.h
index d56cc8a..3cf4a89 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.h
@@ -8,7 +8,7 @@
#define NDN_BINARYXMLENCODER_H
#include "../errors.h"
-#include "../util/dynamic-uchar-array.h"
+#include "../util/dynamic-uint8-array.h"
#include "binary-xml.h"
#ifdef __cplusplus
@@ -19,18 +19,18 @@
* ndn_BinaryXmlEncoder_initialize.
*/
struct ndn_BinaryXmlEncoder {
- struct ndn_DynamicUCharArray *output; /**< A pointer to a ndn_DynamicUCharArray which receives the encoded output */
+ struct ndn_DynamicUInt8Array *output; /**< A pointer to a ndn_DynamicUInt8Array which receives the encoded output */
unsigned int offset; /**< the offset into output.array for the next encoding */
};
/**
- * Initialize an ndn_BinaryXmlEncoder_initialize struct with the arguments for initializing the ndn_DynamicUCharArray.
+ * Initialize an ndn_BinaryXmlEncoder_initialize struct with the arguments for initializing the ndn_DynamicUInt8Array.
* @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param output A pointer to a ndn_DynamicUCharArray struct which receives the encoded output. The struct must
+ * @param output A pointer to a ndn_DynamicUInt8Array struct which receives the encoded output. The struct must
* remain valid during the entire life of this ndn_BinaryXmlEncoder. If the output->realloc
* function pointer is null, its array must be large enough to receive the entire encoding.
*/
-static inline void ndn_BinaryXmlEncoder_initialize(struct ndn_BinaryXmlEncoder *self, struct ndn_DynamicUCharArray *output)
+static inline void ndn_BinaryXmlEncoder_initialize(struct ndn_BinaryXmlEncoder *self, struct ndn_DynamicUInt8Array *output)
{
self->output = output;
self->offset = 0;
@@ -70,7 +70,7 @@
* @param valueLength the length of the array
* @return 0 for success, else an error code
*/
-ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, uint8_t *value, unsigned int valueLength);
/**
* Write an element start header using DTAG with the tag to self->output, then the blob, then an element close.
@@ -81,7 +81,7 @@
* @param valueLength the length of the array
* @return 0 for success, else an error code
*/
-ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, unsigned int valueLength);
/**
* If value or valueLen is 0 then do nothing, otherwise call ndn_BinaryXmlEncoder_writeBlobDTagElement.
@@ -92,7 +92,7 @@
* @return 0 for success, else an error code
*/
static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
- (struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+ (struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, unsigned int valueLength)
{
if (value && valueLength > 0)
return ndn_BinaryXmlEncoder_writeBlobDTagElement(self, tag, value, valueLength);
@@ -107,7 +107,7 @@
* @param valueLength the length of the array
* @return 0 for success, else an error code
*/
-ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, uint8_t *value, unsigned int valueLength);
/**
* Write an element start header using DTAG with the tag to self->output, then the UDATA value, then an element close.
@@ -118,7 +118,7 @@
* @param valueLength the length of the array
* @return 0 for success, else an error code
*/
-ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, unsigned int valueLength);
/**
* If value or valueLen is 0 then do nothing, otherwise call ndn_BinaryXmlEncoder_writeUDataDTagElement.
@@ -129,7 +129,7 @@
* @return 0 for success, else an error code
*/
static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalUDataDTagElement
- (struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+ (struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, unsigned int valueLength)
{
if (value && valueLength > 0)
return ndn_BinaryXmlEncoder_writeUDataDTagElement(self, tag, value, valueLength);
diff --git a/ndn-cpp/c/encoding/binary-xml-interest.c b/ndn-cpp/c/encoding/binary-xml-interest.c
index a1b51a6..ee20f05 100644
--- a/ndn-cpp/c/encoding/binary-xml-interest.c
+++ b/ndn-cpp/c/encoding/binary-xml-interest.c
@@ -60,7 +60,7 @@
return error;
if (gotExpectedTag) {
// Component
- unsigned char *component;
+ uint8_t *component;
unsigned int componentLen;
if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component, &componentLen)))
return error;
@@ -96,7 +96,7 @@
return error;
if (gotExpectedTag) {
// Skip the Bloom and treat it as Any.
- unsigned char *value;
+ uint8_t *value;
unsigned int valueLen;
if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Bloom, 0, &value, &valueLen)))
return error;
diff --git a/ndn-cpp/c/encoding/binary-xml-name.c b/ndn-cpp/c/encoding/binary-xml-name.c
index c6f55f7..f36e0ef 100644
--- a/ndn-cpp/c/encoding/binary-xml-name.c
+++ b/ndn-cpp/c/encoding/binary-xml-name.c
@@ -44,7 +44,7 @@
// No more components.
break;
- unsigned char *component;
+ uint8_t *component;
unsigned int componentLen;
if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component, &componentLen)))
return error;
diff --git a/ndn-cpp/c/encoding/binary-xml-structure-decoder.c b/ndn-cpp/c/encoding/binary-xml-structure-decoder.c
index 4596910..603d07d 100644
--- a/ndn-cpp/c/encoding/binary-xml-structure-decoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-structure-decoder.c
@@ -31,7 +31,7 @@
}
ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
- (struct ndn_BinaryXmlStructureDecoder *self, unsigned char *input, unsigned int inputLength)
+ (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, unsigned int inputLength)
{
if (self->gotElementEnd)
// Someone is calling when we already got the end.
diff --git a/ndn-cpp/c/encoding/binary-xml-structure-decoder.h b/ndn-cpp/c/encoding/binary-xml-structure-decoder.h
index e58471e..f8bf5d0 100644
--- a/ndn-cpp/c/encoding/binary-xml-structure-decoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-structure-decoder.h
@@ -7,6 +7,7 @@
#ifndef NDN_BINARYXMLSTRUCTUREDECODER_H
#define NDN_BINARYXMLSTRUCTUREDECODER_H
+#include "../common.h"
#include "../errors.h"
#ifdef __cplusplus
@@ -21,7 +22,7 @@
unsigned int headerLength;
int useHeaderBuffer; /**< boolean */
// 10 bytes is enough to hold an encoded header with a type and a 64 bit value.
- unsigned char headerBuffer[10];
+ uint8_t headerBuffer[10];
int nBytesToRead;
};
@@ -43,7 +44,7 @@
* @return 0 for success, else an error code
*/
ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
- (struct ndn_BinaryXmlStructureDecoder *self, unsigned char *input, unsigned int inputLength);
+ (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, unsigned int inputLength);
/**
* Set the offset into the input, used for the next read.
diff --git a/ndn-cpp/c/errors.c b/ndn-cpp/c/errors.c
index 125be8a..5ccbec1 100644
--- a/ndn-cpp/c/errors.c
+++ b/ndn-cpp/c/errors.c
@@ -43,10 +43,10 @@
return "findElementEnd unrecognized header type";
case NDN_ERROR_findElementEnd_unrecognized_state:
return "findElementEnd unrecognized state";
- case NDN_ERROR_DynamicUCharArray_realloc_function_pointer_not_supplied:
- return "DynamicUCharArray realloc function pointer not supplied";
- case NDN_ERROR_DynamicUCharArray_realloc_failed:
- return "DynamicUCharArray realloc failed";
+ case NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied:
+ return "DynamicUInt8Array realloc function pointer not supplied";
+ case NDN_ERROR_DynamicUInt8Array_realloc_failed:
+ return "DynamicUInt8Array realloc failed";
case NDN_ERROR_unrecognized_ndn_ExcludeType:
return "unrecognized ndn_ExcludeType";
case NDN_ERROR_unrecognized_ndn_ContentType:
diff --git a/ndn-cpp/c/errors.h b/ndn-cpp/c/errors.h
index 1254c0b..9f992f9 100644
--- a/ndn-cpp/c/errors.h
+++ b/ndn-cpp/c/errors.h
@@ -30,8 +30,8 @@
NDN_ERROR_findElementEnd_cannot_read_header_type_and_value,
NDN_ERROR_findElementEnd_unrecognized_header_type,
NDN_ERROR_findElementEnd_unrecognized_state,
- NDN_ERROR_DynamicUCharArray_realloc_function_pointer_not_supplied,
- NDN_ERROR_DynamicUCharArray_realloc_failed,
+ NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied,
+ NDN_ERROR_DynamicUInt8Array_realloc_failed,
NDN_ERROR_unrecognized_ndn_ExcludeType,
NDN_ERROR_unrecognized_ndn_ContentType,
NDN_ERROR_unrecognized_ndn_KeyLocatorType,
diff --git a/ndn-cpp/c/forwarding-entry.h b/ndn-cpp/c/forwarding-entry.h
index f28ce69..8a77e2f 100644
--- a/ndn-cpp/c/forwarding-entry.h
+++ b/ndn-cpp/c/forwarding-entry.h
@@ -7,6 +7,7 @@
#ifndef NDN_FORWARDING_ENTRY_H
#define NDN_FORWARDING_ENTRY_H
+#include "common.h"
#include "name.h"
#include "publisher-public-key-digest.h"
@@ -18,7 +19,7 @@
* An ndn_ForwardingEntry holds fields for a ForwardingEntry which is used to register a prefix with a hub.
*/
struct ndn_ForwardingEntry {
- unsigned char *action; /**< pointer to pre-allocated buffer. 0 for none. */
+ uint8_t *action; /**< pointer to pre-allocated buffer. 0 for none. */
unsigned int actionLength; /**< length of action. 0 for none. */
struct ndn_Name prefix;
struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
diff --git a/ndn-cpp/c/interest.h b/ndn-cpp/c/interest.h
index cda0598..ad1b700 100644
--- a/ndn-cpp/c/interest.h
+++ b/ndn-cpp/c/interest.h
@@ -34,7 +34,7 @@
* @param component the pre-allocated buffer for the component value, only used if type is ndn_Exclude_COMPONENT
* @param componentLength the number of bytes in value, only used if type is ndn_Exclude_COMPONENT
*/
-static inline void ndn_ExcludeEntry_initialize(struct ndn_ExcludeEntry *self, ndn_ExcludeType type, unsigned char *component, unsigned int componentLength)
+static inline void ndn_ExcludeEntry_initialize(struct ndn_ExcludeEntry *self, ndn_ExcludeType type, uint8_t *component, unsigned int componentLength)
{
self->type = type;
ndn_NameComponent_initialize(&self->component, component, componentLength);
@@ -102,7 +102,7 @@
int answerOriginKind; /**< -1 for none */
int scope; /**< -1 for none */
double interestLifetimeMilliseconds; /**< milliseconds. -1.0 for none */
- unsigned char *nonce; /**< pointer to pre-allocated buffer. 0 for none */
+ uint8_t *nonce; /**< pointer to pre-allocated buffer. 0 for none */
unsigned int nonceLength; /**< length of nonce. 0 for none */
};
diff --git a/ndn-cpp/c/key.h b/ndn-cpp/c/key.h
index fee3c64..2069789 100644
--- a/ndn-cpp/c/key.h
+++ b/ndn-cpp/c/key.h
@@ -31,7 +31,7 @@
*/
struct ndn_KeyLocator {
ndn_KeyLocatorType type; /**< -1 for none */
- unsigned char *keyData; /**< A pointer to a pre-allocated buffer for the key data as follows:
+ uint8_t *keyData; /**< A pointer to a pre-allocated buffer for the key data as follows:
* If type is ndn_KeyLocatorType_KEY, the key data.
* If type is ndn_KeyLocatorType_CERTIFICATE, the certificate data.
* If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST, the publisher public key digest.
diff --git a/ndn-cpp/c/name.h b/ndn-cpp/c/name.h
index ade193a..5415f6e 100644
--- a/ndn-cpp/c/name.h
+++ b/ndn-cpp/c/name.h
@@ -15,7 +15,7 @@
* An ndn_NameComponent holds a pointer to the component value.
*/
struct ndn_NameComponent {
- unsigned char *value; /**< pointer to the pre-allocated buffer for the component value */
+ uint8_t *value; /**< pointer to the pre-allocated buffer for the component value */
unsigned int valueLength; /**< the number of bytes in value */
};
@@ -25,7 +25,7 @@
* @param value the pre-allocated buffer for the component value
* @param valueLength the number of bytes in value
*/
-static inline void ndn_NameComponent_initialize(struct ndn_NameComponent *self, unsigned char *value, unsigned int valueLength)
+static inline void ndn_NameComponent_initialize(struct ndn_NameComponent *self, uint8_t *value, unsigned int valueLength)
{
self->value = value;
self->valueLength = valueLength;
diff --git a/ndn-cpp/c/publisher-public-key-digest.h b/ndn-cpp/c/publisher-public-key-digest.h
index 0fcf032..3e02b9b 100644
--- a/ndn-cpp/c/publisher-public-key-digest.h
+++ b/ndn-cpp/c/publisher-public-key-digest.h
@@ -7,6 +7,8 @@
#ifndef NDN_PUBLISHERPUBLICKEYDIGEST_H
#define NDN_PUBLISHERPUBLICKEYDIGEST_H
+#include "common.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -16,7 +18,7 @@
* We make a separate struct since this is used by multiple other structs.
*/
struct ndn_PublisherPublicKeyDigest {
- unsigned char *publisherPublicKeyDigest; /**< pointer to pre-allocated buffer. 0 for none */
+ uint8_t *publisherPublicKeyDigest; /**< pointer to pre-allocated buffer. 0 for none */
unsigned int publisherPublicKeyDigestLength; /**< length of publisherPublicKeyDigest. 0 for none */
};
diff --git a/ndn-cpp/c/transport/socket-transport.c b/ndn-cpp/c/transport/socket-transport.c
index 53987b0..aef13ac 100644
--- a/ndn-cpp/c/transport/socket-transport.c
+++ b/ndn-cpp/c/transport/socket-transport.c
@@ -25,7 +25,7 @@
}
struct addrinfo hints;
- ndn_memset((unsigned char *)&hints, 0, sizeof(hints));
+ ndn_memset((uint8_t *)&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
if (socketType == SOCKET_TCP)
hints.ai_socktype = SOCK_STREAM;
@@ -67,7 +67,7 @@
return NDN_ERROR_success;
}
-ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, unsigned char *data, unsigned int dataLength)
+ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, unsigned int dataLength)
{
if (self->socketDescriptor < 0)
return NDN_ERROR_SocketTransport_socket_is_not_open;
@@ -115,7 +115,7 @@
}
ndn_Error ndn_SocketTransport_receive
- (struct ndn_SocketTransport *self, unsigned char *buffer, unsigned int bufferLength, unsigned int *nBytesOut)
+ (struct ndn_SocketTransport *self, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytesOut)
{
if (self->socketDescriptor < 0)
return NDN_ERROR_SocketTransport_socket_is_not_open;
diff --git a/ndn-cpp/c/transport/socket-transport.h b/ndn-cpp/c/transport/socket-transport.h
index 750cc56..e1388c3 100644
--- a/ndn-cpp/c/transport/socket-transport.h
+++ b/ndn-cpp/c/transport/socket-transport.h
@@ -8,6 +8,7 @@
#define NDN_SOCKETTRANSPORT_H
#include <sys/socket.h>
+#include "../common.h"
#include "../errors.h"
#ifdef __cplusplus
@@ -49,7 +50,7 @@
* @param dataLength The number of bytes in data.
* @return 0 for success, else an error code.
*/
-ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, unsigned char *data, unsigned int dataLength);
+ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, unsigned int dataLength);
/**
* Check if there is data ready on the socket to be received with ndn_SocketTransport_receive.
@@ -70,7 +71,7 @@
* @return 0 for success, else an error code.
*/
ndn_Error ndn_SocketTransport_receive
- (struct ndn_SocketTransport *self, unsigned char *buffer, unsigned int bufferLength, unsigned int *nBytes);
+ (struct ndn_SocketTransport *self, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytes);
/**
* Close the socket.
diff --git a/ndn-cpp/c/transport/tcp-transport.h b/ndn-cpp/c/transport/tcp-transport.h
index e31e127..05902f9 100644
--- a/ndn-cpp/c/transport/tcp-transport.h
+++ b/ndn-cpp/c/transport/tcp-transport.h
@@ -45,7 +45,7 @@
* @param dataLength The number of bytes in data.
* @return 0 for success, else an error code.
*/
-static inline ndn_Error ndn_TcpTransport_send(struct ndn_TcpTransport *self, unsigned char *data, unsigned int dataLength)
+static inline ndn_Error ndn_TcpTransport_send(struct ndn_TcpTransport *self, uint8_t *data, unsigned int dataLength)
{
return ndn_SocketTransport_send(&self->base, data, dataLength);
}
@@ -72,7 +72,7 @@
* @return 0 for success, else an error code.
*/
static inline ndn_Error ndn_TcpTransport_receive
- (struct ndn_TcpTransport *self, unsigned char *buffer, unsigned int bufferLength, unsigned int *nBytes)
+ (struct ndn_TcpTransport *self, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytes)
{
return ndn_SocketTransport_receive(&self->base, buffer, bufferLength, nBytes);
}
diff --git a/ndn-cpp/c/transport/udp-transport.h b/ndn-cpp/c/transport/udp-transport.h
index a97af10..fc9a173 100644
--- a/ndn-cpp/c/transport/udp-transport.h
+++ b/ndn-cpp/c/transport/udp-transport.h
@@ -45,7 +45,7 @@
* @param dataLength The number of bytes in data.
* @return 0 for success, else an error code.
*/
-static inline ndn_Error ndn_UdpTransport_send(struct ndn_UdpTransport *self, unsigned char *data, unsigned int dataLength)
+static inline ndn_Error ndn_UdpTransport_send(struct ndn_UdpTransport *self, uint8_t *data, unsigned int dataLength)
{
return ndn_SocketTransport_send(&self->base, data, dataLength);
}
@@ -72,7 +72,7 @@
* @return 0 for success, else an error code.
*/
static inline ndn_Error ndn_UdpTransport_receive
- (struct ndn_UdpTransport *self, unsigned char *buffer, unsigned int bufferLength, unsigned int *nBytes)
+ (struct ndn_UdpTransport *self, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytes)
{
return ndn_SocketTransport_receive(&self->base, buffer, bufferLength, nBytes);
}
diff --git a/ndn-cpp/c/util/blob.h b/ndn-cpp/c/util/blob.h
index 90e665b..4784065 100644
--- a/ndn-cpp/c/util/blob.h
+++ b/ndn-cpp/c/util/blob.h
@@ -15,7 +15,7 @@
* An ndn_Blob holds a pointer to a read-only pre-allocated buffer and its length.
*/
struct ndn_Blob {
- unsigned char *value; /**< pointer to the pre-allocated buffer for the value. Must be treated as read only. */
+ uint8_t *value; /**< pointer to the pre-allocated buffer for the value. Must be treated as read only. */
unsigned int valueLength; /**< the number of bytes in value. */
};
@@ -25,7 +25,7 @@
* @param value The pre-allocated buffer for the value, or 0 for none.
* @param valueLength The number of bytes in value.
*/
-static inline void ndn_Blob_initialize(struct ndn_Blob *self, unsigned char *value, unsigned int valueLength)
+static inline void ndn_Blob_initialize(struct ndn_Blob *self, uint8_t *value, unsigned int valueLength)
{
self->value = value;
self->valueLength = valueLength;
diff --git a/ndn-cpp/c/util/crypto.c b/ndn-cpp/c/util/crypto.c
index 397a542..2cdc91b 100644
--- a/ndn-cpp/c/util/crypto.c
+++ b/ndn-cpp/c/util/crypto.c
@@ -6,7 +6,7 @@
#include "crypto.h"
-void ndn_digestSha256(const unsigned char *data, unsigned int dataLength, unsigned char *digest)
+void ndn_digestSha256(const uint8_t *data, unsigned int dataLength, uint8_t *digest)
{
SHA256_CTX sha256;
SHA256_Init(&sha256);
diff --git a/ndn-cpp/c/util/crypto.h b/ndn-cpp/c/util/crypto.h
index 9dea5b0..eb7cec5 100644
--- a/ndn-cpp/c/util/crypto.h
+++ b/ndn-cpp/c/util/crypto.h
@@ -9,6 +9,7 @@
#include <openssl/ssl.h>
#include <openssl/rsa.h>
+#include "../common.h"
#ifdef __cplusplus
extern "C" {
@@ -20,7 +21,7 @@
* @param dataLength The length of data.
* @param digest A pointer to a buffer of size SHA256_DIGEST_LENGTH to receive the data.
*/
-void ndn_digestSha256(const unsigned char *data, unsigned int dataLength, unsigned char *digest);
+void ndn_digestSha256(const uint8_t *data, unsigned int dataLength, uint8_t *digest);
#ifdef __cplusplus
}
diff --git a/ndn-cpp/c/util/dynamic-uchar-array.c b/ndn-cpp/c/util/dynamic-uint8-array.c
similarity index 60%
rename from ndn-cpp/c/util/dynamic-uchar-array.c
rename to ndn-cpp/c/util/dynamic-uint8-array.c
index aa573e8..5a7e96d 100644
--- a/ndn-cpp/c/util/dynamic-uchar-array.c
+++ b/ndn-cpp/c/util/dynamic-uint8-array.c
@@ -4,12 +4,12 @@
* See COPYING for copyright and distribution information.
*/
-#include "dynamic-uchar-array.h"
+#include "dynamic-uint8-array.h"
-ndn_Error ndn_DynamicUCharArray_reallocArray(struct ndn_DynamicUCharArray *self, unsigned int length)
+ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, unsigned int length)
{
if (!self->realloc)
- return NDN_ERROR_DynamicUCharArray_realloc_function_pointer_not_supplied;
+ return NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied;
// See if double is enough.
unsigned int newLength = self->length * 2;
@@ -17,9 +17,9 @@
// The needed length is much greater, so use it.
newLength = length;
- unsigned char *newArray = (*self->realloc)(self, self->array, newLength);
+ uint8_t *newArray = (*self->realloc)(self, self->array, newLength);
if (!newArray)
- return NDN_ERROR_DynamicUCharArray_realloc_failed;
+ return NDN_ERROR_DynamicUInt8Array_realloc_failed;
self->array = newArray;
self->length = newLength;
diff --git a/ndn-cpp/c/util/dynamic-uchar-array.h b/ndn-cpp/c/util/dynamic-uint8-array.h
similarity index 62%
rename from ndn-cpp/c/util/dynamic-uchar-array.h
rename to ndn-cpp/c/util/dynamic-uint8-array.h
index 14f06e5..8b7b489 100644
--- a/ndn-cpp/c/util/dynamic-uchar-array.h
+++ b/ndn-cpp/c/util/dynamic-uint8-array.h
@@ -14,27 +14,27 @@
extern "C" {
#endif
-struct ndn_DynamicUCharArray {
- unsigned char *array; /**< the allocated array buffer */
+struct ndn_DynamicUInt8Array {
+ uint8_t *array; /**< the allocated array buffer */
unsigned int length; /**< the length of the allocated array buffer */
- unsigned char * (*realloc)
- (struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length); /**< a pointer to a function that reallocates array and returns a new pointer to a buffer of
+ uint8_t * (*realloc)
+ (struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length); /**< a pointer to a function that reallocates array and returns a new pointer to a buffer of
* length bytes, or 0 for error. On success, the contents of the old buffer are copied to the new one.
* On success, the original array pointer will no longer be used.
- * self is a pointer to the struct ndn_DynamicUCharArray which is calling realloc.
+ * self is a pointer to the struct ndn_DynamicUInt8Array which is calling realloc.
* This function pointer may be 0 (which causes an error if a reallocate is necessary). */
};
/**
- * Initialize an ndn_DynamicUCharArray struct with the given array buffer.
- * @param self pointer to the ndn_DynamicUCharArray struct
+ * Initialize an ndn_DynamicUInt8Array struct with the given array buffer.
+ * @param self pointer to the ndn_DynamicUInt8Array struct
* @param array the allocated array buffer
* @param length the length of the allocated array buffer
- * @param reallocFunction see ndn_DynamicUCharArray_ensureLength. This may be 0.
+ * @param reallocFunction see ndn_DynamicUInt8Array_ensureLength. This may be 0.
*/
-static inline void ndn_DynamicUCharArray_initialize
- (struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length,
- unsigned char * (*reallocFunction)(struct ndn_DynamicUCharArray *self, unsigned char *, unsigned int))
+static inline void ndn_DynamicUInt8Array_initialize
+ (struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length,
+ uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, unsigned int))
{
self->array = array;
self->length = length;
@@ -42,44 +42,44 @@
}
/**
- * Do the work of ndn_DynamicUCharArray_ensureLength if realloc is necessary.
+ * Do the work of ndn_DynamicUInt8Array_ensureLength if realloc is necessary.
* If the self->realloc function pointer is null, then return an error.
* If not null, call self->realloc to reallocate self->array, and update self->length (which may be greater than length).
- * @param self pointer to the ndn_DynamicUCharArray struct
+ * @param self pointer to the ndn_DynamicUInt8Array struct
* @param length the needed minimum size for self->length
* @return 0 for success, else an error code if can't reallocate the array
*/
-ndn_Error ndn_DynamicUCharArray_reallocArray(struct ndn_DynamicUCharArray *self, unsigned int length);
+ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, unsigned int length);
/**
* Ensure that self->length is greater than or equal to length. If it is, just return 0 for success.
* Otherwise, if the self->realloc function pointer is null, then return an error.
* If not null, call self->realloc to reallocate self->array, and update self->length (which may be greater than length).
- * @param self pointer to the ndn_DynamicUCharArray struct
+ * @param self pointer to the ndn_DynamicUInt8Array struct
* @param length the needed minimum size for self->length
* @return 0 for success, else an error code if need to reallocate the array but can't
*/
-static inline ndn_Error ndn_DynamicUCharArray_ensureLength(struct ndn_DynamicUCharArray *self, unsigned int length)
+static inline ndn_Error ndn_DynamicUInt8Array_ensureLength(struct ndn_DynamicUInt8Array *self, unsigned int length)
{
if (self->length >= length)
return NDN_ERROR_success;
- return ndn_DynamicUCharArray_reallocArray(self, length);
+ return ndn_DynamicUInt8Array_reallocArray(self, length);
}
/**
- * Copy value into self->array at offset, using ndn_DynamicUCharArray_ensureLength to make sure self->array has enough length.
- * @param self pointer to the ndn_DynamicUCharArray struct
+ * Copy value into self->array at offset, using ndn_DynamicUInt8Array_ensureLength to make sure self->array has enough length.
+ * @param self pointer to the ndn_DynamicUInt8Array struct
* @param value the buffer to copy from
* @param valueLength the length of the value buffer
* @param offset the offset in self->array to copy to
* @return 0 for success, else an error code if need to reallocate the array but can't
*/
-static inline ndn_Error ndn_DynamicUCharArray_set
- (struct ndn_DynamicUCharArray *self, unsigned char *value, unsigned int valueLength, unsigned int offset)
+static inline ndn_Error ndn_DynamicUInt8Array_set
+ (struct ndn_DynamicUInt8Array *self, uint8_t *value, unsigned int valueLength, unsigned int offset)
{
ndn_Error error;
- if ((error = ndn_DynamicUCharArray_ensureLength(self, valueLength + offset)))
+ if ((error = ndn_DynamicUInt8Array_ensureLength(self, valueLength + offset)))
return error;
ndn_memcpy(self->array + offset, value, valueLength);
return NDN_ERROR_success;
diff --git a/ndn-cpp/c/util/ndn_memory.c b/ndn-cpp/c/util/ndn_memory.c
index 863e886..db92bde 100644
--- a/ndn-cpp/c/util/ndn_memory.c
+++ b/ndn-cpp/c/util/ndn_memory.c
@@ -7,7 +7,7 @@
#include "ndn_memory.h"
#if !HAVE_MEMCMP
-int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len)
+int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, unsigned int len)
{
unsigned int i;
@@ -25,7 +25,7 @@
#endif
#if !HAVE_MEMCPY
-void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len)
+void ndn_memcpy(uint8_t *dest, uint8_t *src, unsigned int len)
{
unsigned int i;
@@ -37,12 +37,12 @@
#endif
#if !HAVE_MEMSET
-void ndn_memset(unsigned char *dest, int val, unsigned int len)
+void ndn_memset(uint8_t *dest, int val, unsigned int len)
{
unsigned int i;
for (i = 0; i < len; i++)
- dest[i] = (unsigned char)val;
+ dest[i] = (uint8_t)val;
}
#else
int ndn_memset_stub_to_avoid_empty_file_warning = 0;
diff --git a/ndn-cpp/c/util/ndn_memory.h b/ndn-cpp/c/util/ndn_memory.h
index 85b01b3..ba0a85b 100644
--- a/ndn-cpp/c/util/ndn_memory.h
+++ b/ndn-cpp/c/util/ndn_memory.h
@@ -11,7 +11,7 @@
#ifndef NDN_MEMORY_H
#define NDN_MEMORY_H
-#include "../../../config.h"
+#include "../common.h"
#ifdef __cplusplus
extern "C" {
@@ -22,12 +22,12 @@
/**
* Use the library version of memcmp.
*/
-static inline int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len) { return memcmp(buf1, buf2, len); }
+static inline int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, unsigned int len) { return memcmp(buf1, buf2, len); }
#else
/**
* Use a local implementation of memcmp instead of the library version.
*/
-int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len);
+int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, unsigned int len);
#endif
#if HAVE_MEMCPY
@@ -35,12 +35,12 @@
/**
* Use the library version of memcpy.
*/
-static inline void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len) { memcpy(dest, src, len); }
+static inline void ndn_memcpy(uint8_t *dest, uint8_t *src, unsigned int len) { memcpy(dest, src, len); }
#else
/**
* Use a local implementation of memcpy instead of the library version.
*/
-void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len);
+void ndn_memcpy(uint8_t *dest, uint8_t *src, unsigned int len);
#endif
#if HAVE_MEMSET
@@ -48,12 +48,12 @@
/**
* Use the library version of memset.
*/
-static inline void ndn_memset(unsigned char *dest, int val, unsigned int len) { memset(dest, val, len); }
+static inline void ndn_memset(uint8_t *dest, int val, unsigned int len) { memset(dest, val, len); }
#else
/**
* Use a local implementation of memset instead of the library version.
*/
-void ndn_memset(unsigned char *dest, int val, unsigned int len);
+void ndn_memset(uint8_t *dest, int val, unsigned int len);
#endif
#ifdef __cplusplus
diff --git a/ndn-cpp/c/util/ndn_realloc.c b/ndn-cpp/c/util/ndn_realloc.c
index bc701e0..8e560b9 100644
--- a/ndn-cpp/c/util/ndn_realloc.c
+++ b/ndn-cpp/c/util/ndn_realloc.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include "ndn_realloc.h"
-unsigned char *ndn_realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length)
+uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length)
{
- return (unsigned char *)realloc(array, length);
+ return (uint8_t *)realloc(array, length);
}
diff --git a/ndn-cpp/c/util/ndn_realloc.h b/ndn-cpp/c/util/ndn_realloc.h
index 07dd053..5259f70 100644
--- a/ndn-cpp/c/util/ndn_realloc.h
+++ b/ndn-cpp/c/util/ndn_realloc.h
@@ -7,21 +7,21 @@
#ifndef NDN_NDN_REALLOC_H
#define NDN_NDN_REALLOC_H
-#include "dynamic-uchar-array.h"
+#include "dynamic-uint8-array.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
- * Wrap the C stdlib realloc to convert to/from void * to unsigned char *.
- * This can be used by ndn_DynamicUCharArray_initialize.
+ * Wrap the C stdlib realloc to convert to/from void * to uint8_t *.
+ * This can be used by ndn_DynamicUInt8Array_initialize.
* @param self This is ignored.
* @param array the allocated array buffer to realloc.
* @param length the length for the new array buffer.
* @return the new allocated array buffer.
*/
-unsigned char *ndn_realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length);
+uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length);
#ifdef __cplusplus
}
diff --git a/ndn-cpp/common.cpp b/ndn-cpp/common.cpp
index d1c55f3..70d3a90 100644
--- a/ndn-cpp/common.cpp
+++ b/ndn-cpp/common.cpp
@@ -12,7 +12,7 @@
namespace ndn {
string
-toHex(const vector<unsigned char>& array)
+toHex(const vector<uint8_t>& array)
{
if (!&array)
return "";
@@ -20,7 +20,7 @@
ostringstream result;
result.flags(ios::hex | ios::uppercase);
for (unsigned int i = 0; i < array.size(); ++i) {
- unsigned char x = array[i];
+ uint8_t x = array[i];
if (x < 16)
result << '0';
result << (unsigned int)x;
diff --git a/ndn-cpp/common.hpp b/ndn-cpp/common.hpp
index 0ed219c..70b36ed 100644
--- a/ndn-cpp/common.hpp
+++ b/ndn-cpp/common.hpp
@@ -58,7 +58,7 @@
* @return Hex string.
*/
std::string
-toHex(const std::vector<unsigned char>& array);
+toHex(const std::vector<uint8_t>& array);
}
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index 684a061..5681159 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -53,7 +53,7 @@
dataStruct.contentLength = content_.size();
if (content_.size() > 0)
- dataStruct.content = (unsigned char*)content_.buf();
+ dataStruct.content = (uint8_t*)content_.buf();
else
dataStruct.content = 0;
}
@@ -80,7 +80,7 @@
}
void
-Data::wireDecode(const unsigned char* input, unsigned int inputLength, WireFormat& wireFormat)
+Data::wireDecode(const uint8_t* input, unsigned int inputLength, WireFormat& wireFormat)
{
unsigned int signedPortionBeginOffset, signedPortionEndOffset;
wireFormat.decodeData(*this, input, inputLength, &signedPortionBeginOffset, &signedPortionEndOffset);
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index e8434b4..4b82fef 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -98,10 +98,10 @@
setFreshnessSeconds(int freshnessSeconds) { freshnessSeconds_ = freshnessSeconds; }
void
- setFinalBlockID(const std::vector<unsigned char>& finalBlockID) { finalBlockID_ = Name::Component(finalBlockID); }
+ setFinalBlockID(const std::vector<uint8_t>& finalBlockID) { finalBlockID_ = Name::Component(finalBlockID); }
void
- setFinalBlockID(const unsigned char* finalBlockID, unsigned int finalBlockIdLength)
+ setFinalBlockID(const uint8_t* finalBlockID, unsigned int finalBlockIdLength)
{
finalBlockID_ = Name::Component(finalBlockID, finalBlockIdLength);
}
@@ -142,7 +142,7 @@
* @param wireFormat A WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
*/
void
- wireDecode(const unsigned char* input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+ wireDecode(const uint8_t* input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
/**
* Decode the input using a particular wire format and update this Data. Also, set the wireEncoding field to the input.
@@ -150,7 +150,7 @@
* @param wireFormat A WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
*/
void
- wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+ wireDecode(const std::vector<uint8_t>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
@@ -250,14 +250,14 @@
* @param content A vector whose contents are copied.
*/
void
- setContent(const std::vector<unsigned char>& content)
+ setContent(const std::vector<uint8_t>& content)
{
content_ = content;
onChanged();
}
void
- setContent(const unsigned char* content, unsigned int contentLength)
+ setContent(const uint8_t* content, unsigned int contentLength)
{
content_ = Blob(content, contentLength);
onChanged();
@@ -269,14 +269,14 @@
* @param content A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
void
- setContent(const ptr_lib::shared_ptr<std::vector<unsigned char> > &content)
+ setContent(const ptr_lib::shared_ptr<std::vector<uint8_t> > &content)
{
content_ = content;
onChanged();
}
void
- setContent(const ptr_lib::shared_ptr<const std::vector<unsigned char> > &content)
+ setContent(const ptr_lib::shared_ptr<const std::vector<uint8_t> > &content)
{
content_ = content;
onChanged();
diff --git a/ndn-cpp/encoding/binary-xml-decoder.hpp b/ndn-cpp/encoding/binary-xml-decoder.hpp
index 7b28e7f..1bbca34 100644
--- a/ndn-cpp/encoding/binary-xml-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-decoder.hpp
@@ -22,9 +22,9 @@
/**
* Initialize the base ndn_BinaryXmlDecoder struct with the input.
*/
- BinaryXmlDecoder(const unsigned char *input, unsigned int inputLength)
+ BinaryXmlDecoder(const uint8_t *input, unsigned int inputLength)
{
- ndn_BinaryXmlDecoder_initialize(this, (unsigned char *)input, inputLength);
+ ndn_BinaryXmlDecoder_initialize(this, (uint8_t *)input, inputLength);
}
/**
diff --git a/ndn-cpp/encoding/binary-xml-element-reader.cpp b/ndn-cpp/encoding/binary-xml-element-reader.cpp
index 6a7c5ad..bfb9a2a 100644
--- a/ndn-cpp/encoding/binary-xml-element-reader.cpp
+++ b/ndn-cpp/encoding/binary-xml-element-reader.cpp
@@ -9,7 +9,7 @@
namespace ndn {
void
-ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength)
+ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength)
{
((ElementListener *)self)->onReceivedElement(element, elementLength);
}
diff --git a/ndn-cpp/encoding/binary-xml-element-reader.hpp b/ndn-cpp/encoding/binary-xml-element-reader.hpp
index c86b99a..5aed8a0 100644
--- a/ndn-cpp/encoding/binary-xml-element-reader.hpp
+++ b/ndn-cpp/encoding/binary-xml-element-reader.hpp
@@ -29,7 +29,7 @@
* @param elementLength length of element
*/
virtual void
- onReceivedElement(const unsigned char *element, unsigned int elementLength) = 0;
+ onReceivedElement(const uint8_t *element, unsigned int elementLength) = 0;
private:
/**
@@ -39,7 +39,7 @@
* @param elementLength
*/
static void
- staticOnReceivedElement(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength);
+ staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength);
};
}
diff --git a/ndn-cpp/encoding/binary-xml-encoder.hpp b/ndn-cpp/encoding/binary-xml-encoder.hpp
index 7c7f626..af495ca 100644
--- a/ndn-cpp/encoding/binary-xml-encoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-encoder.hpp
@@ -9,7 +9,7 @@
#include <vector>
#include "../common.hpp"
-#include "../util/dynamic-uchar-vector.hpp"
+#include "../util/dynamic-uint8-vector.hpp"
#include "../c/encoding/binary-xml-encoder.h"
namespace ndn {
@@ -32,14 +32,14 @@
* Resize the output vector to the correct encoding length and return.
* @return The encoding as a shared_ptr. Assume that the caller now owns the vector.
*/
- const ptr_lib::shared_ptr<std::vector<unsigned char> >&
+ const ptr_lib::shared_ptr<std::vector<uint8_t> >&
getOutput()
{
output_.get()->resize(offset);
return output_.get();
}
- DynamicUCharVector output_;
+ DynamicUInt8Vector output_;
};
}
diff --git a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
index a1911ea..0fbc1cf 100644
--- a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
@@ -31,7 +31,7 @@
* @return true if found the element end, false if need to read more. (This is the same as returning gotElementEnd().)
*/
bool
- findElementEnd(unsigned char *input, unsigned int inputLength)
+ findElementEnd(uint8_t *input, unsigned int inputLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(this, input, inputLength)))
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index 71f74d5..130412c 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -46,7 +46,7 @@
}
void
-BinaryXmlWireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
+BinaryXmlWireFormat::decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_ExcludeEntry excludeEntries[100];
@@ -84,7 +84,7 @@
void
BinaryXmlWireFormat::decodeData
- (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
+ (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_NameComponent keyNameComponents[100];
@@ -119,7 +119,7 @@
}
void
-BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
+BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength)
{
struct ndn_NameComponent prefixNameComponents[100];
struct ndn_ForwardingEntry forwardingEntryStruct;
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.hpp b/ndn-cpp/encoding/binary-xml-wire-format.hpp
index 350561e..de1388e 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.hpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.hpp
@@ -32,7 +32,7 @@
* @param inputLength The number of bytes in input.
*/
virtual void
- decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
+ decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength);
/**
* Encode data with binary XML and return the encoding.
@@ -54,14 +54,14 @@
* @param inputLength The number of bytes in input.
* @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
* If you are not decoding in order to verify, you can call
- * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
* @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
* If you are not decoding in order to verify, you can call
- * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
*/
virtual void
decodeData
- (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
+ (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
/**
* Encode forwardingEntry in binary XML and return the encoding.
@@ -78,7 +78,7 @@
* @param inputLength The number of bytes in input.
*/
virtual void
- decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
+ decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength);
};
}
diff --git a/ndn-cpp/encoding/wire-format.cpp b/ndn-cpp/encoding/wire-format.cpp
index 41c1f39..70644ad 100644
--- a/ndn-cpp/encoding/wire-format.cpp
+++ b/ndn-cpp/encoding/wire-format.cpp
@@ -35,7 +35,7 @@
}
void
-WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
+WireFormat::decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
@@ -48,7 +48,7 @@
void
WireFormat::decodeData
- (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
+ (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
{
throw logic_error("unimplemented");
}
@@ -60,7 +60,7 @@
}
void
-WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
+WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/encoding/wire-format.hpp b/ndn-cpp/encoding/wire-format.hpp
index 02e7a8c..489415b 100644
--- a/ndn-cpp/encoding/wire-format.hpp
+++ b/ndn-cpp/encoding/wire-format.hpp
@@ -35,7 +35,7 @@
* @throw logic_error for unimplemented if the derived class does not override.
*/
virtual void
- decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
+ decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength);
/**
* Encode data and return the encoding. Your derived class should override.
@@ -71,18 +71,18 @@
* @param inputLength The number of bytes in input.
* @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
* If you are not decoding in order to verify, you can call
- * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
* @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
* If you are not decoding in order to verify, you can call
- * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
* @throw logic_error for unimplemented if the derived class does not override.
*/
virtual void
decodeData
- (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
+ (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
void
- decodeData(Data& data, const unsigned char *input, unsigned int inputLength)
+ decodeData(Data& data, const uint8_t *input, unsigned int inputLength)
{
unsigned int dummyBeginOffset, dummyEndOffset;
decodeData(data, input, inputLength, &dummyBeginOffset, &dummyEndOffset);
@@ -105,7 +105,7 @@
* @throw logic_error for unimplemented if the derived class does not override.
*/
virtual void
- decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
+ decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength);
/**
* Set the static default WireFormat used by default encoding and decoding methods.
diff --git a/ndn-cpp/forwarding-entry.cpp b/ndn-cpp/forwarding-entry.cpp
index 7311e3c..57c01c4 100644
--- a/ndn-cpp/forwarding-entry.cpp
+++ b/ndn-cpp/forwarding-entry.cpp
@@ -38,7 +38,7 @@
forwardingEntryStruct.actionLength = action_.size();
if (action_.size() > 0)
- forwardingEntryStruct.action = (unsigned char *)&action_[0];
+ forwardingEntryStruct.action = (uint8_t *)&action_[0];
else
forwardingEntryStruct.action = 0;
}
diff --git a/ndn-cpp/forwarding-entry.hpp b/ndn-cpp/forwarding-entry.hpp
index 3c88a89..73a9484 100644
--- a/ndn-cpp/forwarding-entry.hpp
+++ b/ndn-cpp/forwarding-entry.hpp
@@ -39,13 +39,13 @@
}
void
- wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+ wireDecode(const uint8_t *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireFormat.decodeForwardingEntry(*this, input, inputLength);
}
void
- wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+ wireDecode(const std::vector<uint8_t>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
diff --git a/ndn-cpp/interest.cpp b/ndn-cpp/interest.cpp
index 3c09234..0a736dc 100644
--- a/ndn-cpp/interest.cpp
+++ b/ndn-cpp/interest.cpp
@@ -91,7 +91,7 @@
interestStruct.nonceLength = nonce_.size();
if (nonce_.size() > 0)
- interestStruct.nonce = (unsigned char *)nonce_.buf();
+ interestStruct.nonce = (uint8_t *)nonce_.buf();
else
interestStruct.nonce = 0;
}
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index 749363f..0f59a28 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -29,7 +29,7 @@
/**
* Create an ExcludeEntry of type ndn_Exclude_COMPONENT
*/
- ExcludeEntry(unsigned char *component, unsigned int componentLen)
+ ExcludeEntry(uint8_t *component, unsigned int componentLen)
: type_(ndn_Exclude_COMPONENT), component_(component, componentLen)
{
}
@@ -103,7 +103,7 @@
* Add a new entry of type ndn_Exclude_COMPONENT, copying from component of length compnentLength
*/
void
- addComponent(unsigned char *component, unsigned int componentLen)
+ addComponent(uint8_t *component, unsigned int componentLen)
{
entries_.push_back(ExcludeEntry(component, componentLen));
}
@@ -133,7 +133,7 @@
public:
Interest(const Name& name, int minSuffixComponents, int maxSuffixComponents,
const PublisherPublicKeyDigest& publisherPublicKeyDigest, const Exclude& exclude, int childSelector, int answerOriginKind,
- int scope, double interestLifetimeMilliseconds, const std::vector<unsigned char>& nonce)
+ int scope, double interestLifetimeMilliseconds, const std::vector<uint8_t>& nonce)
: name_(name), minSuffixComponents_(minSuffixComponents), maxSuffixComponents_(maxSuffixComponents),
publisherPublicKeyDigest_(publisherPublicKeyDigest), exclude_(exclude), childSelector_(childSelector),
answerOriginKind_(answerOriginKind), scope_(scope), interestLifetimeMilliseconds_(interestLifetimeMilliseconds),
@@ -175,13 +175,13 @@
}
void
- wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+ wireDecode(const uint8_t *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireFormat.decodeInterest(*this, input, inputLength);
}
void
- wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+ wireDecode(const std::vector<uint8_t>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
@@ -259,7 +259,7 @@
setInterestLifetimeMilliseconds(double value) { interestLifetimeMilliseconds_ = value; }
void
- setNonce(const std::vector<unsigned char>& value) { nonce_ = value; }
+ setNonce(const std::vector<uint8_t>& value) { nonce_ = value; }
private:
void
diff --git a/ndn-cpp/key.cpp b/ndn-cpp/key.cpp
index b453471..ef57265 100644
--- a/ndn-cpp/key.cpp
+++ b/ndn-cpp/key.cpp
@@ -18,7 +18,7 @@
keyLocatorStruct.keyDataLength = keyData_.size();
if (keyData_.size() > 0)
- keyLocatorStruct.keyData = (unsigned char *)keyData_.buf();
+ keyLocatorStruct.keyData = (uint8_t *)keyData_.buf();
else
keyLocatorStruct.keyData = 0;
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index b918d99..da9a11f 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -65,10 +65,10 @@
setType(ndn_KeyLocatorType type) { type_ = type; }
void
- setKeyData(const std::vector<unsigned char>& keyData) { keyData_ = keyData; }
+ setKeyData(const std::vector<uint8_t>& keyData) { keyData_ = keyData; }
void
- setKeyData(const unsigned char *keyData, unsigned int keyDataLength)
+ setKeyData(const uint8_t *keyData, unsigned int keyDataLength)
{
keyData_ = Blob(keyData, keyDataLength);
}
@@ -79,7 +79,7 @@
* @param keyData A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
void
- setKeyData(const ptr_lib::shared_ptr<std::vector<unsigned char> > &keyData) { keyData_ = keyData; }
+ setKeyData(const ptr_lib::shared_ptr<std::vector<uint8_t> > &keyData) { keyData_ = keyData; }
void setKeyName(const Name &keyName) { keyName_ = keyName; }
diff --git a/ndn-cpp/name.cpp b/ndn-cpp/name.cpp
index 4e27db1..7534ba3 100644
--- a/ndn-cpp/name.cpp
+++ b/ndn-cpp/name.cpp
@@ -66,7 +66,7 @@
* @return
*/
static int
-fromHexChar(unsigned char c)
+fromHexChar(uint8_t c)
{
if (c >= '0' && c <= '9')
return (int)c - (int)'0';
@@ -96,7 +96,7 @@
// Invalid hex characters, so just keep the escaped string.
result << str[i] << str[i + 1] << str[i + 2];
else
- result << (unsigned char)(16 * hi + lo);
+ result << (uint8_t)(16 * hi + lo);
// Skip ahead past the escaped value.
i += 2;
@@ -123,16 +123,16 @@
return Blob();
else
// Remove 3 periods.
- return Blob((const unsigned char *)&component[3], component.size() - 3);
+ return Blob((const uint8_t *)&component[3], component.size() - 3);
}
else
- return Blob((const unsigned char *)&component[0], component.size());
+ return Blob((const uint8_t *)&component[0], component.size());
}
Blob
Name::Component::makeSegment(unsigned long segment)
{
- shared_ptr<vector<unsigned char> > value(new vector<unsigned char>());
+ shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
// Add the leading zero.
value->push_back(0);
@@ -298,7 +298,7 @@
}
void
-Name::toEscapedString(const vector<unsigned char>& value, ostringstream& result)
+Name::toEscapedString(const vector<uint8_t>& value, ostringstream& result)
{
bool gotNonDot = false;
for (unsigned i = 0; i < value.size(); ++i) {
@@ -318,7 +318,7 @@
ios::fmtflags saveFlags = result.flags(ios::hex | ios::uppercase);
for (unsigned int i = 0; i < value.size(); ++i) {
- unsigned char x = value[i];
+ uint8_t x = value[i];
// Check for 0-9, A-Z, a-z, (+), (-), (.), (_)
if (x >= 0x30 && x <= 0x39 || x >= 0x41 && x <= 0x5a ||
x >= 0x61 && x <= 0x7a || x == 0x2b || x == 0x2d ||
@@ -338,7 +338,7 @@
}
string
-Name::toEscapedString(const vector<unsigned char>& value)
+Name::toEscapedString(const vector<uint8_t>& value)
{
ostringstream result;
toEscapedString(value, result);
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index 2fed5ba..7e9be6c 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -34,7 +34,7 @@
* Create a new Name::Component, copying the given value.
* @param value The value byte array.
*/
- Component(const std::vector<unsigned char>& value)
+ Component(const std::vector<uint8_t>& value)
: value_(value)
{
}
@@ -44,7 +44,7 @@
* @param value Pointer to the value byte array.
* @param valueLen Length of value.
*/
- Component(const unsigned char *value, unsigned int valueLen)
+ Component(const uint8_t *value, unsigned int valueLen)
: value_(value, valueLen)
{
}
@@ -68,7 +68,7 @@
{
componentStruct.valueLength = value_.size();
if (value_.size() > 0)
- componentStruct.value = (unsigned char*)value_.buf();
+ componentStruct.value = (uint8_t*)value_.buf();
else
componentStruct.value = 0;
}
@@ -174,7 +174,7 @@
* @return This name so that you can chain calls to append.
*/
Name&
- append(const unsigned char *value, unsigned int valueLength)
+ append(const uint8_t *value, unsigned int valueLength)
{
components_.push_back(Component(value, valueLength));
return *this;
@@ -185,7 +185,7 @@
* @return This name so that you can chain calls to append.
*/
Name&
- append(const std::vector<unsigned char>& value)
+ append(const std::vector<uint8_t>& value)
{
components_.push_back(value);
return *this;
@@ -210,7 +210,7 @@
* @deprecated Use append.
*/
Name&
- appendComponent(const unsigned char *value, unsigned int valueLength)
+ appendComponent(const uint8_t *value, unsigned int valueLength)
{
return append(value, valueLength);
}
@@ -219,7 +219,7 @@
* @deprecated Use append.
*/
Name&
- appendComponent(const std::vector<unsigned char>& value)
+ appendComponent(const std::vector<uint8_t>& value)
{
return append(value);
}
@@ -237,7 +237,7 @@
* @deprecated Use append.
*/
Name&
- addComponent(const unsigned char *value, unsigned int valueLength)
+ addComponent(const uint8_t *value, unsigned int valueLength)
{
return append(value, valueLength);
}
@@ -246,7 +246,7 @@
* @deprecated Use append.
*/
Name&
- addComponent(const std::vector<unsigned char>& value)
+ addComponent(const std::vector<uint8_t>& value)
{
return append(value);
}
@@ -351,7 +351,7 @@
* @param result the string stream to write to.
*/
static void
- toEscapedString(const std::vector<unsigned char>& value, std::ostringstream& result);
+ toEscapedString(const std::vector<uint8_t>& value, std::ostringstream& result);
/**
* Convert the value by escaping characters according to the NDN URI Scheme.
@@ -360,7 +360,7 @@
* @return The escaped string.
*/
static std::string
- toEscapedString(const std::vector<unsigned char>& value);
+ toEscapedString(const std::vector<uint8_t>& value);
private:
std::vector<Component> components_;
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 76e12c9..6eb30fd 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -19,7 +19,7 @@
namespace ndn {
-static unsigned char SELFREG_PUBLIC_KEY_DER[] = {
+static uint8_t SELFREG_PUBLIC_KEY_DER[] = {
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x7D, 0x30, 0xA7, 0xD8, 0x28, 0xAB, 0x1B, 0x84, 0x0B, 0x17,
0x54, 0x2D, 0xCA, 0xF6, 0x20, 0x7A, 0xFD, 0x22, 0x1E, 0x08, 0x6B, 0x2A, 0x60, 0xD1, 0x6C, 0xB7, 0xF5, 0x44, 0x48, 0xBA,
@@ -31,7 +31,7 @@
0x00, 01
};
-static unsigned char SELFREG_PRIVATE_KEY_DER[] = {
+static uint8_t SELFREG_PRIVATE_KEY_DER[] = {
0x30, 0x82, 0x02, 0x5d, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xe1, 0x7d, 0x30, 0xa7, 0xd8, 0x28, 0xab, 0x1b, 0x84,
0x0b, 0x17, 0x54, 0x2d, 0xca, 0xf6, 0x20, 0x7a, 0xfd, 0x22, 0x1e, 0x08, 0x6b, 0x2a, 0x60, 0xd1, 0x6c, 0xb7, 0xf5, 0x44,
0x48, 0xba, 0x9f, 0x3f, 0x08, 0xbc, 0xd0, 0x99, 0xdb, 0x21, 0xdd, 0x16, 0x2a, 0x77, 0x9e, 0x61, 0xaa, 0x89, 0xee, 0xe5,
@@ -79,7 +79,7 @@
Sha256WithRsaSignature *signature = dynamic_cast<Sha256WithRsaSignature*>(data.getSignature());
// Set the public key.
- unsigned char publicKeyDigest[SHA256_DIGEST_LENGTH];
+ uint8_t publicKeyDigest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(SELFREG_PUBLIC_KEY_DER, sizeof(SELFREG_PUBLIC_KEY_DER), publicKeyDigest);
signature->getPublisherPublicKeyDigest().setPublisherPublicKeyDigest(publicKeyDigest, sizeof(publicKeyDigest));
signature->getKeyLocator().setType(ndn_KeyLocatorType_KEY);
@@ -87,12 +87,12 @@
// Sign the fields.
SignedBlob encoding = data.wireEncode(wireFormat);
- unsigned char signedPortionDigest[SHA256_DIGEST_LENGTH];
+ uint8_t signedPortionDigest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(encoding.signedBuf(), encoding.signedSize(), signedPortionDigest);
- unsigned char signatureBits[1000];
+ uint8_t signatureBits[1000];
unsigned int signatureBitsLength;
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = SELFREG_PRIVATE_KEY_DER;
+ const uint8_t *derPointer = SELFREG_PRIVATE_KEY_DER;
RSA *privateKey = d2i_RSAPrivateKey(NULL, &derPointer, sizeof(SELFREG_PRIVATE_KEY_DER));
if (!privateKey)
throw std::runtime_error("Error decoding private key in d2i_RSAPrivateKey");
@@ -189,8 +189,8 @@
// Create an interest where the name has the encoded Data packet.
Name interestName;
- const unsigned char component0[] = "ndnx";
- const unsigned char component2[] = "selfreg";
+ const uint8_t component0[] = "ndnx";
+ const uint8_t component2[] = "selfreg";
interestName.addComponent(component0, sizeof(component0) - 1);
interestName.addComponent(ndndId_);
interestName.addComponent(component2, sizeof(component2) - 1);
@@ -224,7 +224,7 @@
}
void
-Node::onReceivedElement(const unsigned char *element, unsigned int elementLength)
+Node::onReceivedElement(const uint8_t *element, unsigned int elementLength)
{
BinaryXmlDecoder decoder(element, elementLength);
diff --git a/ndn-cpp/node.hpp b/ndn-cpp/node.hpp
index 467a537..eba6eb5 100644
--- a/ndn-cpp/node.hpp
+++ b/ndn-cpp/node.hpp
@@ -90,7 +90,7 @@
getConnectionInfo() { return connectionInfo_; }
void
- onReceivedElement(const unsigned char *element, unsigned int elementLength);
+ onReceivedElement(const uint8_t *element, unsigned int elementLength);
void
shutdown();
diff --git a/ndn-cpp/publisher-public-key-digest.hpp b/ndn-cpp/publisher-public-key-digest.hpp
index 9a31816..6abe8bd 100644
--- a/ndn-cpp/publisher-public-key-digest.hpp
+++ b/ndn-cpp/publisher-public-key-digest.hpp
@@ -32,7 +32,7 @@
{
publisherPublicKeyDigestStruct.publisherPublicKeyDigestLength = publisherPublicKeyDigest_.size();
if (publisherPublicKeyDigest_.size() > 0)
- publisherPublicKeyDigestStruct.publisherPublicKeyDigest = (unsigned char *)publisherPublicKeyDigest_.buf();
+ publisherPublicKeyDigestStruct.publisherPublicKeyDigest = (uint8_t *)publisherPublicKeyDigest_.buf();
else
publisherPublicKeyDigestStruct.publisherPublicKeyDigest = 0;
}
@@ -52,13 +52,13 @@
getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
void
- setPublisherPublicKeyDigest(const std::vector<unsigned char>& publisherPublicKeyDigest)
+ setPublisherPublicKeyDigest(const std::vector<uint8_t>& publisherPublicKeyDigest)
{
publisherPublicKeyDigest_ = publisherPublicKeyDigest;
}
void
- setPublisherPublicKeyDigest(const unsigned char *publisherPublicKeyDigest, unsigned int publisherPublicKeyDigestLength)
+ setPublisherPublicKeyDigest(const uint8_t *publisherPublicKeyDigest, unsigned int publisherPublicKeyDigestLength)
{
publisherPublicKeyDigest_ = Blob(publisherPublicKeyDigest, publisherPublicKeyDigestLength);
}
@@ -69,13 +69,13 @@
* @param signature A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
void
- setPublisherPublicKeyDigest(const ptr_lib::shared_ptr<std::vector<unsigned char> > &publisherPublicKeyDigest)
+ setPublisherPublicKeyDigest(const ptr_lib::shared_ptr<std::vector<uint8_t> > &publisherPublicKeyDigest)
{
publisherPublicKeyDigest_ = publisherPublicKeyDigest;
}
void
- setPublisherPublicKeyDigest(const ptr_lib::shared_ptr<const std::vector<unsigned char> > &publisherPublicKeyDigest)
+ setPublisherPublicKeyDigest(const ptr_lib::shared_ptr<const std::vector<uint8_t> > &publisherPublicKeyDigest)
{
publisherPublicKeyDigest_ = publisherPublicKeyDigest;
}
diff --git a/ndn-cpp/security/certificate/public-key.cpp b/ndn-cpp/security/certificate/public-key.cpp
index 1f64c07..3565ac3 100644
--- a/ndn-cpp/security/certificate/public-key.cpp
+++ b/ndn-cpp/security/certificate/public-key.cpp
@@ -32,7 +32,7 @@
PublicKey::fromDer(const Blob& keyDer)
{
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = keyDer.buf();
+ const uint8_t *derPointer = keyDer.buf();
RSA *publicKey = d2i_RSA_PUBKEY(NULL, &derPointer, keyDer.size());
if (!publicKey)
throw UnrecognizedKeyFormatException("Error decoding public key DER");
@@ -45,7 +45,7 @@
PublicKey::getDigest(DigestAlgorithm digestAlgorithm) const
{
if (digestAlgorithm == DIGEST_ALGORITHM_SHA256) {
- unsigned char digest[SHA256_DIGEST_LENGTH];
+ uint8_t digest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(keyDer_.buf(), keyDer_.size(), digest);
return Blob(digest, sizeof(digest));
diff --git a/ndn-cpp/security/identity/memory-private-key-storage.cpp b/ndn-cpp/security/identity/memory-private-key-storage.cpp
index 56054af..0fef285 100644
--- a/ndn-cpp/security/identity/memory-private-key-storage.cpp
+++ b/ndn-cpp/security/identity/memory-private-key-storage.cpp
@@ -19,7 +19,7 @@
}
void MemoryPrivateKeyStorage::setKeyPairForKeyName
- (const Name& keyName, unsigned char *publicKeyDer, size_t publicKeyDerLength, unsigned char *privateKeyDer,
+ (const Name& keyName, uint8_t *publicKeyDer, size_t publicKeyDerLength, uint8_t *privateKeyDer,
size_t privateKeyDerLength)
{
publicKeyStore_[keyName.toUri()] = PublicKey::fromDer(Blob(publicKeyDer, publicKeyDerLength));
@@ -44,15 +44,15 @@
}
Blob
-MemoryPrivateKeyStorage::sign(const unsigned char *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm)
+MemoryPrivateKeyStorage::sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm)
{
if (digestAlgorithm != DIGEST_ALGORITHM_SHA256)
return Blob();
- unsigned char digest[SHA256_DIGEST_LENGTH];
+ uint8_t digest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(data, dataLength, digest);
// TODO: use RSA_size to get the proper size of the signature buffer.
- unsigned char signatureBits[1000];
+ uint8_t signatureBits[1000];
unsigned int signatureBitsLength;
// Find the private key and sign.
@@ -66,7 +66,7 @@
}
Blob
-MemoryPrivateKeyStorage::decrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric)
+MemoryPrivateKeyStorage::decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric)
{
#if 1
throw std::runtime_error("MemoryPrivateKeyStorage::decrypt not implemented");
@@ -74,7 +74,7 @@
}
Blob
-MemoryPrivateKeyStorage::encrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric)
+MemoryPrivateKeyStorage::encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric)
{
#if 1
throw std::runtime_error("MemoryPrivateKeyStorage::encrypt not implemented");
@@ -101,10 +101,10 @@
return false;
}
-MemoryPrivateKeyStorage::RsaPrivateKey::RsaPrivateKey(unsigned char *keyDer, size_t keyDerLength)
+MemoryPrivateKeyStorage::RsaPrivateKey::RsaPrivateKey(uint8_t *keyDer, size_t keyDerLength)
{
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = keyDer;
+ const uint8_t *derPointer = keyDer;
privateKey_ = d2i_RSAPrivateKey(NULL, &derPointer, keyDerLength);
if (!privateKey_)
throw SecurityException("RsaPrivateKey constructor: Error decoding private key DER");
diff --git a/ndn-cpp/security/identity/memory-private-key-storage.hpp b/ndn-cpp/security/identity/memory-private-key-storage.hpp
index d97d2a8..b44f2ba 100644
--- a/ndn-cpp/security/identity/memory-private-key-storage.hpp
+++ b/ndn-cpp/security/identity/memory-private-key-storage.hpp
@@ -36,7 +36,7 @@
* @param privateKeyDerLength The length of privateKeyDer.
*/
void setKeyPairForKeyName
- (const Name& keyName, unsigned char *publicKeyDer, size_t publicKeyDerLength, unsigned char *privateKeyDer,
+ (const Name& keyName, uint8_t *publicKeyDer, size_t publicKeyDerLength, uint8_t *privateKeyDer,
size_t privateKeyDerLength);
/**
@@ -65,7 +65,7 @@
* @return The signature, or a null pointer if signing fails.
*/
virtual Blob
- sign(const unsigned char *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
+ sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
/**
* Decrypt data.
@@ -76,7 +76,7 @@
* @return The decrypted data.
*/
virtual Blob
- decrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric);
+ decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric);
/**
* Encrypt data.
@@ -87,7 +87,7 @@
* @return The encrypted data.
*/
virtual Blob
- encrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric);
+ encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric);
/**
* @brief Generate a symmetric key.
@@ -113,7 +113,7 @@
*/
class RsaPrivateKey {
public:
- RsaPrivateKey(unsigned char *keyDer, size_t keyDerLength);
+ RsaPrivateKey(uint8_t *keyDer, size_t keyDerLength);
~RsaPrivateKey();
diff --git a/ndn-cpp/security/identity/private-key-storage.hpp b/ndn-cpp/security/identity/private-key-storage.hpp
index 3b71d37..0e24eec 100644
--- a/ndn-cpp/security/identity/private-key-storage.hpp
+++ b/ndn-cpp/security/identity/private-key-storage.hpp
@@ -50,7 +50,7 @@
* @return The signature, or a null pointer if signing fails.
*/
virtual Blob
- sign(const unsigned char *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) = 0;
+ sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) = 0;
Blob
sign(const Blob& data, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256)
@@ -67,7 +67,7 @@
* @return The decrypted data.
*/
virtual Blob
- decrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric = false) = 0;
+ decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric = false) = 0;
Blob
decrypt(const Name& keyName, const Blob& data, bool isSymmetric = false)
@@ -84,7 +84,7 @@
* @return The encrypted data.
*/
virtual Blob
- encrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric = false) = 0;
+ encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric = false) = 0;
Blob
encrypt(const Name& keyName, const Blob& data, bool isSymmetric = false)
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 85df172..fdfc998 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -18,7 +18,7 @@
namespace ndn {
#if 1
-static unsigned char DEFAULT_PUBLIC_KEY_DER[] = {
+static uint8_t DEFAULT_PUBLIC_KEY_DER[] = {
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x7D, 0x30, 0xA7, 0xD8, 0x28, 0xAB, 0x1B, 0x84, 0x0B, 0x17,
0x54, 0x2D, 0xCA, 0xF6, 0x20, 0x7A, 0xFD, 0x22, 0x1E, 0x08, 0x6B, 0x2A, 0x60, 0xD1, 0x6C, 0xB7, 0xF5, 0x44, 0x48, 0xBA,
@@ -78,17 +78,17 @@
if (!data.getWireEncoding())
// Don't expect this to happen
throw SecurityException("The Data wireEncoding is null.");
- unsigned char signedPortionDigest[SHA256_DIGEST_LENGTH];
+ uint8_t signedPortionDigest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(data.getWireEncoding().signedBuf(), data.getWireEncoding().signedSize(), signedPortionDigest);
// Verify the signedPortionDigest.
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = DEFAULT_PUBLIC_KEY_DER;
+ const uint8_t *derPointer = DEFAULT_PUBLIC_KEY_DER;
RSA *publicKey = d2i_RSA_PUBKEY(NULL, &derPointer, sizeof(DEFAULT_PUBLIC_KEY_DER));
if (!publicKey)
throw UnrecognizedKeyFormatException("Error decoding public key in d2i_RSAPublicKey");
int success = RSA_verify
- (NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), (unsigned char *)signature->getSignature().buf(),
+ (NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), (uint8_t *)signature->getSignature().buf(),
signature->getSignature().size(), publicKey);
// Free the public key before checking for success.
RSA_free(publicKey);
diff --git a/ndn-cpp/sha256-with-rsa-signature.cpp b/ndn-cpp/sha256-with-rsa-signature.cpp
index c2c933f..5862faa 100644
--- a/ndn-cpp/sha256-with-rsa-signature.cpp
+++ b/ndn-cpp/sha256-with-rsa-signature.cpp
@@ -22,19 +22,19 @@
{
signatureStruct.digestAlgorithmLength = digestAlgorithm_.size();
if (digestAlgorithm_.size() > 0)
- signatureStruct.digestAlgorithm = (unsigned char *)digestAlgorithm_.buf();
+ signatureStruct.digestAlgorithm = (uint8_t *)digestAlgorithm_.buf();
else
signatureStruct.digestAlgorithm = 0;
signatureStruct.witnessLength = witness_.size();
if (witness_.size() > 0)
- signatureStruct.witness = (unsigned char *)witness_.buf();
+ signatureStruct.witness = (uint8_t *)witness_.buf();
else
signatureStruct.witness = 0;
signatureStruct.signatureLength = signature_.size();
if (signature_.size() > 0)
- signatureStruct.signature = (unsigned char *)signature_.buf();
+ signatureStruct.signature = (uint8_t *)signature_.buf();
else
signatureStruct.signature = 0;
diff --git a/ndn-cpp/sha256-with-rsa-signature.hpp b/ndn-cpp/sha256-with-rsa-signature.hpp
index 5bb3951..93bae74 100644
--- a/ndn-cpp/sha256-with-rsa-signature.hpp
+++ b/ndn-cpp/sha256-with-rsa-signature.hpp
@@ -62,28 +62,28 @@
getKeyLocator() { return keyLocator_; }
void
- setDigestAlgorithm(const std::vector<unsigned char>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
+ setDigestAlgorithm(const std::vector<uint8_t>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
void
- setDigestAlgorithm(const unsigned char *digestAlgorithm, unsigned int digestAlgorithmLength)
+ setDigestAlgorithm(const uint8_t *digestAlgorithm, unsigned int digestAlgorithmLength)
{
digestAlgorithm_ = Blob(digestAlgorithm, digestAlgorithmLength);
}
void
- setWitness(const std::vector<unsigned char>& witness) { witness_ = witness; }
+ setWitness(const std::vector<uint8_t>& witness) { witness_ = witness; }
void
- setWitness(const unsigned char *witness, unsigned int witnessLength)
+ setWitness(const uint8_t *witness, unsigned int witnessLength)
{
witness_ = Blob(witness, witnessLength);
}
void
- setSignature(const std::vector<unsigned char>& signature) { signature_ = signature; }
+ setSignature(const std::vector<uint8_t>& signature) { signature_ = signature; }
void
- setSignature(const unsigned char *signature, unsigned int signatureLength)
+ setSignature(const uint8_t *signature, unsigned int signatureLength)
{
signature_ = Blob(signature, signatureLength);
}
@@ -94,10 +94,10 @@
* @param signature A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
void
- setSignature(const ptr_lib::shared_ptr<std::vector<unsigned char> > &signature) { signature_ = signature; }
+ setSignature(const ptr_lib::shared_ptr<std::vector<uint8_t> > &signature) { signature_ = signature; }
void
- setSignature(const ptr_lib::shared_ptr<const std::vector<unsigned char> > &signature) { signature_ = signature; }
+ setSignature(const ptr_lib::shared_ptr<const std::vector<uint8_t> > &signature) { signature_ = signature; }
void
setPublisherPublicKeyDigest(const PublisherPublicKeyDigest& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
diff --git a/ndn-cpp/transport/tcp-transport.cpp b/ndn-cpp/transport/tcp-transport.cpp
index e454e4a..553c5c7 100644
--- a/ndn-cpp/transport/tcp-transport.cpp
+++ b/ndn-cpp/transport/tcp-transport.cpp
@@ -30,17 +30,17 @@
const unsigned int initialLength = 1000;
// Automatically cast elementReader_ to (struct ndn_ElementListener *)
ndn_BinaryXmlElementReader_initialize
- (&elementReader_, &elementListener, (unsigned char *)malloc(initialLength), initialLength, ndn_realloc);
+ (&elementReader_, &elementListener, (uint8_t *)malloc(initialLength), initialLength, ndn_realloc);
isConnected_ = true;
elementListener_ = &elementListener;
}
void
-TcpTransport::send(const unsigned char *data, unsigned int dataLength)
+TcpTransport::send(const uint8_t *data, unsigned int dataLength)
{
ndn_Error error;
- if ((error = ndn_TcpTransport_send(&transport_, (unsigned char *)data, dataLength)))
+ if ((error = ndn_TcpTransport_send(&transport_, (uint8_t *)data, dataLength)))
throw std::runtime_error(ndn_getErrorString(error));
}
@@ -54,7 +54,7 @@
if (!receiveIsReady)
return;
- unsigned char buffer[8000];
+ uint8_t buffer[8000];
unsigned int nBytes;
if ((error = ndn_TcpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes)))
throw std::runtime_error(ndn_getErrorString(error));
diff --git a/ndn-cpp/transport/tcp-transport.hpp b/ndn-cpp/transport/tcp-transport.hpp
index 1f8a573..d999df8 100644
--- a/ndn-cpp/transport/tcp-transport.hpp
+++ b/ndn-cpp/transport/tcp-transport.hpp
@@ -72,7 +72,7 @@
* @param data A pointer to the buffer of data to send.
* @param dataLength The number of bytes in data.
*/
- virtual void send(const unsigned char *data, unsigned int dataLength);
+ virtual void send(const uint8_t *data, unsigned int dataLength);
/**
* Process any data to receive. For each element received, call elementListener.onReceivedElement.
diff --git a/ndn-cpp/transport/transport.cpp b/ndn-cpp/transport/transport.cpp
index ae532db..4b8aca1 100644
--- a/ndn-cpp/transport/transport.cpp
+++ b/ndn-cpp/transport/transport.cpp
@@ -22,7 +22,7 @@
}
void
-Transport::send(const unsigned char *data, unsigned int dataLength)
+Transport::send(const uint8_t *data, unsigned int dataLength)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/transport/transport.hpp b/ndn-cpp/transport/transport.hpp
index 2f71096..ed3e240 100644
--- a/ndn-cpp/transport/transport.hpp
+++ b/ndn-cpp/transport/transport.hpp
@@ -37,10 +37,10 @@
* @param dataLength The number of bytes in data.
*/
virtual void
- send(const unsigned char *data, unsigned int dataLength);
+ send(const uint8_t *data, unsigned int dataLength);
void
- send(const std::vector<unsigned char>& data)
+ send(const std::vector<uint8_t>& data)
{
send(&data[0], data.size());
}
diff --git a/ndn-cpp/transport/udp-transport.cpp b/ndn-cpp/transport/udp-transport.cpp
index d5e48cb..0b2f397 100644
--- a/ndn-cpp/transport/udp-transport.cpp
+++ b/ndn-cpp/transport/udp-transport.cpp
@@ -30,17 +30,17 @@
const unsigned int initialLength = 1000;
// Automatically cast elementReader_ to (struct ndn_ElementListener *)
ndn_BinaryXmlElementReader_initialize
- (&elementReader_, &elementListener, (unsigned char *)malloc(initialLength), initialLength, ndn_realloc);
+ (&elementReader_, &elementListener, (uint8_t *)malloc(initialLength), initialLength, ndn_realloc);
isConnected_ = true;
elementListener_ = &elementListener;
}
void
-UdpTransport::send(const unsigned char *data, unsigned int dataLength)
+UdpTransport::send(const uint8_t *data, unsigned int dataLength)
{
ndn_Error error;
- if ((error = ndn_UdpTransport_send(&transport_, (unsigned char *)data, dataLength)))
+ if ((error = ndn_UdpTransport_send(&transport_, (uint8_t *)data, dataLength)))
throw std::runtime_error(ndn_getErrorString(error));
}
@@ -54,7 +54,7 @@
if (!receiveIsReady)
return;
- unsigned char buffer[8000];
+ uint8_t buffer[8000];
unsigned int nBytes;
if ((error = ndn_UdpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes)))
throw std::runtime_error(ndn_getErrorString(error));
diff --git a/ndn-cpp/transport/udp-transport.hpp b/ndn-cpp/transport/udp-transport.hpp
index 3ea1703..b2374df 100644
--- a/ndn-cpp/transport/udp-transport.hpp
+++ b/ndn-cpp/transport/udp-transport.hpp
@@ -74,7 +74,7 @@
* @param dataLength The number of bytes in data.
*/
virtual void
- send(const unsigned char *data, unsigned int dataLength);
+ send(const uint8_t *data, unsigned int dataLength);
/**
* Process any data to receive. For each element received, call elementListener.onReceivedElement.
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)
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 67e2e89..744ac06 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -24,7 +24,7 @@
using namespace func_lib::placeholders;
#endif
-static unsigned char DEFAULT_PUBLIC_KEY_DER[] = {
+static uint8_t DEFAULT_PUBLIC_KEY_DER[] = {
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x7D, 0x30, 0xA7, 0xD8, 0x28, 0xAB, 0x1B, 0x84, 0x0B, 0x17,
0x54, 0x2D, 0xCA, 0xF6, 0x20, 0x7A, 0xFD, 0x22, 0x1E, 0x08, 0x6B, 0x2A, 0x60, 0xD1, 0x6C, 0xB7, 0xF5, 0x44, 0x48, 0xBA,
@@ -36,7 +36,7 @@
0x00, 01
};
-static unsigned char DEFAULT_PRIVATE_KEY_DER[] = {
+static uint8_t DEFAULT_PRIVATE_KEY_DER[] = {
0x30, 0x82, 0x02, 0x5d, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xe1, 0x7d, 0x30, 0xa7, 0xd8, 0x28, 0xab, 0x1b, 0x84,
0x0b, 0x17, 0x54, 0x2d, 0xca, 0xf6, 0x20, 0x7a, 0xfd, 0x22, 0x1e, 0x08, 0x6b, 0x2a, 0x60, 0xd1, 0x6c, 0xb7, 0xf5, 0x44,
0x48, 0xba, 0x9f, 0x3f, 0x08, 0xbc, 0xd0, 0x99, 0xdb, 0x21, 0xdd, 0x16, 0x2a, 0x77, 0x9e, 0x61, 0xaa, 0x89, 0xee, 0xe5,
@@ -70,7 +70,7 @@
0x30, 0x18, 0xeb, 0x90, 0xfb, 0x17, 0xd3, 0xce, 0xb5
};
-unsigned char Data1[] = {
+uint8_t Data1[] = {
0x04, 0x82, // NDN Data
0x02, 0xaa, // Signature
0x03, 0xb2, // SignatureBits
@@ -233,7 +233,7 @@
dumpData(*reDecodedData);
shared_ptr<Data> freshData(new Data(Name("/ndn/abc")));
- const unsigned char freshContent[] = "SUCCESS!";
+ const uint8_t freshContent[] = "SUCCESS!";
freshData->setContent(freshContent, sizeof(freshContent) - 1);
freshData->getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
diff --git a/tests/test-encode-decode-forwarding-entry.cpp b/tests/test-encode-decode-forwarding-entry.cpp
index a9967c4..fe34c04 100644
--- a/tests/test-encode-decode-forwarding-entry.cpp
+++ b/tests/test-encode-decode-forwarding-entry.cpp
@@ -15,7 +15,7 @@
using namespace std;
using namespace ndn;
-unsigned char Interest1[] = {
+uint8_t Interest1[] = {
0x01, 0xd2, 0xf2, 0xfa, 0xa5, 0x6e, 0x64, 0x6e, 0x78, 0x00, 0xfa, 0x02, 0x85, 0xe0, 0xa0, 0x1e, 0x09, 0x39, 0x68,
0xf9, 0x74, 0x0c, 0xe7, 0xf4, 0x36, 0x1b, 0xab, 0xf5, 0xbb, 0x05, 0xa4, 0xe5, 0x5a, 0xac, 0xa5, 0xe5, 0x8f, 0x73,
0xed, 0xde, 0xb8, 0xe0, 0x13, 0xaa, 0x8f, 0x00, 0xfa, 0xcd, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x72, 0x65, 0x67,
@@ -58,7 +58,7 @@
1
};
-static inline string toString(const vector<unsigned char>& v)
+static inline string toString(const vector<uint8_t>& v)
{
if (!&v)
return "";
diff --git a/tests/test-encode-decode-interest.cpp b/tests/test-encode-decode-interest.cpp
index ecabda5..9281569 100644
--- a/tests/test-encode-decode-interest.cpp
+++ b/tests/test-encode-decode-interest.cpp
@@ -12,7 +12,7 @@
using namespace std;
using namespace ndn;
-unsigned char Interest1[] = {
+uint8_t Interest1[] = {
0x01, 0xd2,
0xf2, 0xfa, 0x9d, 0x6e, 0x64, 0x6e, 0x00, 0xfa, 0x9d, 0x61, 0x62, 0x63, 0x00, 0x00,
0x05, 0x9a, 0x9e, 0x31, 0x32, 0x33, 0x00,
diff --git a/tests/test-publish-async.cpp b/tests/test-publish-async.cpp
index a140e43..72dec4b 100644
--- a/tests/test-publish-async.cpp
+++ b/tests/test-publish-async.cpp
@@ -18,7 +18,7 @@
using namespace ptr_lib;
using namespace func_lib;
-static unsigned char DEFAULT_PUBLIC_KEY_DER[] = {
+static uint8_t DEFAULT_PUBLIC_KEY_DER[] = {
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x7D, 0x30, 0xA7, 0xD8, 0x28, 0xAB, 0x1B, 0x84, 0x0B, 0x17,
0x54, 0x2D, 0xCA, 0xF6, 0x20, 0x7A, 0xFD, 0x22, 0x1E, 0x08, 0x6B, 0x2A, 0x60, 0xD1, 0x6C, 0xB7, 0xF5, 0x44, 0x48, 0xBA,
@@ -30,7 +30,7 @@
0x00, 01
};
-static unsigned char DEFAULT_PRIVATE_KEY_DER[] = {
+static uint8_t DEFAULT_PRIVATE_KEY_DER[] = {
0x30, 0x82, 0x02, 0x5d, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xe1, 0x7d, 0x30, 0xa7, 0xd8, 0x28, 0xab, 0x1b, 0x84,
0x0b, 0x17, 0x54, 0x2d, 0xca, 0xf6, 0x20, 0x7a, 0xfd, 0x22, 0x1e, 0x08, 0x6b, 0x2a, 0x60, 0xd1, 0x6c, 0xb7, 0xf5, 0x44,
0x48, 0xba, 0x9f, 0x3f, 0x08, 0xbc, 0xd0, 0x99, 0xdb, 0x21, 0xdd, 0x16, 0x2a, 0x77, 0x9e, 0x61, 0xaa, 0x89, 0xee, 0xe5,
@@ -80,7 +80,7 @@
// Make and sign a Data packet.
Data data(interest->getName());
string content(string("Echo ") + interest->getName().toUri());
- data.setContent((const unsigned char *)&content[0], content.size());
+ data.setContent((const uint8_t *)&content[0], content.size());
data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
keyChain_.signData(data, certificateName_);
Blob encodedData = data.wireEncode();