From: Ari Johnson <ari@startrekkin.net>
Date: Sat, 17 Feb 2007 19:18:43 +0000 (+0000)
Subject: 64-bit compatibility fixes
X-Git-Tag: 0.73~214
X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=35dc3dc145226bb1a79510e804efc88cde23572d;p=cobramush.git

64-bit compatibility fixes
---

diff --git a/src/bsd.c b/src/bsd.c
index a5e84f4..d9668e8 100644
--- a/src/bsd.c
+++ b/src/bsd.c
@@ -3993,7 +3993,7 @@ do_doing(dbref player, const char *message)
       strcpy(d->doing, buf);
   if (strlen(message) >= DOING_LEN) {
     notify_format(player,
-		  T("Doing set. %d characters lost."),
+		  T("Doing set. %zu characters lost."),
 		  strlen(message) - (DOING_LEN - 1));
   } else
     notify(player, T("Doing set."));
@@ -4026,7 +4026,7 @@ do_poll(dbref player, const char *message)
   if (strlen(message) >= DOING_LEN) {
     poll_msg[DOING_LEN - 1] = 0;
     notify_format(player,
-		  T("Poll set. %d characters lost."),
+		  T("Poll set. %zu characters lost."),
 		  strlen(message) - (DOING_LEN - 1));
   } else
     notify(player, T("Poll set."));
diff --git a/src/chunk.c b/src/chunk.c
index 32aefc7..6c98c9e 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -1284,7 +1284,7 @@ read_cache_region(fd_type fd, RegionHeader * rhp, u_int_16 region)
   mush_panicf("chunk swap file read, %d remaining, GetLastError %d",
 	      remaining, GetLastError());
 #else
-  mush_panicf("chunk swap file read, %d remaining, errno %d: %s",
+  mush_panicf("chunk swap file read, %zu remaining, errno %d: %s",
 	      remaining, errno, strerror(errno));
 #endif
 }
@@ -1349,7 +1349,7 @@ write_cache_region(fd_type fd, RegionHeader * rhp, u_int_16 region)
   mush_panicf("chunk swap file write, %d remaining, GetLastError %d",
 	      remaining, GetLastError());
 #else
-  mush_panicf("chunk swap file write, %d remaining, errno %d: %s",
+  mush_panicf("chunk swap file write, %zu remaining, errno %d: %s",
 	      remaining, errno, strerror(errno));
 #endif
 }
diff --git a/src/console.c b/src/console.c
index 8a4fdaf..b54147a 100644
--- a/src/console.c
+++ b/src/console.c
@@ -3270,7 +3270,7 @@ do_doing(dbref player, const char *message)
       strcpy(d->doing, buf);
   if (strlen(message) >= DOING_LEN) {
     notify_format(player,
-		  T("Doing set. %d characters lost."),
+		  T("Doing set. %zu characters lost."),
 		  strlen(message) - (DOING_LEN - 1));
   } else
     notify(player, T("Doing set."));
@@ -3303,7 +3303,7 @@ do_poll(dbref player, const char *message)
   if (strlen(message) >= DOING_LEN) {
     poll_msg[DOING_LEN - 1] = 0;
     notify_format(player,
-		  T("Poll set. %d characters lost."),
+		  T("Poll set. %zu characters lost."),
 		  strlen(message) - (DOING_LEN - 1));
   } else
     notify(player, T("Poll set."));
diff --git a/src/extchat.c b/src/extchat.c
index 2b20fce..40d2f93 100644
--- a/src/extchat.c
+++ b/src/extchat.c
@@ -1083,7 +1083,7 @@ list_partial_matches(dbref player, const char *name, enum chan_match_type type)
     if (!Chan_Can_See(p, player))
       continue;
     if ((type == PMATCH_ALL) || ((type == PMATCH_ON)
-				 ? (int) (void *) OnChannel(player, p)
+				 ? (long) OnChannel(player, p)
 				 : !OnChannel(player, p))) {
       strcpy(cleanp, remove_markup(ChanName(p), NULL));
       if (string_prefix(cleanp, cleanname)) {
diff --git a/src/plyrlist.c b/src/plyrlist.c
index c03d3ba..5e13d50 100644
--- a/src/plyrlist.c
+++ b/src/plyrlist.c
@@ -54,12 +54,14 @@ clear_players(void)
 void
 add_player(dbref player, const char *alias)
 {
+  long tmp;
+  tmp = player;
   if (!hft_initialized)
     init_hft();
   if (alias)
-    hashadd(strupper(alias), (void *) player, &htab_player_list);
+    hashadd(strupper(alias), (void *) tmp, &htab_player_list);
   else
-    hashadd(strupper(Name(player)), (void *) player, &htab_player_list);
+    hashadd(strupper(Name(player)), (void *) tmp, &htab_player_list);
 }
 
 /** Look up a player in the player list htab (or by dbref).
@@ -71,6 +73,7 @@ lookup_player(const char *name)
 {
   int p;
   void *hval;
+  long tmp;
 
   if (!name || !*name)
     return NOTHING;
@@ -86,7 +89,8 @@ lookup_player(const char *name)
   hval = hashfind(strupper(name), &htab_player_list);
   if (!hval)
     return NOTHING;
-  return (dbref) hval;
+  tmp = (long) hval;
+  return (dbref) tmp;
   /* By the way, there's a flaw in this code. If #0 was a player, we'd
    * hash its name with a dbref of (void *)0, aka NULL, so we'd never
    * be able to retrieve that player. However, we assume that #0 will
diff --git a/src/strtree.c b/src/strtree.c
index 8469aab..f8c7597 100644
--- a/src/strtree.c
+++ b/src/strtree.c
@@ -143,7 +143,7 @@ st_stats(dbref player, StrTree *root, const char *name)
   bytes = (sizeof(StrNode) - BUFFER_LEN) * root->count + root->mem;
   st_traverse_stats(root->root, &maxdepth, &mindepth, &avgdepth, &leaves,
 		    &perms, &nperms);
-  notify_format(player, "%-10s %7d %7d %6d %4d %4d %9lu %11.3f %7lu",
+  notify_format(player, "%-10s %7ld %7d %6d %4d %4d %9lu %11.3f %7lu",
 		name, root->count, leaves, mindepth, maxdepth,
 		avgdepth, perms,
 		((double) nperms / (double) (root->count - perms)), bytes);
diff --git a/src/utils.c b/src/utils.c
index 4078d73..12efcc7 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -68,7 +68,7 @@ mush_malloc(size_t size, const char *check)
   add_check(check);
   ptr = malloc(size);
   if (ptr == NULL)
-    do_log(LT_ERR, 0, 0, "mush_malloc failed to malloc %d bytes for %s",
+    do_log(LT_ERR, 0, 0, "mush_malloc failed to malloc %ld bytes for %s",
 	   size, check);
   return ptr;
 }