Răsfoiți Sursa

Merge branch 'compile-warnings' into maint

* compile-warnings:
  Cast time_t to long to avoid printf() format warning
  Cast pid_t to int to avoid printf() format warning
Bryan Drewery 14 ani în urmă
părinte
comite
07897d12fc
4 a modificat fișierele cu 13 adăugiri și 13 ștergeri
  1. 3 3
      src/conf.c
  2. 6 6
      src/main.c
  3. 3 3
      src/misc.c
  4. 1 1
      src/userent.c

+ 3 - 3
src/conf.c

@@ -63,7 +63,7 @@ tellconf()
              bot->net.host ? bot->net.host : "", bot->net.ip6 ? bot->net.ip6 : "", bot->net.host6 ? bot->net.host6 : "", 
              bot->net.v6,
              bot->hub,
-             bot->pid);
+             (int)bot->pid);
   }
   if (conf.bot && ((bot = conf.bot))) {
     sdprintf(STR("me:\n"));
@@ -74,7 +74,7 @@ tellconf()
              bot->net.host ? bot->net.host : "", bot->net.ip6 ? bot->net.ip6 : "", bot->net.host6 ? bot->net.host6 : "", 
              bot->net.v6,
              bot->hub,
-             bot->pid);
+             (int)bot->pid);
   }
 }
 
@@ -113,7 +113,7 @@ spawnbots(conf_bot *bots, bool rehashed)
      */
     } else if ((conf.bot && !strcasecmp(bot->nick, conf.bot->nick) &&
                (updating == UPDATE_AUTO || rehashed)) || (bot->pid && !updating)) {
-      sdprintf(STR(" ... skipping. Updating: %d, pid: %d"), updating, bot->pid);
+      sdprintf(STR(" ... skipping. Updating: %d, pid: %d"), updating, (int)bot->pid);
       continue;
     } else {
       /* if we are updating with -u then we need to restart ALL bots */

+ 6 - 6
src/main.c

@@ -425,7 +425,7 @@ static void dtx_arg(int& argc, char *argv[])
         char date[50] = "";
 
         strftime(date, sizeof date, "%c %Z", gmtime(&buildts));
-	printf(STR("%s\nBuild Date: %s (%s%lu%s)\n"), version, date, BOLD(-1), buildts, BOLD_END(-1));
+	printf(STR("%s\nBuild Date: %s (%s%li%s)\n"), version, date, BOLD(-1), (long)buildts, BOLD_END(-1));
         printf(STR("BuildOS: %s%s%s BuildArch: %s%s%s\n"), BOLD(-1), BUILD_OS, BOLD_END(-1), BOLD(-1), BUILD_ARCH, BOLD_END(-1));
         printf(STR("- http://wraith.botpack.net -\n"));
 #ifdef DEBUG
@@ -752,13 +752,13 @@ int main(int argc, char **argv)
 
   /* Version info! */
   simple_snprintf(ver, sizeof(ver), STR("[%s] Wraith %s"), settings.packname, egg_version);
-  simple_snprintf(version, sizeof(version), STR("%s%s (%lu)"), ver,
+  simple_snprintf(version, sizeof(version), STR("%s%s (%li)"), ver,
 #ifdef DEBUG
       "(d)",
 #else
       "",
 #endif
-      buildts);
+      (long)buildts);
 
   memcpy(&nowtm, gmtime(&now), sizeof(struct tm));
   lastmin = nowtm.tm_min;
@@ -770,14 +770,14 @@ int main(int argc, char **argv)
     if (settings.prefix[i] != SETTINGS_HEADER[0])
       werr(ERR_BADPASS);
 
-  sdprintf(STR("my euid: %d my uuid: %d, my ppid: %d my pid: %d"), myuid, getuid(), getppid(), mypid);
+  sdprintf(STR("my euid: %d my uuid: %d, my ppid: %d my pid: %d"), myuid, getuid(), (int)getppid(), (int)mypid);
 
   /* Check and load conf file */
   startup_checks(0);
 
   if (!socksfile && ((conf.bot->localhub && !updating) || !conf.bot->localhub)) {
     if ((conf.bot->pid > 0) && conf.bot->pid_file) {
-      sdprintf(STR("%s is already running, pid: %d"), conf.bot->nick, conf.bot->pid);
+      sdprintf(STR("%s is already running, pid: %d"), conf.bot->nick, (int)conf.bot->pid);
       exit(1);
     }
   }
@@ -825,7 +825,7 @@ int main(int argc, char **argv)
 
     printf(STR("%s[%s%s%s]%s -%s- initiated %s(%s%d%s)%s\n"),
            BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick,
-           BOLD(-1), BOLD_END(-1), mypid, BOLD(-1), BOLD_END(-1));
+           BOLD(-1), BOLD_END(-1), (int)mypid, BOLD(-1), BOLD_END(-1));
 
     } else
       writepid(conf.bot->pid_file, mypid);

+ 3 - 3
src/misc.c

@@ -802,9 +802,9 @@ restart(int idx)
       stream << bd::String::printf(STR("+flood_count %d\n"), flood_count);
     if (my_cookie_counter)
       stream << bd::String::printf(STR("+my_cookie_counter %lu\n"), my_cookie_counter);
-    stream << bd::String::printf(STR("+server_online %li\n"), server_online);
+    stream << bd::String::printf(STR("+server_online %li\n"), (long)server_online);
   }
-  stream << bd::String::printf(STR("+online_since %li\n"), online_since);
+  stream << bd::String::printf(STR("+online_since %li\n"), (long)online_since);
   if (floodless)
     stream << bd::String::printf(STR("+server_floodless %d\n"), floodless);
   if (in_deaf)
@@ -814,7 +814,7 @@ restart(int idx)
   for (struct chanset_t *chan = chanset; chan; chan = chan->next)
     if (shouldjoin(chan) && (channel_active(chan) || channel_pending(chan)))
       stream << bd::String::printf(STR("+chan %s\n"), chan->dname);
-  stream << bd::String::printf(STR("+buildts %li\n"), buildts);
+  stream << bd::String::printf(STR("+buildts %li\n"), (long)buildts);
   stream << bd::String::printf(STR("+ip4 %s\n"), myipstr(AF_INET));
   stream << bd::String::printf(STR("+ip6 %s\n"), myipstr(AF_INET6));
   replay_cache(-1, &stream);

+ 1 - 1
src/userent.c

@@ -730,7 +730,7 @@ static bool laston_set(struct userrec *u, struct user_entry *e, void *buf)
 
   /* FIXME: laston sharing is disabled until a better solution is found
   if (!noshare)
-    shareout("c LASTON %s %s %li\n", u->handle, li->lastonplace ? li->lastonplace : "-", li->laston);
+    shareout("c LASTON %s %s %li\n", u->handle, li->lastonplace ? li->lastonplace : "-", (long) li->laston);
   */
 
   return 1;