diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 19:31:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 20:59:10 +0200 |
commit | 7baa60a5e9a8c48829f47db8cd98d0f05a30e235 (patch) | |
tree | a613e309e12be23ca9fb929deda1a15d9dbe0374 /sdext | |
parent | a2362e0ff5a7cec16e888502a3c16fe2fa7ba0fe (diff) |
loplugin:buriedassign in scaddins..sdext
Change-Id: I72acfdac5879aa251a1074ea850758f66072b46e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92311
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfparse.cxx | 43 | ||||
-rw-r--r-- | sdext/source/pdfimport/wrapper/wrapper.cxx | 21 |
2 files changed, 37 insertions, 27 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx index da5daa5bf6c1..e61d900885ea 100644 --- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx @@ -327,38 +327,41 @@ public: { PDFContainer* pContainer = nullptr; const char* pMsg = nullptr; - if( ! m_aObjectStack.empty() && - (pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back())) != nullptr ) + if( ! m_aObjectStack.empty() ) { - if( dynamic_cast<PDFDict*>(pContainer) == nullptr && - dynamic_cast<PDFArray*>(pContainer) == nullptr ) + pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back()); + if (pContainer) { - PDFObject* pObj = dynamic_cast<PDFObject*>(pContainer); - if( pObj ) + if( dynamic_cast<PDFDict*>(pContainer) == nullptr && + dynamic_cast<PDFArray*>(pContainer) == nullptr ) { - if( pObj->m_pObject == nullptr ) - pObj->m_pObject = pNewValue.get(); - else + PDFObject* pObj = dynamic_cast<PDFObject*>(pContainer); + if( pObj ) { - pMsg = "second value for object"; - pContainer = nullptr; + if( pObj->m_pObject == nullptr ) + pObj->m_pObject = pNewValue.get(); + else + { + pMsg = "second value for object"; + pContainer = nullptr; + } } - } - else if( dynamic_cast<PDFDict*>(pNewValue.get()) ) - { - PDFTrailer* pTrailer = dynamic_cast<PDFTrailer*>(pContainer); - if( pTrailer ) + else if( dynamic_cast<PDFDict*>(pNewValue.get()) ) { - if( pTrailer->m_pDict == nullptr ) - pTrailer->m_pDict = dynamic_cast<PDFDict*>(pNewValue.get()); + PDFTrailer* pTrailer = dynamic_cast<PDFTrailer*>(pContainer); + if( pTrailer ) + { + if( pTrailer->m_pDict == nullptr ) + pTrailer->m_pDict = dynamic_cast<PDFDict*>(pNewValue.get()); + else + pContainer = nullptr; + } else pContainer = nullptr; } else pContainer = nullptr; } - else - pContainer = nullptr; } } if( pContainer ) diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index e8932f16f3b7..e850e5a6c7b8 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -280,9 +280,11 @@ void Parser::readBinaryData( uno::Sequence<sal_Int8>& rBuf ) sal_Int8* pBuf( rBuf.getArray() ); sal_uInt64 nBytesRead(0); oslFileError nRes=osl_File_E_None; - while( nFileLen && - osl_File_E_None == (nRes=osl_readFile( m_pErr, pBuf, nFileLen, &nBytesRead )) ) + while( nFileLen ) { + nRes = osl_readFile( m_pErr, pBuf, nFileLen, &nBytesRead ); + if (osl_File_E_None != nRes ) + break; pBuf += nBytesRead; nFileLen -= sal::static_int_cast<sal_Int32>(nBytesRead); } @@ -1101,18 +1103,23 @@ bool xpdf_ImportFromFile(const OUString& rURL, oslFileError nRes; // skip garbage \r \n at start of line - while( osl_File_E_None == (nRes = aBuffering.read(&aChar, 1, &nBytesRead)) && - nBytesRead == 1 && - (aChar == '\n' || aChar == '\r') ) ; + for (;;) + { + nRes = aBuffering.read(&aChar, 1, &nBytesRead); + if (osl_File_E_None != nRes || nBytesRead != 1 || !(aChar == '\n' || aChar == '\r') ) + break; + } if ( osl_File_E_None != nRes ) break; if( aChar != '\n' && aChar != '\r' ) line.append( aChar ); - while( osl_File_E_None == (nRes = aBuffering.read(&aChar, 1, &nBytesRead)) && - nBytesRead == 1 && aChar != '\n' && aChar != '\r' ) + for (;;) { + nRes = aBuffering.read(&aChar, 1, &nBytesRead); + if ( osl_File_E_None != nRes || nBytesRead != 1 || aChar == '\n' || aChar == '\r' ) + break; line.append( aChar ); } if ( osl_File_E_None != nRes ) |