From 3ae6364aacacc4b8bb8729b5bc55a1103aa0fadf Mon Sep 17 00:00:00 2001 From: Imre Kaloz Date: Thu, 23 Mar 2006 14:20:38 +0000 Subject: [PATCH] upgrade lzma sdk to 4.32 SVN-Revision: 3459 --- openwrt/target/lzma/Makefile | 16 +-- ...-406-zlib-stream.patch => lzma-zlib.patch} | 112 ++++++++++-------- 2 files changed, 69 insertions(+), 59 deletions(-) rename openwrt/target/lzma/{lzma-406-zlib-stream.patch => lzma-zlib.patch} (77%) diff --git a/openwrt/target/lzma/Makefile b/openwrt/target/lzma/Makefile index 6e846c31c9..0225844d30 100644 --- a/openwrt/target/lzma/Makefile +++ b/openwrt/target/lzma/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk LZMA_DIR=$(BUILD_DIR)/lzma -LZMA_SOURCE=lzma406.zip -LZMA_SITE=http://www.7-zip.org/dl -LZMA_MD5=a09378411cba5f786b5c49c9c58496df +LZMA_SOURCE=lzma432.tar.bz2 +LZMA_SITE=@SF/sevenzip +LZMA_MD5=155c1ebce5bc6710ae7ecc926226d9d7 -LZMA_LIB_DIR=$(LZMA_DIR)/SRC/7zip/Compress/LZMA_Lib -LZMA_ALONE_DIR=$(LZMA_DIR)/SRC/7zip/Compress/LZMA_Alone +LZMA_LIB_DIR=$(LZMA_DIR)/C/7zip/Compress/LZMA_Lib +LZMA_ALONE_DIR=$(LZMA_DIR)/C/7zip/Compress/LZMA_Alone TARGETS=$(LZMA_LIB_DIR)/liblzma.a $(LZMA_ALONE_DIR)/lzma @@ -21,14 +21,14 @@ $(DL_DIR)/$(LZMA_SOURCE): $(LZMA_DIR)/.unpacked: $(DL_DIR)/$(LZMA_SOURCE) @rm -rf $(LZMA_DIR) && mkdir -p $(LZMA_DIR) - unzip -q $^ -d $(LZMA_DIR) - patch -d $(LZMA_DIR) -p1 < lzma-406-zlib-stream.patch $(MAKE_TRACE) + tar xjf $^ -C $(LZMA_DIR) + patch -d $(LZMA_DIR) -p1 < lzma-zlib.patch $(MAKE_TRACE) touch $(LZMA_DIR)/.unpacked $(LZMA_ALONE_DIR)/lzma $(LZMA_LIB_DIR)/liblzma.a: $(LZMA_DIR)/.built $(LZMA_DIR)/.built: $(LZMA_DIR)/.unpacked $(MAKE) -C $(LZMA_LIB_DIR) $(MAKE_TRACE) - $(MAKE) -C $(LZMA_ALONE_DIR) $(MAKE_TRACE) + $(MAKE) -f makefile.gcc -C $(LZMA_ALONE_DIR) $(MAKE_TRACE) touch $@ lzma: $(TARGETS) diff --git a/openwrt/target/lzma/lzma-406-zlib-stream.patch b/openwrt/target/lzma/lzma-zlib.patch similarity index 77% rename from openwrt/target/lzma/lzma-406-zlib-stream.patch rename to openwrt/target/lzma/lzma-zlib.patch index 822655f45a..4ec57d3365 100644 --- a/openwrt/target/lzma/lzma-406-zlib-stream.patch +++ b/openwrt/target/lzma/lzma-zlib.patch @@ -1,42 +1,6 @@ -diff -BurN lzma406/SRC/7zip/Compress/LZMA/LZMADecoder.cpp lzma/SRC/7zip/Compress/LZMA/LZMADecoder.cpp ---- lzma406/SRC/7zip/Compress/LZMA/LZMADecoder.cpp 2004-08-25 01:40:48.000000000 +0400 -+++ lzma/SRC/7zip/Compress/LZMA/LZMADecoder.cpp 2005-01-20 14:47:45.789801629 +0300 -@@ -288,12 +288,17 @@ - Byte remainder = (Byte)(properties[0] / 9); - int lp = remainder % 5; - int pb = remainder / 5; -- if (pb > NLength::kNumPosStatesBitsMax) -- return E_INVALIDARG; -- _posStateMask = (1 << pb) - 1; - UInt32 dictionarySize = 0; - for (int i = 0; i < 4; i++) - dictionarySize += ((UInt32)(properties[1 + i])) << (i * 8); -+ return SetDecoderPropertiesRaw(lc, lp, pb, dictionarySize); -+} -+ -+STDMETHODIMP CDecoder::SetDecoderPropertiesRaw(int lc, int lp, int pb, UInt32 dictionarySize) -+{ -+ if (pb > NLength::kNumPosStatesBitsMax) -+ return E_INVALIDARG; -+ _posStateMask = (1 << pb) - 1; - _dictionarySizeCheck = MyMax(dictionarySize, UInt32(1)); - UInt32 blockSize = MyMax(_dictionarySizeCheck, UInt32(1 << 12)); - if (!_outWindowStream.Create(blockSize)) -diff -BurN lzma406/SRC/7zip/Compress/LZMA/LZMADecoder.h lzma/SRC/7zip/Compress/LZMA/LZMADecoder.h ---- lzma406/SRC/7zip/Compress/LZMA/LZMADecoder.h 2004-08-25 01:40:08.000000000 +0400 -+++ lzma/SRC/7zip/Compress/LZMA/LZMADecoder.h 2005-01-20 13:06:59.081297916 +0300 -@@ -234,6 +234,8 @@ - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize); - -+ STDMETHOD(SetDecoderPropertiesRaw)(int lc, int lp, int pb, UInt32 dictionarySize); -+ - virtual ~CDecoder() {} - }; - -diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/makefile lzma/SRC/7zip/Compress/LZMA_Lib/makefile ---- lzma406/SRC/7zip/Compress/LZMA_Lib/makefile 1970-01-01 03:00:00.000000000 +0300 -+++ lzma/SRC/7zip/Compress/LZMA_Lib/makefile 2005-01-19 13:49:20.000000000 +0300 +diff -Nur lzma432/C/7zip/Compress/LZMA_Lib/makefile lzma432-owrt/C/7zip/Compress/LZMA_Lib/makefile +--- lzma432/C/7zip/Compress/LZMA_Lib/makefile 1970-01-01 01:00:00.000000000 +0100 ++++ lzma432-owrt/C/7zip/Compress/LZMA_Lib/makefile 2006-03-22 14:23:38.000000000 +0100 @@ -0,0 +1,88 @@ +PROG = liblzma.a +CXX = g++ -O3 -Wall @@ -126,14 +90,15 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/makefile lzma/SRC/7zip/Compress/LZ +clean: + -$(RM) $(PROG) $(OBJS) + -diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp ---- lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp 1970-01-01 03:00:00.000000000 +0300 -+++ lzma/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp 2005-01-20 15:01:18.439221129 +0300 -@@ -0,0 +1,273 @@ +diff -Nur lzma432/C/7zip/Compress/LZMA_Lib/ZLib.cpp lzma432-owrt/C/7zip/Compress/LZMA_Lib/ZLib.cpp +--- lzma432/C/7zip/Compress/LZMA_Lib/ZLib.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ lzma432-owrt/C/7zip/Compress/LZMA_Lib/ZLib.cpp 2006-03-22 14:23:38.000000000 +0100 +@@ -0,0 +1,283 @@ +/* + * lzma zlib simplified wrapper + * + * Copyright (c) 2005 Oleg I. Vdovikin ++ * Modified for LZMA 4.27 SDK Craig.Peacock@beyondlogic.org + * + * This library is free software; you can redistribute + * it and/or modify it under the terms of the GNU Lesser @@ -319,9 +284,9 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZ + CInMemoryStream *inStreamSpec = new CInMemoryStream(source, sourceLen); + CMyComPtr inStream = inStreamSpec; + -+ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen); ++ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest+4, (*destLen)-4); + CMyComPtr outStream = outStreamSpec; -+ ++ + NCompress::NLZMA::CEncoder *encoderSpec = + new NCompress::NLZMA::CEncoder; + CMyComPtr encoder = encoderSpec; @@ -342,12 +307,12 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZ + PROPVARIANT properties[kNumProps]; + for (int p = 0; p < 6; p++) + properties[p].vt = VT_UI4; -+ properties[0].ulVal = UInt32(1 << (level + 14)); ++ properties[0].ulVal = UInt32(1 << 15); + properties[1].ulVal = UInt32(ZLIB_PB); + properties[2].ulVal = UInt32(ZLIB_LC); // for normal files + properties[3].ulVal = UInt32(ZLIB_LP); // for normal files -+ properties[4].ulVal = UInt32(2); -+ properties[5].ulVal = UInt32(128); ++ properties[4].ulVal = UInt32(0); ++ properties[5].ulVal = UInt32(0x28); + + properties[6].vt = VT_BSTR; + properties[6].bstrVal = (BSTR)(const wchar_t *)L"BT4"; @@ -358,6 +323,9 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZ + if (encoderSpec->SetCoderProperties(propIDs, properties, kNumProps) != S_OK) + return Z_MEM_ERROR; // should not happen + ++ if (encoderSpec->WriteCoderProperties(outStream) != S_OK) ++ return Z_MEM_ERROR; ++ + HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0); + if (result == E_OUTOFMEMORY) + { @@ -372,13 +340,16 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZ + outStreamSpec->Seek(0, STREAM_SEEK_END, &fileSize); + *destLen = fileSize; + ++ /* Copy size of uncompressed string into first four bytes */ ++ memcpy(dest, &sourceLen, 4); ++ + return Z_OK; +} + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)) +{ -+ CInMemoryStream *inStreamSpec = new CInMemoryStream(source, sourceLen); ++ CInMemoryStream *inStreamSpec = new CInMemoryStream(source+9, sourceLen-9); + CMyComPtr inStream = inStreamSpec; + + COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen); @@ -388,8 +359,11 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZ + new NCompress::NLZMA::CDecoder; + CMyComPtr decoder = decoderSpec; + -+ if (decoderSpec->SetDecoderPropertiesRaw(ZLIB_LC, -+ ZLIB_LP, ZLIB_PB, (1 << 23)) != S_OK) return Z_DATA_ERROR; ++ //if (decoderSpec->SetDecoderPropertiesRaw(ZLIB_LC, ++ // ZLIB_LP, ZLIB_PB, (1 << 23)) != S_OK) return Z_DATA_ERROR; ++ ++ if (decoderSpec->SetDecoderProperties2(source+4, 5) != S_OK) ++ return Z_DATA_ERROR; + + UInt64 fileSize = *destLen; + @@ -403,3 +377,39 @@ diff -BurN lzma406/SRC/7zip/Compress/LZMA_Lib/ZLib.cpp lzma/SRC/7zip/Compress/LZ + + return Z_OK; +} +diff -Nur lzma432/C/Common/CommandLineParser.h lzma432-owrt/C/Common/CommandLineParser.h +--- lzma432/C/Common/CommandLineParser.h 2005-03-07 17:03:46.000000000 +0100 ++++ lzma432-owrt/C/Common/CommandLineParser.h 2006-03-22 14:23:38.000000000 +0100 +@@ -3,7 +3,7 @@ + #ifndef __COMMON_COMMANDLINEPARSER_H + #define __COMMON_COMMANDLINEPARSER_H + +-#include "Common/String.h" ++#include "String.h" + + namespace NCommandLineParser { + +diff -Nur lzma432/C/Common/StringConvert.h lzma432-owrt/C/Common/StringConvert.h +--- lzma432/C/Common/StringConvert.h 2005-09-16 10:19:44.000000000 +0200 ++++ lzma432-owrt/C/Common/StringConvert.h 2006-03-22 14:23:38.000000000 +0100 +@@ -4,7 +4,7 @@ + #define __COMMON_STRINGCONVERT_H + + #include "MyWindows.h" +-#include "Common/String.h" ++#include "String.h" + #include "Types.h" + + UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP); +diff -Nur lzma432/C/Common/String.cpp lzma432-owrt/C/Common/String.cpp +--- lzma432/C/Common/String.cpp 2005-09-28 11:44:06.000000000 +0200 ++++ lzma432-owrt/C/Common/String.cpp 2006-03-22 14:23:38.000000000 +0100 +@@ -8,7 +8,7 @@ + #include + #endif + +-#include "Common/String.h" ++#include "String.h" + + + #ifdef _WIN32 -- 2.30.2