diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-22 11:26:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-22 11:54:12 +0100 |
commit | 1ae61b0ac4187b2938647f3ca0289a070a5dc7d2 (patch) | |
tree | 9461c0532919f4fe61f3e0e3fa8556e954244fbd /svtools/source/svrtf/svparser.cxx | |
parent | 04bb9549e0a0ee567f3bd48a7707286c5abd631a (diff) |
loplugin:flatten in svtools
almost completely automatically rewritten, only had to tweak
the indentation on a couple of lines.
Change-Id: Ieec92e5b602d180d7ec556e3421ce3c835c1f646
Reviewed-on: https://gerrit.libreoffice.org/45072
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/svrtf/svparser.cxx')
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index bfcc511a8490..6b2d8a9683a0 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -136,38 +136,38 @@ void SvParser<T>::ClearTxtConvContext() template<typename T> void SvParser<T>::SetSrcEncoding( rtl_TextEncoding eEnc ) { - if( eEnc != eSrcEnc ) + if( eEnc == eSrcEnc ) + return; + + if( pImplData && pImplData->hConv ) { - if( pImplData && pImplData->hConv ) - { - rtl_destroyTextToUnicodeContext( pImplData->hConv, - pImplData->hContext ); - rtl_destroyTextToUnicodeConverter( pImplData->hConv ); - pImplData->hConv = nullptr; - pImplData->hContext = reinterpret_cast<rtl_TextToUnicodeContext>(1); - } + rtl_destroyTextToUnicodeContext( pImplData->hConv, + pImplData->hContext ); + rtl_destroyTextToUnicodeConverter( pImplData->hConv ); + pImplData->hConv = nullptr; + pImplData->hContext = reinterpret_cast<rtl_TextToUnicodeContext>(1); + } - if( rtl_isOctetTextEncoding(eEnc) || - RTL_TEXTENCODING_UCS2 == eEnc ) - { - eSrcEnc = eEnc; - if( !pImplData ) - pImplData.reset(new SvParser_Impl<T>); - pImplData->hConv = rtl_createTextToUnicodeConverter( eSrcEnc ); - DBG_ASSERT( pImplData->hConv, - "SvParser::SetSrcEncoding: no converter for source encoding" ); - if( !pImplData->hConv ) - eSrcEnc = RTL_TEXTENCODING_DONTKNOW; - else - pImplData->hContext = - rtl_createTextToUnicodeContext( pImplData->hConv ); - } - else - { - SAL_WARN( "svtools", - "SvParser::SetSrcEncoding: invalid source encoding" ); + if( rtl_isOctetTextEncoding(eEnc) || + RTL_TEXTENCODING_UCS2 == eEnc ) + { + eSrcEnc = eEnc; + if( !pImplData ) + pImplData.reset(new SvParser_Impl<T>); + pImplData->hConv = rtl_createTextToUnicodeConverter( eSrcEnc ); + DBG_ASSERT( pImplData->hConv, + "SvParser::SetSrcEncoding: no converter for source encoding" ); + if( !pImplData->hConv ) eSrcEnc = RTL_TEXTENCODING_DONTKNOW; - } + else + pImplData->hContext = + rtl_createTextToUnicodeContext( pImplData->hConv ); + } + else + { + SAL_WARN( "svtools", + "SvParser::SetSrcEncoding: invalid source encoding" ); + eSrcEnc = RTL_TEXTENCODING_DONTKNOW; } } @@ -582,21 +582,21 @@ template<typename T> void SvParser<T>::RestoreState() { // restore old status - if( pImplData ) - { - if( ERRCODE_IO_PENDING == rInput.GetError() ) - rInput.ResetError(); - aToken = pImplData->aToken; - nlLineNr = pImplData->nlLineNr; - nlLinePos = pImplData->nlLinePos; - nTokenValue= pImplData->nTokenValue; - bTokenHasValue=pImplData->bTokenHasValue; - nNextCh = pImplData->nNextCh; + if( !pImplData ) + return; - pImplData->nSaveToken = pImplData->nToken; + if( ERRCODE_IO_PENDING == rInput.GetError() ) + rInput.ResetError(); + aToken = pImplData->aToken; + nlLineNr = pImplData->nlLineNr; + nlLinePos = pImplData->nlLinePos; + nTokenValue= pImplData->nTokenValue; + bTokenHasValue=pImplData->bTokenHasValue; + nNextCh = pImplData->nNextCh; - rInput.Seek( pImplData->nFilePos ); - } + pImplData->nSaveToken = pImplData->nToken; + + rInput.Seek( pImplData->nFilePos ); } template<typename T> |