Quellcode durchsuchen

* Fix up misc compile warnings

svn: 3847
Bryan Drewery vor 18 Jahren
Ursprung
Commit
abf3045125

+ 3 - 3
src/botnet.c

@@ -639,7 +639,7 @@ void tell_bottree(int idx)
 
   if (s[0])
     dprintf(idx, "(%s %s)\n", BOT_NOTRACEINFO, s);
-  dprintf(idx, "%s%s%s (%s %li)\n", color_str ? color_str : "", 
+  dprintf(idx, "%s%s%s (%s %d)\n", color_str ? color_str : "", 
                                     conf.bot->nick,
                                     color_str ? COLOR_END(idx) : "",
                                     egg_version, revision);
@@ -686,7 +686,7 @@ void tell_bottree(int idx)
             i = simple_snprintf(s, sizeof(s), "%c", bot->share);
           else
             i = simple_snprintf(s, sizeof(s), "-");
-          i = sprintf(s + 1, "%s%s%s (%s %li)", color_str ? color_str : "",
+          i = sprintf(s + 1, "%s%s%s (%s %d)", color_str ? color_str : "",
                                                 bot->bot,
                                                 color_str ? COLOR_END(idx) : "",
                                                 bot->version, bot->revision);
@@ -732,7 +732,7 @@ void tell_bottree(int idx)
                   i = simple_snprintf(s, sizeof(s), "%c", bot->share);
                 else
                   i = simple_snprintf(s, sizeof(s), "-");
-                i = sprintf(s + 1, "%s%s%s (%s %li)", color_str ? color_str : "",
+                i = sprintf(s + 1, "%s%s%s (%s %d)", color_str ? color_str : "",
                                                       bot->bot,
                                                       color_str ? COLOR_END(idx) : "",
                                                       bot->version, bot->revision);

+ 2 - 2
src/cmds.c

@@ -1347,7 +1347,7 @@ static void cmd_botcmd(int idx, char *par)
 
   /* random leaf */
   if (!strcmp(botm, "?")) {
-    rand_leaf++;
+    rand_leaf = 1;
     for (tbot = tandbot; tbot; tbot = tbot->next) {
       if (bot_hublevel(get_user_by_handle(userlist, tbot->bot)) == 999)
         tbots++;
@@ -1358,7 +1358,7 @@ static void cmd_botcmd(int idx, char *par)
 
   /* localhubs */
   if (!strcmp(botm, "&")) {
-    all_localhub++;
+    all_localhub = 1;
     for (tbot = tandbot; tbot; tbot = tbot->next) {
       if (bot_hublevel(get_user_by_handle(userlist, tbot->bot)) == 999 && tbot->localhub)
         tbots++;

+ 2 - 0
src/mod/irc.mod/chan.c

@@ -90,6 +90,7 @@ void resolve_to_member(struct chanset_t *chan, char *nick, char *host)
  */
 #define CHANNEL_ID_LEN 5
 
+#ifdef NO
 static void print_memberlist(memberlist *toprint)
 {
   memberlist *m = NULL;
@@ -98,6 +99,7 @@ static void print_memberlist(memberlist *toprint)
     sdprintf("%s!%s user: %s tried: %d hops: %d", m->nick, m->userhost, m->user ? m->user->handle : "", m->tried_getuser, m->hops);
   }
 }
+#endif
 
 /* Returns a pointer to a new channel member structure.
  */

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

@@ -1239,7 +1239,7 @@ static void cmd_mop(int idx, char *par)
           continue;		/* dont op users without a pass */
         get_user_flagrec(m->user, &victim, chan->dname);
         if (!chan_hasop(m) && !glob_bot(victim) && chk_op(victim, chan)) {
-          found++;
+          found = 1;
           dprintf(idx, "Gave op to '%s' as '%s' on %s\n", m->user->handle, m->nick, chan->dname);
           do_op(m->nick, chan, 0, 0);
         }

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

@@ -975,7 +975,7 @@ gotmode(char *from, char *msg)
 
     if ((channel_active(chan) || channel_pending(chan))) {
       char *isserver = NULL;
-      size_t z = strlen(msg), siz = 0;
+      size_t z = strlen(msg);
       struct userrec *u = NULL;
       memberlist *m = NULL;
       char *nick = NULL;

+ 1 - 1
src/mod/server.mod/servmsg.c

@@ -500,7 +500,7 @@ static int gotmsg(char *from, char *msg)
 	p = uhost;
       simple_snprintf(ctcpbuf, sizeof(ctcpbuf), "*!*@%s", p);
       addignore(ctcpbuf, conf.bot->nick, "ctcp avalanche", now + (60 * ignore_time));
-      ignoring++;
+      ignoring = 1;
     }
   }
 

+ 8 - 4
src/mod/share.mod/share.c

@@ -926,8 +926,10 @@ share_ufsend(int idx, char *par)
   int i, sock;
   FILE *f = NULL;
 
-  simple_snprintf(s, sizeof(s), "%s.share.XXXXXX", tempdir);
-  mktemp(s);
+  char rand[7] = "";
+  make_rand_str(rand, sizeof(rand) - 1);
+  simple_snprintf(s, sizeof(s), "%s.share.%s", tempdir, rand);
+  //mktemp(s); //Although safe here, g++ complains too much.
 
   if (!(b_status(idx) & STAT_SHARE)) {
     dprintf(idx, "s e You didn't ask; you just started sending.\n");
@@ -1410,8 +1412,10 @@ start_sending_users(int idx)
   char share_file[1024] = "";
   int i = 1, j = -1;
 
-  simple_snprintf(share_file, sizeof(share_file), "%s.share.XXXXXX", tempdir);
-  mktemp(share_file);
+  char rand[7] = "";
+  make_rand_str(rand, sizeof(rand) - 1);
+  simple_snprintf(share_file, sizeof(share_file), "%s.share.%s", tempdir, rand);
+  //mktemp(share_file); //Although safe here, g++ complains too much.
 
   write_tmp_userfile(share_file, userlist, idx);
 

+ 1 - 1
src/mod/update.mod/update.c

@@ -190,7 +190,7 @@ static void got_nu(char *botnick, char *code, char *par)
   }
 
 /* needupdate? curver */
-   time_t newts = atol(newsplit(&par));
+   newsplit(&par); //newts
    int newrevision = atol(newsplit(&par));
 
    if (newrevision > revision) {

+ 1 - 1
src/set.c

@@ -213,7 +213,7 @@ char *var_sanitize(variable_t *var, const char *data)
 
     /* No limit enforcing yet */
     dataout = (char*) my_calloc(1, 21);
-    simple_snprintf(dataout, 21, "%u:%u", rate.count, rate.time);
+    egg_snprintf(dataout, 21, "%u:%li", rate.count, rate.time);
   } else if ((var->flags & VAR_SERVERS)) {
     dataout = data ? strdup(data) : NULL;
   }

+ 4 - 0
src/socket.c

@@ -51,6 +51,7 @@ typedef struct connect_info {
         int port;
 } connect_info_t;
 
+#ifdef NO
 /* If a connection times out, due to dns timeout or connect timeout. */
 static int egg_connect_timeout(void *client_data)
 {
@@ -71,6 +72,7 @@ static int egg_connect_timeout(void *client_data)
 //        }
         return(0);
 }
+
 static connect_info_t *attach(int idx, const char *host, int port, int timeout)
 {
         connect_info_t *connect_info = (connect_info_t *) my_calloc(1, sizeof(*connect_info));
@@ -103,6 +105,8 @@ static int detach(void *client_data, int idx)
         free(connect_info);
         return(0);
 }
+#endif
+
 /*
 int egg_client(int idx, const char *host, int port, const char *vip, int vport, int timeout)
 {