s3/registry: Fix incompatible func casts
authorNoel Power <noel.power@suse.com>
Fri, 3 May 2019 11:06:45 +0000 (12:06 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2019 01:15:18 +0000 (01:15 +0000)
[3425/3524] Compiling source3/registry/reg_parse.c
../../source3/registry/reg_parse.c: In function ‘reg_parse_new’:
../../source3/registry/reg_parse.c:223:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char **, size_t,  _Bool)’ {aka ‘int (*)(void *, const char **, long unsigned int,  _Bool)’} [-Werror=cast-function-type]
   cb.key = (reg_parse_callback_key_t)&nop;
            ^
../../source3/registry/reg_parse.c:226:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *, uint32_t,  const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int,  const unsigned char *, unsigned int)’} [-Werror=cast-function-type]
   cb.val = (reg_parse_callback_val_t)&nop;
            ^
../../source3/registry/reg_parse.c:229:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type]
   cb.val_del = (reg_parse_callback_val_del_t)&nop;
                ^
../../source3/registry/reg_parse.c:232:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type]
   cb.comment = (reg_parse_callback_comment_t)&nop;

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/registry/reg_parse.c

index c276c7e..81815a4 100644 (file)
@@ -192,11 +192,27 @@ static bool act_comment (struct reg_parse* p, const char* txt)
 /**@}*/
 
 
-static int nop(void* data)
+static int nop_callback_key(void* private_data,
+               const char* key[],
+               size_t klen,
+               bool del)
 {
        return 0;
 }
 
+static int nop_callback_val(void* private_data,
+               const char* name,
+               uint32_t type,
+               const uint8_t* data,
+               size_t len)
+{
+       return 0;
+}
+
+static int nop_callback_del(void* data, const char* str)
+{
+       return 0;
+}
 
 struct reg_parse* reg_parse_new(const void* ctx,
                                struct reg_parse_callback cb,
@@ -220,16 +236,17 @@ struct reg_parse* reg_parse_new(const void* ctx,
 
        s->valtype = 0;
        if (cb.key == NULL) {
-               cb.key = (reg_parse_callback_key_t)&nop;
+               cb.key = (reg_parse_callback_key_t)&nop_callback_key;
        }
        if (cb.val == NULL) {
-               cb.val = (reg_parse_callback_val_t)&nop;
+               cb.val = (reg_parse_callback_val_t)&nop_callback_val;
        }
        if (cb.val_del == NULL) {
-               cb.val_del = (reg_parse_callback_val_del_t)&nop;
+               cb.val_del = (reg_parse_callback_val_del_t)&nop_callback_del;
        }
        if (cb.comment == NULL) {
-               cb.comment = (reg_parse_callback_comment_t)&nop;
+               cb.comment =
+                       (reg_parse_callback_comment_t)&nop_callback_del;
        }
 
        s->call = cb;