@@ -192,17 +192,21 @@ SocketIpStatus UdpSocket::openProtocol(SocketDescriptor& socketDescriptor) {
192192 return status;
193193}
194194
195- I32 UdpSocket::sendProtocol (const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
195+ FwSignedSizeType UdpSocket::sendProtocol (const SocketDescriptor& socketDescriptor,
196+ const U8* const data,
197+ const FwSizeType size) {
196198 FW_ASSERT (this ->m_addr_send .sin_family != 0 ); // Make sure the address was previously setup
197199 FW_ASSERT (socketDescriptor.fd >= 0 ); // File descriptor should be valid
198200 FW_ASSERT (data != nullptr ); // Data pointer should not be null
199201
200- return static_cast <I32>(:: sendto (socketDescriptor. fd , data, size, SOCKET_IP_SEND_FLAGS,
201- reinterpret_cast < struct sockaddr *>(& this -> m_addr_send ) ,
202- sizeof (this ->m_addr_send )));
202+ return static_cast <FwSignedSizeType>(
203+ ::sendto (socketDescriptor.fd, data, static_cast < size_t >(size), SOCKET_IP_SEND_FLAGS ,
204+ reinterpret_cast<struct sockaddr*>(& this ->m_addr_send), sizeof(this ->m_addr_send)));
203205}
204206
205- I32 UdpSocket::recvProtocol (const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) {
207+ FwSignedSizeType UdpSocket::recvProtocol (const SocketDescriptor& socketDescriptor,
208+ U8* const data,
209+ const FwSizeType size) {
206210 FW_ASSERT (this ->m_addr_recv .sin_family != 0 ); // Make sure the address was previously setup
207211 FW_ASSERT (socketDescriptor.fd >= 0 ); // File descriptor should be valid
208212 FW_ASSERT (data != nullptr ); // Data pointer should not be null
@@ -212,8 +216,9 @@ I32 UdpSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const
212216 (void )::memset (&sender_addr, 0 , sizeof (sender_addr));
213217
214218 socklen_t sender_addr_len = sizeof (sender_addr);
215- I32 received = static_cast <I32>(::recvfrom (socketDescriptor.fd , data, size, SOCKET_IP_RECV_FLAGS,
216- reinterpret_cast <struct sockaddr *>(&sender_addr), &sender_addr_len));
219+ FwSignedSizeType received = static_cast <FwSignedSizeType>(
220+ ::recvfrom (socketDescriptor.fd, data, static_cast <size_t >(size), SOCKET_IP_RECV_FLAGS,
221+ reinterpret_cast<struct sockaddr*>(&sender_addr), &sender_addr_len));
217222 // If we have not configured a send port, set it to the source of the last received packet
218223 if (received >= 0 && this ->m_addr_send .sin_port == 0 ) {
219224 this ->m_addr_send = sender_addr;
@@ -223,14 +228,14 @@ I32 UdpSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const
223228 return received;
224229}
225230
226- SocketIpStatus UdpSocket::send (const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
231+ SocketIpStatus UdpSocket::send (const SocketDescriptor& socketDescriptor, const U8* const data, const FwSizeType size) {
227232 // Note: socketDescriptor.fd can be -1 in some test cases
228233 FW_ASSERT ((size == 0 ) || (data != nullptr ));
229234
230235 // Special case for zero-length datagrams in UDP
231236 if (size == 0 ) {
232237 errno = 0 ;
233- I32 sent = this ->sendProtocol (socketDescriptor, data, 0 );
238+ FwSignedSizeType sent = this ->sendProtocol (socketDescriptor, data, 0 );
234239 if (sent == -1 ) {
235240 if (errno == EINTR) {
236241 // For zero-length datagrams, we'll just try once more if interrupted
0 commit comments