summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2009-12-01 17:55:30 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2009-12-01 17:55:30 +0100
commitef8d59c5b909d5a9b956934ab1120f90b90a4e10 (patch)
treec48cb224af652b76a033656fc06e40ed086ef67a
parentbf3e97339b940da3894cbf1e286c7186bf9baff6 (diff)
vcl108: #i106853# work around broken file_iterator on Windows
-rw-r--r--sdext/source/pdfimport/config/description.xml2
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfparse.cxx30
2 files changed, 30 insertions, 2 deletions
diff --git a/sdext/source/pdfimport/config/description.xml b/sdext/source/pdfimport/config/description.xml
index 9feff443b421..08e2f505653a 100644
--- a/sdext/source/pdfimport/config/description.xml
+++ b/sdext/source/pdfimport/config/description.xml
@@ -16,7 +16,7 @@
</simple-license>
</registration>
- <version value="1.0" />
+ <version value="1.0.2" />
<platform value="UPDATED_SUPPORTED_PLATFORM" />
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index c9b3b1522cc5..36734cfcbc84 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -51,6 +51,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/memory.h>
+#include <rtl/alloc.h>
// disable warnings again because someone along the line has enabled them
#if defined __SUNPRO_CC
@@ -573,6 +574,33 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
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.
+ */
+ PDFEntry* pRet = NULL;
+ FILE* fp = fopen( pFileName, "rb" );
+ if( fp )
+ {
+ fseek( fp, 0, SEEK_END );
+ unsigned int nLen = (unsigned int)ftell( fp );
+ fseek( fp, 0, SEEK_SET );
+ char* pBuf = (char*)rtl_allocateMemory( nLen );
+ if( pBuf )
+ {
+ fread( pBuf, 1, nLen, fp );
+ pRet = read( pBuf, nLen );
+ rtl_freeMemory( pBuf );
+ }
+ fclose( fp );
+ }
+ return pRet;
+ #else
file_iterator<> file_start( pFileName );
if( ! file_start )
return NULL;
@@ -629,8 +657,8 @@ PDFEntry* PDFReader::read( const char* pFileName )
}
}
#endif
-
return pRet;
+ #endif // WIN32
}
#if defined __SUNPRO_CC