Make the compiler stricter and tidy up code to make the subsequent errors and warnings go away

This commit is contained in:
Alex Young
2012-06-11 13:57:03 +01:00
parent 8825f86726
commit 25fc0969cf
19 changed files with 132 additions and 139 deletions

View File

@@ -176,7 +176,7 @@ START_TEST( test_default_accept_rejects )
END_TEST
Suite* acl_suite()
Suite* acl_suite(void)
{
Suite *s = suite_create("acl");
TCase *tc_create = tcase_create("create");

View File

@@ -62,7 +62,7 @@ START_TEST(test_bit_ranges)
for (i=0; i<64; i++) {
bit_set_range(buffer, i*64, i);
fail_unless(
longs[i] == (1L<<i)-1,
longs[i] == (1UL<<i)-1,
"longs[%ld] = %lx SHOULD BE %lx",
i, longs[i], (1L<<i)-1
);
@@ -140,7 +140,7 @@ START_TEST(test_bitset)
}
END_TEST
Suite* bitset_suite()
Suite* bitset_suite(void)
{
Suite *s = suite_create("bitset");
TCase *tc_core = tcase_create("bitset");

View File

@@ -5,6 +5,8 @@
#include "client.h"
#include <unistd.h>
#define FAKE_SERVER ((struct server *)23)
#define FAKE_SOCKET (42)
@@ -46,6 +48,8 @@ START_TEST( test_opens_stop_signal )
END_TEST
int fd_is_closed(int);
START_TEST( test_closes_stop_signal )
{
struct client *c = client_create( FAKE_SERVER, FAKE_SOCKET );
@@ -78,7 +82,7 @@ START_TEST( test_read_request_quits_on_stop_signal )
END_TEST
Suite *client_suite()
Suite *client_suite(void)
{
Suite *s = suite_create("client");

View File

@@ -182,7 +182,7 @@ START_TEST(test_reply_handle)
END_TEST
Suite *nbdtypes_suite()
Suite *nbdtypes_suite(void)
{
Suite *s = suite_create( "nbdtypes" );
TCase *tc_init = tcase_create( "nbd_init" );

View File

@@ -1,6 +1,8 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <check.h>
#include <mcheck.h>
@@ -157,19 +159,8 @@ START_TEST( test_destroy_closes_write_pipe )
END_TEST
START_TEST( test_signal_after_destroy_fails )
{
struct self_pipe* sig;
sig = self_pipe_create();
self_pipe_destroy( sig );
fail_unless( self_pipe_signal( sig ) == 0, "Signaling a closed self_pipe didn't return 0." );
}
END_TEST
Suite *self_pipe_suite()
Suite *self_pipe_suite(void)
{
Suite *s = suite_create("self_pipe");

View File

@@ -16,7 +16,7 @@
char * dummy_file;
char *make_tmpfile()
char *make_tmpfile(void)
{
FILE *fp;
char *fn_buf;
@@ -84,11 +84,13 @@ int connect_client( char *addr, int actual_port )
{
int client_fd;
struct addrinfo hint = {0};
struct addrinfo hint;
struct addrinfo *ailist, *aip;
memset( &hint, '\0', sizeof( struct addrinfo ) );
hint.ai_socktype = SOCK_STREAM;
myfail_if( getaddrinfo( "127.0.0.7", NULL, &hint, &ailist ) != 0, "getaddrinfo failed." );
myfail_if( getaddrinfo( addr, NULL, &hint, &ailist ) != 0, "getaddrinfo failed." );
int connected = 0;
for( aip = ailist; aip; aip = aip->ai_next ) {
@@ -106,6 +108,13 @@ int connect_client( char *addr, int actual_port )
return client_fd;
}
/* These are "internal" functions we need for the following test. We
* shouldn't need them but there's no other way at the moment. */
void serve_open_server_socket( struct server * );
int server_port( struct server * );
void server_accept( struct server * );
int fd_is_closed( int );
void server_close_clients( struct server * );
START_TEST( test_acl_update_closes_bad_client )
{
@@ -197,7 +206,7 @@ START_TEST( test_acl_update_leaves_good_client )
END_TEST
Suite* serve_suite()
Suite* serve_suite(void)
{
Suite *s = suite_create("serve");
TCase *tc_acl_update = tcase_create("acl_update");