globa: Change unsigned int to size_t where it is the size of a byte array or an index/offset into it.
diff --git a/ndn-cpp/c/encoding/binary-xml-data.c b/ndn-cpp/c/encoding/binary-xml-data.c
index 98dde11..25cf16a 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -77,7 +77,7 @@
   if (!(metaInfo->type < 0 || metaInfo->type == ndn_ContentType_DATA)) {
     // Not the default of DATA, so we need to encode the type.
     uint8_t *typeBytes;
-    unsigned int typeBytesLength = 3;
+    size_t typeBytesLength = 3;
     if (metaInfo->type == ndn_ContentType_ENCR)
       typeBytes = "\x10\xD0\x91";
     else if (metaInfo->type == ndn_ContentType_GONE)
@@ -128,7 +128,7 @@
     return error;
   
   uint8_t *typeBytes;
-  unsigned int typeBytesLength;
+  size_t typeBytesLength;
   if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
       (decoder, ndn_BinaryXml_DTag_Type, 0, &typeBytes, &typeBytesLength)))
     return error;
@@ -173,7 +173,7 @@
 }
 
 ndn_Error ndn_encodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder)
+  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ContentObject)))
@@ -203,7 +203,7 @@
 }
 
 ndn_Error ndn_decodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder)
+  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ContentObject)))
diff --git a/ndn-cpp/c/encoding/binary-xml-data.h b/ndn-cpp/c/encoding/binary-xml-data.h
index caf9e35..f5865ba 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.h
+++ b/ndn-cpp/c/encoding/binary-xml-data.h
@@ -27,7 +27,7 @@
  * @return 0 for success, else an error code.
  */
 ndn_Error ndn_encodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder);
+  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder);
 
 /**
  * Decode the data packet as binary XML and set the fields in the data object.
@@ -40,7 +40,7 @@
  * @return 0 for success, else an error code.
  */
 ndn_Error ndn_decodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder);
+  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder);
 
 #ifdef __cplusplus
 }
diff --git a/ndn-cpp/c/encoding/binary-xml-decoder.c b/ndn-cpp/c/encoding/binary-xml-decoder.c
index 4be2450..6cbb8ac 100644
--- a/ndn-cpp/c/encoding/binary-xml-decoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-decoder.c
@@ -34,11 +34,11 @@
  * @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(uint8_t *value, unsigned int valueLength, unsigned int *resultOut)
+static ndn_Error parseUnsignedDecimalInt(uint8_t *value, size_t valueLength, unsigned int *resultOut)
 {
   unsigned int result = 0;
   
-  unsigned int i;
+  size_t i;
   for (i = 0; i < valueLength; ++i) {
     uint8_t digit = value[i];
     if (!(digit >= '0' && digit <= '9'))
@@ -125,7 +125,7 @@
 
   unsigned int type;
   unsigned int value;
-  unsigned int saveOffset = self->offset;
+  size_t saveOffset = self->offset;
   ndn_Error error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value);
   // Restore offset.
   self->offset = saveOffset;
@@ -140,7 +140,7 @@
 }
 
 ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength)
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, size_t *valueLength)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag)))
@@ -160,10 +160,12 @@
   }
   
   unsigned int itemType;
-  if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, valueLength)))
+  unsigned int uintValueLength;
+  if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, &uintValueLength)))
     return error;
   // Ignore itemType.
   *value = self->input + self->offset;
+  *valueLength = (size_t)uintValueLength;
   self->offset += *valueLength;
   
   if ((error = ndn_BinaryXmlDecoder_readElementClose(self)))
@@ -173,7 +175,7 @@
 }
 
 ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength)
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, size_t *valueLength)
 {
   ndn_Error error;
   int gotExpectedTag;
@@ -192,18 +194,20 @@
 }
 
 ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength)
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, size_t *valueLength)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag)))
     return error;
     
   unsigned int itemType;
-  if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, valueLength)))
+  unsigned int uintValueLength;
+  if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, &uintValueLength)))
     return error;
   if (itemType != ndn_BinaryXml_UDATA)
     return NDN_ERROR_item_is_not_UDATA;
   *value = self->input + self->offset;
+  *valueLength = uintValueLength;
   self->offset += *valueLength;
   
   if ((error = ndn_BinaryXmlDecoder_readElementClose(self)))
@@ -213,7 +217,7 @@
 }
 
 ndn_Error ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength)
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, size_t *valueLength)
 {
   ndn_Error error;
   int gotExpectedTag;
@@ -235,7 +239,7 @@
   (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned int *value)
 {
   uint8_t *udataValue;
-  unsigned int udataValueLength;
+  size_t udataValueLength;
   ndn_Error error;
   if ((error = ndn_BinaryXmlDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength)))
     return error;
@@ -272,7 +276,7 @@
 {
   ndn_Error error;
   uint8_t *bytes;
-  unsigned int bytesLength;
+  size_t bytesLength;
   if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes, &bytesLength)))
     return error;
     
@@ -299,10 +303,10 @@
   return NDN_ERROR_success;
 }
 
-double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, unsigned int bytesLength) 
+double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, size_t bytesLength) 
 {
   double result = 0.0;
-  unsigned int i;
+  size_t i;
   for (i = 0; i < bytesLength; ++i) {
     result *= 256.0;
     result += (double)bytes[i];
diff --git a/ndn-cpp/c/encoding/binary-xml-decoder.h b/ndn-cpp/c/encoding/binary-xml-decoder.h
index dfa9b97..a520a0f 100644
--- a/ndn-cpp/c/encoding/binary-xml-decoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-decoder.h
@@ -16,11 +16,11 @@
 
 struct ndn_BinaryXmlDecoder {
   uint8_t *input;
-  unsigned int inputLength;
-  unsigned int offset;
+  size_t inputLength;
+  size_t offset;
 };
 
-static inline void ndn_BinaryXmlDecoder_initialize(struct ndn_BinaryXmlDecoder *self, uint8_t *input, unsigned int inputLength) 
+static inline void ndn_BinaryXmlDecoder_initialize(struct ndn_BinaryXmlDecoder *self, uint8_t *input, size_t inputLength) 
 {
   self->input = input;
   self->inputLength = inputLength;
@@ -78,7 +78,7 @@
  * and the binary data is absent
  */
 ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, unsigned int *valueLength);
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, size_t *valueLength);
 
 /**
  * Peek at the next element and if it is the expectedTag, call ndn_BinaryXmlDecoder_readBinaryDTagElement.
@@ -93,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, uint8_t **value, unsigned int *valueLength);
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, uint8_t **value, size_t *valueLength);
 
 /**
  * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
@@ -106,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, uint8_t **value, unsigned int *valueLength);
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, size_t *valueLength);
 
 /**
  * Peek at the next element and if it is the expectedTag, call ndn_BinaryXmlDecoder_readUDataDTagElement.
@@ -120,7 +120,7 @@
  * @return 0 for success, else an error code.
  */
 ndn_Error ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, unsigned int *valueLength);
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, uint8_t **value, size_t *valueLength);
 
 /**
  * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
@@ -177,14 +177,14 @@
  * @param bytesLength the length of bytes
  * @return the result
  */
-double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, unsigned int bytesLength); 
+double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, size_t bytesLength); 
 
 /**
  * Set the offset into the input, used for the next read.
  * @param self pointer to the ndn_BinaryXmlDecoder struct
  * @param offset the new offset
  */
-static inline void ndn_BinaryXmlDecoder_seek(struct ndn_BinaryXmlDecoder *self, unsigned int offset) 
+static inline void ndn_BinaryXmlDecoder_seek(struct ndn_BinaryXmlDecoder *self, size_t offset) 
 {
   self->offset = offset;
 }
diff --git a/ndn-cpp/c/encoding/binary-xml-element-reader.c b/ndn-cpp/c/encoding/binary-xml-element-reader.c
index 51f635f..350a978 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, uint8_t *data, unsigned int dataLength)
+  (struct ndn_BinaryXmlElementReader *self, uint8_t *data, size_t dataLength)
 {
   // Process multiple objects in the data.
   while(1) {
diff --git a/ndn-cpp/c/encoding/binary-xml-element-reader.h b/ndn-cpp/c/encoding/binary-xml-element-reader.h
index cb962cd..c2b3777 100644
--- a/ndn-cpp/c/encoding/binary-xml-element-reader.h
+++ b/ndn-cpp/c/encoding/binary-xml-element-reader.h
@@ -19,7 +19,7 @@
  * will be passed to onReceivedElement.
  */
 struct ndn_ElementListener {
-  void (*onReceivedElement)(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength); /**< see ndn_ElementListener_initialize */
+  void (*onReceivedElement)(struct ndn_ElementListener *self, uint8_t *element, size_t 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, uint8_t *element, unsigned int elementLength))
+  (struct ndn_ElementListener *self, void (*onReceivedElement)(struct ndn_ElementListener *self, uint8_t *element, size_t elementLength))
 {
   self->onReceivedElement = onReceivedElement;
 }
@@ -45,7 +45,7 @@
   struct ndn_BinaryXmlStructureDecoder structureDecoder;
   int usePartialData;
   struct ndn_DynamicUInt8Array partialData;
-  unsigned int partialDataLength;
+  size_t partialDataLength;
 };
 
 /**
@@ -58,7 +58,7 @@
  */
 static inline void ndn_BinaryXmlElementReader_initialize
   (struct ndn_BinaryXmlElementReader *self, struct ndn_ElementListener *elementListener,
-   uint8_t *buffer, unsigned int bufferLength, uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, unsigned int))
+   uint8_t *buffer, size_t bufferLength, uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, size_t))
 {
   self->elementListener = elementListener;
   ndn_BinaryXmlStructureDecoder_initialize(&self->structureDecoder);
@@ -75,7 +75,7 @@
  * @return 0 for success, else an error code
  */
 ndn_Error ndn_BinaryXmlElementReader_onReceivedData
-  (struct ndn_BinaryXmlElementReader *self, uint8_t *data, unsigned int dataLength);
+  (struct ndn_BinaryXmlElementReader *self, uint8_t *data, size_t dataLength);
 
 #ifdef __cplusplus
 }
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.c b/ndn-cpp/c/encoding/binary-xml-encoder.c
index fce9b2d..652de3e 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.c
@@ -24,7 +24,7 @@
  * @param arrayLength the length of the array
  * @return 0 for success, else an error code
  */
-static ndn_Error writeArray(struct ndn_BinaryXmlEncoder *self, uint8_t *array, unsigned int arrayLength)
+static ndn_Error writeArray(struct ndn_BinaryXmlEncoder *self, uint8_t *array, size_t arrayLength)
 {
   ndn_Error error;
   if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + arrayLength)))
@@ -39,7 +39,7 @@
 /**
  * Return the number of bytes to encode a header of value x.
  */
-static unsigned int getNHeaderEncodingBytes(unsigned int x) 
+static size_t getNHeaderEncodingBytes(unsigned int x) 
 {
   // Do a quick check for pre-compiled results.
   if (x <= ENCODING_LIMIT_1_BYTE) 
@@ -49,7 +49,7 @@
   if (x <= ENCODING_LIMIT_3_BYTES) 
     return 3;
   
-  unsigned int nBytes = 1;
+  size_t nBytes = 1;
   
   // Last byte gives you TT_VALUE_BITS.
   // Remainder each gives you REGULAR_VALUE_BITS.
@@ -67,7 +67,7 @@
  * @param array
  * @param length
  */
-static void reverse(uint8_t *array, unsigned int length) 
+static void reverse(uint8_t *array, size_t length) 
 {
   if (length == 0)
     return;
@@ -121,10 +121,10 @@
  * @return 0 for success, else an error code
  */
 static ndn_Error reverseBufferAndInsertHeader
-  (struct ndn_BinaryXmlEncoder *self, unsigned int startOffset, unsigned int type)
+  (struct ndn_BinaryXmlEncoder *self, size_t startOffset, unsigned int type)
 {
-  unsigned int nBufferBytes = self->offset - startOffset;
-  unsigned int nHeaderBytes = getNHeaderEncodingBytes(nBufferBytes);
+  size_t nBufferBytes = self->offset - startOffset;
+  size_t nHeaderBytes = getNHeaderEncodingBytes(nBufferBytes);
   ndn_Error error;
   if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + nHeaderBytes)))
     return error;
@@ -177,7 +177,7 @@
     return NDN_ERROR_header_type_is_out_of_range;
   
   // Encode backwards. Calculate how many bytes we need.
-  unsigned int nEncodingBytes = getNHeaderEncodingBytes(value);
+  size_t nEncodingBytes = getNHeaderEncodingBytes(value);
   ndn_Error error;
   if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + nEncodingBytes)))
     return error;
@@ -190,7 +190,7 @@
   value >>= ndn_BinaryXml_TT_VALUE_BITS;
   
   // Rest of value goes into preceding bytes, 7 bits per byte. (Zero top bit is "more" flag.)
-  unsigned int i = self->offset + nEncodingBytes - 2;
+  size_t i = self->offset + nEncodingBytes - 2;
   while (value != 0 && i >= self->offset) {
     self->output->array[i] = (value & ndn_BinaryXml_REGULAR_VALUE_MASK);
     value >>= ndn_BinaryXml_REGULAR_VALUE_BITS;
@@ -217,7 +217,7 @@
   return NDN_ERROR_success;
 }
 
-ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, uint8_t *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, size_t valueLength)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
@@ -274,7 +274,7 @@
 ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(struct ndn_BinaryXmlEncoder *self, unsigned int value)
 {
   // First write the decimal int (to find out how many bytes it is), then shift it forward to make room for the header.
-  unsigned int startOffset = self->offset;
+  size_t startOffset = self->offset;
   
   ndn_Error error;
   if ((error = encodeReversedUnsignedDecimalInt(self, value)))
@@ -307,7 +307,7 @@
   splitAbsDouble(value, &hi32, &lo32);
   
   // First encode the big endian backwards, then reverseBufferAndInsertHeader will reverse it.
-  unsigned int startOffset = self->offset;
+  size_t startOffset = self->offset;
   
   ndn_Error error;
   while (lo32 != 0) {
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.h b/ndn-cpp/c/encoding/binary-xml-encoder.h
index 3cf4a89..c457185 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.h
@@ -20,7 +20,7 @@
  */
 struct ndn_BinaryXmlEncoder {
   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 */
+  size_t offset;                        /**< the offset into output.array for the next encoding */
 };
 
 /**
@@ -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, uint8_t *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength)
+  (struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, size_t 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, uint8_t *value, unsigned int valueLength)
+  (struct ndn_BinaryXmlEncoder *self, unsigned int tag, uint8_t *value, size_t valueLength)
 {
   if (value && valueLength > 0)
     return ndn_BinaryXmlEncoder_writeUDataDTagElement(self, tag, value, valueLength);
@@ -166,7 +166,7 @@
 static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, int value)
 {
   if (value >= 0)
-    return ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement(self, tag, (unsigned int)value);
+    return ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement(self, tag, (size_t)value);
   else
     return NDN_ERROR_success;
 }
diff --git a/ndn-cpp/c/encoding/binary-xml-interest.c b/ndn-cpp/c/encoding/binary-xml-interest.c
index ee20f05..a43ce3b 100644
--- a/ndn-cpp/c/encoding/binary-xml-interest.c
+++ b/ndn-cpp/c/encoding/binary-xml-interest.c
@@ -21,7 +21,7 @@
     return error;
   
   // TODO: Do we want to order the components (except for ANY)?
-  unsigned int i;
+  size_t i;
   for (i = 0; i < exclude->nEntries; ++i) {
     struct ndn_ExcludeEntry *entry = &exclude->entries[i];
     
@@ -61,7 +61,7 @@
     if (gotExpectedTag) {
       // Component
       uint8_t *component;
-      unsigned int componentLen;
+      size_t componentLen;
       if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component, &componentLen)))
         return error;
     
@@ -97,7 +97,7 @@
     if (gotExpectedTag) {
       // Skip the Bloom and treat it as Any.
       uint8_t *value;
-      unsigned int valueLen;
+      size_t 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 f36e0ef..00f5858 100644
--- a/ndn-cpp/c/encoding/binary-xml-name.c
+++ b/ndn-cpp/c/encoding/binary-xml-name.c
@@ -15,7 +15,7 @@
   if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Name)))
     return error;
   
-  unsigned int i;
+  size_t i;
   for (i = 0; i < name->nComponents; ++i) {
     if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
         (encoder, ndn_BinaryXml_DTag_Component, name->components[i].value, name->components[i].valueLength)))
@@ -45,7 +45,7 @@
       break;
     
     uint8_t *component;
-    unsigned int componentLen;
+    size_t 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 603d07d..a8e2f09 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, uint8_t *input, unsigned int inputLength) 
+  (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, size_t inputLength) 
 {
   if (self->gotElementEnd)
     // Someone is calling when we already got the end.
@@ -64,14 +64,14 @@
         continue;
       }
         
-      unsigned int startingHeaderLength = self->headerLength;
+      size_t startingHeaderLength = self->headerLength;
       while (1) {
         if (self->offset >= inputLength) {
           // We can't get all of the header bytes from this input. Save in headerBuffer.
           if (self->headerLength > sizeof(self->headerBuffer))
             return NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer;
           self->useHeaderBuffer = 1;
-          unsigned int nNewBytes = self->headerLength - startingHeaderLength;
+          size_t nNewBytes = self->headerLength - startingHeaderLength;
           ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
             
           return NDN_ERROR_success;
@@ -89,7 +89,7 @@
         // Copy the remaining bytes into headerBuffer.
         if (self->headerLength > sizeof(self->headerBuffer))
           return NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer;
-        unsigned int nNewBytes = self->headerLength - startingHeaderLength;
+        size_t nNewBytes = self->headerLength - startingHeaderLength;
         ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
 
         // Use a local decoder just for the headerBuffer.
@@ -132,7 +132,7 @@
         return NDN_ERROR_findElementEnd_unrecognized_header_type;
     }  
     else if (self->state == ndn_BinaryXmlStructureDecoder_READ_BYTES) {
-      unsigned int nRemainingBytes = inputLength - self->offset;
+      size_t nRemainingBytes = inputLength - self->offset;
       if (nRemainingBytes < self->nBytesToRead) {
         // Need more.
         self->offset += nRemainingBytes;
diff --git a/ndn-cpp/c/encoding/binary-xml-structure-decoder.h b/ndn-cpp/c/encoding/binary-xml-structure-decoder.h
index f8bf5d0..63420d2 100644
--- a/ndn-cpp/c/encoding/binary-xml-structure-decoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-structure-decoder.h
@@ -16,10 +16,10 @@
 
 struct ndn_BinaryXmlStructureDecoder {
   int gotElementEnd; /**< boolean */
-  unsigned int offset;
+  size_t offset;
   int level;
   int state;
-  unsigned int headerLength;
+  size_t headerLength;
   int useHeaderBuffer; /**< boolean */
   // 10 bytes is enough to hold an encoded header with a type and a 64 bit value.
   uint8_t headerBuffer[10];
@@ -44,14 +44,14 @@
  * @return 0 for success, else an error code
  */
 ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
-  (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, unsigned int inputLength);
+  (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, size_t inputLength);
 
 /**
  * Set the offset into the input, used for the next read.
  * @param self pointer to the ndn_BinaryXmlStructureDecoder struct
  * @param offset the new offset
  */
-static inline void ndn_BinaryXmlStructureDecoder_seek(struct ndn_BinaryXmlStructureDecoder *self, unsigned int offset) 
+static inline void ndn_BinaryXmlStructureDecoder_seek(struct ndn_BinaryXmlStructureDecoder *self, size_t offset) 
 {
   self->offset = offset;
 }