summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport/pdfparse/pdfentries.cxx
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-01-29 15:49:01 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-01-29 15:49:01 +0100
commit526575b69666adc555ea14c7524e2ba8bf7834b0 (patch)
tree14687254b30c3e8e65f133950bad4d9db5c75463 /sdext/source/pdfimport/pdfparse/pdfentries.cxx
parent6ad42e8f256146e844c2554ab457f113b197c2e7 (diff)
improve deflate recognition, fix debug output
Diffstat (limited to 'sdext/source/pdfimport/pdfparse/pdfentries.cxx')
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfentries.cxx27
1 files changed, 17 insertions, 10 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 9374e20f12bc..b0e2132fdd9c 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -642,8 +642,17 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const
m_pStream->m_pDict->m_aMap.find( "Filter" );
if( it != m_pStream->m_pDict->m_aMap.end() )
{
- // is the (first) filter FlateDecode ?
PDFName* pFilter = dynamic_cast<PDFName*>(it->second);
+ if( ! pFilter )
+ {
+ PDFArray* pArray = dynamic_cast<PDFArray*>(it->second);
+ if( pArray && ! pArray->m_aSubElements.empty() )
+ {
+ pFilter = dynamic_cast<PDFName*>(pArray->m_aSubElements.front());
+ }
+ }
+
+ // is the (first) filter FlateDecode ?
if( pFilter && pFilter->m_aName.equals( "FlateDecode" ) )
{
bIsDeflated = true;
@@ -673,8 +682,6 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const
}
else
*ppStream = NULL, *pBytes = 0;
- // FIXME: one could also deflate if FlateDecode ws the
- // first filter in an array
return bIsDeflated;
}
@@ -1200,7 +1207,7 @@ PDFFileImplData* PDFFile::impl_getData() const
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "DocId is <" );
for( int i = 0; i < m_pData->m_aDocID.getLength(); i++ )
- fprintf( stderr, "%.2x", sal_uInt32(sal_uInt8(m_pData->m_aDocID.getStr()[i])) );
+ fprintf( stderr, "%.2x", (unsigned int)sal_uInt8(m_pData->m_aDocID.getStr()[i]) );
fprintf( stderr, ">\n" );
#endif
}
@@ -1262,9 +1269,9 @@ PDFFileImplData* PDFFile::impl_getData() const
#if OSL_DEBUG_LEVEL > 1
else
{
- fprintf( stderr, "O entry has length %d, should be 32 <", aEnt.getLength() );
+ fprintf( stderr, "O entry has length %d, should be 32 <", (int)aEnt.getLength() );
for( int i = 0; i < aEnt.getLength(); i++ )
- fprintf( stderr, " %.2X", sal_uInt32(sal_uInt8(aEnt.getStr()[i])) );
+ fprintf( stderr, " %.2X", (unsigned int)sal_uInt8(aEnt.getStr()[i]) );
fprintf( stderr, ">\n" );
}
#endif
@@ -1281,9 +1288,9 @@ PDFFileImplData* PDFFile::impl_getData() const
#if OSL_DEBUG_LEVEL > 1
else
{
- fprintf( stderr, "U entry has length %d, should be 32 <", aEnt.getLength() );
+ fprintf( stderr, "U entry has length %d, should be 32 <", (int)aEnt.getLength() );
for( int i = 0; i < aEnt.getLength(); i++ )
- fprintf( stderr, " %.2X", sal_uInt32(sal_uInt8(aEnt.getStr()[i])) );
+ fprintf( stderr, " %.2X", (unsigned int)sal_uInt8(aEnt.getStr()[i]) );
fprintf( stderr, ">\n" );
}
#endif
@@ -1301,13 +1308,13 @@ PDFFileImplData* PDFFile::impl_getData() const
if( pNum )
m_pData->m_nPEntry = static_cast<sal_uInt32>(static_cast<sal_Int32>(pNum->m_fValue));
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "p entry is 0x%x\n", m_pData->m_nPEntry );
+ fprintf( stderr, "p entry is %p\n", m_pData->m_nPEntry );
#endif
}
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "Encryption dict: sec handler: %s, version = %d, revision = %d, key length = %d\n",
pFilter ? OUStringToOString( pFilter->getFilteredName(), RTL_TEXTENCODING_UTF8 ).getStr() : "<unknown>",
- m_pData->m_nAlgoVersion, m_pData->m_nStandardRevision, m_pData->m_nKeyLength );
+ (int)m_pData->m_nAlgoVersion, (int)m_pData->m_nStandardRevision, m_pData->m_nKeyLength );
#endif
break;
}