Bladeren bron

* Fixed some char * that should have been const

svn: 983
Bryan Drewery 22 jaren geleden
bovenliggende
commit
3c66076cfb

+ 1 - 1
src/chan.h

@@ -227,7 +227,7 @@ struct chanset_t {
 #define CHAN_DYNAMICINVITES BIT4
 #define CHAN_NOUSERINVITES  BIT5
 /* prototypes */
-memberlist *ismember(struct chanset_t *, char *);
+memberlist *ismember(struct chanset_t *, const char *);
 struct chanset_t *findchan(const char *name);
 struct chanset_t *findchan_by_dname(const char *name);
 

+ 2 - 2
src/chanprog.c

@@ -68,7 +68,7 @@ void rmspace(char *s)
 
 /* Returns memberfields if the nick is in the member list.
  */
-memberlist *ismember(struct chanset_t *chan, char *nick)
+memberlist *ismember(struct chanset_t *chan, const char *nick)
 {
   register memberlist	*x = NULL;
 
@@ -659,7 +659,7 @@ int shouldjoin(struct chanset_t *chan)
 /* do_chanset() set (options) on (chan)
  * USES DO_LOCAL|DO_NET bits.
  */
-int do_chanset(char *result, struct chanset_t *chan, char *options, int local)
+int do_chanset(char *result, struct chanset_t *chan, const char *options, int local)
 {
   int ret = OK;
 

+ 1 - 1
src/chanprog.h

@@ -6,7 +6,7 @@
 #define DO_LOCAL	1
 #define DO_NET		2
 
-int do_chanset(char *, struct chanset_t *, char *, int);
+int do_chanset(char *, struct chanset_t *, const char *, int);
 void checkchans(int);
 void tell_verbose_uptime(int);
 void tell_verbose_status(int);

+ 1 - 1
src/cmds.c

@@ -810,7 +810,7 @@ static void cmd_help(struct userrec *u, int idx, char *par)
       done = 1;
 
     for (n = 0; n < cmdi; n++) { /* loop each command */
-      if (!flagrec_ok(&cmdlist[n].flags, &fr) || !wild_match(match, cmdlist[n].name))
+      if (!flagrec_ok(&cmdlist[n].flags, &fr) || !wild_match(match, (char *) cmdlist[n].name))
         continue;
       fnd++;
       if (nowild) {

+ 5 - 5
src/cmds.h

@@ -4,19 +4,19 @@
 #include "types.h"
 
 typedef struct {
-  char          *name;
-  char          *flags;
+  const char          *name;
+  const char          *flags;
   Function      func;
-  char          *funcname;
+  const char          *funcname;
 } cmd_t;
 
 typedef struct {
-        char *name;
+        const char *name;
         struct flag_record     flags;
 } mycmds;
 
 typedef struct {
-  char *name;
+  const char *name;
   Function func;
 } botcmd_t;
 

+ 4 - 3
src/dccutil.c

@@ -70,7 +70,7 @@ char *add_cr(char *buf)
   return WBUF;
 }
 
-void dprintf(int idx, char *format, ...)
+void dprintf(int idx, const char *format, ...)
 {
   static char buf[1024] = "";
   int len;
@@ -176,7 +176,7 @@ void dprintf(int idx, char *format, ...)
   }
 }
 
-void chatout(char *format, ...)
+void chatout(const char *format, ...)
 {
   int i, len;
   char s[601] = "";
@@ -185,6 +185,7 @@ void chatout(char *format, ...)
   va_start(va, format);
   egg_vsnprintf(s, 511, format, va);
   va_end(va);
+
   len = strlen(s);
   if (len > 511)
     len = 511;
@@ -199,7 +200,7 @@ void chatout(char *format, ...)
 
 /* Print to all on this channel but one.
  */
-void chanout_but(int x, int chan, char *format, ...)
+void chanout_but(int x, int chan, const char *format, ...)
 {
   int i, len;
   char s[601] = "";

+ 3 - 3
src/dccutil.h

@@ -26,9 +26,9 @@ struct portmap {
 #define DP_HELP_NEXT    0x7FF9
 
 
-void dprintf(int, char *, ...) __attribute__((format(printf, 2, 3)));
-void chatout(char *, ...) __attribute__((format(printf, 1, 2)));
-void chanout_but(int, int, char *, ...) __attribute__((format(printf, 3, 4)));
+void dprintf(int, const char *, ...) __attribute__((format(printf, 2, 3)));
+void chatout(const char *, ...) __attribute__((format(printf, 1, 2)));
+void chanout_but(int, int, const char *, ...) __attribute__((format(printf, 3, 4)));
 void dcc_chatter(int);
 void lostdcc(int);
 __inline__ void makepass(char *);

+ 3 - 3
src/log.c

@@ -57,7 +57,7 @@ static logmode_mapping_t logmode_mappings[] = {
 #define NEEDS_DEBUG_OUTPUT (LOG_RAW|LOG_SRVOUT|LOG_BOTNET|LOG_BOTSHARE)
 
 
-int logmodes(char *s)
+int logmodes(const char *s)
 {
 	logmode_mapping_t *mapping = NULL;
 	int modes = 0;
@@ -114,7 +114,7 @@ char *maskname(int x)
  *    Logging functions
  */
 
-void logidx(int idx, char *format, ...)
+void logidx(int idx, const char *format, ...)
 {
   char va_out[LOGLINEMAX + 1];
   va_list va;
@@ -133,7 +133,7 @@ void logidx(int idx, char *format, ...)
  * putlog(level,channel_name,format,...);
  * Broadcast the log if chname is not '@'
  */
-void putlog(int type, char *chname, char *format, ...)
+void putlog(int type, const char *chname, const char *format, ...)
 {
   int idx = 0;
   char va_out[LOGLINEMAX + 1] = "", out[LOGLINEMAX + 1] = "", *p = NULL;

+ 3 - 3
src/log.h

@@ -28,9 +28,9 @@
 #define LOG_BOTSHARE BIT22   /* h   share traffic                    */
 #define LOG_ALL      0xfffffff   /* (dump to all logfiles)               */
 
-void logidx(int, char *, ...) __attribute__((format(printf, 2, 3)));
-void putlog (int, char *, char *, ...) __attribute((format(printf, 3, 4)));
-int logmodes(char *);
+void logidx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
+void putlog (int, const char *, const char *, ...) __attribute((format(printf, 3, 4)));
+int logmodes(const char *);
 char *masktype(int);
 char *maskname(int);
 

+ 4 - 4
src/mod/channels.mod/channels.c

@@ -551,7 +551,7 @@ static void get_mode_protect(struct chanset_t *chan, char *s)
 
 /* Returns true if this is one of the channel masks
  */
-int ismodeline(masklist *m, char *username)
+int ismodeline(masklist *m, const char *username)
 {
   for (; m && m->mask[0]; m = m->next)  
     if (!rfc_casecmp(m->mask, username))
@@ -561,10 +561,10 @@ int ismodeline(masklist *m, char *username)
 
 /* Returns true if user matches one of the masklist -- drummer
  */
-int ismasked(masklist *m, char *username)
+int ismasked(masklist *m, const char *username)
 {
   for (; m && m->mask[0]; m = m->next)
-    if (wild_match(m->mask, username))
+    if (wild_match(m->mask, (char *) username))
       return 1;
   return 0;
 }
@@ -597,7 +597,7 @@ void remove_channel(struct chanset_t *chan)
    int		 i;
    /* Remove the channel from the list, so that noone can pull it
       away from under our feet during the check_part() call. */
-   (void) chanset_unlink(chan);
+   chanset_unlink(chan);
 
 #ifdef LEAF
    do_channel_part(chan);

+ 3 - 3
src/mod/channels.mod/channels.h

@@ -45,7 +45,7 @@ void set_handle_laston(char *, struct userrec *, time_t);
 int u_delmask(char type, struct chanset_t *c, char *who, int doit);
 int u_addmask(char type, struct chanset_t *, char *, char *, char *, time_t, int);
 int u_sticky_mask(maskrec *, char *);
-int u_setsticky_mask(struct chanset_t *, maskrec *, char *, int, char *);
+int u_setsticky_mask(struct chanset_t *, maskrec *, char *, int, const char *);
 int SplitList(char *, const char *, int *, const char ***);
 int channel_modify(char *, struct chanset_t *, int, char **);
 int channel_add(char *, char *, char *);
@@ -53,8 +53,8 @@ void check_should_lock();
 void clear_channel(struct chanset_t *, int);
 int u_equals_mask(maskrec *, char *);
 int u_match_mask(struct maskrec *, char *);
-int ismasked(masklist *, char *);
-int ismodeline(masklist *, char *);
+int ismasked(masklist *, const char *);
+int ismodeline(masklist *, const char *);
 void channels_report(int, int);
 #ifdef HUB
 void channels_writeuserfile();

+ 2 - 2
src/mod/channels.mod/cmdschan.c

@@ -1041,7 +1041,7 @@ static void cmd_mns_chan(struct userrec *u, int idx, char *par)
 
 /* thanks Excelsior */
 #define FLAG_COLS 4
-void show_flag(int idx, char *work, int *cnt, char *name, unsigned int state)
+void show_flag(int idx, char *work, int *cnt, const char *name, unsigned int state)
 {
   char tmp[101] = "", chr_state[15] = "";
   /* empty buffer if no (char *) name */
@@ -1071,7 +1071,7 @@ void show_flag(int idx, char *work, int *cnt, char *name, unsigned int state)
 }
 
 #define INT_COLS 1
-void show_int(int idx, char *work, int *cnt, char *desc, int state, char *yes, char *no)
+void show_int(int idx, char *work, int *cnt, const char *desc, int state, const char *yes, const char *no)
 {
   char tmp[101] = "", chr_state[101] = "";
 

+ 1 - 1
src/mod/channels.mod/userchan.c

@@ -150,7 +150,7 @@ int u_sticky_mask(maskrec *u, char *uhost)
 
 /* Set sticky attribute for a mask.
  */
-int u_setsticky_mask(struct chanset_t *chan, maskrec *u, char *uhost, int sticky, char *botcmd)
+int u_setsticky_mask(struct chanset_t *chan, maskrec *u, char *uhost, int sticky, const char *botcmd)
 {
   int j;
 

+ 1 - 1
src/mod/irc.mod/irc.h

@@ -61,7 +61,7 @@ static int gotmode(char *, char *);
 
 #endif /* MAKING_IRC */
 
-void add_mode(struct chanset_t *, unsigned char, unsigned char, char *);
+void add_mode(struct chanset_t *, const unsigned char, const unsigned char, const char *);
 int me_op(struct chanset_t *);
 void check_this_ban(struct chanset_t *, char *, int);
 void check_this_user(char *, int, char *);

+ 1 - 1
src/mod/irc.mod/mode.c

@@ -182,7 +182,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
 
 /* Queue a channel mode change
  */
-void add_mode(struct chanset_t *chan, unsigned char plus, unsigned char mode, char *op)
+void add_mode(struct chanset_t *chan, const unsigned char plus, const unsigned char mode, const char *op)
 {
   int type, modes, l;
   unsigned int i;

+ 5 - 5
src/mod/notes.mod/notes.c

@@ -59,7 +59,7 @@ void fwd_display(int idx, struct user_entry *e, struct userrec *u)
 
 /* Determine how many notes are waiting for a user.
  */
-int num_notes(char *user)
+int num_notes(const char *user)
 {
   int tot = 0;
   FILE *f = NULL;
@@ -90,7 +90,7 @@ int num_notes(char *user)
 
 /* Change someone's handle.
  */
-static void notes_change(char *oldnick, char *newnick)
+static void notes_change(const char *oldnick, const char *newnick)
 {
   FILE *f = NULL, *g = NULL;
   char s[513] = "", *to = NULL, *s1 = NULL;
@@ -306,7 +306,7 @@ int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int buf
 /* Convert a string like "2-4;8;16-"
  * in an array {2, 4, 8, 8, 16, maxnotes, -1}
  */
-static void notes_parse(int dl[], char *s)
+static void notes_parse(int dl[], const char *s)
 {
   int i = 0;
   int idl = 0;
@@ -357,7 +357,7 @@ static int notes_in(int dl[], int in)
  * else    : read msg in list : (ex: .notes read 5-9;12;13;18-)
  * idx=-1  : /msg
  */
-void notes_read(char *hand, char *nick, char *srd, int idx)
+void notes_read(const char *hand, const char *nick, const char *srd, int idx)
 {
   FILE *f = NULL;
   char s[601] = "", *to = NULL, *dt = NULL, *from = NULL, *s1 = NULL, wt[100] = "";
@@ -469,7 +469,7 @@ void notes_read(char *hand, char *nick, char *srd, int idx)
  * else    : erase msg in list : (ex: .notes erase 2-4;8;16-)
  * idx=-1  : /msg
  */
-void notes_del(char *hand, char *nick, char *sdl, int idx)
+void notes_del(const char *hand, const char *nick, const char *sdl, int idx)
 {
   FILE *f = NULL, *g = NULL;
   char s[513] = "", *to = NULL, *s1 = NULL;

+ 3 - 3
src/mod/notes.mod/notes.h

@@ -59,10 +59,10 @@
 #define NOTES_FWD_CHANGED		"Changed notes forwarding for %s to: %s\n"
 #define NOTES_MUSTBE			"Function must be one of INDEX, READ, or ERASE."
 
-void notes_read(char *, char *, char *, int);
-void notes_del(char *, char *, char *, int);
+void notes_read(const char *, const char *, const char *, int);
+void notes_del(const char *, const char *, const char *, int);
 void fwd_display(int, struct user_entry *, struct userrec *);
-int num_notes(char *);
+int num_notes(const char *);
 void notes_report(int, int);
 int storenote(char *, char *, char *, int, char *, int);
 

+ 3 - 3
src/mod/share.mod/share.c

@@ -49,7 +49,7 @@ static struct delay_mode *start_delay = NULL;
 #ifdef HUB
 static void start_sending_users(int);
 #endif /* HUB */
-static void shareout_but(struct chanset_t *chan, int, char *, ...) __attribute__((format(printf, 3, 4)));
+static void shareout_but(struct chanset_t *chan, int, const char *, ...) __attribute__((format(printf, 3, 4)));
 static void cancel_user_xfer(int, void *);
 
 #include "share.h"
@@ -1157,7 +1157,7 @@ sharein(int idx, char *msg)
 }
 
 void
-shareout(struct chanset_t *chan, char *format, ...)
+shareout(struct chanset_t *chan, const char *format, ...)
 {
   int i, l;
   char s[601] = "";
@@ -1177,7 +1177,7 @@ shareout(struct chanset_t *chan, char *format, ...)
 }
 
 static void
-shareout_but(struct chanset_t *chan, int x, char *format, ...)
+shareout_but(struct chanset_t *chan, int x, const char *format, ...)
 {
   int i, l;
   char s[601] = "";

+ 1 - 1
src/mod/share.mod/share.h

@@ -11,7 +11,7 @@
 #define UFF_EXEMPT	BIT2	/* Send exempts in user file	    */
 
 void sharein(int, char *);
-void shareout(struct chanset_t *, char *, ...) __attribute__((format(printf, 2, 3)));
+void shareout(struct chanset_t *, const char *, ...) __attribute__((format(printf, 2, 3)));
 void finish_share(int);
 void dump_resync(int);
 void share_report(int, int);