summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-03 08:28:12 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-03 08:28:12 +0000
commit634c54310c92c48dd4eceec602e230a021bdcfc5 (patch)
tree9f5732a180b8daacf176e42511b0a72c972c7a4b /source3/lib
parent47a7f0cfb5006fb41239a6cd81cce5e35fde750a (diff)
downloadsamba-634c54310c92c48dd4eceec602e230a021bdcfc5.tar.gz
samba-634c54310c92c48dd4eceec602e230a021bdcfc5.tar.bz2
samba-634c54310c92c48dd4eceec602e230a021bdcfc5.zip
Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/account_pol.c4
-rw-r--r--source3/lib/adt_tree.c2
-rw-r--r--source3/lib/charcnv.c12
-rw-r--r--source3/lib/genrand.c2
-rw-r--r--source3/lib/messages.c2
-rw-r--r--source3/lib/pam_errors.c4
-rw-r--r--source3/lib/pidfile.c4
-rw-r--r--source3/lib/smbpasswd.c2
-rw-r--r--source3/lib/util.c8
-rw-r--r--source3/lib/util_sid.c7
-rw-r--r--source3/lib/util_sock.c2
-rw-r--r--source3/lib/util_str.c4
12 files changed, 27 insertions, 26 deletions
diff --git a/source3/lib/account_pol.c b/source3/lib/account_pol.c
index 6f51c916d7..2e619c0c6b 100644
--- a/source3/lib/account_pol.c
+++ b/source3/lib/account_pol.c
@@ -31,7 +31,7 @@ static TDB_CONTEXT *tdb; /* used for driver files */
BOOL init_account_policy(void)
{
static pid_t local_pid;
- char *vstring = "INFO/version";
+ const char *vstring = "INFO/version";
uint32 version;
if (tdb && local_pid == sys_getpid())
@@ -67,7 +67,7 @@ BOOL init_account_policy(void)
static const struct {
int field;
- char *string;
+ const char *string;
} account_policy_names[] = {
{AP_MIN_PASSWORD_LEN, "min password length"},
{AP_PASSWORD_HISTORY, "password history"},
diff --git a/source3/lib/adt_tree.c b/source3/lib/adt_tree.c
index 2c18bb1198..0bc224ec23 100644
--- a/source3/lib/adt_tree.c
+++ b/source3/lib/adt_tree.c
@@ -325,7 +325,7 @@ done:
Recursive routine to print out all children of a TREE_NODE
*************************************************************************/
-static void sorted_tree_print_children( TREE_NODE *node, int debug, char *path )
+static void sorted_tree_print_children( TREE_NODE *node, int debug, const char *path )
{
int i;
int num_children;
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 04145fd17a..3428377d95 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -30,9 +30,9 @@ static smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS];
Return the name of a charset to give to iconv().
****************************************************************************/
-static char *charset_name(charset_t ch)
+static const char *charset_name(charset_t ch)
{
- char *ret = NULL;
+ const char *ret = NULL;
if (ch == CH_UCS2) ret = "UCS-2LE";
else if (ch == CH_UNIX) ret = lp_unix_charset();
@@ -75,8 +75,8 @@ void init_iconv(void)
for (c1=0;c1<NUM_CHARSETS;c1++) {
for (c2=0;c2<NUM_CHARSETS;c2++) {
- char *n1 = charset_name((charset_t)c1);
- char *n2 = charset_name((charset_t)c2);
+ const char *n1 = charset_name((charset_t)c1);
+ const char *n2 = charset_name((charset_t)c2);
if (conv_handles[c1][c2] &&
strcmp(n1, conv_handles[c1][c2]->from_name) == 0 &&
strcmp(n2, conv_handles[c1][c2]->to_name) == 0)
@@ -140,7 +140,7 @@ size_t convert_string(charset_t from, charset_t to,
o_len=destlen;
retval = smb_iconv(descriptor, &inbuf, &i_len, &outbuf, &o_len);
if(retval==-1) {
- char *reason="unknown error";
+ const char *reason="unknown error";
switch(errno) {
case EINVAL:
reason="Incomplete multibyte sequence";
@@ -215,7 +215,7 @@ convert:
&inbuf, &i_len,
&outbuf, &o_len);
if(retval == -1) {
- char *reason="unknown error";
+ const char *reason="unknown error";
switch(errno) {
case EINVAL:
reason="Incomplete multibyte sequence";
diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c
index fe756169a6..bc9f21c640 100644
--- a/source3/lib/genrand.c
+++ b/source3/lib/genrand.c
@@ -101,7 +101,7 @@ static void get_random_stream(unsigned char *data, size_t datasize)
Note that the hash is not initialised.
*****************************************************************/
-static void do_filehash(char *fname, unsigned char *the_hash)
+static void do_filehash(const char *fname, unsigned char *the_hash)
{
unsigned char buf[1011]; /* deliberate weird size */
unsigned char tmp_md4[16];
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 36a23e28ab..8200b2f8c3 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -81,7 +81,7 @@ static void sig_usr1(void)
static void ping_message(int msg_type, pid_t src, void *buf, size_t len)
{
- char *msg = buf ? buf : "none";
+ const char *msg = buf ? buf : "none";
DEBUG(1,("INFO: Received PING message from PID %u [%s]\n",(unsigned int)src, msg));
message_send_pid(src, MSG_PONG, buf, len, True);
}
diff --git a/source3/lib/pam_errors.c b/source3/lib/pam_errors.c
index e1d02151a6..925441fb1d 100644
--- a/source3/lib/pam_errors.c
+++ b/source3/lib/pam_errors.c
@@ -28,7 +28,7 @@
#endif
/* PAM -> NT_STATUS map */
-const static struct {
+static const struct {
int pam_code;
NTSTATUS ntstatus;
} pam_to_nt_status_map[] = {
@@ -58,7 +58,7 @@ const static struct {
};
/* NT_STATUS -> PAM map */
-const static struct {
+static const struct {
NTSTATUS ntstatus;
int pam_code;
} nt_status_to_pam_map[] = {
diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c
index 393fb57994..16a12656b3 100644
--- a/source3/lib/pidfile.c
+++ b/source3/lib/pidfile.c
@@ -28,7 +28,7 @@
/* return the pid in a pidfile. return 0 if the process (or pidfile)
does not exist */
-pid_t pidfile_pid(char *name)
+pid_t pidfile_pid(const char *name)
{
int fd;
char pidstr[20];
@@ -69,7 +69,7 @@ pid_t pidfile_pid(char *name)
}
/* create a pid file in the pid directory. open it and leave it locked */
-void pidfile_create(char *name)
+void pidfile_create(const char *name)
{
int fd;
char buf[20];
diff --git a/source3/lib/smbpasswd.c b/source3/lib/smbpasswd.c
index c27af5540b..92ae1ffea2 100644
--- a/source3/lib/smbpasswd.c
+++ b/source3/lib/smbpasswd.c
@@ -60,7 +60,7 @@ BOOL smbpasswd_gethexpwd(char *p, unsigned char *pwd)
{
int i;
unsigned char lonybble, hinybble;
- char *hexchars = "0123456789ABCDEF";
+ const char *hexchars = "0123456789ABCDEF";
char *p1, *p2;
if (!p) return (False);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b0714dcbeb..67de9e4bf2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -676,7 +676,7 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s)
Make a dir struct.
****************************************************************************/
-void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date)
+void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,int mode,time_t date)
{
char *p;
pstring mask2;
@@ -1398,7 +1398,7 @@ gid_t nametogid(const char *name)
Something really nasty happened - panic !
********************************************************************/
-void smb_panic(char *why)
+void smb_panic(const char *why)
{
char *cmd = lp_panic_action();
int result;
@@ -1463,7 +1463,7 @@ char *readdirname(DIR *p)
of a path matches a (possibly wildcarded) entry in a namelist.
********************************************************************/
-BOOL is_in_path(char *name, name_compare_entry *namelist)
+BOOL is_in_path(const char *name, name_compare_entry *namelist)
{
pstring last_component;
char *p;
@@ -2247,7 +2247,7 @@ BOOL ms_has_wild_w(const smb_ucs2_t *s)
of the ".." name.
*******************************************************************/
-BOOL mask_match(char *string, char *pattern, BOOL is_case_sensitive)
+BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive)
{
fstring p2, s2;
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index edd59ae109..824987f189 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -79,9 +79,9 @@ NT_USER_TOKEN system_token = {
Lookup string names for SID types.
****************************************************************************/
-const static struct {
+static const struct {
enum SID_NAME_USE sid_type;
- char *string;
+ const char *string;
} sid_name_type[] = {
{SID_NAME_USER, "User"},
{SID_NAME_DOM_GRP, "Domain Group"},
@@ -181,7 +181,8 @@ NT_USER_TOKEN *get_system_token(void)
void split_domain_name(const char *fullname, char *domain, char *name)
{
pstring full_name;
- char *p, *sep;
+ const char *sep;
+ char *p;
sep = lp_winbind_separator();
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 2acb20861b..e162e5cd77 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -43,7 +43,7 @@ BOOL is_a_socket(int fd)
enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON};
typedef struct smb_socket_option {
- char *name;
+ const char *name;
int level;
int option;
int value;
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 5a1f159bdb..c519fd8497 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -576,7 +576,7 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex)
size_t i;
size_t num_chars = 0;
unsigned char lonybble, hinybble;
- char *hexchars = "0123456789ABCDEF";
+ const char *hexchars = "0123456789ABCDEF";
char *p1 = NULL, *p2 = NULL;
for (i = 0; i < len && strhex[i] != 0; i++) {
@@ -958,7 +958,7 @@ void split_at_last_component(char *path, char *front, char sep, char *back)
Write an octal as a string.
****************************************************************************/
-char *octal_string(int i)
+const char *octal_string(int i)
{
static char ret[64];
if (i == -1)