summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-31 20:09:35 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-31 21:01:10 +0100
commit046e9545956d8ad1d69345d6b4a4c0a33714d179 (patch)
treebbe08c993fec839580bffdbb1fbd57937b5b3313 /sdext
parent4b1acf7d1a0a2515a5f781b702c22c6233caecc8 (diff)
Try to revert to use of file_iterator from boost on Windows
It was disabled in commit ef8d59c5b909d5a9b956934ab1120f90b90a4e10 (vcl108: #i106853# work around broken file_iterator on Windows, 2009-12-01), referencing boost 1.39. It seems to work fine now, so let's revert it, and hope it doesn't break something. Change-Id: I208aa87eca146a29ffc2f36a48810ecda5df0f00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158736 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfparse.cxx76
1 files changed, 0 insertions, 76 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index 7cef299e8eaa..baa322c1aa3c 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -558,83 +558,8 @@ public:
}
-#ifdef _WIN32
-std::unique_ptr<PDFEntry> PDFReader::read( const char* pBuffer, unsigned int nLen )
-{
- PDFGrammar<const char*> aGrammar( pBuffer );
-
- try
- {
-#if OSL_DEBUG_LEVEL > 0
- boost::spirit::classic::parse_info<const char*> aInfo =
-#endif
- boost::spirit::classic::parse( pBuffer,
- pBuffer+nLen,
- aGrammar,
- boost::spirit::classic::space_p );
-#if OSL_DEBUG_LEVEL > 0
- SAL_INFO("sdext.pdfimport.pdfparse", "parseinfo: stop = " << aInfo.stop << " (buff=" << pBuffer << ", offset = " << aInfo.stop - pBuffer << "), hit = " << (aInfo.hit ? OUString("true") : OUString("false")) << ", full = " << (aInfo.full ? OUString("true") : OUString("false")) << ", length = " << static_cast<int>(aInfo.length) );
-#endif
- }
- catch( const parser_error<const char*, const char*>& rError )
- {
-#if OSL_DEBUG_LEVEL > 0
- OString aTmp;
- unsigned int nElem = aGrammar.m_aObjectStack.size();
- for( unsigned int i = 0; i < nElem; i++ )
- aTmp += OString::Concat(" ") + typeid( *(aGrammar.m_aObjectStack[i]) ).name();
-
- SAL_WARN("sdext.pdfimport.pdfparse", "parse error: " << rError.descriptor << " at buffer pos " << rError.where - pBuffer << ", object stack: " << aTmp);
-#else
- (void)rError;
-#endif
- }
-
- std::unique_ptr<PDFEntry> pRet;
- unsigned int nEntries = aGrammar.m_aObjectStack.size();
- if( nEntries == 1 )
- {
- pRet.reset(aGrammar.m_aObjectStack.back());
- aGrammar.m_aObjectStack.pop_back();
- }
-#if OSL_DEBUG_LEVEL > 0
- else if( nEntries > 1 )
- SAL_WARN("sdext.pdfimport.pdfparse", "error got " << nEntries << " stack objects in parse" );
-#endif
-
- return pRet;
-}
-#endif
-
std::unique_ptr<PDFEntry> PDFReader::read( const char* pFileName )
{
-#ifdef _WIN32
- /* #i106583#
- 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.
- */
- std::unique_ptr<PDFEntry> pRet;
- FILE* fp = fopen( pFileName, "rb" );
- if( fp )
- {
- fseek( fp, 0, SEEK_END );
- unsigned int nLen = static_cast<unsigned int>(ftell( fp ));
- fseek( fp, 0, SEEK_SET );
- char* pBuf = static_cast<char*>(std::malloc( nLen ));
- if( pBuf )
- {
- fread( pBuf, 1, nLen, fp );
- pRet = read( pBuf, nLen );
- std::free( pBuf );
- }
- fclose( fp );
- }
- return pRet;
-#else
file_iterator<> file_start( pFileName );
if( ! file_start )
return nullptr;
@@ -692,7 +617,6 @@ std::unique_ptr<PDFEntry> PDFReader::read( const char* pFileName )
}
#endif
return pRet;
-#endif // WIN32
}
#if defined(_MSC_VER)