015-017.diff.bz2
patches · 1.3 KB · 2010-03-30
Download « Back to the patches list
diff -buraP 015/HACKLOG 017/HACKLOG
--- 015/HACKLOG 2008-10-11 10:10:30.000000000 -0400
+++ 017/HACKLOG 2008-10-13 02:44:10.000000000 -0400
@@ -464,3 +464,14 @@
of the inconsistent blank lines.. IE: 3 lines between
foo() and foo2(), but 2 lines between foo2() and foo3().
+081012 Davion
+ Fixed up the do_dump() command, which shows memory statistics,
+ to compile cleanly on 64-bit architectures. Remember to use
+ the %z modifier for printf of things that vary, like size_t
+ or pointers.
+
+081012 Quixadhal
+ I then also changed my hack in str_dup() to use size_t, which
+ works properly on both platforms, whereas unsigned long does
+ not.
+
diff -buraP 015/src/db.c 017/src/db.c
--- 015/src/db.c 2008-10-12 02:19:42.000000000 -0400
+++ 017/src/db.c 2008-10-13 02:51:28.000000000 -0400
@@ -1,5 +1,5 @@
/*
- * RAM $Id: db.c 15 2008-10-12 06:19:42Z quixadhal $
+ * RAM $Id: db.c 17 2008-10-13 06:51:28Z quixadhal $
*/
/***************************************************************************
@@ -2605,7 +2605,7 @@
if ( str >= string_space && str < top_string ) {
/* return str; */
- return (char *)(unsigned int)str;
+ return (char *)(size_t)str;
/* I can't believe I just did that cast... EVIL! */
}
@@ -2717,7 +2717,7 @@
aff_count = 0;
/* mobile prototypes */
- fprintf(fp,"MobProt %4d (%8d bytes)\n",
+ fprintf(fp,"MobProt %4d (%8zd bytes)\n",
top_mob_index, top_mob_index * (sizeof(*pMobIndex)));
/* mobs */
@@ -2733,7 +2733,7 @@
for (fch = char_free; fch != NULL; fch = fch->next)
count2++;
- fprintf(fp,"Mobs %4d (%8d bytes), %2d free (%d bytes)\n",
+ fprintf(fp,"Mobs %4d (%8zd bytes), %2d free (%zd bytes)\n",
count, count * (sizeof(*fch)), count2, count2 * (sizeof(*fch)));
/* pcdata */
@@ -2741,7 +2741,7 @@
for (pc = pcdata_free; pc != NULL; pc = pc->next)
count++;
- fprintf(fp,"Pcdata %4d (%8d bytes), %2d free (%d bytes)\n",
+ fprintf(fp,"Pcdata %4d (%8zd bytes), %2d free (%zd bytes)\n",
num_pcs, num_pcs * (sizeof(*pc)), count, count * (sizeof(*pc)));
/* descriptors */
@@ -2751,7 +2751,7 @@
for (d= descriptor_free; d != NULL; d = d->next)
count2++;
- fprintf(fp, "Descs %4d (%8d bytes), %2d free (%d bytes)\n",
+ fprintf(fp, "Descs %4d (%8zd bytes), %2d free (%zd bytes)\n",
count, count * (sizeof(*d)), count2, count2 * (sizeof(*d)));
/* object prototypes */
@@ -2763,7 +2763,7 @@
nMatch++;
}
- fprintf(fp,"ObjProt %4d (%8d bytes)\n",
+ fprintf(fp,"ObjProt %4d (%8zd bytes)\n",
top_obj_index, top_obj_index * (sizeof(*pObjIndex)));
@@ -2778,7 +2778,7 @@
for (obj = obj_free; obj != NULL; obj = obj->next)
count2++;
- fprintf(fp,"Objs %4d (%8d bytes), %2d free (%d bytes)\n",
+ fprintf(fp,"Objs %4d (%8zd bytes), %2d free (%zd bytes)\n",
count, count * (sizeof(*obj)), count2, count2 * (sizeof(*obj)));
/* affects */
@@ -2786,15 +2786,15 @@
for (af = affect_free; af != NULL; af = af->next)
count++;
- fprintf(fp,"Affects %4d (%8d bytes), %2d free (%d bytes)\n",
+ fprintf(fp,"Affects %4d (%8zd bytes), %2d free (%zd bytes)\n",
aff_count, aff_count * (sizeof(*af)), count, count * (sizeof(*af)));
/* rooms */
- fprintf(fp,"Rooms %4d (%8d bytes)\n",
+ fprintf(fp,"Rooms %4d (%8zd bytes)\n",
top_room, top_room * (sizeof(*room)));
/* exits */
- fprintf(fp,"Exits %4d (%8d bytes)\n",
+ fprintf(fp,"Exits %4d (%8zd bytes)\n",
top_exit, top_exit * (sizeof(*pExit)));
fclose(fp);