diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:23:11 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:38 +0100 |
commit | d930b6c2e6e3dfb9e1ed19b84a3137cc0cfbfd8c (patch) | |
tree | d846436ca5fd25d707a0428b8c28b67ae6076ed0 /sdext/source/pdfimport/pdfparse | |
parent | 92c697c0e3e4bde88424322875c993c161696b1e (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I8aec30601862feaeb99e3ce01adf61665688fa9a
Diffstat (limited to 'sdext/source/pdfimport/pdfparse')
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfentries.cxx | 46 | ||||
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfparse.cxx | 38 |
2 files changed, 42 insertions, 42 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 98039e93a7b9..67fbc026043d 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -95,7 +95,7 @@ using namespace pdfparse; EmitContext::EmitContext( const PDFContainer* pTop ) : m_bDeflate( false ), m_bDecrypt( false ), - m_pImplData( NULL ) + m_pImplData( nullptr ) { if( pTop ) m_pImplData = new EmitImplData( pTop ); @@ -490,7 +490,7 @@ PDFObject* PDFContainer::findObject( unsigned int nNumber, unsigned int nGenerat return pObject; } } - return NULL; + return nullptr; } PDFArray::~PDFArray() @@ -559,7 +559,7 @@ void PDFDict::eraseValue( const OString& rName ) { for( unsigned int j = i+1; j < nEle; j++ ) { - if( dynamic_cast<PDFComment*>(m_aSubElements[j]) == NULL ) + if( dynamic_cast<PDFComment*>(m_aSubElements[j]) == nullptr ) { // free name and value delete m_aSubElements[j]; @@ -581,17 +581,17 @@ PDFEntry* PDFDict::buildMap() m_aMap.clear(); // build map unsigned int nEle = m_aSubElements.size(); - PDFName* pName = NULL; + PDFName* pName = nullptr; for( unsigned int i = 0; i < nEle; i++ ) { - if( dynamic_cast<PDFComment*>(m_aSubElements[i]) == NULL ) + if( dynamic_cast<PDFComment*>(m_aSubElements[i]) == nullptr ) { if( pName ) { m_aMap[ pName->m_aName ] = m_aSubElements[i]; - pName = NULL; + pName = nullptr; } - else if( (pName = dynamic_cast<PDFName*>(m_aSubElements[i])) == NULL ) + else if( (pName = dynamic_cast<PDFName*>(m_aSubElements[i])) == nullptr ) return m_aSubElements[i]; } } @@ -617,7 +617,7 @@ bool PDFStream::emit( EmitContext& rWriteContext ) const PDFEntry* PDFStream::clone() const { - return new PDFStream( m_nBeginOffset, m_nEndOffset, NULL ); + return new PDFStream( m_nBeginOffset, m_nEndOffset, nullptr ); } unsigned int PDFStream::getDictLength( const PDFContainer* pContainer ) const @@ -670,7 +670,7 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const if( nRead != nOuterStreamLen ) { rtl_freeMemory( *ppStream ); - *ppStream = NULL; + *ppStream = nullptr; *pBytes = 0; return false; } @@ -718,7 +718,7 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const } } else - *ppStream = NULL, *pBytes = 0; + *ppStream = nullptr, *pBytes = 0; return bIsDeflated; } @@ -764,7 +764,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen, if( err < Z_OK ) { rtl_freeMemory( *pOutBuf ); - *pOutBuf = NULL; + *pOutBuf = nullptr; *pOutLen = 0; } } @@ -774,11 +774,11 @@ bool PDFObject::writeStream( EmitContext& rWriteContext, const PDFFile* pParsedF bool bSuccess = false; if( m_pStream ) { - char* pStream = NULL; + char* pStream = nullptr; unsigned int nBytes = 0; if( getDeflatedStream( &pStream, &nBytes, pParsedFile, rWriteContext ) && nBytes && rWriteContext.m_bDeflate ) { - sal_uInt8* pOutBytes = NULL; + sal_uInt8* pOutBytes = nullptr; sal_uInt32 nOutBytes = 0; unzipToBuffer( pStream, nBytes, &pOutBytes, &nOutBytes ); rWriteContext.write( pOutBytes, nOutBytes ); @@ -812,13 +812,13 @@ bool PDFObject::emit( EmitContext& rWriteContext ) const pEData->setDecryptObject( m_nNumber, m_nGeneration ); if( (rWriteContext.m_bDeflate || rWriteContext.m_bDecrypt) && pEData ) { - char* pStream = NULL; + char* pStream = nullptr; unsigned int nBytes = 0; bool bDeflate = getDeflatedStream( &pStream, &nBytes, pEData->m_pObjectContainer, rWriteContext ); if( pStream && nBytes ) { // unzip the stream - sal_uInt8* pOutBytes = NULL; + sal_uInt8* pOutBytes = nullptr; sal_uInt32 nOutBytes = 0; if( bDeflate && rWriteContext.m_bDeflate ) unzipToBuffer( pStream, nBytes, &pOutBytes, &nOutBytes ); @@ -1034,8 +1034,8 @@ struct PDFFileImplData m_nStandardRevision( 0 ), m_nKeyLength( 0 ), m_nPEntry( 0 ), - m_aCipher( NULL ), - m_aDigest( NULL ) + m_aCipher( nullptr ), + m_aDigest( nullptr ) { memset( m_aOEntry, 0, sizeof( m_aOEntry ) ); memset( m_aUEntry, 0, sizeof( m_aUEntry ) ); @@ -1089,7 +1089,7 @@ bool PDFFile::decrypt( const sal_uInt8* pInBuffer, sal_uInt32 nLen, sal_uInt8* p rtlCipherError aErr = rtl_cipher_initARCFOUR( m_pData->m_aCipher, rtl_Cipher_DirectionDecode, aSum, i, - NULL, 0 ); + nullptr, 0 ); if( aErr == rtl_Cipher_E_None ) aErr = rtl_cipher_decodeARCFOUR( m_pData->m_aCipher, pInBuffer, nLen, @@ -1167,7 +1167,7 @@ static bool check_user_password( const OString& rPwd, PDFFileImplData* pData ) // encrypt pad string rtl_cipher_initARCFOUR( pData->m_aCipher, rtl_Cipher_DirectionEncode, aKey, nKeyLen, - NULL, 0 ); + nullptr, 0 ); rtl_cipher_encodeARCFOUR( pData->m_aCipher, nPadString, sizeof( nPadString ), nEncryptedEntry, sizeof( nEncryptedEntry ) ); bValid = (memcmp( nEncryptedEntry, pData->m_aUEntry, 32 ) == 0); @@ -1179,7 +1179,7 @@ static bool check_user_password( const OString& rPwd, PDFFileImplData* pData ) rtl_digest_updateMD5( pData->m_aDigest, pData->m_aDocID.getStr(), pData->m_aDocID.getLength() ); rtl_digest_getMD5( pData->m_aDigest, nEncryptedEntry, sizeof(nEncryptedEntry) ); rtl_cipher_initARCFOUR( pData->m_aCipher, rtl_Cipher_DirectionEncode, - aKey, sizeof(aKey), NULL, 0 ); + aKey, sizeof(aKey), nullptr, 0 ); rtl_cipher_encodeARCFOUR( pData->m_aCipher, nEncryptedEntry, 16, nEncryptedEntry, 16 ); // encrypt in place @@ -1190,7 +1190,7 @@ static bool check_user_password( const OString& rPwd, PDFFileImplData* pData ) aTempKey[j] = static_cast<sal_uInt8>( aKey[j] ^ i ); rtl_cipher_initARCFOUR( pData->m_aCipher, rtl_Cipher_DirectionEncode, - aTempKey, sizeof(aTempKey), NULL, 0 ); + aTempKey, sizeof(aTempKey), nullptr, 0 ); rtl_cipher_encodeARCFOUR( pData->m_aCipher, nEncryptedEntry, 16, nEncryptedEntry, 16 ); // encrypt in place @@ -1237,7 +1237,7 @@ bool PDFFile::setupDecryptionData( const OString& rPwd ) const if( m_pData->m_nStandardRevision == 2 ) { rtl_cipher_initARCFOUR( m_pData->m_aCipher, rtl_Cipher_DirectionDecode, - aKey, nKeyLen, NULL, 0 ); + aKey, nKeyLen, nullptr, 0 ); rtl_cipher_decodeARCFOUR( m_pData->m_aCipher, m_pData->m_aOEntry, 32, nPwd, 32 ); @@ -1251,7 +1251,7 @@ bool PDFFile::setupDecryptionData( const OString& rPwd ) const for( unsigned int j = 0; j < sizeof(nTempKey); j++ ) nTempKey[j] = sal_uInt8(aKey[j] ^ i); rtl_cipher_initARCFOUR( m_pData->m_aCipher, rtl_Cipher_DirectionDecode, - nTempKey, nKeyLen, NULL, 0 ); + nTempKey, nKeyLen, nullptr, 0 ); rtl_cipher_decodeARCFOUR( m_pData->m_aCipher, nPwd, 32, nPwd, 32 ); // decrypt inplace diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx index d4b92be4a833..2f4ba2e48063 100644 --- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx @@ -307,30 +307,30 @@ public: if( m_aObjectStack.empty() ) m_aObjectStack.push_back( new PDFPart() ); PDFContainer* pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back()); - if( pContainer == NULL ) + if( pContainer == nullptr ) parseError( "comment without container", first ); pContainer->m_aSubElements.push_back( pComment ); } void insertNewValue( PDFEntry* pNewValue, iteratorT pPos ) { - PDFContainer* pContainer = NULL; - const char* pMsg = NULL; + PDFContainer* pContainer = nullptr; + const char* pMsg = nullptr; if( ! m_aObjectStack.empty() && - (pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back())) != NULL ) + (pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back())) != nullptr ) { - if( dynamic_cast<PDFDict*>(pContainer) == NULL && - dynamic_cast<PDFArray*>(pContainer) == NULL ) + if( dynamic_cast<PDFDict*>(pContainer) == nullptr && + dynamic_cast<PDFArray*>(pContainer) == nullptr ) { PDFObject* pObj = dynamic_cast<PDFObject*>(pContainer); if( pObj ) { - if( pObj->m_pObject == NULL ) + if( pObj->m_pObject == nullptr ) pObj->m_pObject = pNewValue; else { pMsg = "second value for object"; - pContainer = NULL; + pContainer = nullptr; } } else if( dynamic_cast<PDFDict*>(pNewValue) ) @@ -338,16 +338,16 @@ public: PDFTrailer* pTrailer = dynamic_cast<PDFTrailer*>(pContainer); if( pTrailer ) { - if( pTrailer->m_pDict == NULL ) + if( pTrailer->m_pDict == nullptr ) pTrailer->m_pDict = dynamic_cast<PDFDict*>(pNewValue); else - pContainer = NULL; + pContainer = nullptr; } else - pContainer = NULL; + pContainer = nullptr; } else - pContainer = NULL; + pContainer = nullptr; } } if( pContainer ) @@ -421,7 +421,7 @@ public: { if( m_aObjectStack.empty() ) parseError( "endobj without obj", first ); - else if( dynamic_cast<PDFObject*>(m_aObjectStack.back()) == NULL ) + else if( dynamic_cast<PDFObject*>(m_aObjectStack.back()) == nullptr ) parseError( "spurious endobj", first ); else m_aObjectStack.pop_back(); @@ -447,10 +447,10 @@ public: } void endDict( iteratorT first, SAL_UNUSED_PARAMETER iteratorT ) { - PDFDict* pDict = NULL; + PDFDict* pDict = nullptr; if( m_aObjectStack.empty() ) parseError( "dictionary end without begin", first ); - else if( (pDict = dynamic_cast<PDFDict*>(m_aObjectStack.back())) == NULL ) + else if( (pDict = dynamic_cast<PDFDict*>(m_aObjectStack.back())) == nullptr ) parseError( "spurious dictionary end", first ); else m_aObjectStack.pop_back(); @@ -480,7 +480,7 @@ public: { if( m_aObjectStack.empty() ) parseError( "array end without begin", first ); - else if( dynamic_cast<PDFArray*>(m_aObjectStack.back()) == NULL ) + else if( dynamic_cast<PDFArray*>(m_aObjectStack.back()) == nullptr ) parseError( "spurious array end", first ); else m_aObjectStack.pop_back(); @@ -533,7 +533,7 @@ public: { if( m_aObjectStack.empty() ) parseError( "%%EOF without trailer", first ); - else if( dynamic_cast<PDFTrailer*>(m_aObjectStack.back()) == NULL ) + else if( dynamic_cast<PDFTrailer*>(m_aObjectStack.back()) == nullptr ) parseError( "spurious %%EOF", first ); else m_aObjectStack.pop_back(); @@ -617,7 +617,7 @@ PDFEntry* PDFReader::read( const char* pFileName ) #else file_iterator<> file_start( pFileName ); if( ! file_start ) - return NULL; + return nullptr; file_iterator<> file_end = file_start.make_end(); PDFGrammar< file_iterator<> > aGrammar( file_start ); @@ -651,7 +651,7 @@ PDFEntry* PDFReader::read( const char* pFileName ) #endif } - PDFEntry* pRet = NULL; + PDFEntry* pRet = nullptr; unsigned int nEntries = aGrammar.m_aObjectStack.size(); if( nEntries == 1 ) { |