From: Arran Cudbard-Bell Date: Fri, 11 May 2018 11:25:44 +0000 (+0600) Subject: Fix issues raised by GCC X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c877c7c685d69f5f2e3281efe33c2ed6e434edd;p=thirdparty%2Ffreeradius-server.git Fix issues raised by GCC --- diff --git a/src/include/cursor.h b/src/include/cursor.h index c394b7888d7..30410304d4f 100644 --- a/src/include/cursor.h +++ b/src/include/cursor.h @@ -95,7 +95,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull); * - The first item returned by the iterator. */ #define fr_cursor_talloc_iter_init(_cursor, _head, _iter, _ctx, _type) \ - _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, #_type) + _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, #_type) /** Initialise a cursor with a custom iterator * @@ -109,7 +109,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull); * - The first item returned by the iterator. */ #define fr_cursor_iter_init(_cursor, _head, _iter, _ctx) \ - _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, NULL) + _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, NULL) /** Initialise a cursor with runtime talloc type safety checks * @@ -121,7 +121,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull); * - The first item in the list. */ #define fr_cursor_talloc_init(_cursor, _head, _type) \ - _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), NULL, NULL, #_type) + _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), NULL, NULL, #_type) /** Initialise a cursor * diff --git a/src/include/pair.h b/src/include/pair.h index 8c53adbce22..b7901194d02 100644 --- a/src/include/pair.h +++ b/src/include/pair.h @@ -263,15 +263,15 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool * int fr_pair_list_copy(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR *from); int fr_pair_list_copy_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *da); + VALUE_PAIR *from, fr_dict_attr_t const *da); int fr_pair_list_copy_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *parent_da); + VALUE_PAIR *from, fr_dict_attr_t const *parent_da); void fr_pair_list_move(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from); int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *da); + VALUE_PAIR **from, fr_dict_attr_t const *da); int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *da); + VALUE_PAIR **from, fr_dict_attr_t const *da); /* Value manipulation */ int fr_pair_value_from_str(VALUE_PAIR *vp, char const *value, size_t len); diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index e15e983c49c..236ba721b5c 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -1689,7 +1689,7 @@ int fr_pair_list_copy(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR *from) * - -1 on error. */ int fr_pair_list_copy_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *da) + VALUE_PAIR *from, fr_dict_attr_t const *da) { fr_cursor_t src, dst, tmp; @@ -1742,7 +1742,7 @@ int fr_pair_list_copy_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, * - -1 on error. */ int fr_pair_list_copy_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *parent_da) + VALUE_PAIR *from, fr_dict_attr_t const *parent_da) { fr_cursor_t src, dst, tmp; @@ -1946,7 +1946,7 @@ void fr_pair_list_move(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from) * - 0 if no pairs were moved. */ int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, - VALUE_PAIR const *from, fr_dict_attr_t const *da) + VALUE_PAIR **from, fr_dict_attr_t const *da) { fr_cursor_t src, dst; @@ -1959,7 +1959,7 @@ int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, } fr_cursor_talloc_init(&dst, to, VALUE_PAIR); - for (vp = fr_cursor_talloc_iter_init(&src, &from, fr_pair_iter_next_by_da, da, VALUE_PAIR); + for (vp = fr_cursor_talloc_iter_init(&src, from, fr_pair_iter_next_by_da, da, VALUE_PAIR); vp; vp = fr_cursor_next(&src), cnt++) { VP_VERIFY(vp); @@ -1984,8 +1984,8 @@ int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to, * - >0 number of pairs moved. * - 0 if no pairs were moved. */ -int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR const *from, - fr_dict_attr_t const *parent_da) +int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, + VALUE_PAIR **from, fr_dict_attr_t const *parent_da) { fr_cursor_t src, dst; @@ -1998,7 +1998,7 @@ int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR c } fr_cursor_talloc_init(&dst, to, VALUE_PAIR); - for (vp = fr_cursor_talloc_iter_init(&src, &from, fr_pair_iter_next_by_ancestor, parent_da, VALUE_PAIR); + for (vp = fr_cursor_talloc_iter_init(&src, from, fr_pair_iter_next_by_ancestor, parent_da, VALUE_PAIR); vp; vp = fr_cursor_next(&src), cnt++) { VP_VERIFY(vp); diff --git a/src/main/cf_parse.c b/src/main/cf_parse.c index f5437c656e0..53cd6ee4ca9 100644 --- a/src/main/cf_parse.c +++ b/src/main/cf_parse.c @@ -89,8 +89,16 @@ static inline int CC_HINT(nonnull) fr_item_validate_ipaddr(CONF_SECTION *cs, cha default: return -1; } - default: return 0; + + case FR_TYPE_IPV4_PREFIX: + case FR_TYPE_IPV6_PREFIX: + case FR_TYPE_COMBO_IP_PREFIX: + return 0; + + default: + rad_assert(0); + return -1; } }