[Libreoffice-commits] core.git: sax/source

Takeshi Abe tabe at fixedpoint.jp
Thu Jul 20 13:53:28 UTC 2017


 sax/source/expatwrap/xml2utf.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b64e564492220b34c14f069e8e1f42675bd9abe6
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Tue Jul 18 22:44:33 2017 +0900

    sax: Check if it starts with 5 bytes of "<?xml"
    
    Change-Id: Iec5b748b188c7b1bf61e8137faf4b3f2d480d7f1
    Reviewed-on: https://gerrit.libreoffice.org/40139
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx
index 18540c0ce1af..c12783f10cef 100644
--- a/sax/source/expatwrap/xml2utf.cxx
+++ b/sax/source/expatwrap/xml2utf.cxx
@@ -125,7 +125,7 @@ XMLFile2UTFConverter::~XMLFile2UTFConverter()
 void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq )
 {
     const sal_Int8 *pSource = seq.getArray();
-    if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4) )
+    if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) )
     {
 
         // scan for encoding
@@ -177,7 +177,7 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s
         return false;
     }
 
-    if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4 ) ) {
+    if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) ) {
         // scan if the <?xml tag finishes within this buffer
         bCheckIfFirstClosingBracketExsists = true;
     }
@@ -222,7 +222,7 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
     }
 
     // first level : detect possible file formats
-    if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4 ) ) {
+    if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) ) {
 
         // scan for encoding
         OString str( reinterpret_cast<const char *>(pSource), seq.getLength() );


More information about the Libreoffice-commits mailing list