Fixes Civilization IV crashing on creating a new game (and possibly when loading game save).
From: Paul Gofman pgofman@codeweavers.com
--- dlls/msxml3/element.c | 13 +++++++++++++ dlls/msxml3/tests/domdoc.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 7f5b91b0f39..9d3dacc094d 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -455,6 +455,19 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v) switch (dt) { case DT_INVALID: + { + xmlChar *p; + + while (isspace(*str)) + ++str; + + p = str + strlen((char *)str); + while (p != str && isspace(p[-1])) + --p; + *p = 0; + } + /* fallthrough */ + case DT_STRING: case DT_NMTOKEN: case DT_NMTOKENS: diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 0643ea5350f..b00295166c0 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -906,7 +906,10 @@ static const CHAR szTypeValueXML[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<root xmlns:dt="urn:schemas-microsoft-com:datatypes">\n" " <string>Wine</string>\n" -" <string2 dt:dt="string">String</string2>\n" +" <string2 dt:dt="string">String </string2>\n" +" <string3> Wine Wine </string3>\n" +" <string4>\nWine Wine\t</string4>\n" +" <string5> </string5>\n" " <number dt:dt="number">12.44</number>\n" " <number2 dt:dt="NUMbEr">-3.71e3</number2>\n" " <int dt:dt="int">-13</int>\n" @@ -6998,7 +7001,10 @@ typedef struct _nodetypedvalue_t {
static const nodetypedvalue_t get_nodetypedvalue[] = { { "root/string", VT_BSTR, "Wine" }, - { "root/string2", VT_BSTR, "String" }, + { "root/string2", VT_BSTR, "String " }, + { "root/string3", VT_BSTR, "Wine Wine" }, + { "root/string4", VT_BSTR, "Wine Wine" }, + { "root/string5", VT_BSTR, "" }, { "root/number", VT_BSTR, "12.44" }, { "root/number2", VT_BSTR, "-3.71e3" }, { "root/int", VT_I4, "-13" },
Is it possible to reuse do_get_text() for this somehow? It's using is_preserving_whitespace(), which is potentially not covered by this new test.