modify library/net.c to use polarssl_snprintf

This commit is contained in:
Rich Evans 2015-01-30 10:58:35 +00:00
parent 8f3a9436a9
commit a18b11f285

View file

@ -129,6 +129,12 @@ typedef UINT32 uint32_t;
(((unsigned long )(n) & 0xFF000000) >> 24))
#endif
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#define polarssl_snprintf snprintf
#endif
unsigned short net_htons( unsigned short n );
unsigned long net_htonl( unsigned long n );
#define net_htons(n) POLARSSL_HTONS(n)
@ -173,7 +179,7 @@ int net_connect( int *fd, const char *host, int port )
/* getaddrinfo expects port as a string */
memset( port_str, 0, sizeof( port_str ) );
snprintf( port_str, sizeof( port_str ), "%d", port );
polarssl_snprintf( port_str, sizeof( port_str ), "%d", port );
/* Do name resolution with both IPv6 and IPv4, but only TCP */
memset( &hints, 0, sizeof( hints ) );
@ -259,7 +265,7 @@ int net_bind( int *fd, const char *bind_ip, int port )
/* getaddrinfo expects port as a string */
memset( port_str, 0, sizeof( port_str ) );
snprintf( port_str, sizeof( port_str ), "%d", port );
polarssl_snprintf( port_str, sizeof( port_str ), "%d", port );
/* Bind to IPv6 and/or IPv4, but only in TCP */
memset( &hints, 0, sizeof( hints ) );