diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-01-02 09:07:17 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-01-02 09:07:17 +0000 |
commit | 6d66fb308ab85bd9691d541764e683e6040cf724 (patch) | |
tree | 10b705921665cb7bafdd332ca53b8a943e13f0e5 /source3/rpcclient | |
parent | c105c12d122e599fe57dde8b2b73c52231f0c1d2 (diff) | |
download | samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.gz samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.bz2 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/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 12 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.h | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 5c6308d07c..fbc4d49819 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -94,7 +94,7 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr) } } -static char *display_time(NTTIME nttime) +static const char *display_time(NTTIME nttime) { static fstring string; diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index c76e84580d..06da00748b 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -26,12 +26,12 @@ #include "rpcclient.h" struct table_node { - char *long_archi; - char *short_archi; + const char *long_archi; + const char *short_archi; int version; }; -struct table_node archi_table[]= { +static const struct table_node archi_table[]= { {"Windows 4.0", "WIN40", 0 }, {"Windows NT x86", "W32X86", 2 }, @@ -45,7 +45,7 @@ struct table_node archi_table[]= { function to do the mapping between the long architecture name and the short one. ****************************************************************************/ -BOOL get_short_archi(char *short_archi, char *long_archi) +BOOL get_short_archi(char *short_archi, const char *long_archi) { int i=-1; @@ -1153,7 +1153,7 @@ void set_drv_info_3_env (DRIVER_INFO_3 *info, const char *arch) wrapper for strtok to get the next parameter from a delimited list. Needed to handle the empty parameter string denoted by "NULL" *************************************************************************/ -static char* get_driver_3_param (char* str, char* delim, UNISTR* dest) +static char* get_driver_3_param (char* str, const char* delim, UNISTR* dest) { char *ptr; @@ -2135,7 +2135,7 @@ static NTSTATUS cmd_spoolss_enum_printerkey( struct cli_state *cli, BOOL got_hnd = False; pstring printername; fstring servername, user; - char *keyname = NULL; + const char *keyname = NULL; POLICY_HND hnd; uint16 *keylist = NULL, *curkey; diff --git a/source3/rpcclient/rpcclient.h b/source3/rpcclient/rpcclient.h index ae5b5f3c4f..3276a62437 100644 --- a/source3/rpcclient/rpcclient.h +++ b/source3/rpcclient/rpcclient.h @@ -23,12 +23,12 @@ #define RPCCLIENT_H struct cmd_set { - char *name; + const char *name; NTSTATUS (*fn)(struct cli_state*, TALLOC_CTX *mem_ctx, int argc, char **argv); int pipe_idx; - char *description; - char *usage; + const char *description; + const char *usage; }; #endif /* RPCCLIENT_H */ |