From ab45e72e67c7effae9a9fecbaf5a77f9427d8df4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 28 May 2012 16:54:49 -0400 Subject: COMMON: Move InstallShield code to common The code also now works for both data compressed with sync bytes and without --- common/zlib.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'common/zlib.h') diff --git a/common/zlib.h b/common/zlib.h index 61322c286a..8cfc5829ac 100644 --- a/common/zlib.h +++ b/common/zlib.h @@ -77,6 +77,25 @@ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long */ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, const byte *dict = 0, uint dictLen = 0); +/** + * Wrapper around zlib's inflate functions. This function will call the + * necessary inflate functions to uncompress data compressed for InstallShield + * cabinet files. + * + * Decompresses the src buffer into the dst buffer. + * srcLen is the byte length of the source buffer, dstLen is the byte + * length of the output buffer. + * It decompress as much data as possible, up to dstLen bytes. + * + * @param dst the buffer to store into. + * @param dstLen the size of the destination buffer. + * @param src the data to be decompressed. + * @param dstLen the size of the compressed data. + * + * @return true on success (Z_OK or Z_STREAM_END), false otherwise. + */ +bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcLen); + #endif /** -- cgit v1.2.3 From b398dcabaffbbc53d24d296fed3f64b0b8ecd519 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 18 Jul 2012 13:54:15 +0200 Subject: COMMON: Add an optional argument to wrapCompressedReadStream, to simplify using streams that can't tell their size() --- common/zlib.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'common/zlib.h') diff --git a/common/zlib.h b/common/zlib.h index 61322c286a..8372499922 100644 --- a/common/zlib.h +++ b/common/zlib.h @@ -86,10 +86,18 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, * format. In the former case, the original stream is returned unmodified * (and in particular, not wrapped). * + * Certain GZip-formats don't supply an easily readable length, if you + * still need the length carried along with the stream, and you know + * the decompressed length at wrap-time, then it can be supplied as knownSize + * here. knownSize will be ignored if the GZip-stream DOES include a length. + * * It is safe to call this with a NULL parameter (in this case, NULL is * returned). + * + * @param toBeWrapped the stream to be wrapped (if it is in gzip-format) + * @param knownSize a supplied length of the compressed data (if not available directly) */ -SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped); +SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize = 0); /** * Take an arbitrary WriteStream and wrap it in a custom stream which provides -- cgit v1.2.3 From 89abab97e3124fa25eb4c7d3e8b38501747a8d17 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 26 Sep 2012 04:17:31 +0200 Subject: JANITORIAL: Remove trailing whitespaces. Powered by: git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//' --- common/zlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/zlib.h') diff --git a/common/zlib.h b/common/zlib.h index b2d321d502..6a840f5fdc 100644 --- a/common/zlib.h +++ b/common/zlib.h @@ -114,7 +114,7 @@ bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcL * returned). * * @param toBeWrapped the stream to be wrapped (if it is in gzip-format) - * @param knownSize a supplied length of the compressed data (if not available directly) + * @param knownSize a supplied length of the compressed data (if not available directly) */ SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize = 0); -- cgit v1.2.3