Bug 957356 - Use the correct string type for expat's XML_Char depending on the language to use; r=hsivonen
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 10 Jan 2014 01:36:35 -0500
changeset 162908 c8d90c7a9ebe25d6fbe0db9600cb70a9e1186e37
parent 162907 cc8ef74976b19a14659f37a639c88d76c46e7cba
child 162909 4ab32fa7732f388bda3bb747b2f60b548e1df4f7
push id25975
push userryanvm@gmail.com
push dateFri, 10 Jan 2014 19:46:47 +0000
treeherderautoland@e89afc241513 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs957356
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 957356 - Use the correct string type for expat's XML_Char depending on the language to use; r=hsivonen
parser/expat/expat_config.h
--- a/parser/expat/expat_config.h
+++ b/parser/expat/expat_config.h
@@ -22,20 +22,29 @@
 /* Other Mozilla code relies on memmove already, so we assume it's available */
 #define HAVE_MEMMOVE 1
 
 #define XMLCALL
 #define XML_STATIC
 #define XMLIMPORT
 
 #define XML_UNICODE
+typedef char XML_LChar;
+/*
+ * 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;
-typedef char XML_LChar;
 #define XML_T(x) (char16_t)x
-#define XML_L(x) x
+#else
+#include <stdint.h>
+typedef uint16_t XML_Char;
+#define XML_T(x) (uint16_t)x
+#endif
 
 #define XML_DTD
 #define XML_NS
 
 /* avoid conflicts with system version of libexpat */
 
 /* expat.h */
 #define XML_SetElementDeclHandler MOZ_XML_SetElementDeclHandler