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

This commit is contained in:
Nikolay Sivov 2013-08-21 14:31:28 +04:00 committed by Alexandre Julliard
parent 8c0796c4a7
commit 9554dfb13c
1 changed files with 47 additions and 3 deletions

View File

@ -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");
}