summaryrefslogtreecommitdiffstats
path: root/source3/utils/editreg.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
commit6d66fb308ab85bd9691d541764e683e6040cf724 (patch)
tree10b705921665cb7bafdd332ca53b8a943e13f0e5 /source3/utils/editreg.c
parentc105c12d122e599fe57dde8b2b73c52231f0c1d2 (diff)
downloadsamba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.gz
samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.xz
samba-6d66fb308ab85bd9691d541764e683e6040cf724.zip
BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
Diffstat (limited to 'source3/utils/editreg.c')
-rw-r--r--source3/utils/editreg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source3/utils/editreg.c b/source3/utils/editreg.c
index 532dffe0683..fe040521503 100644
--- a/source3/utils/editreg.c
+++ b/source3/utils/editreg.c
@@ -420,10 +420,10 @@ typedef struct key_sec_desc_s {
* There should eventually be one to deal with security keys as well
*/
-typedef int (*key_print_f)(char *path, char *key_name, char *class_name,
+typedef int (*key_print_f)(const char *path, char *key_name, char *class_name,
int root, int terminal, int values);
-typedef int (*val_print_f)(char *path, char *val_name, int val_type,
+typedef int (*val_print_f)(const char *path, char *val_name, int val_type,
int data_len, void *data_blk, int terminal,
int first, int last);
@@ -431,7 +431,7 @@ typedef int (*sec_print_f)(SEC_DESC *sec_desc);
typedef struct regf_struct_s REGF;
-int nt_key_iterator(REGF *regf, REG_KEY *key_tree, int bf, char *path,
+int nt_key_iterator(REGF *regf, REG_KEY *key_tree, int bf, const char *path,
key_print_f key_print, sec_print_f sec_print,
val_print_f val_print);
@@ -476,7 +476,7 @@ int nt_key_list_iterator(REGF *regf, KEY_LIST *key_list, int bf, char *path,
return 1;
}
-int nt_key_iterator(REGF *regf, REG_KEY *key_tree, int bf, char *path,
+int nt_key_iterator(REGF *regf, REG_KEY *key_tree, int bf, const char *path,
key_print_f key_print, sec_print_f sec_print,
val_print_f val_print)
{
@@ -875,10 +875,10 @@ typedef struct vk_struct {
typedef struct _val_str {
unsigned int val;
- char * str;
+ const char * str;
} VAL_STR;
-VAL_STR reg_type_names[] = {
+const VAL_STR reg_type_names[] = {
{ 1, "REG_SZ" },
{ 2, "REG_EXPAND_SZ" },
{ 3, "REG_BIN" },
@@ -887,7 +887,7 @@ VAL_STR reg_type_names[] = {
{ 0, NULL },
};
-char *val_to_str(unsigned int val, VAL_STR *val_array)
+const char *val_to_str(unsigned int val, const VAL_STR *val_array)
{
int i = 0;
@@ -1364,7 +1364,7 @@ VAL_KEY *process_vk(REGF *regf, VK_HDR *vk_hdr, int size)
{
char val_name[1024];
int nam_len, dat_len, flag, dat_type, dat_off, vk_id;
- char *val_type;
+ const char *val_type;
VAL_KEY *tmp = NULL;
if (!vk_hdr) return NULL;
@@ -1754,7 +1754,7 @@ int nt_load_registry(REGF *regf)
* key print function here ...
*/
-int print_key(char *path, char *name, char *class_name, int root,
+int print_key(const char *path, char *name, char *class_name, int root,
int terminal, int vals)
{
@@ -1794,7 +1794,7 @@ int print_sec(SEC_DESC *sec_desc)
/*
* Value print function here ...
*/
-int print_val(char *path, char *val_name, int val_type, int data_len,
+int print_val(const char *path, char *val_name, int val_type, int data_len,
void *data_blk, int terminal, int first, int last)
{
char data_asc[1024];