- Improved compile-time compatibility with mingw32 64-bit versions

This commit is contained in:
Paul Bakker 2011-04-24 16:08:12 +00:00
parent f4a3f301fd
commit f4f6968a86
3 changed files with 8 additions and 7 deletions

View File

@ -96,7 +96,7 @@ void debug_print_buf( const ssl_context *ssl, int level,
return; return;
snprintf( str, maxlen, "%s(%04d): dumping '%s' (%d bytes)\n", snprintf( str, maxlen, "%s(%04d): dumping '%s' (%d bytes)\n",
file, line, text, len ); file, line, text, (unsigned int) len );
str[maxlen] = '\0'; str[maxlen] = '\0';
ssl->f_dbg( ssl->p_dbg, level, str ); ssl->f_dbg( ssl->p_dbg, level, str );
@ -111,7 +111,8 @@ void debug_print_buf( const ssl_context *ssl, int level,
if( i > 0 ) if( i > 0 )
ssl->f_dbg( ssl->p_dbg, level, "\n" ); ssl->f_dbg( ssl->p_dbg, level, "\n" );
snprintf( str, maxlen, "%s(%04d): %04x: ", file, line, i ); snprintf( str, maxlen, "%s(%04d): %04x: ", file, line,
(unsigned int) i );
str[maxlen] = '\0'; str[maxlen] = '\0';
ssl->f_dbg( ssl->p_dbg, level, str ); ssl->f_dbg( ssl->p_dbg, level, str );

View File

@ -40,8 +40,8 @@
#pragma comment( lib, "ws2_32.lib" ) #pragma comment( lib, "ws2_32.lib" )
#endif #endif
#define read(fd,buf,len) recv(fd,buf,(int) len,0) #define read(fd,buf,len) recv(fd,(char*)buf,(int) len,0)
#define write(fd,buf,len) send(fd,buf,(int) len,0) #define write(fd,buf,len) send(fd,(char*)buf,(int) len,0)
#define close(fd) closesocket(fd) #define close(fd) closesocket(fd)
static int wsa_init_done = 0; static int wsa_init_done = 0;
@ -257,7 +257,7 @@ int net_accept( int bind_fd, int *client_fd, void *client_ip )
int net_set_block( int fd ) int net_set_block( int fd )
{ {
#if defined(_WIN32) || defined(_WIN32_WCE) #if defined(_WIN32) || defined(_WIN32_WCE)
long n = 0; u_long n = 0;
return( ioctlsocket( fd, FIONBIO, &n ) ); return( ioctlsocket( fd, FIONBIO, &n ) );
#else #else
return( fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) & ~O_NONBLOCK ) ); return( fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) & ~O_NONBLOCK ) );
@ -267,7 +267,7 @@ int net_set_block( int fd )
int net_set_nonblock( int fd ) int net_set_nonblock( int fd )
{ {
#if defined(_WIN32) || defined(_WIN32_WCE) #if defined(_WIN32) || defined(_WIN32_WCE)
long n = 1; u_long n = 1;
return( ioctlsocket( fd, FIONBIO, &n ) ); return( ioctlsocket( fd, FIONBIO, &n ) );
#else #else
return( fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) | O_NONBLOCK ) ); return( fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) | O_NONBLOCK ) );

View File

@ -2411,7 +2411,7 @@ int x509parse_cert_info( char *buf, size_t size, const char *prefix,
SAFE_SNPRINTF(); SAFE_SNPRINTF();
ret = snprintf( p, n, "\n%sRSA key size : %d bits\n", prefix, ret = snprintf( p, n, "\n%sRSA key size : %d bits\n", prefix,
crt->rsa.N.n * (int) sizeof( unsigned long ) * 8 ); (int) crt->rsa.N.n * (int) sizeof( unsigned long ) * 8 );
SAFE_SNPRINTF(); SAFE_SNPRINTF();
return( (int) ( size - n ) ); return( (int) ( size - n ) );