global: Rename unsigned char to uint8, DynamicUCharArray to DynamicUInt8Array and DynamicUCharVector to DynamicUInt8Vector.
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.