diff options
author | Noel Power <noel.power@suse.com> | 2019-05-03 12:53:27 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-05-10 01:15:19 +0000 |
commit | 09c4611b01bb7716b81ab8a594f6dcbe66cda1db (patch) | |
tree | 7d252ba53b66707f3b412e5eccc0c8e0e8a6e100 /source3/registry | |
parent | 61dd7d6f06e45a101a304bf4a11aab624e5d744c (diff) | |
download | samba-09c4611b01bb7716b81ab8a594f6dcbe66cda1db.tar.gz |
s3/registry: fix various 'cast between incompatible function' warnings
[3395/3524] Compiling source3/registry/reg_import.c
../../source3/registry/reg_import.c: In function ‘reg_import_adapter’:
../../source3/registry/reg_import.c:237:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **)’} [-Werror=cast-function-type]
cb.openkey = (reg_import_callback_openkey_t)&nop;
^
../../source3/registry/reg_import.c:240:17: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *)’ {aka ‘struct <anonymous> (*)(void *, void *)’} [-Werror=cast-function-type]
cb.closekey = (reg_import_callback_closekey_t)&nop;
^
../../source3/registry/reg_import.c:243:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **, _Bool *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **, _Bool *)’} [-Werror=cast-function-type]
cb.createkey = (reg_import_callback_createkey_t)&nop;
^
../../source3/registry/reg_import.c:246:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type]
cb.deletekey = (reg_import_callback_deletekey_t)&nop;
^
../../source3/registry/reg_import.c:249:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type]
cb.deleteval = (reg_import_callback_deleteval_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>
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_import.c | 61 |
1 files changed, 45 insertions, 16 deletions
diff --git a/source3/registry/reg_import.c b/source3/registry/reg_import.c index 01d85af4e87..aef8645ed9e 100644 --- a/source3/registry/reg_import.c +++ b/source3/registry/reg_import.c @@ -39,18 +39,18 @@ static int reg_parse_callback_key(struct reg_import *cb_private, static int reg_parse_callback_val(struct reg_import *cb_private, const char *name, uint32_t type, - const uint8_t *data, uint32_t len); + const uint8_t *data, size_t len); static int reg_parse_callback_val_registry_value(struct reg_import *cb_private, const char *name, uint32_t type, const uint8_t *data, - uint32_t len); + size_t len); static int reg_parse_callback_val_regval_blob(struct reg_import *cb_private, const char *name, uint32_t type, const uint8_t *data, - uint32_t len); + size_t len); static int reg_parse_callback_val_del(struct reg_import *cb_private, const char *name); @@ -118,11 +118,11 @@ int reg_parse_callback_key(struct reg_import *p, /*----------------------------------------------------------------------------*/ int reg_parse_callback_val(struct reg_import *p, const char *name, uint32_t type, - const uint8_t *data, uint32_t len) + const uint8_t *data, size_t len) { WERROR werr = WERR_OK; - DEBUG(TL, ("%s(%x): >%s< = [%x]\n", __FUNCTION__, type, name, len)); + DEBUG(TL, ("%s(%x): >%s< = [%zx]\n", __FUNCTION__, type, name, len)); DEBUG_ADD_HEX(TL, data, len); werr = p->call.setval.blob(p->call.data, p->open_key, name, type, @@ -138,7 +138,7 @@ int reg_parse_callback_val(struct reg_import *p, /*----------------------------------------------------------------------------*/ int reg_parse_callback_val_registry_value(struct reg_import *p, const char *name, uint32_t type, - const uint8_t *data, uint32_t len) + const uint8_t *data, size_t len) { WERROR werr = WERR_OK; struct registry_value val = { @@ -146,7 +146,7 @@ int reg_parse_callback_val_registry_value(struct reg_import *p, .data = data_blob_talloc(p, data, len), }; - DEBUG(TL, ("%s(%x): >%s< = [%x]\n", __FUNCTION__, type, name, len)); + DEBUG(TL, ("%s(%x): >%s< = [%zx]\n", __FUNCTION__, type, name, len)); DEBUG_ADD_HEX(TL, data, len); werr = p->call.setval.registry_value(p->call.data, p->open_key, @@ -163,13 +163,13 @@ int reg_parse_callback_val_registry_value(struct reg_import *p, /*----------------------------------------------------------------------------*/ int reg_parse_callback_val_regval_blob(struct reg_import *p, const char *name, uint32_t type, - const uint8_t *data, uint32_t len) + const uint8_t *data, size_t len) { WERROR werr = WERR_OK; void* mem_ctx = talloc_new(p); struct regval_blob *v = NULL; - DEBUG(TL, ("%s(%x): >%s< = [%x]\n", __FUNCTION__, type, name, len)); + DEBUG(TL, ("%s(%x): >%s< = [%zx]\n", __FUNCTION__, type, name, len)); DEBUG_ADD_HEX(TL, data, len); v = regval_compose(mem_ctx, name, type, data, len); @@ -219,11 +219,35 @@ int reg_parse_callback_comment(struct reg_import *cb_private, } /******************************************************************************/ -static int nop(void *data) +static WERROR nop_callback_open(void* private_data, + void* parent, + const char* name, + void** key) { - return 0; + return WERR_OK; +} + +static WERROR nop_callback_close(void* private_data, void* key) +{ + return WERR_OK; } +static WERROR nop_callback_create(void* private_data, + void* parent, + const char* name, + void** key, + bool* existing) +{ + return WERR_OK; +} + + +static WERROR nop_callback_del(void* private_data, + void* parent, + const char* name) +{ + return WERR_OK; +} struct reg_parse_callback *reg_import_adapter(TALLOC_CTX *talloc_ctx, struct reg_import_callback cb) @@ -234,19 +258,24 @@ struct reg_parse_callback *reg_import_adapter(TALLOC_CTX *talloc_ctx, goto fail; } if (cb.openkey == NULL) { - cb.openkey = (reg_import_callback_openkey_t)&nop; + cb.openkey = (reg_import_callback_openkey_t)&nop_callback_open; } if (cb.closekey == NULL) { - cb.closekey = (reg_import_callback_closekey_t)&nop; + cb.closekey = + (reg_import_callback_closekey_t)&nop_callback_close; } if (cb.createkey == NULL) { - cb.createkey = (reg_import_callback_createkey_t)&nop; + cb.createkey = + (reg_import_callback_createkey_t)&nop_callback_create; } if (cb.deletekey == NULL) { - cb.deletekey = (reg_import_callback_deletekey_t)&nop; + cb.deletekey = + (reg_import_callback_deletekey_t)&nop_callback_del; + } if (cb.deleteval == NULL) { - cb.deleteval = (reg_import_callback_deleteval_t)&nop; + cb.deleteval = + (reg_import_callback_deleteval_t)&nop_callback_del; } p->call = cb; |