diff options
author | Dennis Francis <dennisfrancis.in@gmail.com> | 2015-04-15 22:22:16 +0530 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2015-04-27 00:33:57 +0000 |
commit | f0edb677f09ad338e22ac3b5d91497b4479e0b3c (patch) | |
tree | bbd2b4a48538b3b019108460309be52724005022 /tools | |
parent | 89aee8b17f8dd4eb2213a7844a9ef26951e39775 (diff) |
enhancement : tdf#90225 Cannot open compressed csv files from calc
Change-Id: I5098fd25f1747b49e47e360f017ee1112a242771
Reviewed-on: https://gerrit.libreoffice.org/15108
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index d6bce145a188..b5c645ac92e2 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -394,4 +394,30 @@ void ZCodec::UpdateCRC ( sal_uInt8* pSource, long nDatSize) mnCRC = rtl_crc32( mnCRC, pSource, nDatSize ); } +bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm, bool updateCrc, bool gzLib) +{ + assert(meState == STATE_INIT); + sal_uLong nStreamPos = rIStm.Tell(); + BeginCompression(ZCODEC_DEFAULT_COMPRESSION, updateCrc, gzLib); + InitDecompress(rIStm); + EndCompression(); + if ( !mbStatus || rIStm.GetError() ) + { + rIStm.Seek(nStreamPos); + return false; + } + rIStm.Seek(nStreamPos); + BeginCompression(ZCODEC_DEFAULT_COMPRESSION, updateCrc, gzLib); + Decompress(rIStm, rOStm); + EndCompression(); + if( !mbStatus || rIStm.GetError() || rOStm.GetError() ) + { + rIStm.Seek(nStreamPos); + return false; + } + rIStm.Seek(nStreamPos); + rOStm.Seek(0); + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |