summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2013-03-20 23:47:45 +0100
committerThorsten Behrens <tbehrens@suse.com>2013-03-21 00:51:03 +0100
commitdd0db92a174f6a4da1ada3de17cb869264be9342 (patch)
tree7eec076115f7575347a795afd68294b9076ba048 /sdext
parent86a5e14b5a2f13c68aa3c39fd48f2a4c8a094170 (diff)
Kill fprintf in sdext in favour of SAL_LOG
Change-Id: I2253c1a4d90ab348764cd8863b8aaf2036a254de
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfentries.cxx43
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfparse.cxx78
2 files changed, 56 insertions, 65 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 44fc327bc219..4ce780455f45 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -1316,12 +1316,12 @@ PDFFileImplData* PDFFile::impl_getData() const
PDFString* pStr = dynamic_cast<PDFString*>(pArr->m_aSubElements[0]);
if( pStr )
m_pData->m_aDocID = pStr->getFilteredString();
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "DocId is <" );
+#if OSL_DEBUG_LEVEL > 1
+ OUString aTmp;
for( int i = 0; i < m_pData->m_aDocID.getLength(); i++ )
- fprintf( stderr, "%.2x", (unsigned int)sal_uInt8(m_pData->m_aDocID.getStr()[i]) );
- fprintf( stderr, ">\n" );
- #endif
+ aTmp += OUString::number((unsigned int)sal_uInt8(m_pData->m_aDocID.getStr()[i]), 16);
+ SAL_INFO("sdext.pdfimport.pdfparse", "DocId is <" << OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8).getStr() << ">");
+#endif
}
}
// search Encrypt entry
@@ -1378,15 +1378,16 @@ PDFFileImplData* PDFFile::impl_getData() const
OString aEnt = pString->getFilteredString();
if( aEnt.getLength() == 32 )
memcpy( m_pData->m_aOEntry, aEnt.getStr(), 32 );
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
else
{
- fprintf( stderr, "O entry has length %d, should be 32 <", (int)aEnt.getLength() );
+ OUString aTmp;
for( int i = 0; i < aEnt.getLength(); i++ )
- fprintf( stderr, " %.2X", (unsigned int)sal_uInt8(aEnt.getStr()[i]) );
- fprintf( stderr, ">\n" );
+ aTmp += " " + OUString::number((unsigned int)sal_uInt8(aEnt.getStr()[i]), 16);
+ SAL_WARN("sdext.pdfimport.pdfparse",
+ "O entry has length " << (int)aEnt.getLength() << ", should be 32 <" << OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8).getStr() << ">" );
}
- #endif
+#endif
}
}
if( u_ent != pDict->m_aMap.end() )
@@ -1397,15 +1398,16 @@ PDFFileImplData* PDFFile::impl_getData() const
OString aEnt = pString->getFilteredString();
if( aEnt.getLength() == 32 )
memcpy( m_pData->m_aUEntry, aEnt.getStr(), 32 );
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
else
{
- fprintf( stderr, "U entry has length %d, should be 32 <", (int)aEnt.getLength() );
+ OUString aTmp;
for( int i = 0; i < aEnt.getLength(); i++ )
- fprintf( stderr, " %.2X", (unsigned int)sal_uInt8(aEnt.getStr()[i]) );
- fprintf( stderr, ">\n" );
+ aTmp += " " + OUString::number((unsigned int)sal_uInt8(aEnt.getStr()[i]), 16);
+ SAL_WARN("sdext.pdfimport.pdfparse",
+ "U entry has length " << (int)aEnt.getLength() << ", should be 32 <" << OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8).getStr() << ">" );
}
- #endif
+#endif
}
}
if( r_ent != pDict->m_aMap.end() )
@@ -1419,15 +1421,10 @@ PDFFileImplData* PDFFile::impl_getData() const
PDFNumber* pNum = dynamic_cast<PDFNumber*>(p_ent->second);
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 %" SAL_PRIxUINT32 "\n", m_pData->m_nPEntry );
- #endif
+ SAL_INFO("sdext.pdfimport.pdfparse", "p entry is " << m_pData->m_nPEntry );
}
- #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>",
- (int)m_pData->m_nAlgoVersion, (int)m_pData->m_nStandardRevision, (int)m_pData->m_nKeyLength );
- #endif
+
+ SAL_INFO("sdext.pdfimport.pdfparse", "Encryption dict: sec handler: " << (pFilter ? OUStringToOString( pFilter->getFilteredName(), RTL_TEXTENCODING_UTF8 ).getStr() : "<unknown>") << ", version = " << (int)m_pData->m_nAlgoVersion << ", revision = " << (int)m_pData->m_nStandardRevision << ", key length = " << m_pData->m_nKeyLength );
break;
}
}
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index 272702d2c118..1e8a97e7721e 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -553,32 +553,27 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
try
{
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
boost::spirit::parse_info<const char*> aInfo =
- #endif
+#endif
boost::spirit::parse( pBuffer,
pBuffer+nLen,
aGrammar,
boost::spirit::space_p );
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "parseinfo: stop = %p (buff=%p, offset = %d), hit = %s, full = %s, length = %d\n",
- aInfo.stop, pBuffer, aInfo.stop - pBuffer,
- aInfo.hit ? "true" : "false",
- aInfo.full ? "true" : "false",
- (int)aInfo.length );
- #endif
+#if OSL_DEBUG_LEVEL > 1
+ SAL_INFO("sdext.pdfimport.pdfparse", "parseinfo: stop = " << aInfo.stop << " (buff=" << pBuffer << ", offset = " << aInfo.stop - pBuffer << "), hit = " << aInfo.hit ? "true" : "false" << ", full = " << aInfo.full ? "true" : "false" << ", length = " << (int)aInfo.length );
+#endif
}
catch( const parser_error<const char*, const char*>& rError )
{
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "parse error: %s at buffer pos %u\nobject stack:\n",
- rError.descriptor, rError.where - pBuffer );
- unsigned int nElem = aGrammar.m_aObjectStack.size();
+#if OSL_DEBUG_LEVEL > 1
+ OUString aTmp;
+ unsigned int nElem = aGrammar.m_aObjectStack.size()
for( unsigned int i = 0; i < nElem; i++ )
- {
- fprintf( stderr, " %s\n", typeid( *(aGrammar.m_aObjectStack[i]) ).name() );
- }
- #endif
+ aTmp += " " + OUString(typeid( *(aGrammar.m_aObjectStack[i]) ).name());
+
+ SAL_WARN("sdext.pdfimport.pdfparse", "parse error: " << rError.descriptor << " at buffer pos " << rError.where - pBuffer << ", object stack: " << OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8).getStr());
+#endif
}
PDFEntry* pRet = NULL;
@@ -588,10 +583,10 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
pRet = aGrammar.m_aObjectStack.back();
aGrammar.m_aObjectStack.pop_back();
}
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
else if( nEntries > 1 )
- fprintf( stderr, "error got %u stack objects in parse\n", nEntries );
- #endif
+ SAL_WARN("sdext.pdfimport.pdfparse", "error got " << nEntries << " stack objects in parse" );
+#endif
return pRet;
}
@@ -634,32 +629,31 @@ PDFEntry* PDFReader::read( const char* pFileName )
try
{
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
boost::spirit::parse_info< file_iterator<> > aInfo =
- #endif
+#endif
boost::spirit::parse( file_start,
file_end,
aGrammar,
boost::spirit::space_p );
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "parseinfo: stop at offset = %ld, hit = %s, full = %s, length = %lu\n",
- aInfo.stop - file_start,
- aInfo.hit ? "true" : "false",
- aInfo.full ? "true" : "false",
- aInfo.length );
- #endif
+#if OSL_DEBUG_LEVEL > 1
+ SAL_INFO("sdext.pdfimport.pdfparse", "parseinfo: stop at offset = " << aInfo.stop - file_start << ", hit = " << (aInfo.hit ? "true" : "false") << ", full = " << (aInfo.full ? "true" : "false") << ", length = " << aInfo.length);
+#endif
}
catch( const parser_error< const char*, file_iterator<> >& rError )
{
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "parse error: %s at buffer pos %lu\nobject stack:\n",
- rError.descriptor, rError.where - file_start );
- size_t nElem = aGrammar.m_aObjectStack.size();
- for( size_t i = 0; i < nElem; ++i )
+#if OSL_DEBUG_LEVEL > 1
+ OUString aTmp;
+ unsigned int nElem = aGrammar.m_aObjectStack.size();
+ for( unsigned int i = 0; i < nElem; i++ )
{
- fprintf( stderr, " %s\n", typeid( *(aGrammar.m_aObjectStack[i]) ).name() );
+ aTmp += " ";
+ aTmp += OUString(typeid( *(aGrammar.m_aObjectStack[i]) ).name(),
+ strlen(typeid( *(aGrammar.m_aObjectStack[i]) ).name()),
+ RTL_TEXTENCODING_ASCII_US);
}
- #endif
+ SAL_WARN("sdext.pdfimport.pdfparse", "parse error: " << rError.descriptor << " at buffer pos " << rError.where - file_start << ", object stack: " << OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8).getStr());
+#endif
}
PDFEntry* pRet = NULL;
@@ -669,21 +663,21 @@ PDFEntry* PDFReader::read( const char* pFileName )
pRet = aGrammar.m_aObjectStack.back();
aGrammar.m_aObjectStack.pop_back();
}
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
else if( nEntries > 1 )
{
- fprintf( stderr, "error got %u stack objects in parse\n", nEntries );
+ SAL_WARN("sdext.pdfimport.pdfparse", "error got " << nEntries << " stack objects in parse");
for( unsigned int i = 0; i < nEntries; i++ )
{
- fprintf( stderr, "%s\n", typeid(*aGrammar.m_aObjectStack[i]).name() );
+ SAL_WARN("sdext.pdfimport.pdfparse", typeid(*aGrammar.m_aObjectStack[i]).name());
PDFObject* pObj = dynamic_cast<PDFObject*>(aGrammar.m_aObjectStack[i]);
if( pObj )
- fprintf( stderr, " -> object %d generation %d\n", pObj->m_nNumber, pObj->m_nGeneration );
+ SAL_WARN("sdext.pdfimport.pdfparse", " -> object " << pObj->m_nNumber << " generation " << pObj->m_nGeneration);
else
- fprintf( stderr, "(type %s)\n", typeid(*aGrammar.m_aObjectStack[i]).name() );
+ SAL_WARN("sdext.pdfimport.pdfparse", "(type " << typeid(*aGrammar.m_aObjectStack[i]).name() << ")");
}
}
- #endif
+#endif
return pRet;
#endif // WIN32
}