소스 검색

Cast time_t to long to avoid printf() format warning

Bryan Drewery 14 년 전
부모
커밋
54cc62a64b
3개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 3 3
      src/main.c
  2. 3 3
      src/misc.c
  3. 1 1
      src/userent.c

+ 3 - 3
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;

+ 3 - 3
src/misc.c

@@ -797,9 +797,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)
@@ -809,7 +809,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;