msxml3/mxwriter: Simplify argument check in externalEntityDecl().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-24 12:05:39 +03:00 committed by Alexandre Julliard
parent 62bd656711
commit ba4fcecfa3
2 changed files with 13 additions and 4 deletions

View File

@ -1679,9 +1679,7 @@ static HRESULT WINAPI SAXDeclHandler_externalEntityDecl(ISAXDeclHandler *iface,
TRACE("(%p)->(%s:%d %s:%d %s:%d)\n", This, debugstr_wn(name, n_name), n_name,
debugstr_wn(publicId, n_publicId), n_publicId, debugstr_wn(systemId, n_systemId), n_systemId);
if (!name) return E_INVALIDARG;
if (publicId && !systemId) return E_INVALIDARG;
if (!publicId && !systemId) return E_INVALIDARG;
if (!name || !systemId) return E_INVALIDARG;
write_output_buffer(This, entityW, sizeof(entityW)/sizeof(WCHAR));
if (n_name) {

View File

@ -4996,11 +4996,22 @@ static void test_mxwriter_dtd(void)
_bstr_("sysid"), strlen("sysid"));
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = ISAXDeclHandler_externalEntityDecl(decl, _bstr_("name"), strlen("name"), NULL, 0, _bstr_("sysid"), strlen("sysid"));
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = ISAXDeclHandler_externalEntityDecl(decl, _bstr_("name"), strlen("name"), _bstr_("pubid"), strlen("pubid"),
NULL, 0);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_get_output(writer, &dest);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
ok(!lstrcmpW(_bstr_("<!ENTITY name PUBLIC \"pubid\" \"sysid\">\r\n"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
ok(!lstrcmpW(_bstr_(
"<!ENTITY name PUBLIC \"pubid\" \"sysid\">\r\n"
"<!ENTITY name SYSTEM \"sysid\">\r\n"),
V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
ISAXContentHandler_Release(content);