[poppler] poppler/goo: gmem.c,1.2,1.3 gmem.h,1.2,1.3
Brad Hards
bradh at freedesktop.org
Sat Aug 27 01:43:45 PDT 2005
- Previous message: [poppler] poppler/fofi: FoFiTrueType.cc, 1.1.1.1, 1.2 FoFiType1.cc,
1.3, 1.4 FoFiType1C.cc, 1.1.1.1, 1.2
- Next message: [poppler] poppler/poppler: Annot.cc, 1.1.1.1, 1.2 Array.cc, 1.2,
1.3 BuiltinFont.cc, 1.1.1.1, 1.2 CMap.cc, 1.1.1.1,
1.2 Catalog.cc, 1.10, 1.11 CharCodeToUnicode.cc, 1.1.1.1,
1.2 Dict.cc, 1.2, 1.3 Function.cc, 1.1.1.1, 1.2 Gfx.cc, 1.2,
1.3 GfxFont.cc, 1.3, 1.4 GfxState.cc, 1.3,
1.4 JArithmeticDecoder.cc, 1.1.1.1, 1.2 JBIG2Stream.cc,
1.1.1.1, 1.2 Link.cc, 1.1.1.1, 1.2 NameToCharCode.cc, 1.1.1.1,
1.2 Outline.cc, 1.2, 1.3 SplashOutputDev.cc, 1.2,
1.3 Stream.cc, 1.3, 1.4 TextOutputDev.cc, 1.10, 1.11 XRef.cc,
1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/poppler/poppler/goo
In directory gabe:/tmp/cvs-serv7837/goo
Modified Files:
gmem.c gmem.h
Log Message:
Merge the gmalloc -> gmallocn changes from xpdf 3.0.1. This change is
based on martink's work (13-xpdf-3.01-goo-allocn.patch) with some
tweaking by me. There may be some residual gmallocn changes still to
be merged.
Index: gmem.c
===================================================================
RCS file: /cvs/poppler/poppler/goo/gmem.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gmem.c 1 May 2005 21:54:55 -0000 1.2
+++ gmem.c 27 Aug 2005 08:43:43 -0000 1.3
@@ -135,6 +135,28 @@
#endif
}
+void *gmallocn(int nObjs, int objSize) {
+ int n;
+
+ n = nObjs * objSize;
+ if (objSize == 0 || n / objSize != nObjs) {
+ fprintf(stderr, "Bogus memory allocation size\n");
+ exit(1);
+ }
+ return gmalloc(n);
+}
+
+void *greallocn(void *p, int nObjs, int objSize) {
+ int n;
+
+ n = nObjs * objSize;
+ if (objSize == 0 || n / objSize != nObjs) {
+ fprintf(stderr, "Bogus memory allocation size\n");
+ exit(1);
+ }
+ return grealloc(p, n);
+}
+
void gfree(void *p) {
#ifdef DEBUG_MEM
size_t size;
Index: gmem.h
===================================================================
RCS file: /cvs/poppler/poppler/goo/gmem.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gmem.h 1 May 2005 21:54:55 -0000 1.2
+++ gmem.h 27 Aug 2005 08:43:43 -0000 1.3
@@ -28,6 +28,15 @@
extern void *grealloc(void *p, size_t size);
/*
+ * These are similar to gmalloc and grealloc, but take an object count
+ * and size. The result is similar to allocating nObjs * objSize
+ * bytes, but there is an additional error check that the total size
+ * doesn't overflow an int.
+ */
+extern void *gmallocn(int nObjs, int objSize);
+extern void *greallocn(void *p, int nObjs, int objSize);
+
+/*
* Same as free, but checks for and ignores NULL pointers.
*/
extern void gfree(void *p);
- Previous message: [poppler] poppler/fofi: FoFiTrueType.cc, 1.1.1.1, 1.2 FoFiType1.cc,
1.3, 1.4 FoFiType1C.cc, 1.1.1.1, 1.2
- Next message: [poppler] poppler/poppler: Annot.cc, 1.1.1.1, 1.2 Array.cc, 1.2,
1.3 BuiltinFont.cc, 1.1.1.1, 1.2 CMap.cc, 1.1.1.1,
1.2 Catalog.cc, 1.10, 1.11 CharCodeToUnicode.cc, 1.1.1.1,
1.2 Dict.cc, 1.2, 1.3 Function.cc, 1.1.1.1, 1.2 Gfx.cc, 1.2,
1.3 GfxFont.cc, 1.3, 1.4 GfxState.cc, 1.3,
1.4 JArithmeticDecoder.cc, 1.1.1.1, 1.2 JBIG2Stream.cc,
1.1.1.1, 1.2 Link.cc, 1.1.1.1, 1.2 NameToCharCode.cc, 1.1.1.1,
1.2 Outline.cc, 1.2, 1.3 SplashOutputDev.cc, 1.2,
1.3 Stream.cc, 1.3, 1.4 TextOutputDev.cc, 1.10, 1.11 XRef.cc,
1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the poppler
mailing list