summaryrefslogtreecommitdiff
path: root/parser/expat
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2016-09-01 13:39:08 +0200
committerPale Moon <git-repo@palemoon.org>2016-09-01 13:39:08 +0200
commit3d8ce1a11a7347cc94a937719c4bc8df46fb8d14 (patch)
tree8c26ca375a6312751c00a27e1653fb6f189f0463 /parser/expat
parente449bdb1ec3a82f204bffdd9c3c54069d086eee3 (diff)
downloadpalemoon-gre-3d8ce1a11a7347cc94a937719c4bc8df46fb8d14.tar.gz
Base import of Tycho code (warning: huge commit)
Diffstat (limited to 'parser/expat')
-rw-r--r--parser/expat/expat_config.h15
-rw-r--r--parser/expat/lib/Makefile.in27
-rw-r--r--parser/expat/lib/expat_external.h2
-rw-r--r--parser/expat/lib/moz.build13
-rw-r--r--parser/expat/lib/xmlparse.c6
-rw-r--r--parser/expat/moz.build2
6 files changed, 27 insertions, 38 deletions
diff --git a/parser/expat/expat_config.h b/parser/expat/expat_config.h
index fad2c06bd..1f4de5ac4 100644
--- a/parser/expat/expat_config.h
+++ b/parser/expat/expat_config.h
@@ -27,10 +27,19 @@
#define XMLIMPORT
#define XML_UNICODE
-typedef PRUnichar XML_Char;
typedef char XML_LChar;
-#define XML_T(x) (PRUnichar)x
-#define XML_L(x) x
+/*
+ * The char16_t type is only usable in C++ code, so we need this ugly hack to
+ * select a binary compatible C type for the expat C code to use.
+ */
+#ifdef __cplusplus
+typedef char16_t XML_Char;
+#define XML_T(x) (char16_t)x
+#else
+#include <stdint.h>
+typedef uint16_t XML_Char;
+#define XML_T(x) (uint16_t)x
+#endif
#define XML_DTD
#define XML_NS
diff --git a/parser/expat/lib/Makefile.in b/parser/expat/lib/Makefile.in
deleted file mode 100644
index 473ed6bdd..000000000
--- a/parser/expat/lib/Makefile.in
+++ /dev/null
@@ -1,27 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MSVC_ENABLE_PGO := 1
-
-CSRCS = \
- xmlparse.c \
- xmlrole.c \
- xmltok.c \
- $(NULL)
-
-# We want only the static lib, not the shared lib
-FORCE_STATIC_LIB = 1
-
-include $(topsrcdir)/config/rules.mk
-
-xmltok.$(OBJ_SUFFIX): moz_extensions.c
-
-DEFINES += -DHAVE_EXPAT_CONFIG_H
diff --git a/parser/expat/lib/expat_external.h b/parser/expat/lib/expat_external.h
index e257c15f2..70c630bc9 100644
--- a/parser/expat/lib/expat_external.h
+++ b/parser/expat/lib/expat_external.h
@@ -82,7 +82,7 @@ extern "C" {
#define XML_UNICODE
#endif
-/* BEGIN MOZILLA CHANGE (typedef XML_Char to PRUnichar) */
+/* BEGIN MOZILLA CHANGE (typedef XML_Char to char16_t) */
#if 0
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
diff --git a/parser/expat/lib/moz.build b/parser/expat/lib/moz.build
index bea67ad77..c69dca4bc 100644
--- a/parser/expat/lib/moz.build
+++ b/parser/expat/lib/moz.build
@@ -4,12 +4,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-MODULE = 'expat'
-
EXPORTS += [
'expat.h',
'expat_external.h',
]
-LIBRARY_NAME = 'mozexpat_s'
+SOURCES += [
+ 'xmlparse.c',
+ 'xmlrole.c',
+ 'xmltok.c',
+]
+
+MSVC_ENABLE_PGO = True
+
+FINAL_LIBRARY = 'gkmedias'
+DEFINES['HAVE_EXPAT_CONFIG_H'] = True
diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c
index 045ffa15a..ad4e3698d 100644
--- a/parser/expat/lib/xmlparse.c
+++ b/parser/expat/lib/xmlparse.c
@@ -49,7 +49,7 @@ typedef char ICHAR;
#endif
-/* BEGIN MOZILLA CHANGE (typedef XML_Char to PRUnichar) */
+/* BEGIN MOZILLA CHANGE (typedef XML_Char to char16_t) */
#if 0
#ifdef XML_UNICODE
@@ -136,7 +136,9 @@ typedef struct {
#define INIT_DATA_BUF_SIZE 1024
#define INIT_ATTS_SIZE 16
#define INIT_ATTS_VERSION 0xFFFFFFFF
-#define INIT_BLOCK_SIZE 1024
+/* BEGIN MOZILLA CHANGE (Avoid slop in poolGrow() allocations) */
+#define INIT_BLOCK_SIZE ((int)(1024 - (offsetof(BLOCK, s) / sizeof(XML_Char))))
+/* END MOZILLA CHANGE */
#define INIT_BUFFER_SIZE 1024
#define EXPAND_SPARE 24
diff --git a/parser/expat/moz.build b/parser/expat/moz.build
index 255a1db77..e4d77fdc1 100644
--- a/parser/expat/moz.build
+++ b/parser/expat/moz.build
@@ -6,8 +6,6 @@
DIRS += ['lib']
-MODULE = 'expat'
-
EXPORTS += [
'expat_config.h',
]