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 id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewershsivonen
bugs957356
milestone29.0a1
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