libreoffice-online/wasm/poco-no-special-expat-sauce.diff
Tor Lillqvist d9024e8955 Add patch that prevents expat in Poco from causing trouble with WASM
As we build a single statically linked bunary for WASM, we will end up
with just one copy of each function in it. Both LO core and Poco
include expat. Upstream Poco builds one of the expat source files as
C++. That causes trouble as it then isn't compatible with what LO core
wants to call. Or something like that. You get "RuntimeError: null
function or function signature mismatch". (The "signature" concept in
WASM is orthogonal to C++ name mangling.)

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Iacf75ed34eea98611cb6aa6867e460697ea1fc4a
2023-01-16 18:43:21 +02:00

54 lines
1.4 KiB
Diff

--- /tmp/poco-poco-1.12.4-release/XML/src/xmlparse.cpp 2022-10-31 19:41:19.000000000 +0200
+++ XML/src/xmlparse.c 2022-12-14 12:50:31.845361409 +0200
@@ -84,10 +84,7 @@
#define EXPAT_POCO 1
-#if defined(EXPAT_POCO)
-# include "Poco/RandomStream.h"
-# include "Poco/BinaryReader.h"
-#elif defined(_WIN32)
+#ifdef _WIN32
# define getpid GetCurrentProcessId
#else
# include <sys/time.h> /* gettimeofday() */
@@ -746,8 +743,6 @@
'\0'};
-#if ! defined(EXPAT_POCO)
-
/* To avoid warnings about unused functions: */
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
@@ -901,8 +896,6 @@
#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
-#endif /* ! defined(EXPAT_POCO) */
-
static unsigned long
ENTROPY_DEBUG(const char *label, unsigned long entropy) {
if (getDebugLevel("EXPAT_ENTROPY_DEBUG", 0) >= 1u) {
@@ -916,12 +909,7 @@
generate_hash_secret_salt(XML_Parser parser) {
unsigned long entropy;
(void)parser;
-#if defined(EXPAT_POCO)
- Poco::RandomInputStream rstr;
- Poco::BinaryReader rrdr(rstr);
- rrdr >> entropy;
- return ENTROPY_DEBUG("RandomInputStream", entropy);
-#else
+
/* "Failproof" high quality providers: */
#if defined(HAVE_ARC4RANDOM_BUF)
arc4random_buf(&entropy, sizeof(entropy));
@@ -958,7 +946,6 @@
entropy * (unsigned long)2305843009213693951ULL);
}
#endif
-#endif /* defined(EXPAT_POCO) */
}
static unsigned long