]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
fix a warning
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 6ee48e20035fbb913dc3db93a618f19c07739b5a..7b83e25a45f18752b50910adb771f75855959b0b 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -26,7 +26,7 @@ cvar_t developer_memorydebug = {0, "developer_memorydebug", "0"};
 
 mempool_t *poolchain = NULL;
 
-void *_Mem_Alloc(mempool_t *pool, int size, const char *filename, int fileline)
+void *_Mem_Alloc(mempool_t *pool, size_t size, const char *filename, int fileline)
 {
 #if MEMCLUMPING
        int i, j, k, needed, endbit, largest;
@@ -245,7 +245,7 @@ void _Mem_FreePool(mempool_t **pool, const char *filename, int fileline)
 
                // free memory owned by the pool
                while ((*pool)->chain)
-                       Mem_Free((void *)((qbyte *) (*pool)->chain + sizeof(memheader_t)));
+                       _Mem_Free((void *)((qbyte *) (*pool)->chain + sizeof(memheader_t)), filename, fileline);
 
                // free child pools, too
                for(iter = poolchain; iter; temp = iter = iter->next)
@@ -272,7 +272,7 @@ void _Mem_EmptyPool(mempool_t *pool, const char *filename, int fileline)
 
        // free memory owned by the pool
        while (pool->chain)
-               Mem_Free((void *)((qbyte *) pool->chain + sizeof(memheader_t)));
+               _Mem_Free((void *)((qbyte *) pool->chain + sizeof(memheader_t)), filename, fileline);
 
        // empty child pools, too
        for(chainaddress = poolchain; chainaddress; chainaddress = chainaddress->next)
@@ -352,7 +352,7 @@ mempool_t *zonemempool;
 
 void Mem_PrintStats(void)
 {
-       int count = 0, size = 0;
+       size_t count = 0, size = 0;
        mempool_t *pool;
        memheader_t *mem;
        Mem_CheckSentinelsGlobal();
@@ -361,14 +361,14 @@ void Mem_PrintStats(void)
                count++;
                size += pool->totalsize;
        }
-       Con_Printf("%i memory pools, totalling %i bytes (%.3fMB)\n", count, size, size / 1048576.0);
+       Con_Printf("%lu memory pools, totalling %lu bytes (%.3fMB)\n", (unsigned long)count, (unsigned long)size, size / 1048576.0);
        for (pool = poolchain;pool;pool = pool->next)
        {
                if ((pool->flags & POOLFLAG_TEMP) && pool->chain)
                {
-                       Con_Printf("Memory pool %p has sprung a leak totalling %i bytes (%.3fMB)!  Listing contents...\n", pool, pool->totalsize, pool->totalsize / 1048576.0);
+                       Con_Printf("Memory pool %p has sprung a leak totalling %lu bytes (%.3fMB)!  Listing contents...\n", pool, (unsigned long)pool->totalsize, pool->totalsize / 1048576.0);
                        for (mem = pool->chain;mem;mem = mem->next)
-                               Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+                               Con_Printf("%10lu bytes allocated at %s:%i\n", (unsigned long)mem->size, mem->filename, mem->fileline);
                }
        }
 }
@@ -382,11 +382,11 @@ void Mem_PrintList(int listallocations)
                   "size    name\n");
        for (pool = poolchain;pool;pool = pool->next)
        {
-               Con_Printf("%10ik (%10ik actual) %s (%+i byte change) %s\n", (pool->totalsize + 1023) / 1024, (pool->realsize + 1023) / 1024, pool->name, pool->totalsize - pool->lastchecksize, (pool->flags & POOLFLAG_TEMP) ? "TEMP" : "");
+               Con_Printf("%10luk (%10luk actual) %s (%+li byte change) %s\n", (unsigned long) ((pool->totalsize + 1023) / 1024), (unsigned long)((pool->realsize + 1023) / 1024), pool->name, (long)pool->totalsize - pool->lastchecksize, (pool->flags & POOLFLAG_TEMP) ? "TEMP" : "");
                pool->lastchecksize = pool->totalsize;
                if (listallocations)
                        for (mem = pool->chain;mem;mem = mem->next)
-                               Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+                               Con_Printf("%10lu bytes allocated at %s:%i\n", (unsigned long)mem->size, mem->filename, mem->fileline);
        }
 }