Fix MSVC warning in sample programs

The warning was caused because of conversions from size_t to int, which
can cause data loss. The files affected are:
* ssl_client2.c
* ssl_server2.c
* ssl_mail_client.c
This commit is contained in:
Andres Amaya Garcia 2017-07-06 14:07:53 +01:00 committed by Simon Butcher
parent 7d661f83e1
commit 2d0a5840fe
3 changed files with 4 additions and 4 deletions

View File

@ -1267,7 +1267,7 @@ send_request:
len = polarssl_snprintf( (char *) buf, sizeof(buf) - 1, GET_REQUEST,
opt.request_page );
tail_len = strlen( GET_REQUEST_END );
tail_len = (int) strlen( GET_REQUEST_END );
/* Add padding to GET request to reach opt.request_size in length */
if( opt.request_size != DFL_REQUEST_SIZE &&

View File

@ -57,8 +57,8 @@
#include <unistd.h>
#else
#include <io.h>
#define read _read
#define write _write
#define read(fd, buf, len) _read( fd, (void *)buf, (unsigned int)len )
#define write(fd, buf, len) _write( fd, (const void *)buf, (unsigned int)len )
#endif
#if defined(_WIN32) || defined(_WIN32_WCE)

View File

@ -1791,7 +1791,7 @@ data_exchange:
unsigned char *larger_buf;
ori_len = ret;
extra_len = ssl_get_bytes_avail( &ssl );
extra_len = (int) ssl_get_bytes_avail( &ssl );
larger_buf = polarssl_malloc( ori_len + extra_len + 1 );
if( larger_buf == NULL )