Commit 52f91932 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/reader: Explicitly return empty static string as local name for nodes without names.

parent 1ccc1f2f
...@@ -1353,7 +1353,6 @@ static HRESULT reader_parse_comment(xmlreader *reader) ...@@ -1353,7 +1353,6 @@ static HRESULT reader_parse_comment(xmlreader *reader)
reader->nodetype = XmlNodeType_Comment; reader->nodetype = XmlNodeType_Comment;
reader->resume[XmlReadResume_Body] = start; reader->resume[XmlReadResume_Body] = start;
reader->resumestate = XmlReadResumeState_Comment; reader->resumestate = XmlReadResumeState_Comment;
reader_set_strvalue(reader, StringValue_LocalName, NULL);
reader_set_strvalue(reader, StringValue_QualifiedName, NULL); reader_set_strvalue(reader, StringValue_QualifiedName, NULL);
reader_set_strvalue(reader, StringValue_Value, NULL); reader_set_strvalue(reader, StringValue_Value, NULL);
} }
...@@ -1376,7 +1375,6 @@ static HRESULT reader_parse_comment(xmlreader *reader) ...@@ -1376,7 +1375,6 @@ static HRESULT reader_parse_comment(xmlreader *reader)
/* skip rest of markup '->' */ /* skip rest of markup '->' */
reader_skipn(reader, 3); reader_skipn(reader, 3);
reader_set_strvalue(reader, StringValue_LocalName, &strval_empty);
reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty);
reader_set_strvalue(reader, StringValue_Value, &value); reader_set_strvalue(reader, StringValue_Value, &value);
reader->resume[XmlReadResume_Body] = 0; reader->resume[XmlReadResume_Body] = 0;
...@@ -2343,7 +2341,6 @@ static HRESULT reader_parse_cdata(xmlreader *reader) ...@@ -2343,7 +2341,6 @@ static HRESULT reader_parse_cdata(xmlreader *reader)
reader->nodetype = XmlNodeType_CDATA; reader->nodetype = XmlNodeType_CDATA;
reader->resume[XmlReadResume_Body] = start; reader->resume[XmlReadResume_Body] = start;
reader->resumestate = XmlReadResumeState_CDATA; reader->resumestate = XmlReadResumeState_CDATA;
reader_set_strvalue(reader, StringValue_LocalName, NULL);
reader_set_strvalue(reader, StringValue_QualifiedName, NULL); reader_set_strvalue(reader, StringValue_QualifiedName, NULL);
reader_set_strvalue(reader, StringValue_Value, NULL); reader_set_strvalue(reader, StringValue_Value, NULL);
} }
...@@ -2360,7 +2357,6 @@ static HRESULT reader_parse_cdata(xmlreader *reader) ...@@ -2360,7 +2357,6 @@ static HRESULT reader_parse_cdata(xmlreader *reader)
reader_skipn(reader, 3); reader_skipn(reader, 3);
TRACE("%s\n", debug_strval(reader, &value)); TRACE("%s\n", debug_strval(reader, &value));
reader_set_strvalue(reader, StringValue_LocalName, &strval_empty);
reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty);
reader_set_strvalue(reader, StringValue_Value, &value); reader_set_strvalue(reader, StringValue_Value, &value);
reader->resume[XmlReadResume_Body] = 0; reader->resume[XmlReadResume_Body] = 0;
...@@ -2404,7 +2400,6 @@ static HRESULT reader_parse_chardata(xmlreader *reader) ...@@ -2404,7 +2400,6 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
reader->nodetype = is_wchar_space(*ptr) ? XmlNodeType_Whitespace : XmlNodeType_Text; reader->nodetype = is_wchar_space(*ptr) ? XmlNodeType_Whitespace : XmlNodeType_Text;
reader->resume[XmlReadResume_Body] = start; reader->resume[XmlReadResume_Body] = start;
reader->resumestate = XmlReadResumeState_CharData; reader->resumestate = XmlReadResumeState_CharData;
reader_set_strvalue(reader, StringValue_LocalName, &strval_empty);
reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty);
reader_set_strvalue(reader, StringValue_Value, NULL); reader_set_strvalue(reader, StringValue_Value, NULL);
} }
...@@ -3090,7 +3085,6 @@ static HRESULT WINAPI xmlreader_GetNamespaceUri(IXmlReader* iface, const WCHAR * ...@@ -3090,7 +3085,6 @@ static HRESULT WINAPI xmlreader_GetNamespaceUri(IXmlReader* iface, const WCHAR *
static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface, LPCWSTR *name, UINT *len) static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface, LPCWSTR *name, UINT *len)
{ {
xmlreader *This = impl_from_IXmlReader(iface); xmlreader *This = impl_from_IXmlReader(iface);
XmlNodeType nodetype;
UINT length; UINT length;
TRACE("(%p)->(%p %p)\n", This, name, len); TRACE("(%p)->(%p %p)\n", This, name, len);
...@@ -3098,8 +3092,15 @@ static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface, LPCWSTR *name, U ...@@ -3098,8 +3092,15 @@ static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface, LPCWSTR *name, U
if (!len) if (!len)
len = &length; len = &length;
switch ((nodetype = reader_get_nodetype(This))) switch (reader_get_nodetype(This))
{ {
case XmlNodeType_Text:
case XmlNodeType_CDATA:
case XmlNodeType_Comment:
case XmlNodeType_Whitespace:
*name = emptyW;
*len = 0;
break;
case XmlNodeType_Element: case XmlNodeType_Element:
case XmlNodeType_EndElement: case XmlNodeType_EndElement:
/* empty elements are not added to the stack */ /* empty elements are not added to the stack */
......
...@@ -1010,19 +1010,15 @@ static void test_read_comment(void) ...@@ -1010,19 +1010,15 @@ static void test_read_comment(void)
str = NULL; str = NULL;
hr = IXmlReader_GetLocalName(reader, &str, &len); hr = IXmlReader_GetLocalName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == strlen(test->name), "got %u\n", len); ok(len == 0, "got %u\n", len);
str_exp = a2w(test->name); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
free_str(str_exp);
len = 1; len = 1;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == strlen(test->name), "got %u\n", len); ok(len == 0, "got %u\n", len);
str_exp = a2w(test->name); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
free_str(str_exp);
/* value */ /* value */
len = 1; len = 1;
...@@ -1696,21 +1692,17 @@ static void test_read_cdata(void) ...@@ -1696,21 +1692,17 @@ static void test_read_cdata(void)
ok(type == XmlNodeType_CDATA, "got %d for %s\n", type, test->xml); ok(type == XmlNodeType_CDATA, "got %d for %s\n", type, test->xml);
str_exp = a2w(test->name);
len = 1; len = 1;
str = NULL; str = NULL;
hr = IXmlReader_GetLocalName(reader, &str, &len); hr = IXmlReader_GetLocalName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == strlen(test->name), "got %u\n", len); ok(len == 0, "got %u\n", len);
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
str = NULL; str = NULL;
hr = IXmlReader_GetLocalName(reader, &str, NULL); hr = IXmlReader_GetLocalName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
free_str(str_exp);
len = 1; len = 1;
str = NULL; str = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment