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