Be more careful in recognizing MathML (bnc#774921)

Change-Id: I82c36a3ff49f74dc674df46dcf35f8c1a991c9e2
This commit is contained in:
Tor Lillqvist
2012-08-14 12:33:52 +02:00
parent 318590b290
commit aa4b8a8164

View File

@@ -311,6 +311,15 @@ SmFilterDetect::~SmFilterDetect()
if (nBytesRead == nSize)
{
if (0 == strncmp( "<?xml",aBuffer,nSize))
{
// 200 should be enough for the XML
// version, encoding and !DOCTYPE
// stuff I hope?
sal_Char aBuffer2[200];
nBytesRead = pStrm->Read( aBuffer2, sizeof(aBuffer2) - 1);
aBuffer2[nBytesRead] = 0;
if (strstr( aBuffer2, "<math>" ) != NULL ||
strstr( aBuffer2, "<math " ) != NULL)
{
static const sal_Char sFltrNm_2[] = MATHML_XML;
static const sal_Char sTypeNm_2[] = "math_MathML_XML_Math";
@@ -319,6 +328,7 @@ SmFilterDetect::~SmFilterDetect()
}
}
}
}
if ( aTypeName.Len() )
{