diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-30 11:49:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-31 07:34:41 +0100 |
commit | 7fed35ff43d6e8c1e838c6fe582edd308692bab0 (patch) | |
tree | 57bc40dd19c70c36e5f3c9256e4a7b65af7926cc /svtools/source/svhtml | |
parent | 4cfcf965b5c95b1ba7dd454e9dda954e8315b8a9 (diff) |
loplugin:constantparam in svl,svtools
Change-Id: I0d7c1dff2646e483c866f547224c60838b221c4b
Reviewed-on: https://gerrit.libreoffice.org/44083
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/svhtml')
-rw-r--r-- | svtools/source/svhtml/htmlsupp.cxx | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 8b5998648712..619cc6009e0d 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -78,7 +78,7 @@ void HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBas } } -void HTMLParser::RemoveSGMLComment( OUString &rString, bool bFull ) +void HTMLParser::RemoveSGMLComment( OUString &rString ) { sal_Unicode c = 0; while( !rString.isEmpty() && @@ -94,20 +94,16 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, bool bFull ) // remove SGML comments if( rString.startsWith( "<!--" ) ) { - sal_Int32 nPos = 3; - if( bFull ) - { - // the whole line - nPos = 4; - while( nPos < rString.getLength() && - ( ( c = rString[nPos] ) != '\r' && c != '\n' ) ) - ++nPos; - if( c == '\r' && nPos+1 < rString.getLength() && - '\n' == rString[nPos+1] ) - ++nPos; - else if( c != '\n' ) - nPos = 3; - } + // the whole line + sal_Int32 nPos = 4; + while( nPos < rString.getLength() && + ( ( c = rString[nPos] ) != '\r' && c != '\n' ) ) + ++nPos; + if( c == '\r' && nPos+1 < rString.getLength() && + '\n' == rString[nPos+1] ) + ++nPos; + else if( c != '\n' ) + nPos = 3; ++nPos; rString = rString.copy( nPos ); } @@ -115,33 +111,30 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, bool bFull ) if( rString.endsWith("-->") ) { rString = rString.copy( 0, rString.getLength()-3 ); - if( bFull ) + // "//" or "'", maybe preceding CR/LF + rString = comphelper::string::stripEnd(rString, ' '); + sal_Int32 nDel = 0, nLen = rString.getLength(); + if( nLen >= 2 && + rString.endsWith("//") ) { - // "//" or "'", maybe preceding CR/LF - rString = comphelper::string::stripEnd(rString, ' '); - sal_Int32 nDel = 0, nLen = rString.getLength(); - if( nLen >= 2 && - rString.endsWith("//") ) - { - nDel = 2; - } - else if( nLen && '\'' == rString[nLen-1] ) - { - nDel = 1; - } - if( nDel && nLen >= nDel+1 ) + nDel = 2; + } + else if( nLen && '\'' == rString[nLen-1] ) + { + nDel = 1; + } + if( nDel && nLen >= nDel+1 ) + { + c = rString[nLen-(nDel+1)]; + if( '\r'==c || '\n'==c ) { - c = rString[nLen-(nDel+1)]; - if( '\r'==c || '\n'==c ) - { + nDel++; + if( '\n'==c && nLen >= nDel+1 && + '\r'==rString[nLen-(nDel+1)] ) nDel++; - if( '\n'==c && nLen >= nDel+1 && - '\r'==rString[nLen-(nDel+1)] ) - nDel++; - } } - rString = rString.copy( 0, nLen-nDel ); } + rString = rString.copy( 0, nLen-nDel ); } } |