summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starmath/source/smdetect.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index 05f6056821c5..2f157f425e89 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -322,10 +322,20 @@ SmFilterDetect::~SmFilterDetect()
{
if (0 == strncmp( "<?xml",aBuffer,nSize))
{
- static const sal_Char sFltrNm_2[] = MATHML_XML;
- static const sal_Char sTypeNm_2[] = "math_MathML_XML_Math";
- aFilterName.AssignAscii( sFltrNm_2 );
- aTypeName.AssignAscii( sTypeNm_2 );
+ // 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";
+ aFilterName.AssignAscii( sFltrNm_2 );
+ aTypeName.AssignAscii( sTypeNm_2 );
+ }
}
}
}