r26451: Janitorial: fix warnings in lib/registry/
authorKai Blin <kai@samba.org>
Fri, 14 Dec 2007 09:38:26 +0000 (10:38 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:50:16 +0000 (05:50 +0100)
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
source4/lib/registry/hive.h
source4/lib/registry/interface.c
source4/lib/registry/ldb.c
source4/lib/registry/local.c
source4/lib/registry/regf.c
source4/lib/registry/registry.h
source4/lib/registry/rpc.c
source4/lib/registry/tests/hive.c
source4/lib/registry/tests/registry.c

index 532770bcaf04fb23e2b4d0d6203a4d3d55c2c7af..2f00d2fea01b8dc64139f0cb2e9b1a915d462085 100644 (file)
@@ -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)
 {
index 37e5493da8a7801b2138b93a4b6c03047d2ef502..ffb92f8e79691013b4ce701d479b5372bcd3cdf4 100644 (file)
@@ -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);
 
index 8f60a55ae9bdc745214f297e7c256f915cab422b..b914fbab305b6e9a01ed660cdce4fb00ded6a51c 100644 (file)
@@ -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);
index 873e291d5b1927032c854a242d4d7185266f4bab..78acc3150b7059a3cda36c84c03f77672f1bf07d 100644 (file)
@@ -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)
 {
index b54f0cf30adae906ade88677aa305dc0165e77fe..5789a94a6da66cb2bc7322f0b525b651fe94fd64 100644 (file)
@@ -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++;
        }
 
index 210b4c9ada1aead7fc93f874a1a455f0ff5e5e5e..28bd0ad461130f449b16d179992850c9fa8fd448 100644 (file)
@@ -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;
index edd6c6713f1ed348b72a3ad2750997448190928f..a02acbea1eaed892288e2002c9e33618787661d0 100644 (file)
@@ -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);
 
index ac0eecd0acfca3e328ae25812bc184cf41e9d603..7f800b786e74357df7f77467d935e4f939a6820c 100644 (file)
@@ -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)
 {
index 04a91d42fae7eb7b69f053460faa3fc710e14a05..fdb72823952af3e34e4ef7e1a8da19cf9c819277 100644 (file)
@@ -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);
index 8cb04330844e68c97683f3b36418f5d583223f3d..6c520f54edd69619b1582691bfee2988c97c9dab 100644 (file)
@@ -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;