summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/goo
diff options
context:
space:
mode:
authorMartin Schröder <martin@oneiros.de>2006-12-25 23:53:09 +0000
committerMartin Schröder <martin@oneiros.de>2006-12-25 23:53:09 +0000
commit6f0e5de91f7cb5ea0951bc92a74a4c22722a54aa (patch)
tree89d1429133d4d58410a18e06fb544f35ad79a8f2 /Build/source/libs/xpdf/goo
parent57379ff68397e601ba3be4ef7f81f30629a43de9 (diff)
Changes to xpdf for pdftex 1.40 (official und unofficial patches)
git-svn-id: svn://tug.org/texlive/trunk@2921 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/xpdf/goo')
-rw-r--r--Build/source/libs/xpdf/goo/Makefile.in6
-rw-r--r--Build/source/libs/xpdf/goo/gfile.cc2
-rw-r--r--Build/source/libs/xpdf/goo/gfile.h5
-rw-r--r--Build/source/libs/xpdf/goo/gmem.c22
4 files changed, 28 insertions, 7 deletions
diff --git a/Build/source/libs/xpdf/goo/Makefile.in b/Build/source/libs/xpdf/goo/Makefile.in
index 3770857d2b8..fe992f46ac5 100644
--- a/Build/source/libs/xpdf/goo/Makefile.in
+++ b/Build/source/libs/xpdf/goo/Makefile.in
@@ -4,6 +4,8 @@
#
# Copyright 1996 Derek B. Noonburg
#
+# Modified for pdftex by Martin Schröder 2005
+#
#========================================================================
srcdir = @srcdir@
@@ -13,7 +15,9 @@ srcdirparent = $(srcdir)/..
kpathsea_include_dir = -I../../../texk -I$(srcdir)/../../../texk
ALLCFLAGS = $(CFLAGS) @DEFS@ -I.. -I$(srcdir)/.. -I. -I$(srcdir) $(kpathsea_include_dir)
-ALLCXXFLAGS = $(CXXFLAGS) @DEFS@ -I.. -I$(srcdir)/.. -I. -I$(srcdir) $(kpathsea_include_dir)
+ALLCXXFLAGS = $(CXXFLAGS) @DEFS@ \
+ -I.. -I$(srcdir)/.. -I. -I$(srcdir) $(kpathsea_include_dir) \
+ -DPDF_PARSER_ONLY
CXXFLAGS = @CXXFLAGS@
CC = @CC@
CXX = @CXX@
diff --git a/Build/source/libs/xpdf/goo/gfile.cc b/Build/source/libs/xpdf/goo/gfile.cc
index 11f5cf69e20..caa96e7459b 100644
--- a/Build/source/libs/xpdf/goo/gfile.cc
+++ b/Build/source/libs/xpdf/goo/gfile.cc
@@ -437,6 +437,7 @@ time_t getModTime(char *fileName) {
#endif
}
+#ifndef PDF_PARSER_ONLY
GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
#if defined(WIN32)
//---------- Win32 ----------
@@ -521,6 +522,7 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
return gTrue;
#endif
}
+#endif
GBool executeCommand(char *cmd) {
#ifdef VMS
diff --git a/Build/source/libs/xpdf/goo/gfile.h b/Build/source/libs/xpdf/goo/gfile.h
index 82f1d7a98e3..8817e8b2381 100644
--- a/Build/source/libs/xpdf/goo/gfile.h
+++ b/Build/source/libs/xpdf/goo/gfile.h
@@ -46,6 +46,9 @@
# endif
# endif
#endif
+#if defined(__DJGPP__)
+typedef unsigned int time_t;
+#endif
#include "gtypes.h"
class GString;
@@ -83,7 +86,9 @@ extern time_t getModTime(char *fileName);
// should be done to the returned file pointer; the file may be
// reopened later for reading, but not for writing. The <mode> string
// should be "w" or "wb". Returns true on success.
+#ifndef PDF_PARSER_ONLY
extern GBool openTempFile(GString **name, FILE **f, char *mode, char *ext);
+#endif
// Execute <command>. Returns true on success.
extern GBool executeCommand(char *cmd);
diff --git a/Build/source/libs/xpdf/goo/gmem.c b/Build/source/libs/xpdf/goo/gmem.c
index a0f2cf540e0..b97535adf04 100644
--- a/Build/source/libs/xpdf/goo/gmem.c
+++ b/Build/source/libs/xpdf/goo/gmem.c
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
+#include <limits.h>
#include "gmem.h"
#ifdef DEBUG_MEM
@@ -63,7 +64,7 @@ void *gmalloc(int size) {
int lst;
unsigned long *trl, *p;
- if (size == 0)
+ if (size <= 0)
return NULL;
size1 = gMemDataSize(size);
if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
@@ -86,7 +87,7 @@ void *gmalloc(int size) {
#else
void *p;
- if (size == 0)
+ if (size <= 0)
return NULL;
if (!(p = malloc(size))) {
fprintf(stderr, "Out of memory\n");
@@ -102,7 +103,7 @@ void *grealloc(void *p, int size) {
void *q;
int oldSize;
- if (size == 0) {
+ if (size <= 0) {
if (p)
gfree(p);
return NULL;
@@ -120,7 +121,7 @@ void *grealloc(void *p, int size) {
#else
void *q;
- if (size == 0) {
+ if (size <= 0) {
if (p)
free(p);
return NULL;
@@ -140,8 +141,11 @@ void *grealloc(void *p, int size) {
void *gmallocn(int nObjs, int objSize) {
int n;
+ if (nObjs == 0) {
+ return NULL;
+ }
n = nObjs * objSize;
- if (objSize == 0 || n / objSize != nObjs) {
+ if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
fprintf(stderr, "Bogus memory allocation size\n");
exit(1);
}
@@ -151,8 +155,14 @@ void *gmallocn(int nObjs, int objSize) {
void *greallocn(void *p, int nObjs, int objSize) {
int n;
+ if (nObjs == 0) {
+ if (p) {
+ gfree(p);
+ }
+ return NULL;
+ }
n = nObjs * objSize;
- if (objSize == 0 || n / objSize != nObjs) {
+ if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
fprintf(stderr, "Bogus memory allocation size\n");
exit(1);
}