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/data.h b/ndn-cpp/c/data.h
index 81489f5..6340c8c 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -21,11 +21,11 @@
 struct ndn_Signature {
   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 */
+  size_t digestAlgorithmLength;  /**< length of digestAlgorithm.  0 for none */
   uint8_t *witness;              /**< pointer to pre-allocated buffer.  0 for none. */
-  unsigned int witnessLength;          /**< length of witness.  0 for none */
+  size_t witnessLength;          /**< length of witness.  0 for none */
   uint8_t *signature;
-  unsigned int signatureLength;
+  size_t signatureLength;
   struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
   struct ndn_KeyLocator keyLocator;
 };
@@ -36,7 +36,7 @@
  * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the keyLocator.
  * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
-static inline void ndn_Signature_initialize(struct ndn_Signature *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
+static inline void ndn_Signature_initialize(struct ndn_Signature *self, struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) {
   self->digestAlgorithm = 0;
   self->digestAlgorithmLength = 0;
   self->witness = 0;
@@ -82,7 +82,7 @@
   struct ndn_Name name;
   struct ndn_MetaInfo metaInfo;
   uint8_t *content;     /**< pointer to the content */
-  unsigned int contentLength; /**< length of content */
+  size_t contentLength; /**< length of content */
 };
 
 /**
@@ -95,8 +95,8 @@
  * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
 static inline void ndn_Data_initialize
-  (struct ndn_Data *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents, 
-   struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) 
+  (struct ndn_Data *self, struct ndn_NameComponent *nameComponents, size_t maxNameComponents, 
+   struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) 
 {
   ndn_Signature_initialize(&self->signature, keyNameComponents, maxKeyNameComponents);
   ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
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;
 }
diff --git a/ndn-cpp/c/forwarding-entry.h b/ndn-cpp/c/forwarding-entry.h
index 8a77e2f..a57429d 100644
--- a/ndn-cpp/c/forwarding-entry.h
+++ b/ndn-cpp/c/forwarding-entry.h
@@ -20,7 +20,7 @@
  */
 struct ndn_ForwardingEntry {
   uint8_t *action;     /**< pointer to pre-allocated buffer.  0 for none. */
-  unsigned int actionLength; /**< length of action.  0 for none. */
+  size_t actionLength; /**< length of action.  0 for none. */
   struct ndn_Name prefix;
   struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
   int faceId;               /**< -1 for none. */
@@ -36,7 +36,7 @@
  * @param maxPrefixNameComponents the number of elements in the allocated prefixNameComponents array
  */
 static inline void ndn_ForwardingEntry_initialize
-  (struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, unsigned int maxPrefixNameComponents) 
+  (struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, size_t maxPrefixNameComponents) 
 {
   self->action = 0;
   self->actionLength = 0;
diff --git a/ndn-cpp/c/interest.c b/ndn-cpp/c/interest.c
index 78bd9b8..0e32368 100644
--- a/ndn-cpp/c/interest.c
+++ b/ndn-cpp/c/interest.c
@@ -20,7 +20,7 @@
 
 int ndn_Exclude_matches(struct ndn_Exclude *self, struct ndn_NameComponent *component)
 {
-  unsigned int i;
+  size_t i;
   for (i = 0; i < self->nEntries; ++i) {
     if (self->entries[i].type == ndn_Exclude_ANY) {
       struct ndn_ExcludeEntry *lowerBound = 0;
@@ -28,7 +28,7 @@
         lowerBound = self->entries + (i - 1);
       
       // Find the upper bound, possibly skipping over multiple ANY in a row.
-      unsigned int iUpperBound;
+      size_t iUpperBound;
       struct ndn_ExcludeEntry *upperBound = 0;
       for (iUpperBound = i + 1; iUpperBound < self->nEntries; ++iUpperBound) {
         if (self->entries[iUpperBound].type == ndn_Exclude_COMPONENT) {
diff --git a/ndn-cpp/c/interest.h b/ndn-cpp/c/interest.h
index ad1b700..af067a3 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, uint8_t *component, unsigned int componentLength) 
+static inline void ndn_ExcludeEntry_initialize(struct ndn_ExcludeEntry *self, ndn_ExcludeType type, uint8_t *component, size_t componentLength) 
 {
   self->type = type;
   ndn_NameComponent_initialize(&self->component, component, componentLength);
@@ -45,8 +45,8 @@
  */
 struct ndn_Exclude {
   struct ndn_ExcludeEntry *entries;  /**< pointer to the array of entries. */
-  unsigned int maxEntries;           /**< the number of elements in the allocated entries array */
-  unsigned int nEntries;             /**< the number of entries in the exclude, 0 for no exclude */
+  size_t maxEntries;                 /**< the number of elements in the allocated entries array */
+  size_t nEntries;                   /**< the number of entries in the exclude, 0 for no exclude */
 };
 /**
  * Initialize an ndn_Exclude struct with the entries array.
@@ -54,7 +54,7 @@
  * @param entries the pre-allocated array of ndn_ExcludeEntry
  * @param maxEntries the number of elements in the allocated entries array
  */
-static inline void ndn_Exclude_initialize(struct ndn_Exclude *self, struct ndn_ExcludeEntry *entries, unsigned int maxEntries) 
+static inline void ndn_Exclude_initialize(struct ndn_Exclude *self, struct ndn_ExcludeEntry *entries, size_t maxEntries) 
 {
   self->entries = entries;
   self->maxEntries = maxEntries;
@@ -102,8 +102,8 @@
   int answerOriginKind;     /**< -1 for none */
   int scope;                /**< -1 for none */
   double interestLifetimeMilliseconds; /**< milliseconds. -1.0 for none */
-  uint8_t *nonce;     /**< pointer to pre-allocated buffer.  0 for none */
-  unsigned int nonceLength; /**< length of nonce.  0 for none */
+  uint8_t *nonce;           /**< pointer to pre-allocated buffer.  0 for none */
+  size_t nonceLength;       /**< length of nonce.  0 for none */
 };
 
 /**
@@ -116,8 +116,8 @@
  * @param maxExcludeEntries the number of elements in the allocated excludeEntries array
  */
 static inline void ndn_Interest_initialize
-  (struct ndn_Interest *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents,
-   struct ndn_ExcludeEntry *excludeEntries, unsigned int maxExcludeEntries) 
+  (struct ndn_Interest *self, struct ndn_NameComponent *nameComponents, size_t maxNameComponents,
+   struct ndn_ExcludeEntry *excludeEntries, size_t maxExcludeEntries) 
 {
   ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
   self->minSuffixComponents = -1;
diff --git a/ndn-cpp/c/key.h b/ndn-cpp/c/key.h
index 2069789..814c200 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 */
-  uint8_t *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. 
@@ -39,7 +39,7 @@
     *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST, the publisher issuer key digest. 
     *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST, the publisher issuer certificate digest. 
     */
-  unsigned int keyDataLength;  /**< The length of keyData. */
+  size_t keyDataLength;        /**< The length of keyData. */
   struct ndn_Name keyName;     /**< The key name (only used if type is ndn_KeyLocatorType_KEYNAME.) */
   ndn_KeyNameType keyNameType; /**< The type of data for keyName, -1 for none. (only used if type is ndn_KeyLocatorType_KEYNAME.) */
 };
@@ -51,7 +51,7 @@
  * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
 static inline void ndn_KeyLocator_initialize
-  (struct ndn_KeyLocator *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
+  (struct ndn_KeyLocator *self, struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) {
   self->type = (ndn_KeyLocatorType)-1;
   self->keyData = 0;
   self->keyDataLength = 0;
diff --git a/ndn-cpp/c/name.c b/ndn-cpp/c/name.c
index a2569f9..ab190ce 100644
--- a/ndn-cpp/c/name.c
+++ b/ndn-cpp/c/name.c
@@ -14,7 +14,7 @@
     return 0;
 
 	// Check if at least one of given components doesn't match.
-  unsigned int i;
+  size_t i;
   for (i = 0; i < self->nComponents; ++i) {
     struct ndn_NameComponent *selfComponent = self->components + i;
     struct ndn_NameComponent *nameComponent = name->components + i;
diff --git a/ndn-cpp/c/name.h b/ndn-cpp/c/name.h
index 5415f6e..9a4159b 100644
--- a/ndn-cpp/c/name.h
+++ b/ndn-cpp/c/name.h
@@ -16,7 +16,7 @@
  */
 struct ndn_NameComponent {
   uint8_t *value;     /**< pointer to the pre-allocated buffer for the component value */
-  unsigned int valueLength; /**< the number of bytes in value */
+  size_t 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, uint8_t *value, unsigned int valueLength) 
+static inline void ndn_NameComponent_initialize(struct ndn_NameComponent *self, uint8_t *value, size_t valueLength) 
 {
   self->value = value;
   self->valueLength = valueLength;
@@ -36,8 +36,8 @@
  */
 struct ndn_Name {
   struct ndn_NameComponent *components; /**< pointer to the array of components. */
-  unsigned int maxComponents;           /**< the number of elements in the allocated components array */
-  unsigned int nComponents;             /**< the number of components in the name */
+  size_t maxComponents;                 /**< the number of elements in the allocated components array */
+  size_t nComponents;                   /**< the number of components in the name */
 };
 
 /**
@@ -46,7 +46,7 @@
  * @param components the pre-allocated array of ndn_NameComponent
  * @param maxComponents the number of elements in the allocated components array
  */
-static inline void ndn_Name_initialize(struct ndn_Name *self, struct ndn_NameComponent *components, unsigned int maxComponents) 
+static inline void ndn_Name_initialize(struct ndn_Name *self, struct ndn_NameComponent *components, size_t maxComponents) 
 {
   self->components = components;
   self->maxComponents = maxComponents;
diff --git a/ndn-cpp/c/publisher-public-key-digest.h b/ndn-cpp/c/publisher-public-key-digest.h
index 3e02b9b..11d9dec 100644
--- a/ndn-cpp/c/publisher-public-key-digest.h
+++ b/ndn-cpp/c/publisher-public-key-digest.h
@@ -19,7 +19,7 @@
  */
 struct ndn_PublisherPublicKeyDigest {
   uint8_t *publisherPublicKeyDigest;      /**< pointer to pre-allocated buffer.  0 for none */
-  unsigned int publisherPublicKeyDigestLength;  /**< length of publisherPublicKeyDigest.  0 for none */  
+  size_t 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 aef13ac..09a5b57 100644
--- a/ndn-cpp/c/transport/socket-transport.c
+++ b/ndn-cpp/c/transport/socket-transport.c
@@ -67,7 +67,7 @@
   return NDN_ERROR_success;
 }
 
-ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, unsigned int dataLength)
+ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, size_t 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, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytesOut)
+  (struct ndn_SocketTransport *self, uint8_t *buffer, size_t bufferLength, size_t *nBytesOut)
 {
   if (self->socketDescriptor < 0)
     return NDN_ERROR_SocketTransport_socket_is_not_open;
@@ -124,7 +124,7 @@
   if ((nBytes = recv(self->socketDescriptor, buffer, bufferLength, 0)) == -1)
     return NDN_ERROR_SocketTransport_error_in_recv;
 
-  *nBytesOut = (unsigned int)nBytes;
+  *nBytesOut = (size_t)nBytes;
   
   return NDN_ERROR_success;  
 }
diff --git a/ndn-cpp/c/transport/socket-transport.h b/ndn-cpp/c/transport/socket-transport.h
index e1388c3..b0a0979 100644
--- a/ndn-cpp/c/transport/socket-transport.h
+++ b/ndn-cpp/c/transport/socket-transport.h
@@ -50,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, uint8_t *data, unsigned int dataLength);
+ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, size_t dataLength);
 
 /**
  * Check if there is data ready on the socket to be received with ndn_SocketTransport_receive.
@@ -71,7 +71,7 @@
  * @return 0 for success, else an error code.
  */
 ndn_Error ndn_SocketTransport_receive
-  (struct ndn_SocketTransport *self, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytes);
+  (struct ndn_SocketTransport *self, uint8_t *buffer, size_t bufferLength, size_t *nBytes);
 
 /**
  * Close the socket.
diff --git a/ndn-cpp/c/transport/tcp-transport.h b/ndn-cpp/c/transport/tcp-transport.h
index 05902f9..55f2e8e 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, uint8_t *data, unsigned int dataLength)
+static inline ndn_Error ndn_TcpTransport_send(struct ndn_TcpTransport *self, uint8_t *data, size_t 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, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytes)
+  (struct ndn_TcpTransport *self, uint8_t *buffer, size_t bufferLength, size_t *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 fc9a173..20d106b 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, uint8_t *data, unsigned int dataLength)
+static inline ndn_Error ndn_UdpTransport_send(struct ndn_UdpTransport *self, uint8_t *data, size_t 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, uint8_t *buffer, unsigned int bufferLength, unsigned int *nBytes)
+  (struct ndn_UdpTransport *self, uint8_t *buffer, size_t bufferLength, size_t *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 4784065..1029185 100644
--- a/ndn-cpp/c/util/blob.h
+++ b/ndn-cpp/c/util/blob.h
@@ -16,7 +16,7 @@
  */
 struct ndn_Blob {
   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. */
+  size_t 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, uint8_t *value, unsigned int valueLength) 
+static inline void ndn_Blob_initialize(struct ndn_Blob *self, uint8_t *value, size_t valueLength) 
 {
   self->value = value;
   self->valueLength = valueLength;
diff --git a/ndn-cpp/c/util/crypto.c b/ndn-cpp/c/util/crypto.c
index 2cdc91b..ec13f68 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 uint8_t *data, unsigned int dataLength, uint8_t *digest)
+void ndn_digestSha256(const uint8_t *data, size_t 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 eb7cec5..5bec549 100644
--- a/ndn-cpp/c/util/crypto.h
+++ b/ndn-cpp/c/util/crypto.h
@@ -21,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 uint8_t *data, unsigned int dataLength, uint8_t *digest);
+void ndn_digestSha256(const uint8_t *data, size_t dataLength, uint8_t *digest);
 
 #ifdef __cplusplus
 }
diff --git a/ndn-cpp/c/util/dynamic-uint8-array.c b/ndn-cpp/c/util/dynamic-uint8-array.c
index 5a7e96d..23bfd7c 100644
--- a/ndn-cpp/c/util/dynamic-uint8-array.c
+++ b/ndn-cpp/c/util/dynamic-uint8-array.c
@@ -6,13 +6,13 @@
 
 #include "dynamic-uint8-array.h"
 
-ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, unsigned int length)
+ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, size_t length)
 {
   if (!self->realloc)
     return NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied;
   
   // See if double is enough.
-  unsigned int newLength = self->length * 2;
+  size_t newLength = self->length * 2;
   if (length > newLength)
     // The needed length is much greater, so use it.
     newLength = length;
diff --git a/ndn-cpp/c/util/dynamic-uint8-array.h b/ndn-cpp/c/util/dynamic-uint8-array.h
index 8b7b489..6548662 100644
--- a/ndn-cpp/c/util/dynamic-uint8-array.h
+++ b/ndn-cpp/c/util/dynamic-uint8-array.h
@@ -16,9 +16,9 @@
 
 struct ndn_DynamicUInt8Array {
   uint8_t *array; /**< the allocated array buffer */
-  unsigned int length;  /**< the length of the allocated array buffer */
+  size_t length;  /**< the length of the allocated array buffer */
   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
+    (struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t 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_DynamicUInt8Array which is calling realloc.
@@ -33,8 +33,8 @@
  * @param reallocFunction see ndn_DynamicUInt8Array_ensureLength.  This may be 0.
  */
 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)) 
+  (struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length, 
+   uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, size_t)) 
 {
   self->array = array;
   self->length = length;
@@ -49,7 +49,7 @@
  * @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_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, unsigned int length);
+ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, size_t length);
 
 /**
  * Ensure that self->length is greater than or equal to length.  If it is, just return 0 for success.
@@ -59,7 +59,7 @@
  * @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_DynamicUInt8Array_ensureLength(struct ndn_DynamicUInt8Array *self, unsigned int length) 
+static inline ndn_Error ndn_DynamicUInt8Array_ensureLength(struct ndn_DynamicUInt8Array *self, size_t length) 
 {
   if (self->length >= length)
     return NDN_ERROR_success;
@@ -76,7 +76,7 @@
  * @return 0 for success, else an error code if need to reallocate the array but can't
  */
 static inline ndn_Error ndn_DynamicUInt8Array_set
-  (struct ndn_DynamicUInt8Array *self, uint8_t *value, unsigned int valueLength, unsigned int offset) 
+  (struct ndn_DynamicUInt8Array *self, uint8_t *value, size_t valueLength, size_t offset) 
 {
   ndn_Error error;
   if ((error = ndn_DynamicUInt8Array_ensureLength(self, valueLength + offset)))
diff --git a/ndn-cpp/c/util/ndn_memory.c b/ndn-cpp/c/util/ndn_memory.c
index db92bde..ba3fc2e 100644
--- a/ndn-cpp/c/util/ndn_memory.c
+++ b/ndn-cpp/c/util/ndn_memory.c
@@ -7,9 +7,9 @@
 #include "ndn_memory.h"
 
 #if !HAVE_MEMCMP
-int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, unsigned int len)
+int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, size_t len)
 {
-  unsigned int i;
+  size_t i;
   
   for (i = 0; i < len; i++) {
     if (buf1[i] > buf2[i])
@@ -25,9 +25,9 @@
 #endif
 
 #if !HAVE_MEMCPY
-void ndn_memcpy(uint8_t *dest, uint8_t *src, unsigned int len)
+void ndn_memcpy(uint8_t *dest, uint8_t *src, size_t len)
 {
-  unsigned int i;
+  size_t i;
   
   for (i = 0; i < len; i++)
     dest[i] = src[i];
@@ -37,9 +37,9 @@
 #endif
 
 #if !HAVE_MEMSET
-void ndn_memset(uint8_t *dest, int val, unsigned int len)
+void ndn_memset(uint8_t *dest, int val, size_t len)
 {
-  unsigned int i;
+  size_t i;
   
   for (i = 0; i < len; i++)
     dest[i] = (uint8_t)val;
diff --git a/ndn-cpp/c/util/ndn_memory.h b/ndn-cpp/c/util/ndn_memory.h
index ba0a85b..68721e8 100644
--- a/ndn-cpp/c/util/ndn_memory.h
+++ b/ndn-cpp/c/util/ndn_memory.h
@@ -22,12 +22,12 @@
 /**
  * Use the library version of memcmp.
  */
-static inline int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, unsigned int len) { return memcmp(buf1, buf2, len); }
+static inline int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, size_t len) { return memcmp(buf1, buf2, len); }
 #else
 /**
  * Use a local implementation of memcmp instead of the library version.
  */
-int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, unsigned int len);
+int ndn_memcmp(uint8_t *buf1, uint8_t *buf2, size_t len);
 #endif
 
 #if HAVE_MEMCPY
@@ -35,12 +35,12 @@
 /**
  * Use the library version of memcpy.
  */
-static inline void ndn_memcpy(uint8_t *dest, uint8_t *src, unsigned int len) { memcpy(dest, src, len); }
+static inline void ndn_memcpy(uint8_t *dest, uint8_t *src, size_t len) { memcpy(dest, src, len); }
 #else
 /**
  * Use a local implementation of memcpy instead of the library version.
  */
-void ndn_memcpy(uint8_t *dest, uint8_t *src, unsigned int len);
+void ndn_memcpy(uint8_t *dest, uint8_t *src, size_t len);
 #endif
 
 #if HAVE_MEMSET
@@ -48,12 +48,12 @@
 /**
  * Use the library version of memset.
  */
-static inline void ndn_memset(uint8_t *dest, int val, unsigned int len) { memset(dest, val, len); }
+static inline void ndn_memset(uint8_t *dest, int val, size_t len) { memset(dest, val, len); }
 #else
 /**
  * Use a local implementation of memset instead of the library version.
  */
-void ndn_memset(uint8_t *dest, int val, unsigned int len);
+void ndn_memset(uint8_t *dest, int val, size_t len);
 #endif
 
 #ifdef __cplusplus
diff --git a/ndn-cpp/c/util/ndn_realloc.c b/ndn-cpp/c/util/ndn_realloc.c
index 8e560b9..f3147f4 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"
 
-uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length)
+uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t 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 5259f70..7aeb6af 100644
--- a/ndn-cpp/c/util/ndn_realloc.h
+++ b/ndn-cpp/c/util/ndn_realloc.h
@@ -21,7 +21,7 @@
  * @param length the length for the new array buffer.
  * @return the new allocated array buffer.
  */
-uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length);
+uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length);
 
 #ifdef __cplusplus
 }