summaryrefslogtreecommitdiff
path: root/expat
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2022-10-11 16:50:30 +0100
committerChris Liddell <chris.liddell@artifex.com>2022-10-11 18:49:48 +0100
commitd54d6fffba57bd417e31ab33230cbc490142bf03 (patch)
treec8091ad41edb9f38b121096a92b3382ad092a11b /expat
parent3134ce2b26946d1bbe2dca318e0cebe6acd0f266 (diff)
downloadghostpdl-d54d6fffba57bd417e31ab33230cbc490142bf03.tar.gz
Tweaks for expat 2.4.9 to build on Windows.
Diffstat (limited to 'expat')
-rw-r--r--expat/expat_config.h22
-rw-r--r--expat/lib/siphash.h2
-rw-r--r--expat/lib/xmlparse.c7
-rw-r--r--expat/lib/xmltok.c5
4 files changed, 30 insertions, 6 deletions
diff --git a/expat/expat_config.h b/expat/expat_config.h
index 7842c262c..f64037ac6 100644
--- a/expat/expat_config.h
+++ b/expat/expat_config.h
@@ -23,7 +23,7 @@
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getrandom' function. */
-#define HAVE_GETRANDOM 1
+/*#define HAVE_GETRANDOM 1*/
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -35,7 +35,21 @@
#define HAVE_MMAP 1
/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
+/*#define HAVE_STDINT_H 1*/
+# if defined(__WIN32__) /* MSVC currently doesn't provide C99 headers */
+ typedef signed char int8_t;
+ typedef short int int16_t;
+ typedef int int32_t;
+ typedef __int64 int64_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short int uint16_t;
+ typedef unsigned int uint32_t;
+ typedef unsigned __int64 uint64_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+ typedef unsigned long long uint64_t;
+#endif
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
@@ -50,7 +64,7 @@
#define HAVE_STRING_H 1
/* Define to 1 if you have `syscall' and `SYS_getrandom'. */
-#define HAVE_SYSCALL_GETRANDOM 1
+/*#define HAVE_SYSCALL_GETRANDOM 1*/
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
@@ -117,7 +131,7 @@
#define XML_CONTEXT_BYTES 1024
/* Define to include code reading entropy from `/dev/urandom'. */
-#define XML_DEV_URANDOM 1
+/*#define XML_DEV_URANDOM 1*/
/* Define to make parameter entity parsing functionality available. */
#define XML_DTD 1
diff --git a/expat/lib/siphash.h b/expat/lib/siphash.h
index 303283ad2..b1cff17eb 100644
--- a/expat/lib/siphash.h
+++ b/expat/lib/siphash.h
@@ -99,7 +99,9 @@
#define SIPHASH_H
#include <stddef.h> /* size_t */
+#ifdef HAVE_STDINT_H
#include <stdint.h> /* uint64_t uint32_t uint8_t */
+#endif
/*
* Workaround to not require a C++11 compiler for using ULL suffix
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
index b89d7ed22..db1f26083 100644
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -78,7 +78,9 @@
#include <limits.h> /* UINT_MAX */
#include <stdio.h> /* fprintf */
#include <stdlib.h> /* getenv, rand_s */
+#ifdef HAVE_STDINT_H
#include <stdint.h> /* uintptr_t */
+#endif
#include <math.h> /* isnan */
#ifdef _WIN32
@@ -2533,7 +2535,7 @@ XML_Bool XMLCALL
XML_SetBillionLaughsAttackProtectionMaximumAmplification(
XML_Parser parser, float maximumAmplificationFactor) {
if ((parser == NULL) || (parser->m_parentParser != NULL)
- || isnan(maximumAmplificationFactor)
+/* || isnan(maximumAmplificationFactor) */
|| (maximumAmplificationFactor < 1.0f)) {
return XML_FALSE;
}
@@ -5283,6 +5285,7 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
case XML_ROLE_GROUP_OPEN:
if (parser->m_prologState.level >= parser->m_groupSize) {
char *new_connector;
+ int *new_scaff_index;
if (parser->m_groupSize) {
{
/* Detect and prevent integer overflow */
@@ -5310,7 +5313,7 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
}
#endif
- int *const new_scaff_index = (int *)REALLOC(
+ new_scaff_index = (int *)REALLOC(
parser, dtd->scaffIndex, parser->m_groupSize * sizeof(int));
if (new_scaff_index == NULL)
return XML_ERROR_NO_MEMORY;
diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c
index 2b7012a58..9f857b3d0 100644
--- a/expat/lib/xmltok.c
+++ b/expat/lib/xmltok.c
@@ -48,7 +48,12 @@
#include <stddef.h>
#include <string.h> /* memcpy */
+#if 0
#include <stdbool.h>
+#endif
+typedef int bool;
+#define true 1
+#define false 0
#ifdef _WIN32
# include "winconfig.h"