From 6187eb3f7706bf124f65dcca665ab88564482116 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 9 Sep 2014 09:53:32 -0700 Subject: [PATCH] * Fix LZO --- include/Athena/Compression.hpp | 4 ++-- include/LZ77/LZBase.hpp | 4 ++-- include/LZ77/LZType10.hpp | 4 ++-- include/LZ77/LZType11.hpp | 4 ++-- src/Athena/Compression.cpp | 4 ++-- src/LZ77/LZType10.cpp | 8 ++++---- src/LZ77/LZType11.cpp | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/Athena/Compression.hpp b/include/Athena/Compression.hpp index bc82529..215aed6 100644 --- a/include/Athena/Compression.hpp +++ b/include/Athena/Compression.hpp @@ -35,8 +35,8 @@ atInt32 decompressLZO(const atUint8* source, atInt32 sourceSize, atUint8* dst, a atUint32 yaz0Decode(const atUint8* src, atUint8*& dst, atUint32 uncompressedSize); atUint32 yaz0Encode(const atUint8* src, atUint32 srcSize, atUint8* data); -atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst); -atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst, bool extended = false); +atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst); +atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended = false); } } } diff --git a/include/LZ77/LZBase.hpp b/include/LZ77/LZBase.hpp index 67a403d..ad65935 100644 --- a/include/LZ77/LZBase.hpp +++ b/include/LZ77/LZBase.hpp @@ -10,8 +10,8 @@ public: explicit LZBase(atInt32 minimumOffset=1,atInt32 slidingWindow=4096, atInt32 minimumMatch=3, atInt32 blockSize=8); virtual ~LZBase() {} - virtual atUint32 compress(const atUint8* src, atUint8*& dest, atUint32 srcLength)=0; - virtual atUint32 decompress(const atUint8* src, atUint8*& dest, atUint32 srcLength)=0; + virtual atUint32 compress(const atUint8* src, atUint8** dest, atUint32 srcLength)=0; + virtual atUint32 decompress(const atUint8* src, atUint8** dest, atUint32 srcLength)=0; void setSlidingWindow(atInt32 SlidingWindow); atInt32 slidingWindow(); diff --git a/include/LZ77/LZType10.hpp b/include/LZ77/LZType10.hpp index ddba1a7..2707801 100644 --- a/include/LZ77/LZType10.hpp +++ b/include/LZ77/LZType10.hpp @@ -6,8 +6,8 @@ class LZType10 : public LZBase { public: explicit LZType10(atInt32 minimumOffset=1, atInt32 SlidingWindow=4096, atInt32 MinimumMatch=3, atInt32 BlockSize=8); - atUint32 compress(const atUint8* src, atUint8*& dest, atUint32 srcLength); - atUint32 decompress(const atUint8* src, atUint8*& dst, atUint32 srcLen); + atUint32 compress(const atUint8* src, atUint8** dest, atUint32 srcLength); + atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen); }; #endif // LZ77TYPE10_HPP diff --git a/include/LZ77/LZType11.hpp b/include/LZ77/LZType11.hpp index e63b38b..08d8c0a 100644 --- a/include/LZ77/LZType11.hpp +++ b/include/LZ77/LZType11.hpp @@ -7,8 +7,8 @@ class LZType11 : public LZBase { public: explicit LZType11(atInt32 MinimumOffset=1, atInt32 SlidingWindow=4096, atInt32 MinimumMatch=3, atInt32 BlockSize=8); - atUint32 compress(const atUint8 *src, atUint8*& dest, atUint32 srcLength); - atUint32 decompress(const atUint8 *src, atUint8*& dest, atUint32 srcLength); + atUint32 compress(const atUint8 *src, atUint8** dest, atUint32 srcLength); + atUint32 decompress(const atUint8 *src, atUint8** dest, atUint32 srcLength); }; diff --git a/src/Athena/Compression.cpp b/src/Athena/Compression.cpp index c14a6dc..3d9e92c 100644 --- a/src/Athena/Compression.cpp +++ b/src/Athena/Compression.cpp @@ -326,7 +326,7 @@ atUint32 simpleEnc(const atUint8* src, atInt32 size, atInt32 pos, atUint32 *pMat return numBytes; } -atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst) +atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst) { LZBase* lzCodec; if (*(atUint8*)src == 0x11) @@ -340,7 +340,7 @@ atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst) return retLength; } -atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst, bool extended) +atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended) { LZBase* lzCodec; if (extended) diff --git a/src/LZ77/LZType10.cpp b/src/LZ77/LZType10.cpp index 6fadb84..5845f49 100644 --- a/src/LZ77/LZType10.cpp +++ b/src/LZ77/LZType10.cpp @@ -11,7 +11,7 @@ LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 Minimum m_readAheadBuffer = m_minMatch + 0xF; } -atUint32 LZType10::compress(const atUint8* src, atUint8*& dstBuf, atUint32 srcLength) +atUint32 LZType10::compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength) { atUint32 encodeSize=(srcLength<<8)|(0x10); encodeSize = Athena::utility::LittleUint32(encodeSize); //File size needs to be written as little endian always @@ -65,12 +65,12 @@ atUint32 LZType10::compress(const atUint8* src, atUint8*& dstBuf, atUint32 srcLe while ((outbuf.position()%4) !=0 ) outbuf.writeByte(0); - dstBuf = outbuf.data(); + *dstBuf = outbuf.data(); outbuf.save(); return outbuf.length(); } -atUint32 LZType10::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLength) +atUint32 LZType10::decompress(const atUint8* src, atUint8** dst, atUint32 srcLength) { if (*(atUint8*)(src) != 0x10) return 0; @@ -128,7 +128,7 @@ atUint32 LZType10::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLen } } - dst = uncompressedData; + *dst = uncompressedData; return uncompressedSize; } diff --git a/src/LZ77/LZType11.cpp b/src/LZ77/LZType11.cpp index 9edd6db..bba5106 100644 --- a/src/LZ77/LZType11.cpp +++ b/src/LZ77/LZType11.cpp @@ -11,7 +11,7 @@ LZType11::LZType11(atInt32 minimumOffset, atInt32 slidingWindow, atInt32 minimum m_lookupTable.setLookAheadWindow(m_readAheadBuffer); } -atUint32 LZType11::compress(const atUint8* src, atUint8*& dst, atUint32 srcLength) +atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLength) { Athena::io::BinaryWriter outbuff("tmp"); if (srcLength>0xFFFFFF){// If length is greater than 24 bits or 16 Megs @@ -113,11 +113,11 @@ atUint32 LZType11::compress(const atUint8* src, atUint8*& dst, atUint32 srcLengt while((outbuff.position()%4) !=0 ) outbuff.writeByte(0); - dst = outbuff.data(); + *dst = outbuff.data(); return outbuff.length(); } -atUint32 LZType11::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLength) +atUint32 LZType11::decompress(const atUint8* src, atUint8** dst, atUint32 srcLength) { if(*(atUint8*)(src) != 0x11) return 0; @@ -207,7 +207,7 @@ atUint32 LZType11::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLen } } - dst = uncompressedData; + *dst = uncompressedData; return uncompressedLen; }