--- goo/gmem.cc.orig Tue Feb 27 14:05:51 2007 +++ goo/gmem.cc @@ -47,9 +47,9 @@ #endif /* DEBUG_MEM */ -void *gmalloc(int size) GMEM_EXCEP { +void *gmalloc(size_t size) GMEM_EXCEP { #ifdef DEBUG_MEM - int size1; + size_t size1; char *mem; GMemHdr *hdr; void *data; @@ -106,11 +106,11 @@ #endif } -void *grealloc(void *p, int size) GMEM_EXCEP { +void *grealloc(void *p, size_t size) GMEM_EXCEP { #ifdef DEBUG_MEM GMemHdr *hdr; void *q; - int oldSize; + size_t oldSize; if (size <= 0) { if (p) { @@ -154,14 +154,14 @@ #endif } -void *gmallocn(int nObjs, int objSize) GMEM_EXCEP { - int n; +void *gmallocn(int nObjs, size_t objSize) GMEM_EXCEP { + size_t n; if (nObjs == 0) { return NULL; } n = nObjs * objSize; - if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { + if (objSize == 0u || nObjs < 0 || (size_t)nObjs >= INT_MAX / objSize) { #if USE_EXCEPTIONS throw GMemException(); #else @@ -172,8 +172,8 @@ return gmalloc(n); } -void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP { - int n; +void *greallocn(void *p, int nObjs, size_t objSize) GMEM_EXCEP { + size_t n; if (nObjs == 0) { if (p) { @@ -182,7 +182,7 @@ return NULL; } n = nObjs * objSize; - if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { + if (objSize == 0u || nObjs < 0 || (size_t)nObjs >= INT_MAX / objSize) { #if USE_EXCEPTIONS throw GMemException(); #else --- goo/gmem.h.orig Tue Feb 27 14:05:51 2007 +++ goo/gmem.h @@ -36,13 +36,13 @@ * Same as malloc, but prints error message and exits if malloc() * returns NULL. */ -extern void *gmalloc(int size) GMEM_EXCEP; +extern void *gmalloc(size_t size) GMEM_EXCEP; /* * Same as realloc, but prints error message and exits if realloc() * returns NULL. If
is NULL, calls malloc instead of realloc(). */ -extern void *grealloc(void *p, int size) GMEM_EXCEP; +extern void *grealloc(void *p, size_t size) GMEM_EXCEP; /* * These are similar to gmalloc and grealloc, but take an object count @@ -50,8 +50,8 @@ * bytes, but there is an additional error check that the total size * doesn't overflow an int. */ -extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP; -extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP; +extern void *gmallocn(int nObjs, size_t objSize) GMEM_EXCEP; +extern void *greallocn(void *p, int nObjs, size_t objSize) GMEM_EXCEP; /* * Same as free, but checks for and ignores NULL pointers.