diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-23 15:07:32 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-23 15:07:32 +0200 |
commit | 99effbc418feee675b6fd54a07c2f68d927de469 (patch) | |
tree | b9a415494780c6cb86d0dfcf2d69a9da9cc436bd /sdext/source/pdfimport/pdfparse/pdfparse.cxx | |
parent | f76f752dc908cfbab1cade605fe4f742233dfa6d (diff) |
recreated tag libreoffice-3.3.0.4 which had these commits:
commit 01c917c0bdbb833cda4a0a77bc10264c4d40fcd5 (tag: refs/tags/libreoffice-3.3.0.4, refs/remotes/origin/libreoffice-3-3-0)
Author: Petr Mladek <pmladek@suse.cz>
Date: Tue Jan 18 19:01:16 2011 +0100
Version 3.3.0.4, tag libreoffice-3.3.0.4 (3.3-rc4)
commit 983cd7d8b4d9c87f872472343f8399cb640cfb9a
Author: Rene Engelhard <rene@debian.org>
Date: Wed Jan 12 10:03:30 2011 +0100
fix presenter screens description.xml build
sdext/source/presenter/makefile.mk | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
commit cb68579984b772fcbccd673f9cf930b4828d6fde
Author: Petr Mladek <pmladek@suse.cz>
Date: Tue Jan 11 22:59:36 2011 +0100
Branch libreoffice-3-3-0
This is 'libreoffice-3-3-0' - the stable branch for the 3.3.0 release.
Only very safe changes, reviewed by three people are allowed.
If you want to commit more complicated fix for the next 3.3.x release,
please use the 'libreoffice-3-3' branch.
If you want to build something cool, unstable, and risky, use master.
Notes
Notes:
split repo tag: extensions_libreoffice-3.3.0.4
Diffstat (limited to 'sdext/source/pdfimport/pdfparse/pdfparse.cxx')
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfparse.cxx | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx index b278021df6f8..5105ac5e2413 100644 --- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx @@ -85,7 +85,7 @@ class StringEmitContext : public EmitContext } return 0; } - + OString getString() { return m_aBuf.makeStringAndClear(); } }; @@ -107,7 +107,7 @@ public: std::vector< PDFEntry* > m_aObjectStack; rtl::OString m_aErrorString; iteratorT m_aGlobalBegin; - + public: struct pdf_string_parser { @@ -117,7 +117,7 @@ public: operator()(ScannerT const& scan, result_t&) const { std::ptrdiff_t len = 0; - + int nBraceLevel = 0; while( ! scan.at_end() ) { @@ -150,11 +150,11 @@ public: definition( const PDFGrammar<iteratorT>& rSelf ) { PDFGrammar<iteratorT>* pSelf = const_cast< PDFGrammar<iteratorT>* >( &rSelf ); - + // workaround workshop compiler: comment_p doesn't work // comment = comment_p("%")[boost::bind(&PDFGrammar::pushComment, pSelf, _1, _2 )]; comment = lexeme_d[ (ch_p('%') >> *(~ch_p('\r') & ~ch_p('\n')) >> eol_p)[boost::bind(&PDFGrammar::pushComment, pSelf, _1, _2 )] ]; - + boolean = (str_p("true") | str_p("false"))[boost::bind(&PDFGrammar::pushBool, pSelf, _1, _2)]; // workaround workshop compiler: confix_p doesn't work @@ -170,13 +170,13 @@ public: //stringtype = ( confix_p("(",*anychar_p, ")") | // confix_p("<",*xdigit_p, ">") ) // [boost::bind(&PDFGrammar::pushString,pSelf, _1, _2)]; - + stringtype = ( ( ch_p('(') >> functor_parser<pdf_string_parser>() >> ch_p(')') ) | ( ch_p('<') >> *xdigit_p >> ch_p('>') ) ) [boost::bind(&PDFGrammar::pushString,pSelf, _1, _2)]; null_object = str_p( "null" )[boost::bind(&PDFGrammar::pushNull, pSelf, _1, _2)]; - + #ifdef USE_ASSIGN_ACTOR objectref = ( uint_p[push_back_a(pSelf->m_aUIntStack)] >> uint_p[push_back_a(pSelf->m_aUIntStack)] @@ -202,10 +202,10 @@ public: [boost::bind(&PDFGrammar::pushDouble, pSelf, _1, _2)] | stringtype | boolean | null_object; #endif - + dict_begin = str_p( "<<" )[boost::bind(&PDFGrammar::beginDict, pSelf, _1, _2)]; dict_end = str_p( ">>" )[boost::bind(&PDFGrammar::endDict, pSelf, _1, _2)]; - + array_begin = str_p("[")[boost::bind(&PDFGrammar::beginArray,pSelf, _1, _2)]; array_end = str_p("]")[boost::bind(&PDFGrammar::endArray,pSelf, _1, _2)]; @@ -219,7 +219,7 @@ public: >> str_p("obj" )[boost::bind(&PDFGrammar::beginObject, pSelf, _1, _2)]; #endif object_end = str_p( "endobj" )[boost::bind(&PDFGrammar::endObject, pSelf, _1, _2)]; - + xref = str_p( "xref" ) >> uint_p >> uint_p >> lexeme_d[ +( repeat_p(10)[digit_p] @@ -229,21 +229,21 @@ public: >> ( ch_p('n') | ch_p('f') ) >> repeat_p(2)[space_p] ) ]; - + dict_element= dict_begin | comment | simple_type | array_begin | array_end | dict_end; - + object = object_begin >> *dict_element >> !stream >> object_end; - + trailer = str_p( "trailer" )[boost::bind(&PDFGrammar::beginTrailer,pSelf,_1,_2)] >> *dict_element >> str_p("startxref") >> uint_p >> str_p("%%EOF")[boost::bind(&PDFGrammar::endTrailer,pSelf,_1,_2)]; - + #ifdef USE_ASSIGN_ACTOR pdfrule = ! (lexeme_d[ str_p( "%PDF-" ) @@ -270,10 +270,10 @@ public: objectref, array, value, dict_element, dict_begin, dict_end, array_begin, array_end, object, object_begin, object_end, xref, trailer, pdfrule; - + const rule< ScannerT >& start() const { return pdfrule; } }; - + #ifndef USE_ASSIGN_ACTOR void push_back_action_uint( unsigned int i ) { @@ -284,12 +284,12 @@ public: m_fDouble = d; } #endif - + void parseError( const char* pMessage, iteratorT pLocation ) { throw_( pLocation, pMessage ); } - + rtl::OString iteratorToString( iteratorT first, iteratorT last ) const { rtl::OStringBuffer aStr( 32 ); @@ -300,7 +300,7 @@ public: } return aStr.makeStringAndClear(); } - + void haveFile( iteratorT pBegin, iteratorT /*pEnd*/ ) { if( m_aObjectStack.empty() ) @@ -308,14 +308,14 @@ public: PDFFile* pFile = new PDFFile(); pFile->m_nMinor = m_aUIntStack.back(); m_aUIntStack.pop_back(); - pFile->m_nMajor = m_aUIntStack.back(); + pFile->m_nMajor = m_aUIntStack.back(); m_aUIntStack.pop_back(); m_aObjectStack.push_back( pFile ); } else parseError( "found file header in unusual place", pBegin ); } - + void pushComment( iteratorT first, iteratorT last ) { // add a comment to the current stack element @@ -328,7 +328,7 @@ public: parseError( "comment without container", first ); pContainer->m_aSubElements.push_back( pComment ); } - + void insertNewValue( PDFEntry* pNewValue, iteratorT pPos ) { PDFContainer* pContainer = NULL; @@ -382,7 +382,7 @@ public: parseError( pMsg, pPos ); } } - + void pushName( iteratorT first, iteratorT last ) { insertNewValue( new PDFName(iteratorToString(first,last)), first ); @@ -408,7 +408,7 @@ public: insertNewValue( new PDFNull(), first ); } - + void beginObject( iteratorT first, iteratorT /*last*/ ) { if( m_aObjectStack.empty() ) @@ -418,12 +418,12 @@ public: m_aUIntStack.pop_back(); unsigned int nObject = m_aUIntStack.back(); m_aUIntStack.pop_back(); - + PDFObject* pObj = new PDFObject( nObject, nGeneration ); pObj->m_nOffset = first - m_aGlobalBegin; PDFContainer* pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back()); - if( pContainer && + if( pContainer && ( dynamic_cast<PDFFile*>(pContainer) || dynamic_cast<PDFPart*>(pContainer) ) ) { @@ -433,7 +433,7 @@ public: else parseError( "object in wrong place", first ); } - + void endObject( iteratorT first, iteratorT ) { if( m_aObjectStack.empty() ) @@ -443,7 +443,7 @@ public: else m_aObjectStack.pop_back(); } - + void pushObjectRef( iteratorT first, iteratorT ) { unsigned int nGeneration = m_aUIntStack.back(); @@ -452,7 +452,7 @@ public: m_aUIntStack.pop_back(); insertNewValue( new PDFObjectRef(nObject,nGeneration), first ); } - + void beginDict( iteratorT first, iteratorT ) { PDFDict* pDict = new PDFDict(); @@ -471,7 +471,7 @@ public: parseError( "spurious dictionary end", first ); else m_aObjectStack.pop_back(); - + PDFEntry* pOffender = pDict->buildMap(); if( pOffender ) { @@ -487,7 +487,7 @@ public: { PDFArray* pArray = new PDFArray(); pArray->m_nOffset = first - m_aGlobalBegin; - + insertNewValue( pArray, first ); // will not come here if insertion fails (exception) m_aObjectStack.push_back( pArray ); @@ -502,7 +502,7 @@ public: else m_aObjectStack.pop_back(); } - + void emitStream( iteratorT first, iteratorT last ) { if( m_aObjectStack.empty() ) @@ -512,7 +512,7 @@ public: { if( pObj->m_pStream ) parseError( "multiple streams in object", first ); - + PDFDict* pDict = dynamic_cast<PDFDict*>(pObj->m_pObject); if( pDict ) { @@ -535,7 +535,7 @@ public: pTrailer->m_nOffset = first - m_aGlobalBegin; PDFContainer* pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back()); - if( pContainer && + if( pContainer && ( dynamic_cast<PDFFile*>(pContainer) || dynamic_cast<PDFPart*>(pContainer) ) ) { @@ -560,7 +560,7 @@ public: PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen ) { PDFGrammar<const char*> aGrammar( pBuffer ); - + try { boost::spirit::parse_info<const char*> aInfo = @@ -588,7 +588,7 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen ) } #endif } - + PDFEntry* pRet = NULL; unsigned int nEntries = aGrammar.m_aObjectStack.size(); if( nEntries == 1 ) @@ -600,7 +600,7 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen ) else if( nEntries > 1 ) fprintf( stderr, "error got %u stack objects in parse\n", nEntries ); #endif - + return pRet; } @@ -611,7 +611,7 @@ PDFEntry* PDFReader::read( const char* pFileName ) since converting to boost 1.39 file_iterator does not work anymore on all Windows systems C++ stdlib istream_iterator does not allow "-" apparently using spirit 2.0 doesn't work in our environment with the MSC - + So for the time being bite the bullet and read the whole file. FIXME: give Spirit 2.x another try when we upgrade boost again. */ @@ -638,7 +638,7 @@ PDFEntry* PDFReader::read( const char* pFileName ) return NULL; file_iterator<> file_end = file_start.make_end(); PDFGrammar< file_iterator<> > aGrammar( file_start ); - + try { boost::spirit::parse_info< file_iterator<> > aInfo = @@ -666,7 +666,7 @@ PDFEntry* PDFReader::read( const char* pFileName ) } #endif } - + PDFEntry* pRet = NULL; unsigned int nEntries = aGrammar.m_aObjectStack.size(); if( nEntries == 1 ) @@ -697,7 +697,7 @@ PDFEntry* PDFReader::read( const char* pFileName ) #pragma enable_warn #elif defined _MSC_VER #pragma warning(pop) -#endif +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |