Commit 9554dfb1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Fix a warning in DTD dumping code on recent libxml2 versions.

parent 8c0796c4
......@@ -896,6 +896,50 @@ HRESULT node_get_xml(xmlnode *This, BOOL ensure_eol, BSTR *ret)
return *ret ? S_OK : E_OUTOFMEMORY;
}
/* duplicates xmlBufferWriteQuotedString() logic */
static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string)
{
const xmlChar *cur, *base;
if (xmlStrchr(string, '\"'))
{
if (xmlStrchr(string, '\''))
{
xmlOutputBufferWrite(buf, 1, "\"");
base = cur = string;
while (*cur)
{
if (*cur == '"')
{
if (base != cur)
xmlOutputBufferWrite(buf, cur-base, (const char*)base);
xmlOutputBufferWrite(buf, 6, """);
cur++;
base = cur;
}
else
cur++;
}
if (base != cur)
xmlOutputBufferWrite(buf, cur-base, (const char*)base);
xmlOutputBufferWrite(buf, 1, "\"");
}
else
{
xmlOutputBufferWrite(buf, 1, "\'");
xmlOutputBufferWriteString(buf, (const char*)string);
xmlOutputBufferWrite(buf, 1, "\'");
}
}
else
{
xmlOutputBufferWrite(buf, 1, "\"");
xmlOutputBufferWriteString(buf, (const char*)string);
xmlOutputBufferWrite(buf, 1, "\"");
}
}
static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc)
{
xmlDtdPtr cur = doc->intSubset;
......@@ -905,17 +949,17 @@ static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc)
if (cur->ExternalID)
{
xmlOutputBufferWriteString(buf, " PUBLIC ");
xmlBufferWriteQuotedString(buf->buffer, cur->ExternalID);
xml_write_quotedstring(buf, cur->ExternalID);
if (cur->SystemID)
{
xmlOutputBufferWriteString(buf, " ");
xmlBufferWriteQuotedString(buf->buffer, cur->SystemID);
xml_write_quotedstring(buf, cur->SystemID);
}
}
else if (cur->SystemID)
{
xmlOutputBufferWriteString(buf, " SYSTEM ");
xmlBufferWriteQuotedString(buf->buffer, cur->SystemID);
xml_write_quotedstring(buf, cur->SystemID);
}
xmlOutputBufferWriteString(buf, ">\n");
}
......
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