1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00
freebsd-ports/graphics/xpdf/files/patch-gmem
Norikatsu Shigemura a43acc3732 Update to 3.02.
PR:		ports/110058
Submitted by:	Eric P. Scott <eps+pbug0703 <at> ana.com>
		Jose Garcia Juanino <jjuanino <at> gmail.com>
2007-04-01 13:14:26 +00:00

96 lines
2.5 KiB
Plaintext

--- 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 <p> 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.