diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-04-01 13:38:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-04-01 13:46:47 +0100 |
commit | 9a0e6204bba686945a1ab249b741d703ed3e84a6 (patch) | |
tree | 5c1ccb16646d0cbe03516239edcf1af17db8c2f0 /svtools/source/svhtml | |
parent | bbaa84d121deeaba2f173fb272feb2b998aaec70 (diff) |
coverity#735505 Logically dead code
Change-Id: I7e7abf9192ee34c9f1c2080268751503aae90e55
Diffstat (limited to 'svtools/source/svhtml')
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index f54c7415253b..93e8c2df55ae 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -562,59 +562,51 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) break; } + assert(cChar != 0); + // 1 == Non Breaking Space // 2 == SoftHyphen - if( cChar < 3U ) + if (cChar == 1 || cChar == 2) { if( '>' == cBreak ) { // When reading the content of a tag we have // to change it to ' ' or '-' - switch( cChar ) - { - case 1U: cChar = ' '; break; - case 2U: cChar = '-'; break; - default: - DBG_ASSERT( cChar==1U, - "\0x00 should be handled already!" ); - break; - } + if( 1U == cChar ) + cChar = ' '; + else //2U + cChar = '-'; } else { // If not scanning a tag return token aToken += sTmpBuffer.makeStringAndClear(); - if( cChar ) + + if( !aToken.isEmpty() ) { - if( !aToken.isEmpty() ) - { - // restart with character - nNextCh = '&'; - DBG_ASSERT( rInput.Tell()-nStreamPos == - (sal_uLong)(nPos+1)*GetCharSize(), - "Wrong stream position" ); - DBG_ASSERT( nlLinePos-nLinePos == - (sal_uLong)(nPos+1), - "Wrong line position" ); - rInput.Seek( nStreamPos ); - nlLinePos = nLinePos; - ClearTxtConvContext(); - return HTML_TEXTTOKEN; - } - - // Hack: _GetNextChar shall not read the - // next character - if( ';' != nNextCh ) - aToken += " "; - if( 1U == cChar ) - return HTML_NONBREAKSPACE; - if( 2U == cChar ) - return HTML_SOFTHYPH; + // restart with character + nNextCh = '&'; + DBG_ASSERT( rInput.Tell()-nStreamPos == + (sal_uLong)(nPos+1)*GetCharSize(), + "Wrong stream position" ); + DBG_ASSERT( nlLinePos-nLinePos == + (sal_uLong)(nPos+1), + "Wrong line position" ); + rInput.Seek( nStreamPos ); + nlLinePos = nLinePos; + ClearTxtConvContext(); + return HTML_TEXTTOKEN; } - aToken += "&"; - aToken += sEntityBuffer.makeStringAndClear(); - break; + + // Hack: _GetNextChar shall not read the + // next character + if( ';' != nNextCh ) + aToken += " "; + if( 1U == cChar ) + return HTML_NONBREAKSPACE; + else //2U + return HTML_SOFTHYPH; } } } |