- Major type rewrite of int to size_t for most variables and arguments used for buffer lengths and loops

This commit is contained in:
Paul Bakker 2011-04-24 08:57:21 +00:00
parent 1be81a4e5f
commit 23986e5d5d
67 changed files with 1041 additions and 949 deletions

View file

@ -55,7 +55,8 @@
int main( int argc, char *argv[] )
{
int ret = 1, i, n;
int keylen, mode, lastn;
int mode, lastn;
size_t keylen;
FILE *fkey, *fin = NULL, *fout = NULL;
char *p;

View file

@ -56,7 +56,8 @@
int main( int argc, char *argv[] )
{
int ret = 1, i, n;
int keylen, mode, lastn, olen;
int mode, lastn;
size_t keylen, olen;
FILE *fkey, *fin = NULL, *fout = NULL;
char *p;
@ -291,7 +292,7 @@ int main( int argc, char *argv[] )
for( offset = 0; offset < filesize; offset += cipher_get_block_size( &cipher_ctx ) )
{
n = ( filesize - offset > cipher_get_block_size( &cipher_ctx ) ) ?
cipher_get_block_size( &cipher_ctx ) : (int) ( filesize - offset );
cipher_get_block_size( &cipher_ctx ) : (unsigned int) ( filesize - offset );
if( fread( buffer, 1, n, fin ) != (size_t) n )
{

View file

@ -83,7 +83,7 @@ static int generic_check( const md_info_t *md_info, char *filename )
n = sizeof( line );
while( fgets( line, n - 1, f ) != NULL )
while( fgets( line, (int) n - 1, f ) != NULL )
{
n = strlen( line );

View file

@ -83,7 +83,7 @@ static int md5_check( char *filename )
n = sizeof( line );
while( fgets( line, n - 1, f ) != NULL )
while( fgets( line, (int) n - 1, f ) != NULL )
{
n = strlen( line );

View file

@ -83,7 +83,7 @@ static int sha1_check( char *filename )
n = sizeof( line );
while( fgets( line, n - 1, f ) != NULL )
while( fgets( line, (int) n - 1, f ) != NULL )
{
n = strlen( line );

View file

@ -83,7 +83,7 @@ static int sha2_check( char *filename )
n = sizeof( line );
while( fgets( line, n - 1, f ) != NULL )
while( fgets( line, (int) n - 1, f ) != NULL )
{
n = strlen( line );

View file

@ -44,7 +44,8 @@ int main( void )
{
FILE *f;
int ret, n, buflen;
int ret;
size_t n, buflen;
int server_fd = -1;
unsigned char *p, *end;
@ -123,7 +124,7 @@ int main( void )
}
n = buflen = ( buf[0] << 8 ) | buf[1];
if( buflen < 1 || buflen > (int) sizeof( buf ) )
if( buflen < 1 || buflen > sizeof( buf ) )
{
printf( " failed\n ! Got an invalid buffer length\n\n" );
goto exit;
@ -134,7 +135,7 @@ int main( void )
*/
memset( buf, 0, sizeof( buf ) );
if( ( ret = net_recv( &server_fd, buf, n ) ) != n )
if( ( ret = net_recv( &server_fd, buf, n ) ) != (int) n )
{
printf( " failed\n ! net_recv returned %d\n\n", ret );
goto exit;
@ -162,7 +163,7 @@ int main( void )
printf( "\n . Verifying the server's RSA signature" );
fflush( stdout );
if( ( n = (int)( end - p ) ) != rsa.len )
if( ( n = (size_t) ( end - p ) ) != rsa.len )
{
ret = 1;
printf( " failed\n ! Invalid RSA signature size\n\n" );
@ -192,7 +193,7 @@ int main( void )
goto exit;
}
if( ( ret = net_send( &server_fd, buf, n ) ) != n )
if( ( ret = net_send( &server_fd, buf, n ) ) != (int) n )
{
printf( " failed\n ! net_send returned %d\n\n", ret );
goto exit;

View file

@ -44,7 +44,8 @@ int main( void )
{
FILE *f;
int ret, n, buflen;
int ret;
size_t n, buflen;
int listen_fd = -1;
int client_fd = -1;
@ -177,7 +178,7 @@ int main( void )
buf2[1] = (unsigned char)( buflen );
if( ( ret = net_send( &client_fd, buf2, 2 ) ) != 2 ||
( ret = net_send( &client_fd, buf, buflen ) ) != buflen )
( ret = net_send( &client_fd, buf, buflen ) ) != (int) buflen )
{
printf( " failed\n ! net_send returned %d\n\n", ret );
goto exit;
@ -192,7 +193,7 @@ int main( void )
memset( buf, 0, sizeof( buf ) );
n = dhm.len;
if( ( ret = net_recv( &client_fd, buf, n ) ) != n )
if( ( ret = net_recv( &client_fd, buf, n ) ) != (int) n )
{
printf( " failed\n ! net_recv returned %d\n\n", ret );
goto exit;

View file

@ -36,7 +36,8 @@
int main( int argc, char *argv[] )
{
FILE *f;
int ret, i;
int ret;
size_t i;
rsa_context rsa;
unsigned char hash[20];
unsigned char buf[512];

View file

@ -36,7 +36,8 @@
int main( int argc, char *argv[] )
{
FILE *f;
int ret, i, c;
int ret, c;
size_t i;
rsa_context rsa;
unsigned char hash[20];
unsigned char buf[512];

View file

@ -43,7 +43,8 @@
int main( int argc, char *argv[] )
{
FILE *f;
int ret, i;
int ret;
size_t i;
rsa_context rsa;
unsigned char hash[20];
unsigned char buf[512];

View file

@ -92,7 +92,8 @@ int main( int argc, char *argv[] )
x509_cert cacert;
x509_cert clicert;
rsa_context rsa;
int i, j, n;
int i;
size_t j, n;
char *p, *q;
const int *list;