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
 }
diff --git a/ndn-cpp/common.cpp b/ndn-cpp/common.cpp
index 70d3a90..fcebfba 100644
--- a/ndn-cpp/common.cpp
+++ b/ndn-cpp/common.cpp
@@ -19,7 +19,7 @@
   
   ostringstream result;
   result.flags(ios::hex | ios::uppercase);
-  for (unsigned int i = 0; i < array.size(); ++i) {
+  for (size_t i = 0; i < array.size(); ++i) {
     uint8_t x = array[i];
     if (x < 16)
       result << '0';
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index 5681159..1be361a 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -72,7 +72,7 @@
 SignedBlob 
 Data::wireEncode(WireFormat& wireFormat) 
 {
-  unsigned int signedPortionBeginOffset, signedPortionEndOffset;
+  size_t signedPortionBeginOffset, signedPortionEndOffset;
   Blob encoding = wireFormat.encodeData(*this, &signedPortionBeginOffset, &signedPortionEndOffset);
   
   wireEncoding_ = SignedBlob(encoding, signedPortionBeginOffset, signedPortionEndOffset);
@@ -80,9 +80,9 @@
 }
 
 void 
-Data::wireDecode(const uint8_t* input, unsigned int inputLength, WireFormat& wireFormat) 
+Data::wireDecode(const uint8_t* input, size_t inputLength, WireFormat& wireFormat) 
 {
-  unsigned int signedPortionBeginOffset, signedPortionEndOffset;
+  size_t signedPortionBeginOffset, signedPortionEndOffset;
   wireFormat.decodeData(*this, input, inputLength, &signedPortionBeginOffset, &signedPortionEndOffset);
   
   wireEncoding_ = SignedBlob(input, inputLength, signedPortionBeginOffset, signedPortionEndOffset);
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index 4b82fef..edb991b 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -101,7 +101,7 @@
   setFinalBlockID(const std::vector<uint8_t>& finalBlockID) { finalBlockID_ = Name::Component(finalBlockID); }
   
   void 
-  setFinalBlockID(const uint8_t* finalBlockID, unsigned int finalBlockIdLength) 
+  setFinalBlockID(const uint8_t* finalBlockID, size_t finalBlockIdLength) 
   { 
     finalBlockID_ = Name::Component(finalBlockID, finalBlockIdLength); 
   }
@@ -142,7 +142,7 @@
    * @param wireFormat A WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
    */
   void 
-  wireDecode(const uint8_t* input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+  wireDecode(const uint8_t* input, size_t inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
   
   /**
    * Decode the input using a particular wire format and update this Data. Also, set the wireEncoding field to the input.
@@ -257,7 +257,7 @@
   }
   
   void 
-  setContent(const uint8_t* content, unsigned int contentLength) 
+  setContent(const uint8_t* content, size_t contentLength) 
   { 
     content_ = Blob(content, contentLength); 
     onChanged();
diff --git a/ndn-cpp/encoding/binary-xml-decoder.hpp b/ndn-cpp/encoding/binary-xml-decoder.hpp
index 1bbca34..f75d4f0 100644
--- a/ndn-cpp/encoding/binary-xml-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-decoder.hpp
@@ -22,7 +22,7 @@
   /**
    * Initialize the base ndn_BinaryXmlDecoder struct with the input.
    */
-  BinaryXmlDecoder(const uint8_t *input, unsigned int inputLength) 
+  BinaryXmlDecoder(const uint8_t *input, size_t inputLength) 
   {
     ndn_BinaryXmlDecoder_initialize(this, (uint8_t *)input, inputLength);
   }
diff --git a/ndn-cpp/encoding/binary-xml-element-reader.cpp b/ndn-cpp/encoding/binary-xml-element-reader.cpp
index bfb9a2a..559af7f 100644
--- a/ndn-cpp/encoding/binary-xml-element-reader.cpp
+++ b/ndn-cpp/encoding/binary-xml-element-reader.cpp
@@ -9,7 +9,7 @@
 namespace ndn {
 
 void 
-ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength)
+ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, size_t elementLength)
 {
   ((ElementListener *)self)->onReceivedElement(element, elementLength);
 }
diff --git a/ndn-cpp/encoding/binary-xml-element-reader.hpp b/ndn-cpp/encoding/binary-xml-element-reader.hpp
index 5aed8a0..f353e97 100644
--- a/ndn-cpp/encoding/binary-xml-element-reader.hpp
+++ b/ndn-cpp/encoding/binary-xml-element-reader.hpp
@@ -29,7 +29,7 @@
    * @param elementLength length of element
    */
   virtual void 
-  onReceivedElement(const uint8_t *element, unsigned int elementLength) = 0;
+  onReceivedElement(const uint8_t *element, size_t elementLength) = 0;
   
 private:
   /**
@@ -39,7 +39,7 @@
    * @param elementLength
    */
   static void 
-  staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, unsigned int elementLength);
+  staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, size_t elementLength);
 };
 
 }
diff --git a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
index 0fbc1cf..e953a1b 100644
--- a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
@@ -31,7 +31,7 @@
    * @return true if found the element end, false if need to read more. (This is the same as returning gotElementEnd().)
    */
   bool 
-  findElementEnd(uint8_t *input, unsigned int inputLength) 
+  findElementEnd(uint8_t *input, size_t inputLength) 
   {
     ndn_Error error;
     if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(this, input, inputLength)))
@@ -39,7 +39,7 @@
     return gotElementEnd();
   }
   
-  unsigned int 
+  size_t 
   getOffset() const { return offset; }
   
   bool 
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index 130412c..adb756a 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -46,7 +46,7 @@
 }
 
 void 
-BinaryXmlWireFormat::decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength)
+BinaryXmlWireFormat::decodeInterest(Interest& interest, const uint8_t *input, size_t inputLength)
 {
   struct ndn_NameComponent nameComponents[100];
   struct ndn_ExcludeEntry excludeEntries[100];
@@ -64,7 +64,7 @@
 }
 
 Blob 
-BinaryXmlWireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) 
+BinaryXmlWireFormat::encodeData(const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 
 {
   struct ndn_NameComponent nameComponents[100];
   struct ndn_NameComponent keyNameComponents[100];
@@ -84,7 +84,7 @@
 
 void 
 BinaryXmlWireFormat::decodeData
-  (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
+  (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset)
 {
   struct ndn_NameComponent nameComponents[100];
   struct ndn_NameComponent keyNameComponents[100];
@@ -119,7 +119,7 @@
 }
 
 void 
-BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength)
+BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength)
 {
   struct ndn_NameComponent prefixNameComponents[100];
   struct ndn_ForwardingEntry forwardingEntryStruct;
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.hpp b/ndn-cpp/encoding/binary-xml-wire-format.hpp
index de1388e..c169669 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.hpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.hpp
@@ -32,7 +32,7 @@
    * @param inputLength The number of bytes in input.
    */
   virtual void 
-  decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength);
+  decodeInterest(Interest& interest, const uint8_t *input, size_t inputLength);
 
   /**
    * Encode data with binary XML and return the encoding.
@@ -45,7 +45,7 @@
    */
   virtual Blob 
   encodeData
-    (const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
+    (const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
   
   /**
    * Decode input as a data packet in binary XML and set the fields in the data object.
@@ -54,14 +54,14 @@
    * @param inputLength The number of bytes in input.
    * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
    * If you are not decoding in order to verify, you can call 
-   * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
+   * decodeData(Data& data, const uint8_t *input, size_t inputLength) to ignore this returned value.
    * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
    * If you are not decoding in order to verify, you can call 
-   * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
+   * decodeData(Data& data, const uint8_t *input, size_t inputLength) to ignore this returned value.
    */  
   virtual void 
   decodeData
-    (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
+    (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
 
   /**
    * Encode forwardingEntry in binary XML and return the encoding. 
@@ -78,7 +78,7 @@
    * @param inputLength The number of bytes in input.
    */
   virtual void 
-  decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength);
+  decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength);
 };
   
 }
diff --git a/ndn-cpp/encoding/wire-format.cpp b/ndn-cpp/encoding/wire-format.cpp
index 70644ad..cf7890e 100644
--- a/ndn-cpp/encoding/wire-format.cpp
+++ b/ndn-cpp/encoding/wire-format.cpp
@@ -35,20 +35,20 @@
 }
 
 void 
-WireFormat::decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength) 
+WireFormat::decodeInterest(Interest& interest, const uint8_t *input, size_t inputLength) 
 {
   throw logic_error("unimplemented");
 }
 
 Blob 
-WireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) 
+WireFormat::encodeData(const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 
 {
   throw logic_error("unimplemented");
 }
 
 void 
 WireFormat::decodeData
-  (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) 
+  (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 
 {
   throw logic_error("unimplemented");
 }
@@ -60,7 +60,7 @@
 }
 
 void 
-WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength) 
+WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength) 
 {
   throw logic_error("unimplemented");
 }
diff --git a/ndn-cpp/encoding/wire-format.hpp b/ndn-cpp/encoding/wire-format.hpp
index 489415b..c5b4c6e 100644
--- a/ndn-cpp/encoding/wire-format.hpp
+++ b/ndn-cpp/encoding/wire-format.hpp
@@ -35,7 +35,7 @@
    * @throw logic_error for unimplemented if the derived class does not override.
    */
   virtual void 
-  decodeInterest(Interest& interest, const uint8_t *input, unsigned int inputLength);
+  decodeInterest(Interest& interest, const uint8_t *input, size_t inputLength);
 
   /**
    * Encode data and return the encoding.  Your derived class should override.
@@ -49,7 +49,7 @@
    */
   virtual Blob 
   encodeData
-    (const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
+    (const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
 
   /**
    * Encode data and return the encoding.
@@ -60,7 +60,7 @@
   Blob 
   encodeData(const Data& data)
   {
-    unsigned int dummyBeginOffset, dummyEndOffset;
+    size_t dummyBeginOffset, dummyEndOffset;
     return encodeData(data, &dummyBeginOffset, &dummyEndOffset);
   }
 
@@ -71,20 +71,20 @@
    * @param inputLength The number of bytes in input.
    * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
    * If you are not decoding in order to verify, you can call 
-   * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
+   * decodeData(Data& data, const uint8_t *input, size_t inputLength) to ignore this returned value.
    * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
    * If you are not decoding in order to verify, you can call 
-   * decodeData(Data& data, const uint8_t *input, unsigned int inputLength) to ignore this returned value.
+   * decodeData(Data& data, const uint8_t *input, size_t inputLength) to ignore this returned value.
    * @throw logic_error for unimplemented if the derived class does not override.
    */  
   virtual void 
   decodeData
-    (Data& data, const uint8_t *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
+    (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
 
   void 
-  decodeData(Data& data, const uint8_t *input, unsigned int inputLength)
+  decodeData(Data& data, const uint8_t *input, size_t inputLength)
   {
-    unsigned int dummyBeginOffset, dummyEndOffset;
+    size_t dummyBeginOffset, dummyEndOffset;
     decodeData(data, input, inputLength, &dummyBeginOffset, &dummyEndOffset);
   }
   
@@ -105,7 +105,7 @@
    * @throw logic_error for unimplemented if the derived class does not override.
    */
   virtual void 
-  decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, unsigned int inputLength);
+  decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength);
 
   /**
    * Set the static default WireFormat used by default encoding and decoding methods.
diff --git a/ndn-cpp/forwarding-entry.hpp b/ndn-cpp/forwarding-entry.hpp
index 73a9484..6884a08 100644
--- a/ndn-cpp/forwarding-entry.hpp
+++ b/ndn-cpp/forwarding-entry.hpp
@@ -39,7 +39,7 @@
   }
   
   void 
-  wireDecode(const uint8_t *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) 
+  wireDecode(const uint8_t *input, size_t inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) 
   {
     wireFormat.decodeForwardingEntry(*this, input, inputLength);
   }
diff --git a/ndn-cpp/interest.cpp b/ndn-cpp/interest.cpp
index 0a736dc..dff002c 100644
--- a/ndn-cpp/interest.cpp
+++ b/ndn-cpp/interest.cpp
@@ -19,7 +19,7 @@
     throw runtime_error("excludeStruct.maxEntries must be >= this exclude getEntryCount()");
   
   excludeStruct.nEntries = entries_.size();
-  for (unsigned int i = 0; i < excludeStruct.nEntries; ++i)
+  for (size_t i = 0; i < excludeStruct.nEntries; ++i)
     entries_[i].get(excludeStruct.entries[i]);  
 }
 
@@ -27,7 +27,7 @@
 Exclude::set(const struct ndn_Exclude& excludeStruct)
 {
   entries_.clear();
-  for (unsigned int i = 0; i < excludeStruct.nEntries; ++i) {
+  for (size_t i = 0; i < excludeStruct.nEntries; ++i) {
     ndn_ExcludeEntry *entry = &excludeStruct.entries[i];
     
     if (entry->type == ndn_Exclude_COMPONENT)
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index 0f59a28..de4f00e 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -29,7 +29,7 @@
   /**
    * Create an ExcludeEntry of type ndn_Exclude_COMPONENT
    */
-  ExcludeEntry(uint8_t *component, unsigned int componentLen) 
+  ExcludeEntry(uint8_t *component, size_t componentLen) 
   : type_(ndn_Exclude_COMPONENT), component_(component, componentLen)
   {
   }
@@ -67,13 +67,13 @@
   Exclude() {
   }
   
-  unsigned int 
+  size_t 
   getEntryCount() const {
     return entries_.size();
   }
   
   const ExcludeEntry& 
-  getEntry(unsigned int i) const { return entries_[i]; }
+  getEntry(size_t i) const { return entries_[i]; }
   
   /**
    * Set the excludeStruct to point to the entries in this Exclude, without copying any memory.
@@ -103,7 +103,7 @@
    * Add a new entry of type ndn_Exclude_COMPONENT, copying from component of length compnentLength
    */
   void 
-  addComponent(uint8_t *component, unsigned int componentLen) 
+  addComponent(uint8_t *component, size_t componentLen) 
   {
     entries_.push_back(ExcludeEntry(component, componentLen));
   }
@@ -175,7 +175,7 @@
   }
   
   void 
-  wireDecode(const uint8_t *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) 
+  wireDecode(const uint8_t *input, size_t inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) 
   {
     wireFormat.decodeInterest(*this, input, inputLength);
   }
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index da9a11f..6bfd779 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -68,7 +68,7 @@
   setKeyData(const std::vector<uint8_t>& keyData) { keyData_ = keyData; }
   
   void 
-  setKeyData(const uint8_t *keyData, unsigned int keyDataLength) 
+  setKeyData(const uint8_t *keyData, size_t keyDataLength) 
   { 
     keyData_ = Blob(keyData, keyDataLength); 
   }
diff --git a/ndn-cpp/name.cpp b/ndn-cpp/name.cpp
index 7534ba3..03b6168 100644
--- a/ndn-cpp/name.cpp
+++ b/ndn-cpp/name.cpp
@@ -87,7 +87,7 @@
 {
   ostringstream result;
   
-  for (unsigned int i = 0; i < str.size(); ++i) {
+  for (size_t i = 0; i < str.size(); ++i) {
     if (str[i] == '%' && i + 2 < str.size()) {
       int hi = fromHexChar(str[i + 1]);
       int lo = fromHexChar(str[i + 2]);
@@ -110,7 +110,7 @@
 }
 
 Blob 
-Name::Component::makeFromEscapedString(const char *escapedString, unsigned int beginOffset, unsigned int endOffset)
+Name::Component::makeFromEscapedString(const char *escapedString, size_t beginOffset, size_t endOffset)
 {
   string trimmedString(escapedString + beginOffset, escapedString + endOffset);
   trim(trimmedString);
@@ -212,7 +212,7 @@
     throw runtime_error("nameStruct.maxComponents must be >= this name getNComponents()");
   
   nameStruct.nComponents = components_.size();
-  for (unsigned int i = 0; i < nameStruct.nComponents; ++i)
+  for (size_t i = 0; i < nameStruct.nComponents; ++i)
     components_[i].get(nameStruct.components[i]);
 }
   
@@ -220,7 +220,7 @@
 Name::set(const struct ndn_Name& nameStruct) 
 {
   clear();
-  for (unsigned int i = 0; i < nameStruct.nComponents; ++i)
+  for (size_t i = 0; i < nameStruct.nComponents; ++i)
     addComponent(nameStruct.components[i].value, nameStruct.components[i].valueLength);  
 }
 
@@ -244,7 +244,7 @@
     return "/";
   
   ostringstream result;
-  for (unsigned int i = 0; i < components_.size(); ++i) {
+  for (size_t i = 0; i < components_.size(); ++i) {
     result << "/";
     toEscapedString(*components_[i].getValue(), result);
   }
@@ -257,8 +257,8 @@
 {
   Name result;
   
-  unsigned int iEnd = iStartComponent + nComponents;
-  for (unsigned int i = iStartComponent; i < iEnd && i < components_.size(); ++i)
+  size_t iEnd = iStartComponent + nComponents;
+  for (size_t i = iStartComponent; i < iEnd && i < components_.size(); ++i)
     result.components_.push_back(components_[i]);
   
   return result;
@@ -269,7 +269,7 @@
 {
   Name result;
   
-  for (unsigned int i = iStartComponent; i < components_.size(); ++i)
+  for (size_t i = iStartComponent; i < components_.size(); ++i)
     result.components_.push_back(components_[i]);
   
   return result;
@@ -285,7 +285,7 @@
     return 0;
 
 	// Check if at least one of given components doesn't match.
-  unsigned int i;
+  size_t i;
   for (i = 0; i < components_.size(); ++i) {
     const Component &selfComponent = components_[i];
     const Component &nameComponent = name.components_[i];
@@ -310,14 +310,14 @@
   if (!gotNonDot) {
     // Special case for component of zero or more periods.  Add 3 periods.
     result << "...";
-    for (unsigned int i = 0; i < value.size(); ++i)
+    for (size_t i = 0; i < value.size(); ++i)
       result << '.';
   }
   else {
     // In case we need to escape, set to upper case hex and save the previous flags.
     ios::fmtflags saveFlags = result.flags(ios::hex | ios::uppercase);
     
-    for (unsigned int i = 0; i < value.size(); ++i) {
+    for (size_t i = 0; i < value.size(); ++i) {
       uint8_t x = value[i];
       // Check for 0-9, A-Z, a-z, (+), (-), (.), (_)
       if (x >= 0x30 && x <= 0x39 || x >= 0x41 && x <= 0x5a ||
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index 7e9be6c..f39d568 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -44,7 +44,7 @@
      * @param value Pointer to the value byte array.
      * @param valueLen Length of value.
      */
-    Component(const uint8_t *value, unsigned int valueLen) 
+    Component(const uint8_t *value, size_t valueLen) 
     : value_(value, valueLen)
     {
     }
@@ -109,7 +109,7 @@
      * @return The component value as a Blob, or a Blob with a null pointer if escapedString is not a valid escaped component.
      */
     static Blob 
-    makeFromEscapedString(const char *escapedString, unsigned int beginOffset, unsigned int endOffset);
+    makeFromEscapedString(const char *escapedString, size_t beginOffset, size_t endOffset);
     
     /**
      * Make a component as the encoded segment number.
@@ -174,7 +174,7 @@
    * @return This name so that you can chain calls to append.
    */
   Name& 
-  append(const uint8_t *value, unsigned int valueLength) 
+  append(const uint8_t *value, size_t valueLength) 
   {
     components_.push_back(Component(value, valueLength));
     return *this;
@@ -210,7 +210,7 @@
    * @deprecated Use append.
    */
   Name& 
-  appendComponent(const uint8_t *value, unsigned int valueLength) 
+  appendComponent(const uint8_t *value, size_t valueLength) 
   {
     return append(value, valueLength);
   }
@@ -237,7 +237,7 @@
    * @deprecated Use append.
    */
   Name& 
-  addComponent(const uint8_t *value, unsigned int valueLength) 
+  addComponent(const uint8_t *value, size_t valueLength) 
   {
     return append(value, valueLength);
   }
@@ -272,13 +272,13 @@
    * Get the number of components.
    * @return The number of components.
    */
-  unsigned int 
+  size_t 
   getComponentCount() const {
     return components_.size();
   }
   
   const Component& 
-  getComponent(unsigned int i) const { return components_[i]; }
+  getComponent(size_t i) const { return components_[i]; }
   
   /**
    * Get a new name, constructed as a subset of components.
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 6eb30fd..15e3b4d 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -102,7 +102,7 @@
   if (!success)
     throw std::runtime_error("Error in RSA_sign");
   
-  signature->setSignature(signatureBits, signatureBitsLength);
+  signature->setSignature(signatureBits, (size_t)signatureBitsLength);
 }
 
 // Use gettimeofday to return the current time in milliseconds.
@@ -224,7 +224,7 @@
 }
 
 void 
-Node::onReceivedElement(const uint8_t *element, unsigned int elementLength)
+Node::onReceivedElement(const uint8_t *element, size_t elementLength)
 {
   BinaryXmlDecoder decoder(element, elementLength);
   
@@ -269,7 +269,7 @@
   
   int iResult = -1;
     
-	for (unsigned int i = 0; i < pit_.size(); ++i) {
+	for (size_t i = 0; i < pit_.size(); ++i) {
 		if (ndn_Interest_matchesName((struct ndn_Interest *)&pit_[i]->getInterestStruct(), &nameStruct)) {
       if (iResult < 0 || 
           pit_[i]->getInterestStruct().name.nComponents > pit_[iResult]->getInterestStruct().name.nComponents)
@@ -286,7 +286,7 @@
 {
   int iResult = -1;
     
-	for (unsigned int i = 0; i < registeredPrefixTable_.size(); ++i) {
+	for (size_t i = 0; i < registeredPrefixTable_.size(); ++i) {
 		if (registeredPrefixTable_[i]->getPrefix()->match(name)) {
       if (iResult < 0 || 
           registeredPrefixTable_[i]->getPrefix()->getComponentCount() > registeredPrefixTable_[iResult]->getPrefix()->getComponentCount())
diff --git a/ndn-cpp/node.hpp b/ndn-cpp/node.hpp
index eba6eb5..a9bd81f 100644
--- a/ndn-cpp/node.hpp
+++ b/ndn-cpp/node.hpp
@@ -90,7 +90,7 @@
   getConnectionInfo() { return connectionInfo_; }
 
   void 
-  onReceivedElement(const uint8_t *element, unsigned int elementLength);
+  onReceivedElement(const uint8_t *element, size_t elementLength);
   
   void 
   shutdown();
diff --git a/ndn-cpp/publisher-public-key-digest.hpp b/ndn-cpp/publisher-public-key-digest.hpp
index 6abe8bd..1c04b3a 100644
--- a/ndn-cpp/publisher-public-key-digest.hpp
+++ b/ndn-cpp/publisher-public-key-digest.hpp
@@ -58,7 +58,7 @@
   }
   
   void 
-  setPublisherPublicKeyDigest(const uint8_t *publisherPublicKeyDigest, unsigned int publisherPublicKeyDigestLength) 
+  setPublisherPublicKeyDigest(const uint8_t *publisherPublicKeyDigest, size_t publisherPublicKeyDigestLength) 
   { 
     publisherPublicKeyDigest_ = Blob(publisherPublicKeyDigest, publisherPublicKeyDigestLength); 
   }
diff --git a/ndn-cpp/security/identity/memory-private-key-storage.cpp b/ndn-cpp/security/identity/memory-private-key-storage.cpp
index 0fef285..bab5df8 100644
--- a/ndn-cpp/security/identity/memory-private-key-storage.cpp
+++ b/ndn-cpp/security/identity/memory-private-key-storage.cpp
@@ -44,7 +44,7 @@
 }
 
 Blob 
-MemoryPrivateKeyStorage::sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm)
+MemoryPrivateKeyStorage::sign(const uint8_t *data, size_t dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm)
 {
   if (digestAlgorithm != DIGEST_ALGORITHM_SHA256)
     return Blob();
@@ -62,11 +62,11 @@
   if (!RSA_sign(NID_sha256, digest, sizeof(digest), signatureBits, &signatureBitsLength, privateKey->second->getPrivateKey()))
     throw SecurityException("Error in RSA_sign");
   
-  return Blob(signatureBits, signatureBitsLength);
+  return Blob(signatureBits, (size_t)signatureBitsLength);
 }
 
 Blob 
-MemoryPrivateKeyStorage::decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric)
+MemoryPrivateKeyStorage::decrypt(const Name& keyName, const uint8_t* data, size_t dataLength, bool isSymmetric)
 {
 #if 1
   throw std::runtime_error("MemoryPrivateKeyStorage::decrypt not implemented");
@@ -74,7 +74,7 @@
 }
 
 Blob
-MemoryPrivateKeyStorage::encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric)
+MemoryPrivateKeyStorage::encrypt(const Name& keyName, const uint8_t* data, size_t dataLength, bool isSymmetric)
 {
 #if 1
   throw std::runtime_error("MemoryPrivateKeyStorage::encrypt not implemented");
diff --git a/ndn-cpp/security/identity/memory-private-key-storage.hpp b/ndn-cpp/security/identity/memory-private-key-storage.hpp
index b44f2ba..02f8fbc 100644
--- a/ndn-cpp/security/identity/memory-private-key-storage.hpp
+++ b/ndn-cpp/security/identity/memory-private-key-storage.hpp
@@ -65,7 +65,7 @@
    * @return The signature, or a null pointer if signing fails.
    */  
   virtual Blob 
-  sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
+  sign(const uint8_t *data, size_t dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
     
   /**
    * Decrypt data.
@@ -76,7 +76,7 @@
    * @return The decrypted data.
    */
   virtual Blob 
-  decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric);
+  decrypt(const Name& keyName, const uint8_t* data, size_t dataLength, bool isSymmetric);
 
   /**
    * Encrypt data.
@@ -87,7 +87,7 @@
    * @return The encrypted data.
    */
   virtual Blob
-  encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric);
+  encrypt(const Name& keyName, const uint8_t* data, size_t dataLength, bool isSymmetric);
 
   /**
    * @brief Generate a symmetric key.
diff --git a/ndn-cpp/security/identity/private-key-storage.hpp b/ndn-cpp/security/identity/private-key-storage.hpp
index 0e24eec..0ff0077 100644
--- a/ndn-cpp/security/identity/private-key-storage.hpp
+++ b/ndn-cpp/security/identity/private-key-storage.hpp
@@ -50,7 +50,7 @@
    * @return The signature, or a null pointer if signing fails.
    */  
   virtual Blob 
-  sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) = 0;
+  sign(const uint8_t *data, size_t dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) = 0;
     
   Blob 
   sign(const Blob& data, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256)
@@ -67,7 +67,7 @@
    * @return The decrypted data.
    */
   virtual Blob 
-  decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric = false) = 0;
+  decrypt(const Name& keyName, const uint8_t* data, size_t dataLength, bool isSymmetric = false) = 0;
 
   Blob 
   decrypt(const Name& keyName, const Blob& data, bool isSymmetric = false)
@@ -84,7 +84,7 @@
    * @return The encrypted data.
    */
   virtual Blob
-  encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric = false) = 0;
+  encrypt(const Name& keyName, const uint8_t* data, size_t dataLength, bool isSymmetric = false) = 0;
 
   Blob
   encrypt(const Name& keyName, const Blob& data, bool isSymmetric = false)
diff --git a/ndn-cpp/sha256-with-rsa-signature.hpp b/ndn-cpp/sha256-with-rsa-signature.hpp
index 93bae74..2d5c4ce 100644
--- a/ndn-cpp/sha256-with-rsa-signature.hpp
+++ b/ndn-cpp/sha256-with-rsa-signature.hpp
@@ -65,7 +65,7 @@
   setDigestAlgorithm(const std::vector<uint8_t>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
   
   void 
-  setDigestAlgorithm(const uint8_t *digestAlgorithm, unsigned int digestAlgorithmLength) 
+  setDigestAlgorithm(const uint8_t *digestAlgorithm, size_t digestAlgorithmLength) 
   { 
     digestAlgorithm_ = Blob(digestAlgorithm, digestAlgorithmLength); 
   }
@@ -74,7 +74,7 @@
   setWitness(const std::vector<uint8_t>& witness) { witness_ = witness; }
   
   void 
-  setWitness(const uint8_t *witness, unsigned int witnessLength) 
+  setWitness(const uint8_t *witness, size_t witnessLength) 
   { 
     witness_ = Blob(witness, witnessLength); 
   }
@@ -83,7 +83,7 @@
   setSignature(const std::vector<uint8_t>& signature) { signature_ = signature; }
   
   void 
-  setSignature(const uint8_t *signature, unsigned int signatureLength) 
+  setSignature(const uint8_t *signature, size_t signatureLength) 
   { 
     signature_ = Blob(signature, signatureLength); 
   }
diff --git a/ndn-cpp/transport/tcp-transport.cpp b/ndn-cpp/transport/tcp-transport.cpp
index 553c5c7..9a712fb 100644
--- a/ndn-cpp/transport/tcp-transport.cpp
+++ b/ndn-cpp/transport/tcp-transport.cpp
@@ -27,7 +27,7 @@
     throw std::runtime_error(ndn_getErrorString(error)); 
 
   // TODO: This belongs in the socket listener.
-  const unsigned int initialLength = 1000;
+  const size_t initialLength = 1000;
   // Automatically cast elementReader_ to (struct ndn_ElementListener *)
   ndn_BinaryXmlElementReader_initialize
     (&elementReader_, &elementListener, (uint8_t *)malloc(initialLength), initialLength, ndn_realloc);
@@ -37,7 +37,7 @@
 }
 
 void 
-TcpTransport::send(const uint8_t *data, unsigned int dataLength)
+TcpTransport::send(const uint8_t *data, size_t dataLength)
 {
   ndn_Error error;
   if ((error = ndn_TcpTransport_send(&transport_, (uint8_t *)data, dataLength)))
@@ -55,7 +55,7 @@
     return;
 
   uint8_t buffer[8000];
-  unsigned int nBytes;
+  size_t nBytes;
   if ((error = ndn_TcpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes)))
     throw std::runtime_error(ndn_getErrorString(error));  
 
diff --git a/ndn-cpp/transport/tcp-transport.hpp b/ndn-cpp/transport/tcp-transport.hpp
index d999df8..594f007 100644
--- a/ndn-cpp/transport/tcp-transport.hpp
+++ b/ndn-cpp/transport/tcp-transport.hpp
@@ -72,7 +72,7 @@
    * @param data A pointer to the buffer of data to send.
    * @param dataLength The number of bytes in data.
    */
-  virtual void send(const uint8_t *data, unsigned int dataLength);
+  virtual void send(const uint8_t *data, size_t dataLength);
 
   /**
    * Process any data to receive.  For each element received, call elementListener.onReceivedElement.
diff --git a/ndn-cpp/transport/transport.cpp b/ndn-cpp/transport/transport.cpp
index 4b8aca1..b36b119 100644
--- a/ndn-cpp/transport/transport.cpp
+++ b/ndn-cpp/transport/transport.cpp
@@ -22,7 +22,7 @@
 }
   
 void 
-Transport::send(const uint8_t *data, unsigned int dataLength)
+Transport::send(const uint8_t *data, size_t dataLength)
 {
   throw logic_error("unimplemented");
 }
diff --git a/ndn-cpp/transport/transport.hpp b/ndn-cpp/transport/transport.hpp
index ed3e240..512a003 100644
--- a/ndn-cpp/transport/transport.hpp
+++ b/ndn-cpp/transport/transport.hpp
@@ -37,7 +37,7 @@
    * @param dataLength The number of bytes in data.
    */
   virtual void 
-  send(const uint8_t *data, unsigned int dataLength);
+  send(const uint8_t *data, size_t dataLength);
   
   void 
   send(const std::vector<uint8_t>& data)
diff --git a/ndn-cpp/transport/udp-transport.cpp b/ndn-cpp/transport/udp-transport.cpp
index 0b2f397..4e65375 100644
--- a/ndn-cpp/transport/udp-transport.cpp
+++ b/ndn-cpp/transport/udp-transport.cpp
@@ -27,7 +27,7 @@
     throw std::runtime_error(ndn_getErrorString(error)); 
 
   // TODO: This belongs in the socket listener.
-  const unsigned int initialLength = 1000;
+  const size_t initialLength = 1000;
   // Automatically cast elementReader_ to (struct ndn_ElementListener *)
   ndn_BinaryXmlElementReader_initialize
     (&elementReader_, &elementListener, (uint8_t *)malloc(initialLength), initialLength, ndn_realloc);
@@ -37,7 +37,7 @@
 }
 
 void 
-UdpTransport::send(const uint8_t *data, unsigned int dataLength)
+UdpTransport::send(const uint8_t *data, size_t dataLength)
 {
   ndn_Error error;
   if ((error = ndn_UdpTransport_send(&transport_, (uint8_t *)data, dataLength)))
@@ -55,7 +55,7 @@
     return;
 
   uint8_t buffer[8000];
-  unsigned int nBytes;
+  size_t nBytes;
   if ((error = ndn_UdpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes)))
     throw std::runtime_error(ndn_getErrorString(error));  
 
diff --git a/ndn-cpp/transport/udp-transport.hpp b/ndn-cpp/transport/udp-transport.hpp
index b2374df..633b9ad 100644
--- a/ndn-cpp/transport/udp-transport.hpp
+++ b/ndn-cpp/transport/udp-transport.hpp
@@ -74,7 +74,7 @@
    * @param dataLength The number of bytes in data.
    */
   virtual void 
-  send(const uint8_t *data, unsigned int dataLength);
+  send(const uint8_t *data, size_t dataLength);
 
   /**
    * Process any data to receive.  For each element received, call elementListener.onReceivedElement.
diff --git a/ndn-cpp/util/blob.hpp b/ndn-cpp/util/blob.hpp
index d71808d..ef13433 100644
--- a/ndn-cpp/util/blob.hpp
+++ b/ndn-cpp/util/blob.hpp
@@ -35,7 +35,7 @@
    * @param value A pointer to the byte array which is copied.
    * @param valueLength The length of value.
    */
-  Blob(const uint8_t* value, unsigned int valueLength)
+  Blob(const uint8_t* value, size_t valueLength)
   : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(value, value + valueLength))
   {
   }
@@ -68,7 +68,7 @@
   /**
    * Return the length of the immutable byte array.
    */
-  unsigned int 
+  size_t 
   size() const
   {
     if (*this)
diff --git a/ndn-cpp/util/changed-event.cpp b/ndn-cpp/util/changed-event.cpp
index 1d12c75..63b4569 100644
--- a/ndn-cpp/util/changed-event.cpp
+++ b/ndn-cpp/util/changed-event.cpp
@@ -13,7 +13,7 @@
 void 
 ChangedEvent::fire()
 {
-  for (unsigned int i = 0; i < listeners_.size(); ++i)
+  for (size_t i = 0; i < listeners_.size(); ++i)
     listeners_[i]();
 }
 
diff --git a/ndn-cpp/util/dynamic-uint8-vector.cpp b/ndn-cpp/util/dynamic-uint8-vector.cpp
index 240baa6..ae1b621 100644
--- a/ndn-cpp/util/dynamic-uint8-vector.cpp
+++ b/ndn-cpp/util/dynamic-uint8-vector.cpp
@@ -10,14 +10,14 @@
 
 namespace ndn {
 
-DynamicUInt8Vector::DynamicUInt8Vector(unsigned int initialLength)
+DynamicUInt8Vector::DynamicUInt8Vector(size_t initialLength)
 : vector_(new vector<uint8_t>(initialLength))
 {
   ndn_DynamicUInt8Array_initialize(this, &vector_->front(), initialLength, DynamicUInt8Vector::realloc);
 }
 
 uint8_t*
-DynamicUInt8Vector::realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length)
+DynamicUInt8Vector::realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length)
 {
   // Because this method is private, assume there is not a problem with upcasting.
   DynamicUInt8Vector *thisObject = (DynamicUInt8Vector *)self;
diff --git a/ndn-cpp/util/dynamic-uint8-vector.hpp b/ndn-cpp/util/dynamic-uint8-vector.hpp
index 2c6247e..9550899 100644
--- a/ndn-cpp/util/dynamic-uint8-vector.hpp
+++ b/ndn-cpp/util/dynamic-uint8-vector.hpp
@@ -23,7 +23,7 @@
    * Create a new DynamicUInt8Vector with an initial length.
    * @param initialLength The initial size of the allocated vector.
    */
-  DynamicUInt8Vector(unsigned int initialLength);
+  DynamicUInt8Vector(size_t initialLength);
   
   /**
    * Get the shared_ptr to the allocated vector.
@@ -41,7 +41,7 @@
    * @return The front of the allocated vector.
    */
   static uint8_t*
-  realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, unsigned int length);
+  realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length);
   
   ptr_lib::shared_ptr<std::vector<uint8_t> > vector_;
 };
diff --git a/ndn-cpp/util/signed-blob.hpp b/ndn-cpp/util/signed-blob.hpp
index 62e6ee2..dd94ae0 100644
--- a/ndn-cpp/util/signed-blob.hpp
+++ b/ndn-cpp/util/signed-blob.hpp
@@ -34,7 +34,7 @@
    * @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
    */
   SignedBlob
-    (const uint8_t* value, unsigned int valueLength, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+    (const uint8_t* value, size_t valueLength, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
   : Blob(value, valueLength), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
   {
   }
@@ -48,7 +48,7 @@
    * @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
    */
   SignedBlob
-    (const std::vector<uint8_t> &value, unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+    (const std::vector<uint8_t> &value, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
   : Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
   {
   }
@@ -62,13 +62,13 @@
    */
   SignedBlob
     (const ptr_lib::shared_ptr<std::vector<uint8_t> > &value, 
-     unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+     size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
   : Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
   {
   }
   SignedBlob
     (const ptr_lib::shared_ptr<const std::vector<uint8_t> > &value, 
-     unsigned int signedPortionBeginOffset, unsigned int signedPortionEndOffset)
+     size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
   : Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
   {
   }
@@ -76,7 +76,7 @@
   /**
    * Return the length of the signed portion of the immutable byte array, or 0 of the pointer to the array is null.
    */
-  unsigned int 
+  size_t 
   signedSize() const
   {
     if (*this)
@@ -101,18 +101,18 @@
   /**
    * Return the offset in the array of the beginning of the signed portion.
    */  
-  unsigned int 
+  size_t 
   getSignedPortionBeginOffset() { return signedPortionBeginOffset_; }
 
   /**
    * Return the offset in the array of the end of the signed portion.
    */  
-  unsigned int 
+  size_t 
   getSignedPortionEndOffset() { return signedPortionEndOffset_; }
   
 private:
-  unsigned int signedPortionBeginOffset_;
-  unsigned int signedPortionEndOffset_;
+  size_t signedPortionBeginOffset_;
+  size_t signedPortionEndOffset_;
 };
 
 }
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 744ac06..5e09399 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -121,7 +121,7 @@
   cout << "name: " << data.getName().to_uri() << endl;
   if (data.getContent().size() > 0) {
     cout << "content (raw): ";
-    for (unsigned int i = 0; i < data.getContent().size(); ++i)
+    for (size_t i = 0; i < data.getContent().size(); ++i)
       cout << (*data.getContent())[i];
     cout<< endl;
     cout << "content (hex): " << toHex(*data.getContent()) << endl;
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index a50c34e..cbc8b97 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -29,7 +29,7 @@
   {
     ++callbackCount_;
     cout << "Got data packet with name " << data->getName().to_uri() << endl;
-    for (unsigned int i = 0; i < data->getContent().size(); ++i)
+    for (size_t i = 0; i < data->getContent().size(); ++i)
       cout << (*data->getContent())[i];
     cout << endl;  
   }