@@ -558,7 +558,7 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
558558 start = LowResTimer ();
559559 }
560560 else {
561- dtls_timeout -= LowResTimer () - start ;
561+ dtls_timeout -= ( int ) ( LowResTimer () - start ) ;
562562 start = LowResTimer ();
563563 if (dtls_timeout < 0 || dtls_timeout > DTLS_TIMEOUT_MAX )
564564 return WOLFSSL_CBIO_ERR_TIMEOUT ;
@@ -608,7 +608,7 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
608608 }
609609#endif /* !NO_ASN_TIME */
610610
611- recvd = (int )DTLS_RECVFROM_FUNCTION (sd , buf , sz , ssl -> rflags ,
611+ recvd = (int )DTLS_RECVFROM_FUNCTION (sd , buf , ( size_t ) sz , ssl -> rflags ,
612612 (SOCKADDR * )peer , peer != NULL ? & peerSz : NULL );
613613
614614 /* From the RECV(2) man page
@@ -716,7 +716,7 @@ int EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx)
716716#endif
717717 }
718718
719- sent = (int )DTLS_SENDTO_FUNCTION (sd , buf , sz , ssl -> wflags ,
719+ sent = (int )DTLS_SENDTO_FUNCTION (sd , buf , ( size_t ) sz , ssl -> wflags ,
720720 (const SOCKADDR * )peer , peerSz );
721721
722722 sent = TranslateReturnCode (sent , sd );
@@ -743,7 +743,7 @@ int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf, int sz, void *ctx)
743743
744744 WOLFSSL_ENTER ("EmbedReceiveFromMcast" );
745745
746- recvd = (int )DTLS_RECVFROM_FUNCTION (sd , buf , sz , ssl -> rflags , NULL , NULL );
746+ recvd = (int )DTLS_RECVFROM_FUNCTION (sd , buf , ( size_t ) sz , ssl -> rflags , NULL , NULL );
747747
748748 recvd = TranslateReturnCode (recvd , sd );
749749
@@ -787,7 +787,7 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
787787
788788 if (sz > WC_SHA256_DIGEST_SIZE )
789789 sz = WC_SHA256_DIGEST_SIZE ;
790- XMEMCPY (buf , digest , sz );
790+ XMEMCPY (buf , digest , ( size_t ) sz );
791791
792792 return sz ;
793793}
@@ -981,7 +981,7 @@ int wolfIO_Recv(SOCKET_T sd, char *buf, int sz, int rdFlags)
981981{
982982 int recvd ;
983983
984- recvd = (int )RECV_FUNCTION (sd , buf , sz , rdFlags );
984+ recvd = (int )RECV_FUNCTION (sd , buf , ( size_t ) sz , rdFlags );
985985 recvd = TranslateReturnCode (recvd , (int )sd );
986986
987987 return recvd ;
@@ -991,7 +991,7 @@ int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
991991{
992992 int sent ;
993993
994- sent = (int )SEND_FUNCTION (sd , buf , sz , wrFlags );
994+ sent = (int )SEND_FUNCTION (sd , buf , ( size_t ) sz , wrFlags );
995995 sent = TranslateReturnCode (sent , (int )sd );
996996
997997 return sent ;
@@ -1083,9 +1083,9 @@ int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
10831083 }
10841084#endif /* HAVE_IO_TIMEOUT */
10851085
1086- static int wolfIO_Word16ToString (char * d , word16 number )
1086+ static word32 wolfIO_Word16ToString (char * d , word16 number )
10871087{
1088- int i = 0 ;
1088+ word32 i = 0 ;
10891089 word16 order = 10000 ;
10901090 word16 digit ;
10911091
@@ -1100,7 +1100,7 @@ static int wolfIO_Word16ToString(char* d, word16 number)
11001100 if (i > 0 || digit != 0 )
11011101 d [i ++ ] = (char )digit + '0' ;
11021102 if (digit != 0 )
1103- number %= digit * order ;
1103+ number = ( word16 ) ( number % ( digit * order )) ;
11041104
11051105 order = (order > 1 ) ? order / 10 : 0 ;
11061106 }
@@ -1115,7 +1115,7 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
11151115#ifdef HAVE_SOCKADDR
11161116 int ret = 0 ;
11171117 SOCKADDR_S addr ;
1118- int sockaddr_len ;
1118+ socklen_t sockaddr_len ;
11191119#if defined(HAVE_GETADDRINFO )
11201120 /* use getaddrinfo */
11211121 ADDRINFO hints ;
@@ -1179,7 +1179,7 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
11791179 }
11801180
11811181 sockaddr_len = answer -> ai_addrlen ;
1182- XMEMCPY (& addr , answer -> ai_addr , sockaddr_len );
1182+ XMEMCPY (& addr , answer -> ai_addr , ( size_t ) sockaddr_len );
11831183 freeaddrinfo (answer );
11841184#elif defined(WOLFSSL_USE_POPEN_HOST ) && !defined(WOLFSSL_IPV6 )
11851185 {
@@ -1342,7 +1342,7 @@ int wolfIO_TcpBind(SOCKET_T* sockfd, word16 port)
13421342#ifdef HAVE_SOCKADDR
13431343 int ret = 0 ;
13441344 SOCKADDR_S addr ;
1345- int sockaddr_len = sizeof (SOCKADDR_IN );
1345+ socklen_t sockaddr_len = sizeof (SOCKADDR_IN );
13461346 SOCKADDR_IN * sin = (SOCKADDR_IN * )& addr ;
13471347
13481348 if (sockfd == NULL || port < 1 ) {
@@ -1473,7 +1473,7 @@ int wolfIO_DecodeUrl(const char* url, int urlSz, char* outName, char* outPath,
14731473
14741474 for (j = 0 ; j < i ; j ++ ) {
14751475 if (port [j ] < '0' || port [j ] > '9' ) return -1 ;
1476- bigPort = (bigPort * 10 ) + (port [j ] - '0' );
1476+ bigPort = (bigPort * 10 ) + (word32 )( port [j ] - '0' );
14771477 }
14781478 if (outPort )
14791479 * outPort = (word16 )bigPort ;
@@ -1528,15 +1528,15 @@ static int wolfIO_HttpProcessResponseBuf(int sfd, byte **recvBuf,
15281528 return MEMORY_E ;
15291529 }
15301530
1531- newRecvBuf = (byte * )XMALLOC (newRecvSz , heap , dynType );
1531+ newRecvBuf = (byte * )XMALLOC (( size_t ) newRecvSz , heap , dynType );
15321532 if (newRecvBuf == NULL ) {
15331533 WOLFSSL_MSG ("wolfIO_HttpProcessResponseBuf malloc failed" );
15341534 return MEMORY_E ;
15351535 }
15361536
15371537 /* if buffer already exists, then we are growing it */
15381538 if (* recvBuf ) {
1539- XMEMCPY (& newRecvBuf [pos ], * recvBuf , * recvBufSz );
1539+ XMEMCPY (& newRecvBuf [pos ], * recvBuf , ( size_t ) * recvBufSz );
15401540 XFREE (* recvBuf , heap , dynType );
15411541 pos += * recvBufSz ;
15421542 * recvBuf = NULL ;
@@ -1545,7 +1545,7 @@ static int wolfIO_HttpProcessResponseBuf(int sfd, byte **recvBuf,
15451545 /* copy the remainder of the httpBuf into the respBuf */
15461546 if (len != 0 ) {
15471547 if (pos + len <= newRecvSz ) {
1548- XMEMCPY (& newRecvBuf [pos ], start , len );
1548+ XMEMCPY (& newRecvBuf [pos ], start , ( size_t ) len );
15491549 pos += len ;
15501550 }
15511551 else {
@@ -1629,7 +1629,7 @@ int wolfIO_HttpProcessResponse(int sfd, const char** appStrList,
16291629 /* handle incomplete rx */
16301630 if (end == NULL ) {
16311631 if (len != 0 )
1632- XMEMMOVE (httpBuf , start , len );
1632+ XMEMMOVE (httpBuf , start , ( size_t ) len );
16331633 start = end = NULL ;
16341634 }
16351635 /* when start is "\r\n" */
@@ -1755,7 +1755,7 @@ int wolfIO_HttpBuildRequest(const char *reqType, const char *domainName,
17551755 return wolfIO_HttpBuildRequest_ex (reqType , domainName , path , pathLen , reqSz , contentType , "" , buf , bufSize );
17561756}
17571757
1758- int wolfIO_HttpBuildRequest_ex (const char * reqType , const char * domainName ,
1758+ int wolfIO_HttpBuildRequest_ex (const char * reqType , const char * domainName ,
17591759 const char * path , int pathLen , int reqSz , const char * contentType ,
17601760 const char * exHdrs , byte * buf , int bufSize )
17611761 {
@@ -1797,7 +1797,7 @@ int wolfIO_HttpBuildRequest(const char *reqType, const char *domainName,
17971797 maxLen =
17981798 reqTypeLen +
17991799 blankStrLen +
1800- pathLen +
1800+ ( word32 ) pathLen +
18011801 http11StrLen +
18021802 hostStrLen +
18031803 domainNameLen +
@@ -1808,46 +1808,46 @@ int wolfIO_HttpBuildRequest(const char *reqType, const char *domainName,
18081808 singleCrLfStrLen +
18091809 exHdrsLen +
18101810 doubleCrLfStrLen +
1811- 1 /* null term */ ;
1811+ ( word32 ) 1 /* null term */ ;
18121812 if (maxLen > (word32 )bufSize )
18131813 return 0 ;
18141814
1815- XSTRNCPY ((char * )buf , reqType , bufSize );
1816- buf += reqTypeLen ; bufSize -= reqTypeLen ;
1817- XSTRNCPY ((char * )buf , blankStr , bufSize );
1818- buf += blankStrLen ; bufSize -= blankStrLen ;
1819- XSTRNCPY ((char * )buf , path , bufSize );
1820- buf += pathLen ; bufSize -= pathLen ;
1821- XSTRNCPY ((char * )buf , http11Str , bufSize );
1822- buf += http11StrLen ; bufSize -= http11StrLen ;
1815+ XSTRNCPY ((char * )buf , reqType , ( size_t ) bufSize );
1816+ buf += reqTypeLen ; bufSize -= ( int ) reqTypeLen ;
1817+ XSTRNCPY ((char * )buf , blankStr , ( size_t ) bufSize );
1818+ buf += blankStrLen ; bufSize -= ( int ) blankStrLen ;
1819+ XSTRNCPY ((char * )buf , path , ( size_t ) bufSize );
1820+ buf += pathLen ; bufSize -= ( int ) pathLen ;
1821+ XSTRNCPY ((char * )buf , http11Str , ( size_t ) bufSize );
1822+ buf += http11StrLen ; bufSize -= ( int ) http11StrLen ;
18231823 if (domainNameLen > 0 ) {
1824- XSTRNCPY ((char * )buf , hostStr , bufSize );
1825- buf += hostStrLen ; bufSize -= hostStrLen ;
1826- XSTRNCPY ((char * )buf , domainName , bufSize );
1827- buf += domainNameLen ; bufSize -= domainNameLen ;
1824+ XSTRNCPY ((char * )buf , hostStr , ( size_t ) bufSize );
1825+ buf += hostStrLen ; bufSize -= ( int ) hostStrLen ;
1826+ XSTRNCPY ((char * )buf , domainName , ( size_t ) bufSize );
1827+ buf += domainNameLen ; bufSize -= ( int ) domainNameLen ;
18281828 }
18291829 if (reqSz > 0 && reqSzStrLen > 0 ) {
1830- XSTRNCPY ((char * )buf , contentLenStr , bufSize );
1831- buf += contentLenStrLen ; bufSize -= contentLenStrLen ;
1832- XSTRNCPY ((char * )buf , reqSzStr , bufSize );
1833- buf += reqSzStrLen ; bufSize -= reqSzStrLen ;
1830+ XSTRNCPY ((char * )buf , contentLenStr , ( size_t ) bufSize );
1831+ buf += contentLenStrLen ; bufSize -= ( int ) contentLenStrLen ;
1832+ XSTRNCPY ((char * )buf , reqSzStr , ( size_t ) bufSize );
1833+ buf += reqSzStrLen ; bufSize -= ( int ) reqSzStrLen ;
18341834 }
18351835 if (contentTypeLen > 0 ) {
1836- XSTRNCPY ((char * )buf , contentTypeStr , bufSize );
1837- buf += contentTypeStrLen ; bufSize -= contentTypeStrLen ;
1838- XSTRNCPY ((char * )buf , contentType , bufSize );
1839- buf += contentTypeLen ; bufSize -= contentTypeLen ;
1836+ XSTRNCPY ((char * )buf , contentTypeStr , ( size_t ) bufSize );
1837+ buf += contentTypeStrLen ; bufSize -= ( int ) contentTypeStrLen ;
1838+ XSTRNCPY ((char * )buf , contentType , ( size_t ) bufSize );
1839+ buf += contentTypeLen ; bufSize -= ( int ) contentTypeLen ;
18401840 }
18411841 if (exHdrsLen > 0 )
18421842 {
1843- XSTRNCPY ((char * )buf , singleCrLfStr , bufSize );
1843+ XSTRNCPY ((char * )buf , singleCrLfStr , ( size_t ) bufSize );
18441844 buf += singleCrLfStrLen ;
1845- bufSize -= singleCrLfStrLen ;
1846- XSTRNCPY ((char * )buf , exHdrs , bufSize );
1845+ bufSize -= ( int ) singleCrLfStrLen ;
1846+ XSTRNCPY ((char * )buf , exHdrs , ( size_t ) bufSize );
18471847 buf += exHdrsLen ;
1848- bufSize -= exHdrsLen ;
1848+ bufSize -= ( int ) exHdrsLen ;
18491849 }
1850- XSTRNCPY ((char * )buf , doubleCrLfStr , bufSize );
1850+ XSTRNCPY ((char * )buf , doubleCrLfStr , ( size_t ) bufSize );
18511851 buf += doubleCrLfStrLen ;
18521852
18531853#ifdef WOLFIO_DEBUG
@@ -1924,7 +1924,7 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
19241924 /* Note, the library uses the EmbedOcspRespFree() callback to
19251925 * free this buffer. */
19261926 int httpBufSz = HTTP_SCRATCH_BUFFER_SIZE ;
1927- byte * httpBuf = (byte * )XMALLOC (httpBufSz , ctx , DYNAMIC_TYPE_OCSP );
1927+ byte * httpBuf = (byte * )XMALLOC (( size_t ) httpBufSz , ctx , DYNAMIC_TYPE_OCSP );
19281928
19291929 if (httpBuf == NULL ) {
19301930 WOLFSSL_MSG ("Unable to create OCSP response buffer" );
@@ -2031,7 +2031,7 @@ int EmbedCrlLookup(WOLFSSL_CRL* crl, const char* url, int urlSz)
20312031 }
20322032 else {
20332033 int httpBufSz = HTTP_SCRATCH_BUFFER_SIZE ;
2034- byte * httpBuf = (byte * )XMALLOC (httpBufSz , crl -> heap ,
2034+ byte * httpBuf = (byte * )XMALLOC (( size_t ) httpBufSz , crl -> heap ,
20352035 DYNAMIC_TYPE_CRL );
20362036 if (httpBuf == NULL ) {
20372037 WOLFSSL_MSG ("Unable to create CRL response buffer" );
0 commit comments