diff options
author | root <root@lamia.panaceas.james.local> | 2015-12-19 14:18:43 +0000 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2015-12-19 14:18:43 +0000 |
commit | 71478fd62d8483483abb34609cdabb7f9cbadfd6 (patch) | |
tree | 37b8eaba1ffe2d5f775227911eb0ed6fdc3c9553 /hostTools/lzma/compress/lzDecomp.cpp | |
parent | 1a2238d1bddc823df06f67312d96ccf9de2893cc (diff) | |
download | bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.tar.gz bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.tar.bz2 bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.zip |
Add hostTools from https://github.com/Noltari/cfe_bcm63xx
Diffstat (limited to 'hostTools/lzma/compress/lzDecomp.cpp')
-rw-r--r-- | hostTools/lzma/compress/lzDecomp.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/hostTools/lzma/compress/lzDecomp.cpp b/hostTools/lzma/compress/lzDecomp.cpp new file mode 100644 index 0000000..f45cb4b --- /dev/null +++ b/hostTools/lzma/compress/lzDecomp.cpp @@ -0,0 +1,45 @@ +#include "stdio.h" +#include "LZMADecoder.h" + +//static LzmaDecoder cc; +ISequentialInStream in_stream; +ISequentialOutStream out_stream; +int decompress_lzma_7z( unsigned char* in_data, + unsigned in_size, + unsigned char* out_data, + unsigned out_size) { +// LzmaDecoder cc; + int RC; + UINT64 in_size_l = in_size; + UINT64 out_size_l = out_size; + + + InStreamInit(in_data, in_size); + + OutStreamInit((char *)out_data, out_size); + + LzmaDecoderConstructor(&cc); + + if ((RC = LzmaDecoderReadCoderProperties(&cc)) != S_OK) + { + return RC; + } + + if (LzmaDecoderCode(&cc, &in_size_l, &out_size_l) != S_OK) + { + return -2; + } + + if (out_stream.size != out_size) + { + return -3; + } + + if ( out_stream.overflow ) + { + return -4; + } + +printf( "\nDecompressed size: %d\n", out_stream.total ); + return 0; +} |