[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - svtools/source

Caolán McNamara caolanm at redhat.com
Wed Jul 2 01:19:01 PDT 2014


 svtools/source/svhtml/parhtml.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 32eddb3f48fcea0a052401a8a5dc075c7847f1c5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 1 12:50:45 2014 +0100

    fix detection of Salesforce html
    
    Change-Id: Ie777c253e221527cba8affaf766e2eddfc78c103
    Reviewed-on: https://gerrit.libreoffice.org/10012
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 54c1548..13a56c3 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1925,6 +1925,16 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
 
     sCmp = sCmp.toAsciiLowerCase();
 
+    sal_Char c;
+    sal_Int32 nPos;
+    for (nPos = 0; nPos < sCmp.getLength(); ++nPos)
+    {
+        c = sCmp[nPos];
+        if (c != ' ' && c != '\n' && c != '\t' && c != '\r' && c != '\f')
+            break;
+    }
+    sCmp = sCmp.copy(nPos);
+
     // A HTML document must have a '<' in the first line
     sal_Int32 nStart = sCmp.indexOf('<');
     if (nStart == -1)
@@ -1932,8 +1942,6 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
     nStart++;
 
     // followed by arbitrary characters followed by a blank or '>'
-    sal_Char c;
-    sal_Int32 nPos;
     for( nPos = nStart; nPos < sCmp.getLength(); ++nPos )
     {
         if( '>'==(c=sCmp[nPos]) || HTML_ISSPACE(c) )


More information about the Libreoffice-commits mailing list