From d18423c1532f514a278ebea05db3d247758aa1b1 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 23 Jul 2013 17:22:23 +0100 Subject: [PATCH] tests: Fix a couple of compile warnings --- src/bitset.h | 27 ++++++++++++++------------- tests/unit/check_bitset.c | 6 +++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/bitset.h b/src/bitset.h index 3113d0a..1170363 100644 --- a/src/bitset.h +++ b/src/bitset.h @@ -46,7 +46,7 @@ static inline void bit_clear_range(char* b, int from, int len) { for (; len > 0; len--) { bit_clear(b, from++); } } -/** Counts the number of contiguous bits in array ''b'', starting at ''from'' +/** Counts the number of contiguous bits in array ''b'', starting at ''from'' * up to a maximum number of bits ''len''. Returns the number of contiguous * bits that are the same as the first one specified. */ @@ -58,7 +58,8 @@ static inline int bit_run_count(char* b, int from, int len) { ; /* FIXME: debug this later */ - /*for (; (from+count) % 64 != 0 && len > 0; len--) + /* + for (; (from+count) % 64 != 0 && len > 0; len--) if (bit_has_value(b, from+count, first_value)) count++; else @@ -71,12 +72,12 @@ static inline int bit_run_count(char* b, int from, int len) { } for (; len > 0; len--) if (bit_is_set(b, from+count)) - count++;*/ - + count++; +*/ return count; } -/** An application of a bitset - a bitset mapping represents a file of ''size'' +/** An application of a bitset - a bitset mapping represents a file of ''size'' * broken down into ''resolution''-sized chunks. The bit set is assumed to * represent one bit per chunk. We also bundle a lock so that the set can be * written reliably by multiple threads. @@ -92,7 +93,7 @@ struct bitset_mapping { * given resolution. */ static inline struct bitset_mapping* bitset_alloc( - uint64_t size, + uint64_t size, int resolution ) { @@ -123,8 +124,8 @@ static inline struct bitset_mapping* bitset_alloc( * file. */ static inline void bitset_set_range( - struct bitset_mapping* set, - uint64_t from, + struct bitset_mapping* set, + uint64_t from, uint64_t len) { INT_FIRST_AND_LAST; @@ -144,12 +145,12 @@ static inline void bitset_set( -/** Clear the bits in a bitset which correspond to the given bytes in the +/** Clear the bits in a bitset which correspond to the given bytes in the * larger file. */ static inline void bitset_clear_range( - struct bitset_mapping* set, - uint64_t from, + struct bitset_mapping* set, + uint64_t from, uint64_t len) { INT_FIRST_AND_LAST; @@ -172,8 +173,8 @@ static inline void bitset_clear( * the bit field. */ static inline int bitset_run_count( - struct bitset_mapping* set, - uint64_t from, + struct bitset_mapping* set, + uint64_t from, uint64_t len) { /* now fix in case len goes past the end of the memory we have diff --git a/tests/unit/check_bitset.c b/tests/unit/check_bitset.c index b496d64..af41846 100644 --- a/tests/unit/check_bitset.c +++ b/tests/unit/check_bitset.c @@ -2,8 +2,8 @@ #include "bitset.h" -#define assert_bitset_is( map, val ) { \ - uint64_t *num = map->bits; \ +#define assert_bitset_is( map, val ) {\ + uint64_t *num = (uint64_t*) map->bits; \ ck_assert_int_eq( val, *num ); \ } @@ -181,7 +181,7 @@ START_TEST( test_bitset_run_count ) struct bitset_mapping* map = bitset_alloc( 64, 1 ); uint64_t run; - assert_bitset_is( map, 0x0000000000000000 ); + assert_bitset_is( map, 0x0000000000000000 ); bitset_set_range( map, 0, 32 ); assert_bitset_is( map, 0x00000000ffffffff );