From 45015eda2421253f858f0a4500a57c2855f9686c Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 14 Dec 2007 10:38:26 +0100 Subject: r26451: Janitorial: fix warnings in lib/registry/ This does not fix the discarded qualifier warnings in tests, as the test data is currently passed as const. Jelmer wants to provide a test function that passes non-const test data, thus allowing for a cleaner way to fix those warnings. (This used to be commit 46dfa63d4f7381c5c6ce3f4b8b0bd9aa9e16950c) --- source4/lib/registry/dir.c | 2 +- source4/lib/registry/hive.h | 2 +- source4/lib/registry/interface.c | 2 +- source4/lib/registry/ldb.c | 2 +- source4/lib/registry/local.c | 8 ++++---- source4/lib/registry/regf.c | 8 +++----- source4/lib/registry/registry.h | 4 ++-- source4/lib/registry/rpc.c | 2 +- source4/lib/registry/tests/hive.c | 6 +++--- source4/lib/registry/tests/registry.c | 2 +- 10 files changed, 18 insertions(+), 20 deletions(-) (limited to 'source4') diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c index 532770bcaf..2f00d2fea0 100644 --- a/source4/lib/registry/dir.c +++ b/source4/lib/registry/dir.c @@ -272,7 +272,7 @@ static WERROR reg_dir_get_value(TALLOC_CTX *mem_ctx, } static WERROR reg_dir_enum_value(TALLOC_CTX *mem_ctx, - const struct hive_key *key, int idx, + struct hive_key *key, int idx, const char **name, uint32_t *type, DATA_BLOB *data) { diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h index 37e5493da8..ffb92f8e79 100644 --- a/source4/lib/registry/hive.h +++ b/source4/lib/registry/hive.h @@ -82,7 +82,7 @@ struct hive_operations { * Retrieve a registry value with a specific index. */ WERROR (*enum_value) (TALLOC_CTX *mem_ctx, - const struct hive_key *key, int idx, + struct hive_key *key, int idx, const char **name, uint32_t *type, DATA_BLOB *data); diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c index 8f60a55ae9..b914fbab30 100644 --- a/source4/lib/registry/interface.c +++ b/source4/lib/registry/interface.c @@ -74,7 +74,7 @@ _PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, } /** Get predefined key by id. */ -_PUBLIC_ WERROR reg_get_predefined_key(const struct registry_context *ctx, +_PUBLIC_ WERROR reg_get_predefined_key(struct registry_context *ctx, uint32_t hkey, struct registry_key **key) { return ctx->ops->get_predefined_key(ctx, hkey, key); diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 873e291d5b..78acc3150b 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -249,7 +249,7 @@ static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, return WERR_OK; } -static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, const struct hive_key *k, +static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k, int idx, const char **name, uint32_t *data_type, DATA_BLOB *data) { diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index b54f0cf30a..5789a94a6d 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -126,7 +126,7 @@ static WERROR local_open_key(TALLOC_CTX *mem_ctx, return WERR_OK; } -WERROR local_get_predefined_key(const struct registry_context *ctx, +WERROR local_get_predefined_key(struct registry_context *ctx, uint32_t key_id, struct registry_key **key) { struct registry_local *rctx = talloc_get_type(ctx, @@ -168,7 +168,7 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx, struct security_descriptor *security, struct registry_key **key) { - const struct local_key *local_parent; + struct local_key *local_parent; struct hive_key *hivekey; const char **elements; int i; @@ -177,11 +177,11 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx, last_part = strrchr(name, '\\'); if (last_part == NULL) { last_part = name; - local_parent = (const struct local_key *)parent_key; + local_parent = (struct local_key *)parent_key; } else { W_ERROR_NOT_OK_RETURN(reg_open_key(mem_ctx, parent_key, talloc_strndup(mem_ctx, name, last_part-name), - &local_parent)); + (struct registry_key **)&local_parent)); last_part++; } diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 210b4c9ada..28bd0ad461 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -488,7 +488,7 @@ static struct regf_key_data *regf_get_key(TALLOC_CTX *ctx, } -static WERROR regf_get_value(TALLOC_CTX *ctx, const struct hive_key *key, +static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key, int idx, const char **name, uint32_t *data_type, DATA_BLOB *data) { @@ -1529,8 +1529,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset, static WERROR regf_del_value (struct hive_key *key, const char *name) { - const struct regf_key_data *private_data = - (const struct regf_key_data *)key; + struct regf_key_data *private_data = (struct regf_key_data *)key; struct regf_data *regf = private_data->hive; struct nk_block *nk = private_data->nk; struct vk_block vk; @@ -1703,8 +1702,7 @@ static WERROR regf_add_key(TALLOC_CTX *ctx, const struct hive_key *parent, static WERROR regf_set_value(struct hive_key *key, const char *name, uint32_t type, const DATA_BLOB data) { - const struct regf_key_data *private_data = - (const struct regf_key_data *)key; + struct regf_key_data *private_data = (struct regf_key_data *)key; struct regf_data *regf = private_data->hive; struct nk_block *nk = private_data->nk; struct vk_block vk; diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index edd6c6713f..a02acbea1e 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -94,7 +94,7 @@ struct registry_operations { WERROR (*flush_key) (struct registry_key *key); - WERROR (*get_predefined_key) (const struct registry_context *ctx, + WERROR (*get_predefined_key) (struct registry_context *ctx, uint32_t key_id, struct registry_key **key); @@ -195,7 +195,7 @@ const char *reg_get_predef_name(uint32_t hkey); WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char *name, struct registry_key **key); -WERROR reg_get_predefined_key(const struct registry_context *ctx, +WERROR reg_get_predefined_key(struct registry_context *ctx, uint32_t hkey, struct registry_key **key); diff --git a/source4/lib/registry/rpc.c b/source4/lib/registry/rpc.c index ac0eecd0ac..7f800b786e 100644 --- a/source4/lib/registry/rpc.c +++ b/source4/lib/registry/rpc.c @@ -91,7 +91,7 @@ static struct { static WERROR rpc_query_key(const struct registry_key *k); -static WERROR rpc_get_predefined_key(const struct registry_context *ctx, +static WERROR rpc_get_predefined_key(struct registry_context *ctx, uint32_t hkey_type, struct registry_key **k) { diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 04a91d42fa..fdb7282395 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -290,7 +290,7 @@ static bool hive_setup_dir(struct torture_context *tctx, void **data) { struct hive_key *key; WERROR error; - const char *dirname; + char *dirname; NTSTATUS status; status = torture_temp_dir(tctx, "hive-dir", &dirname); @@ -314,7 +314,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data) { struct hive_key *key; WERROR error; - const char *dirname; + char *dirname; NTSTATUS status; status = torture_temp_dir(tctx, "hive-ldb", &dirname); @@ -338,7 +338,7 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data) { struct hive_key *key; WERROR error; - const char *dirname; + char *dirname; NTSTATUS status; status = torture_temp_dir(tctx, "hive-dir", &dirname); diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 8cb0433084..6c520f54ed 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -535,7 +535,7 @@ static bool setup_local_registry(struct torture_context *tctx, void **data) { struct registry_context *rctx; WERROR error; - const char *tempdir; + char *tempdir; NTSTATUS status; struct hive_key *hive_key; const char *filename; -- cgit