[Libreoffice-commits] core.git: sdext/source

Arnold Dumas arnold at dumas.at
Thu Feb 18 19:22:49 UTC 2016


 sdext/source/pdfimport/filterdet.cxx |   31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

New commits:
commit 8c97225d311af6711ac49755079acd29842afeba
Author: Arnold Dumas <arnold at dumas.at>
Date:   Thu Feb 18 13:17:31 2016 +0100

    tdf#43157: Clean up OSL_ASSERT, DBG_ASSERT
    
    Change-Id: I81def3487932497782b4e560ef920330ba5cc2a2
    Reviewed-on: https://gerrit.libreoffice.org/22476
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx
index 1aa7526..2e2a350 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -204,13 +204,10 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
     sal_Int32 nPwdPos = -1;
     for( sal_Int32 i = 0; i < nAttribs; i++ )
     {
-#if OSL_DEBUG_LEVEL > 1
         OUString aVal( "<no string>" );
         pAttribs[i].Value >>= aVal;
-        OSL_TRACE( "doDetection: Attrib: %s = %s\n",
-                   OUStringToOString( pAttribs[i].Name, RTL_TEXTENCODING_UTF8 ).getStr(),
-                   OUStringToOString( aVal, RTL_TEXTENCODING_UTF8 ).getStr() );
-#endif
+        SAL_INFO( "sdext.pdfimport", "doDetection: Attrib: " + pAttribs[i].Name + " = " + aVal + "\n");
+
         if ( pAttribs[i].Name == "InputStream" )
             pAttribs[i].Value >>= xInput;
         else if ( pAttribs[i].Name == "URL" )
@@ -264,13 +261,11 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
                 }
                 else
                 {
-#if OSL_DEBUG_LEVEL > 1
-                    OSL_TRACE( "created temp file %s\n",
-                               OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-#endif
+                    SAL_INFO( "sdext.pdfimport", "created temp file " + aURL + "\n" );
+
                     osl_writeFile( aFile, aBuf.getConstArray(), nBytes, &nWritten );
 
-                    OSL_ENSURE( nWritten == nBytes, "writing of header bytes failed" );
+                    SAL_WARN_IF( nWritten != nBytes, "sdext.pdfimport", "writing of header bytes failed" );
 
                     if( nWritten == nBytes )
                     {
@@ -380,7 +375,7 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
                     break;
 
                 default:
-                    OSL_FAIL("Unexpected case");
+                    assert(!"Unexpected case");
             }
 
             aOutTypeName = "pdf_Portable_Document_Format";
@@ -520,13 +515,13 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString&
                     chk = pTrailer->m_pDict->m_aMap.find( "DocChecksum" );
                     if( chk == pTrailer->m_pDict->m_aMap.end() )
                     {
-                        OSL_TRACE( "no DocChecksum entry" );
+                        SAL_INFO( "sdext.pdfimport", "no DocChecksum entry" );
                         continue;
                     }
                     pdfparse::PDFName* pChkSumName = dynamic_cast<pdfparse::PDFName*>(chk->second);
                     if( pChkSumName == nullptr )
                     {
-                        OSL_TRACE( "no name for DocChecksum entry" );
+                        SAL_INFO( "sdext.pdfimport", "no name for DocChecksum entry" );
                         continue;
                     }
 
@@ -537,13 +532,13 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString&
                     add_stream = pTrailer->m_pDict->m_aMap.find( "AdditionalStreams" );
                     if( add_stream == pTrailer->m_pDict->m_aMap.end() )
                     {
-                        OSL_TRACE( "no AdditionalStreams entry" );
+                        SAL_INFO( "sdext.pdfimport", "no AdditionalStreams entry" );
                         continue;
                     }
                     pdfparse::PDFArray* pStreams = dynamic_cast<pdfparse::PDFArray*>(add_stream->second);
                     if( ! pStreams || pStreams->m_aSubElements.size() < 2 )
                     {
-                        OSL_TRACE( "AdditionalStreams array too small" );
+                        SAL_INFO( "sdext.pdfimport", "AdditionalStreams array too small" );
                         continue;
                     }
 
@@ -556,13 +551,13 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString&
                     pdfparse::PDFName* pMimeType = dynamic_cast<pdfparse::PDFName*>(pStreams->m_aSubElements[0]);
                     pdfparse::PDFObjectRef* pStreamRef = dynamic_cast<pdfparse::PDFObjectRef*>(pStreams->m_aSubElements[1]);
 
-                    OSL_ENSURE( pMimeType, "error: no mimetype element\n" );
-                    OSL_ENSURE( pStreamRef, "error: no stream ref element\n" );
+                    SAL_WARN_IF( !pMimeType, "sdext.pdfimport", "error: no mimetype element\n" );
+                    SAL_WARN_IF( !pStreamRef, "sdext.pdfimport", "error: no stream ref element\n" );
 
                     if( pMimeType && pStreamRef )
                     {
                         pdfparse::PDFObject* pObject = pPDFFile->findObject( pStreamRef->m_nNumber, pStreamRef->m_nGeneration );
-                        OSL_ENSURE( pObject, "object not found\n" );
+                        SAL_WARN_IF( !pObject, "sdext.pdfimport", "object not found\n" );
                         if( pObject )
                         {
                             if( pPDFFile->isEncrypted() )


More information about the Libreoffice-commits mailing list