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/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.