Răsfoiți Sursa

Merge branch 'gcc46-compile-warnings'

* gcc46-compile-warnings:
  * Cleanup unused variable warnings

Conflicts:
	src/debug.c
Bryan Drewery 14 ani în urmă
părinte
comite
09bacd1cea

+ 7 - 7
src/binary.c

@@ -67,13 +67,13 @@ static void tellconfig(settings_t *);
 
 int checked_bin_buf = 0;
 
-#define MMAP_LOOP(_offset, _block_len, _total, _len)	\
+#define MMAP_LOOP(_offset, _block_len, _total)		\
   for ((_offset) = 0; 					\
        (_offset) < (_total); 				\
-       (_offset) += (_block_len),			\
+       (_offset) += (_block_len)/*,			\
        (_len) = ((_total) - (_offset)) < (_block_len) ? \
               ((_total) - (_offset)) : 			\
-              (_block_len)				\
+              (_block_len)*/				\
       )
 
 #define MMAP_READ(_map, _dest, _offset, _len)	\
@@ -87,7 +87,7 @@ bin_checksum(const char *fname, int todo)
   static char hash[MD5_HASH_LENGTH + 1] = "";
   unsigned char md5out[MD5_HASH_LENGTH + 1] = "", buf[PREFIXLEN + 1] = "";
   int fd = -1;
-  size_t len = 0, offset = 0, size = 0, newpos = 0;
+  size_t offset = 0, size = 0, newpos = 0;
   unsigned char *map = NULL, *outmap = NULL;
   char *fname_bak = NULL;
   Tempfile *newbin = NULL;
@@ -106,7 +106,7 @@ bin_checksum(const char *fname, int todo)
     size = lseek(fd, 0, SEEK_END);
     map = (unsigned char*) mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
     if ((void*)map == MAP_FAILED) goto fatal;
-    MMAP_LOOP(offset, sizeof(buf) - 1, size, len) {
+    MMAP_LOOP(offset, sizeof(buf) - 1, size) {
       if (!memcmp(&map[offset], &settings.prefix, PREFIXLEN))
         break;
     }
@@ -132,7 +132,7 @@ bin_checksum(const char *fname, int todo)
     if ((void*)map == MAP_FAILED) goto fatal;
 
     /* Find the packdata */
-    MMAP_LOOP(offset, sizeof(buf) - 1, size, len) {
+    MMAP_LOOP(offset, sizeof(buf) - 1, size) {
       if (!memcmp(&map[offset], &settings.prefix, PREFIXLEN))
         break;
     }
@@ -179,7 +179,7 @@ bin_checksum(const char *fname, int todo)
     if ((void*)map == MAP_FAILED) goto fatal;
 
     /* Find settings struct in original binary */
-    MMAP_LOOP(offset, sizeof(buf) - 1, size, len) {
+    MMAP_LOOP(offset, sizeof(buf) - 1, size) {
       if (!memcmp(&map[offset], &settings.prefix, PREFIXLEN))
         break;
     }

+ 0 - 2
src/botcmd.c

@@ -863,7 +863,6 @@ static void bot_reject(int idx, char *par)
     *destbot++ = 0;
     if (!strcasecmp(destbot, conf.bot->nick)) {
       /* Kick someone here! */
-      int ok = 0;
 
       for (i = 0; i < dcc_total; i++) {
         if (dcc[i].type && dcc[i].simul == -1 && !strcasecmp(who, dcc[i].nick) && (dcc[i].type->flags & DCT_CHAT)) {
@@ -875,7 +874,6 @@ static void bot_reject(int idx, char *par)
             }
             do_boot(i, from, par);
             putlog(LOG_CMDS, "*", "#%s# boot %s (%s)", from, who, par[0] ? par : "No reason");
-            ok = 1;
           }
         }
       }

+ 1 - 3
src/botmsg.c

@@ -449,7 +449,7 @@ void botnet_send_nkch_part(int butidx, int useridx, char *oldnick)
  */
 int add_note(char *to, char *from, char *msg, int idx, int echo)
 {
-  int status, i, sock;
+  int i, sock;
   char *p = NULL, botf[81] = "", ss[81] = "", ssf[81] = "";
   struct userrec *u;
 
@@ -511,8 +511,6 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
   if (is_bot(u))
     return NOTE_ERROR;
 
-  status = NOTE_ERROR;
-
   /* Online right now? */
   for (i = 0; i < dcc_total; i++) {
     if (dcc[i].type && (dcc[i].type->flags & DCT_CHAT) &&

+ 1 - 2
src/chanprog.c

@@ -404,7 +404,7 @@ bool is_hub(const char* nick) {
 void load_internal_users()
 {
   char *p = NULL, *ln = NULL, *hand = NULL, *ip = NULL, *port = NULL, *pass = NULL, *q = NULL;
-  char *hosts = NULL, buf[2048] = "", *attr = NULL, tmp[51] = "";
+  char *hosts = NULL, buf[2048] = "", tmp[51] = "";
   int i, hublevel = 0;
   struct bot_addr *bi = NULL;
   struct userrec *u = NULL;
@@ -472,7 +472,6 @@ void load_internal_users()
       *p++ = 0;
     hand = ln;
     pass = NULL;
-    attr = NULL;
     hosts = NULL;
     for (i = 0; ln; i++) {
       switch (i) {

+ 1 - 2
src/debug.c

@@ -132,7 +132,6 @@ static void write_debug(bool fatal = 1)
   if (fatal) {
     /* Write GDB backtrace */
     char gdb[1024] = "", btfile[256] = "", std_in[101] = "", *out = NULL;
-    unsigned int core = 0;
 
     simple_snprintf(btfile, sizeof(btfile), ".gdb-backtrace-%d", getpid());
 
@@ -154,7 +153,7 @@ static void write_debug(bool fatal = 1)
     struct rlimit limit;
     if (!getrlimit(RLIMIT_CORE, &limit)) {
       limit.rlim_cur = limit.rlim_max;
-      if(!setrlimit(RLIMIT_CORE, &limit)) core = limit.rlim_cur;
+      setrlimit(RLIMIT_CORE, &limit);
     }
   }
 #endif

+ 4 - 4
src/makehelp.c

@@ -47,24 +47,24 @@ help_t help[] = \n\
 
     if (buffer[0] == ':') { /* New cmd */
       bd::String ifdef(buffer.length());
-      int cl = 0, doleaf = 0, dohub = 0;
+      int doleaf = 0, dohub = 0;
 
       ++buffer;
       ifdef = newsplit(buffer, ':');
 
       if (ifdef.length()) {
         if (ifdef == "leaf") {
-          if (hub) { cl = 1; hub = 0; }
+          if (hub) { hub = 0; }
           if (!leaf) {
             doleaf = leaf = 1;
           }
         } else if (ifdef == "hub") {
-          if (leaf) { cl = 1; hub = 0; }
+          if (leaf) { hub = 0; }
           if (!hub) {
             dohub = hub = 1;
           }
         }
-      } else { if (leaf || hub) { cl = 1; } leaf = 0; hub = 0;  }
+      } else { leaf = 0; hub = 0;  }
 
       if (cmd.length()) {		/* CLOSE LAST CMD */
         if (cmd.find(':') != bd::String::npos)		/* garbled */

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

@@ -588,10 +588,8 @@ static void get_mode_protect(struct chanset_t *chan, char *s, size_t ssiz)
 {
   char *p = s, s1[121] = "";
   int tst;
-  bool ok = 0;
 
   for (int i = 0; i < 2; i++) {
-    ok = 0;
     if (i == 0) {
       tst = chan->mode_pls_prot;
       if ((tst) || (chan->limit_prot != 0) || (chan->key_prot[0]))

+ 1 - 4
src/mod/irc.mod/chan.c

@@ -2478,10 +2478,8 @@ static int gottopic(char *from, char *msg)
 {
   char *chname = newsplit(&msg), *nick = NULL;
   struct chanset_t *chan = NULL;
-  struct userrec *u = NULL;
 
   fixcolon(msg);
-  u = get_user_by_host(from);
   nick = splitnick(&from);
   chan = findchan(chname);
   if (chan) {
@@ -2911,7 +2909,7 @@ static int gotkick(char *from, char *origmsg)
  */
 static int gotnick(char *from, char *msg)
 {
-  char *nick = NULL, *chname = NULL, s1[UHOSTLEN] = "", buf[UHOSTLEN] = "", *uhost = buf;
+  char *nick = NULL, s1[UHOSTLEN] = "", buf[UHOSTLEN] = "", *uhost = buf;
   memberlist *m = NULL, *mm = NULL;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
 
@@ -2933,7 +2931,6 @@ static int gotnick(char *from, char *msg)
   struct userrec *u = get_user_by_host(s1);
 
   for (struct chanset_t *chan = chanset; chan; chan = chan->next) {
-    chname = chan->dname; 
     m = ismember(chan, nick);
 
     if (m) {

+ 0 - 3
src/mod/server.mod/servmsg.c

@@ -1283,12 +1283,9 @@ static int goterror(char *from, char *msg)
 static int gotnick(char *from, char *msg)
 {
   char *nick = NULL, *buf = NULL, *buf_ptr = NULL;
-  struct userrec *u = NULL;
 
   //Done to prevent gotnick in irc.mod getting a mangled from
   buf = buf_ptr = strdup(from);
-  //Cache user
-  u = get_user_by_host(buf);
   nick = splitnick(&buf);
   fixcolon(msg);
 

+ 0 - 3
src/mod/transfer.mod/transfer.c

@@ -145,7 +145,6 @@ void eof_dcc_fork_send(int idx)
 
 static void eof_dcc_send(int idx)
 {
-  int ok;
   char s[1024] = "";
 
   fflush(dcc[idx].u.xfer->f);
@@ -153,8 +152,6 @@ static void eof_dcc_send(int idx)
   
   fclose(dcc[idx].u.xfer->f);
   if (dcc[idx].u.xfer->length == dcc[idx].status) {
-    /* Success */
-    ok = 0;
     if (!strcmp(dcc[idx].nick, "*users")) {
       finish_share(idx);
       killsock(dcc[idx].sock);

+ 0 - 3
src/set.c

@@ -560,10 +560,7 @@ void var_set(variable_t *var, const char *target, const char *datain)
 //  }
 
   if (target) {
-    bool me = 0;
-
     if (!strcasecmp(conf.bot->nick, target)) {
-      me = 1;
       domem = 1;				/* always set the mem if it's local */
       if (var->ldata)
         free(var->ldata);