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
$(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)
+++ /dev/null
-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);\r
- int lp = remainder % 5;\r
- int pb = remainder / 5;\r
-- if (pb > NLength::kNumPosStatesBitsMax)\r
-- return E_INVALIDARG;\r
-- _posStateMask = (1 << pb) - 1;\r
- UInt32 dictionarySize = 0;\r
- for (int i = 0; i < 4; i++)\r
- dictionarySize += ((UInt32)(properties[1 + i])) << (i * 8);\r
-+ return SetDecoderPropertiesRaw(lc, lp, pb, dictionarySize);\r
-+}\r
-+\r
-+STDMETHODIMP CDecoder::SetDecoderPropertiesRaw(int lc, int lp, int pb, UInt32 dictionarySize)\r
-+{\r
-+ if (pb > NLength::kNumPosStatesBitsMax)\r
-+ return E_INVALIDARG;\r
-+ _posStateMask = (1 << pb) - 1;\r
- _dictionarySizeCheck = MyMax(dictionarySize, UInt32(1));\r
- UInt32 blockSize = MyMax(_dictionarySizeCheck, UInt32(1 << 12));\r
- if (!_outWindowStream.Create(blockSize))\r
-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);\r
- STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize);\r
- \r
-+ STDMETHOD(SetDecoderPropertiesRaw)(int lc, int lp, int pb, UInt32 dictionarySize);\r
-+\r
- virtual ~CDecoder() {}\r
- };\r
- \r
-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
-@@ -0,0 +1,88 @@
-+PROG = liblzma.a\r
-+CXX = g++ -O3 -Wall\r
-+AR = ar
-+RM = rm -f\r
-+CFLAGS = -c\r
-+\r
-+OBJS = \\r
-+ ZLib.o \\r
-+ LZMADecoder.o \\r
-+ LZMAEncoder.o \\r
-+ LZInWindow.o \\r
-+ LZOutWindow.o \\r
-+ RangeCoderBit.o \\r
-+ InBuffer.o \\r
-+ OutBuffer.o \\r
-+ FileStreams.o \\r
-+ Alloc.o \\r
-+ C_FileIO.o \\r
-+ CommandLineParser.o \\r
-+ CRC.o \\r
-+ String.o \\r
-+ StringConvert.o \\r
-+ StringToInt.o \\r
-+ Vector.o \\r
-+\r
-+\r
-+all: $(PROG)\r
-+\r
-+$(PROG): $(OBJS)\r
-+ $(AR) r $(PROG) $(OBJS)\r
-+\r
-+ZLib.o: ZLib.cpp\r
-+ $(CXX) $(CFLAGS) ZLib.cpp\r
-+\r
-+LZMADecoder.o: ../LZMA/LZMADecoder.cpp\r
-+ $(CXX) $(CFLAGS) ../LZMA/LZMADecoder.cpp\r
-+\r
-+LZMAEncoder.o: ../LZMA/LZMAEncoder.cpp\r
-+ $(CXX) $(CFLAGS) ../LZMA/LZMAEncoder.cpp\r
-+\r
-+LZInWindow.o: ../LZ/LZInWindow.cpp\r
-+ $(CXX) $(CFLAGS) ../LZ/LZInWindow.cpp\r
-+\r
-+LZOutWindow.o: ../LZ/LZOutWindow.cpp\r
-+ $(CXX) $(CFLAGS) ../LZ/LZOutWindow.cpp\r
-+\r
-+RangeCoderBit.o: ../RangeCoder/RangeCoderBit.cpp\r
-+ $(CXX) $(CFLAGS) ../RangeCoder/RangeCoderBit.cpp\r
-+\r
-+InBuffer.o: ../../Common/InBuffer.cpp\r
-+ $(CXX) $(CFLAGS) ../../Common/InBuffer.cpp\r
-+\r
-+OutBuffer.o: ../../Common/OutBuffer.cpp\r
-+ $(CXX) $(CFLAGS) ../../Common/OutBuffer.cpp\r
-+\r
-+FileStreams.o: ../../Common/FileStreams.cpp\r
-+ $(CXX) $(CFLAGS) ../../Common/FileStreams.cpp\r
-+\r
-+Alloc.o: ../../../Common/Alloc.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/Alloc.cpp\r
-+\r
-+C_FileIO.o: ../../../Common/C_FileIO.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/C_FileIO.cpp\r
-+\r
-+CommandLineParser.o: ../../../Common/CommandLineParser.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/CommandLineParser.cpp\r
-+\r
-+CRC.o: ../../../Common/CRC.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/CRC.cpp\r
-+\r
-+MyWindows.o: ../../../Common/MyWindows.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp\r
-+\r
-+String.o: ../../../Common/String.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/String.cpp\r
-+\r
-+StringConvert.o: ../../../Common/StringConvert.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp\r
-+\r
-+StringToInt.o: ../../../Common/StringToInt.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp\r
-+\r
-+Vector.o: ../../../Common/Vector.cpp\r
-+ $(CXX) $(CFLAGS) ../../../Common/Vector.cpp\r
-+\r
-+clean:\r
-+ -$(RM) $(PROG) $(OBJS)\r
-+\r
-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 @@
-+/*\r
-+ * lzma zlib simplified wrapper\r
-+ *\r
-+ * Copyright (c) 2005 Oleg I. Vdovikin <oleg@cs.msu.su>\r
-+ *\r
-+ * This library is free software; you can redistribute \r
-+ * it and/or modify it under the terms of the GNU Lesser \r
-+ * General Public License as published by the Free Software \r
-+ * Foundation; either version 2.1 of the License, or \r
-+ * (at your option) any later version.\r
-+ *\r
-+ * This library is distributed in the hope that it will be \r
-+ * useful, but WITHOUT ANY WARRANTY; without even the implied \r
-+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
-+ * PURPOSE. See the GNU Lesser General Public License \r
-+ * for more details.\r
-+ *\r
-+ * You should have received a copy of the GNU Lesser General \r
-+ * Public License along with this library; if not, write to \r
-+ * the Free Software Foundation, Inc., 59 Temple Place, \r
-+ * Suite 330, Boston, MA 02111-1307 USA \r
-+ */\r
-+\r
-+/*\r
-+ * default values for encoder/decoder used by wrapper\r
-+ */\r
-+\r
-+#include <zlib.h>\r
-+\r
-+#define ZLIB_LC 3\r
-+#define ZLIB_LP 0\r
-+#define ZLIB_PB 2\r
-+\r
-+#ifdef WIN32\r
-+#include <initguid.h>\r
-+#else\r
-+#define INITGUID\r
-+#endif\r
-+\r
-+#include "../../../Common/MyWindows.h"\r
-+#include "../LZMA/LZMADecoder.h"\r
-+#include "../LZMA/LZMAEncoder.h"\r
-+\r
-+#define STG_E_SEEKERROR ((HRESULT)0x80030019L)\r
-+#define STG_E_MEDIUMFULL ((HRESULT)0x80030070L)\r
-+\r
-+class CInMemoryStream: \r
-+ public IInStream,\r
-+ public IStreamGetSize,\r
-+ public CMyUnknownImp\r
-+{\r
-+public:\r
-+ CInMemoryStream(const Bytef *data, UInt64 size) : \r
-+ m_data(data), m_size(size), m_offset(0) {}\r
-+\r
-+ virtual ~CInMemoryStream() {}\r
-+\r
-+ MY_UNKNOWN_IMP2(IInStream, IStreamGetSize)\r
-+\r
-+ STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize)\r
-+ {\r
-+ if (size > m_size - m_offset) \r
-+ size = m_size - m_offset;\r
-+\r
-+ if (size) {\r
-+ memcpy(data, m_data + m_offset, size);\r
-+ }\r
-+\r
-+ m_offset += size;\r
-+\r
-+ if (processedSize) \r
-+ *processedSize = size;\r
-+\r
-+ return S_OK;\r
-+ }\r
-+\r
-+ STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize)\r
-+ {\r
-+ return Read(data, size, processedSize);\r
-+ }\r
-+\r
-+ STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)\r
-+ {\r
-+ UInt64 _offset;\r
-+\r
-+ if (seekOrigin == STREAM_SEEK_SET) _offset = offset;\r
-+ else if (seekOrigin == STREAM_SEEK_CUR) _offset = m_offset + offset; \r
-+ else if (seekOrigin == STREAM_SEEK_END) _offset = m_size;\r
-+ else return STG_E_INVALIDFUNCTION;\r
-+\r
-+ if (_offset < 0 || _offset > m_size)\r
-+ return STG_E_SEEKERROR;\r
-+\r
-+ m_offset = _offset;\r
-+\r
-+ if (newPosition)\r
-+ *newPosition = m_offset;\r
-+\r
-+ return S_OK;\r
-+ }\r
-+\r
-+ STDMETHOD(GetSize)(UInt64 *size)\r
-+ {\r
-+ *size = m_size;\r
-+ return S_OK;\r
-+ }\r
-+protected:\r
-+ const Bytef *m_data;\r
-+ UInt64 m_size;\r
-+ UInt64 m_offset;\r
-+};\r
-+\r
-+class COutMemoryStream: \r
-+ public IOutStream,\r
-+ public CMyUnknownImp\r
-+{\r
-+public:\r
-+ COutMemoryStream(Bytef *data, UInt64 maxsize) : \r
-+ m_data(data), m_size(0), m_maxsize(maxsize), m_offset(0) {}\r
-+ virtual ~COutMemoryStream() {}\r
-+ \r
-+ MY_UNKNOWN_IMP1(IOutStream)\r
-+\r
-+ STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize)\r
-+ {\r
-+ if (size > m_maxsize - m_offset) \r
-+ size = m_maxsize - m_offset;\r
-+\r
-+ if (size) {\r
-+ memcpy(m_data + m_offset, data, size);\r
-+ }\r
-+\r
-+ m_offset += size;\r
-+\r
-+ if (m_offset > m_size)\r
-+ m_size = m_offset;\r
-+\r
-+ if (processedSize) \r
-+ *processedSize = size;\r
-+\r
-+ return S_OK;\r
-+ }\r
-+ \r
-+ STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize)\r
-+ {\r
-+ return Write(data, size, processedSize);\r
-+ }\r
-+\r
-+ STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)\r
-+ {\r
-+ UInt64 _offset;\r
-+\r
-+ if (seekOrigin == STREAM_SEEK_SET) _offset = offset;\r
-+ else if (seekOrigin == STREAM_SEEK_CUR) _offset = m_offset + offset; \r
-+ else if (seekOrigin == STREAM_SEEK_END) _offset = m_size;\r
-+ else return STG_E_INVALIDFUNCTION;\r
-+\r
-+ if (_offset < 0 || _offset > m_maxsize)\r
-+ return STG_E_SEEKERROR;\r
-+\r
-+ m_offset = _offset;\r
-+\r
-+ if (newPosition)\r
-+ *newPosition = m_offset;\r
-+\r
-+ return S_OK;\r
-+ }\r
-+ \r
-+ STDMETHOD(SetSize)(Int64 newSize)\r
-+ {\r
-+ if ((UInt64)newSize > m_maxsize) \r
-+ return STG_E_MEDIUMFULL;\r
-+\r
-+ return S_OK;\r
-+ }\r
-+protected:\r
-+ Bytef *m_data;\r
-+ UInt64 m_size;\r
-+ UInt64 m_maxsize;\r
-+ UInt64 m_offset;\r
-+};\r
-+\r
-+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,\r
-+ const Bytef *source, uLong sourceLen,\r
-+ int level))\r
-+{\r
-+ CInMemoryStream *inStreamSpec = new CInMemoryStream(source, sourceLen);\r
-+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;\r
-+ \r
-+ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen);\r
-+ CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;\r
-+ \r
-+ NCompress::NLZMA::CEncoder *encoderSpec = \r
-+ new NCompress::NLZMA::CEncoder;\r
-+ CMyComPtr<ICompressCoder> encoder = encoderSpec;\r
-+ \r
-+ PROPID propIDs[] = \r
-+ {\r
-+ NCoderPropID::kDictionarySize,\r
-+ NCoderPropID::kPosStateBits,\r
-+ NCoderPropID::kLitContextBits,\r
-+ NCoderPropID::kLitPosBits,\r
-+ NCoderPropID::kAlgorithm,\r
-+ NCoderPropID::kNumFastBytes,\r
-+ NCoderPropID::kMatchFinder,\r
-+ NCoderPropID::kEndMarker\r
-+ };\r
-+ const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);\r
-+ \r
-+ PROPVARIANT properties[kNumProps];\r
-+ for (int p = 0; p < 6; p++)\r
-+ properties[p].vt = VT_UI4;\r
-+ properties[0].ulVal = UInt32(1 << (level + 14));\r
-+ properties[1].ulVal = UInt32(ZLIB_PB);\r
-+ properties[2].ulVal = UInt32(ZLIB_LC); // for normal files\r
-+ properties[3].ulVal = UInt32(ZLIB_LP); // for normal files\r
-+ properties[4].ulVal = UInt32(2);\r
-+ properties[5].ulVal = UInt32(128);\r
-+ \r
-+ properties[6].vt = VT_BSTR;\r
-+ properties[6].bstrVal = (BSTR)(const wchar_t *)L"BT4";\r
-+ \r
-+ properties[7].vt = VT_BOOL;\r
-+ properties[7].boolVal = VARIANT_TRUE;\r
-+ \r
-+ if (encoderSpec->SetCoderProperties(propIDs, properties, kNumProps) != S_OK)\r
-+ return Z_MEM_ERROR; // should not happen\r
-+ \r
-+ HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0);\r
-+ if (result == E_OUTOFMEMORY)\r
-+ {\r
-+ return Z_MEM_ERROR;\r
-+ } \r
-+ else if (result != S_OK)\r
-+ {\r
-+ return Z_BUF_ERROR; // should not happen\r
-+ } \r
-+ \r
-+ UInt64 fileSize;\r
-+ outStreamSpec->Seek(0, STREAM_SEEK_END, &fileSize);\r
-+ *destLen = fileSize;\r
-+ \r
-+ return Z_OK;\r
-+}\r
-+\r
-+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,\r
-+ const Bytef *source, uLong sourceLen))\r
-+{\r
-+ CInMemoryStream *inStreamSpec = new CInMemoryStream(source, sourceLen);\r
-+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;\r
-+ \r
-+ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen);\r
-+ CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;\r
-+ \r
-+ NCompress::NLZMA::CDecoder *decoderSpec = \r
-+ new NCompress::NLZMA::CDecoder;\r
-+ CMyComPtr<ICompressCoder> decoder = decoderSpec;\r
-+ \r
-+ if (decoderSpec->SetDecoderPropertiesRaw(ZLIB_LC, \r
-+ ZLIB_LP, ZLIB_PB, (1 << 23)) != S_OK) return Z_DATA_ERROR;\r
-+ \r
-+ UInt64 fileSize = *destLen;\r
-+ \r
-+ if (decoder->Code(inStream, outStream, 0, &fileSize, 0) != S_OK)\r
-+ {\r
-+ return Z_DATA_ERROR;\r
-+ }\r
-+ \r
-+ outStreamSpec->Seek(0, STREAM_SEEK_END, &fileSize);\r
-+ *destLen = fileSize;\r
-+ \r
-+ return Z_OK;\r
-+}\r
--- /dev/null
+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\r
++CXX = g++ -O3 -Wall\r
++AR = ar
++RM = rm -f\r
++CFLAGS = -c\r
++\r
++OBJS = \\r
++ ZLib.o \\r
++ LZMADecoder.o \\r
++ LZMAEncoder.o \\r
++ LZInWindow.o \\r
++ LZOutWindow.o \\r
++ RangeCoderBit.o \\r
++ InBuffer.o \\r
++ OutBuffer.o \\r
++ FileStreams.o \\r
++ Alloc.o \\r
++ C_FileIO.o \\r
++ CommandLineParser.o \\r
++ CRC.o \\r
++ String.o \\r
++ StringConvert.o \\r
++ StringToInt.o \\r
++ Vector.o \\r
++\r
++\r
++all: $(PROG)\r
++\r
++$(PROG): $(OBJS)\r
++ $(AR) r $(PROG) $(OBJS)\r
++\r
++ZLib.o: ZLib.cpp\r
++ $(CXX) $(CFLAGS) ZLib.cpp\r
++\r
++LZMADecoder.o: ../LZMA/LZMADecoder.cpp\r
++ $(CXX) $(CFLAGS) ../LZMA/LZMADecoder.cpp\r
++\r
++LZMAEncoder.o: ../LZMA/LZMAEncoder.cpp\r
++ $(CXX) $(CFLAGS) ../LZMA/LZMAEncoder.cpp\r
++\r
++LZInWindow.o: ../LZ/LZInWindow.cpp\r
++ $(CXX) $(CFLAGS) ../LZ/LZInWindow.cpp\r
++\r
++LZOutWindow.o: ../LZ/LZOutWindow.cpp\r
++ $(CXX) $(CFLAGS) ../LZ/LZOutWindow.cpp\r
++\r
++RangeCoderBit.o: ../RangeCoder/RangeCoderBit.cpp\r
++ $(CXX) $(CFLAGS) ../RangeCoder/RangeCoderBit.cpp\r
++\r
++InBuffer.o: ../../Common/InBuffer.cpp\r
++ $(CXX) $(CFLAGS) ../../Common/InBuffer.cpp\r
++\r
++OutBuffer.o: ../../Common/OutBuffer.cpp\r
++ $(CXX) $(CFLAGS) ../../Common/OutBuffer.cpp\r
++\r
++FileStreams.o: ../../Common/FileStreams.cpp\r
++ $(CXX) $(CFLAGS) ../../Common/FileStreams.cpp\r
++\r
++Alloc.o: ../../../Common/Alloc.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/Alloc.cpp\r
++\r
++C_FileIO.o: ../../../Common/C_FileIO.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/C_FileIO.cpp\r
++\r
++CommandLineParser.o: ../../../Common/CommandLineParser.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/CommandLineParser.cpp\r
++\r
++CRC.o: ../../../Common/CRC.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/CRC.cpp\r
++\r
++MyWindows.o: ../../../Common/MyWindows.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp\r
++\r
++String.o: ../../../Common/String.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/String.cpp\r
++\r
++StringConvert.o: ../../../Common/StringConvert.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp\r
++\r
++StringToInt.o: ../../../Common/StringToInt.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp\r
++\r
++Vector.o: ../../../Common/Vector.cpp\r
++ $(CXX) $(CFLAGS) ../../../Common/Vector.cpp\r
++\r
++clean:\r
++ -$(RM) $(PROG) $(OBJS)\r
++\r
+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 @@
++/*\r
++ * lzma zlib simplified wrapper\r
++ *\r
++ * Copyright (c) 2005 Oleg I. Vdovikin <oleg@cs.msu.su>\r
++ * Modified for LZMA 4.27 SDK Craig.Peacock@beyondlogic.org\r
++ *\r
++ * This library is free software; you can redistribute \r
++ * it and/or modify it under the terms of the GNU Lesser \r
++ * General Public License as published by the Free Software \r
++ * Foundation; either version 2.1 of the License, or \r
++ * (at your option) any later version.\r
++ *\r
++ * This library is distributed in the hope that it will be \r
++ * useful, but WITHOUT ANY WARRANTY; without even the implied \r
++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
++ * PURPOSE. See the GNU Lesser General Public License \r
++ * for more details.\r
++ *\r
++ * You should have received a copy of the GNU Lesser General \r
++ * Public License along with this library; if not, write to \r
++ * the Free Software Foundation, Inc., 59 Temple Place, \r
++ * Suite 330, Boston, MA 02111-1307 USA \r
++ */\r
++\r
++/*\r
++ * default values for encoder/decoder used by wrapper\r
++ */\r
++\r
++#include <zlib.h>\r
++\r
++#define ZLIB_LC 3\r
++#define ZLIB_LP 0\r
++#define ZLIB_PB 2\r
++\r
++#ifdef WIN32\r
++#include <initguid.h>\r
++#else\r
++#define INITGUID\r
++#endif\r
++\r
++#include "../../../Common/MyWindows.h"\r
++#include "../LZMA/LZMADecoder.h"\r
++#include "../LZMA/LZMAEncoder.h"\r
++\r
++#define STG_E_SEEKERROR ((HRESULT)0x80030019L)\r
++#define STG_E_MEDIUMFULL ((HRESULT)0x80030070L)\r
++\r
++class CInMemoryStream: \r
++ public IInStream,\r
++ public IStreamGetSize,\r
++ public CMyUnknownImp\r
++{\r
++public:\r
++ CInMemoryStream(const Bytef *data, UInt64 size) : \r
++ m_data(data), m_size(size), m_offset(0) {}\r
++\r
++ virtual ~CInMemoryStream() {}\r
++\r
++ MY_UNKNOWN_IMP2(IInStream, IStreamGetSize)\r
++\r
++ STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize)\r
++ {\r
++ if (size > m_size - m_offset) \r
++ size = m_size - m_offset;\r
++\r
++ if (size) {\r
++ memcpy(data, m_data + m_offset, size);\r
++ }\r
++\r
++ m_offset += size;\r
++\r
++ if (processedSize) \r
++ *processedSize = size;\r
++\r
++ return S_OK;\r
++ }\r
++\r
++ STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize)\r
++ {\r
++ return Read(data, size, processedSize);\r
++ }\r
++\r
++ STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)\r
++ {\r
++ UInt64 _offset;\r
++\r
++ if (seekOrigin == STREAM_SEEK_SET) _offset = offset;\r
++ else if (seekOrigin == STREAM_SEEK_CUR) _offset = m_offset + offset; \r
++ else if (seekOrigin == STREAM_SEEK_END) _offset = m_size;\r
++ else return STG_E_INVALIDFUNCTION;\r
++\r
++ if (_offset < 0 || _offset > m_size)\r
++ return STG_E_SEEKERROR;\r
++\r
++ m_offset = _offset;\r
++\r
++ if (newPosition)\r
++ *newPosition = m_offset;\r
++\r
++ return S_OK;\r
++ }\r
++\r
++ STDMETHOD(GetSize)(UInt64 *size)\r
++ {\r
++ *size = m_size;\r
++ return S_OK;\r
++ }\r
++protected:\r
++ const Bytef *m_data;\r
++ UInt64 m_size;\r
++ UInt64 m_offset;\r
++};\r
++\r
++class COutMemoryStream: \r
++ public IOutStream,\r
++ public CMyUnknownImp\r
++{\r
++public:\r
++ COutMemoryStream(Bytef *data, UInt64 maxsize) : \r
++ m_data(data), m_size(0), m_maxsize(maxsize), m_offset(0) {}\r
++ virtual ~COutMemoryStream() {}\r
++ \r
++ MY_UNKNOWN_IMP1(IOutStream)\r
++\r
++ STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize)\r
++ {\r
++ if (size > m_maxsize - m_offset) \r
++ size = m_maxsize - m_offset;\r
++\r
++ if (size) {\r
++ memcpy(m_data + m_offset, data, size);\r
++ }\r
++\r
++ m_offset += size;\r
++\r
++ if (m_offset > m_size)\r
++ m_size = m_offset;\r
++\r
++ if (processedSize) \r
++ *processedSize = size;\r
++\r
++ return S_OK;\r
++ }\r
++ \r
++ STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize)\r
++ {\r
++ return Write(data, size, processedSize);\r
++ }\r
++\r
++ STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)\r
++ {\r
++ UInt64 _offset;\r
++\r
++ if (seekOrigin == STREAM_SEEK_SET) _offset = offset;\r
++ else if (seekOrigin == STREAM_SEEK_CUR) _offset = m_offset + offset; \r
++ else if (seekOrigin == STREAM_SEEK_END) _offset = m_size;\r
++ else return STG_E_INVALIDFUNCTION;\r
++\r
++ if (_offset < 0 || _offset > m_maxsize)\r
++ return STG_E_SEEKERROR;\r
++\r
++ m_offset = _offset;\r
++\r
++ if (newPosition)\r
++ *newPosition = m_offset;\r
++\r
++ return S_OK;\r
++ }\r
++ \r
++ STDMETHOD(SetSize)(Int64 newSize)\r
++ {\r
++ if ((UInt64)newSize > m_maxsize) \r
++ return STG_E_MEDIUMFULL;\r
++\r
++ return S_OK;\r
++ }\r
++protected:\r
++ Bytef *m_data;\r
++ UInt64 m_size;\r
++ UInt64 m_maxsize;\r
++ UInt64 m_offset;\r
++};\r
++\r
++ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,\r
++ const Bytef *source, uLong sourceLen,\r
++ int level))\r
++{\r
++ CInMemoryStream *inStreamSpec = new CInMemoryStream(source, sourceLen);\r
++ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;\r
++ \r
++ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest+4, (*destLen)-4);\r
++ CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;\r
++ \r
++ NCompress::NLZMA::CEncoder *encoderSpec = \r
++ new NCompress::NLZMA::CEncoder;\r
++ CMyComPtr<ICompressCoder> encoder = encoderSpec;\r
++ \r
++ PROPID propIDs[] = \r
++ {\r
++ NCoderPropID::kDictionarySize,\r
++ NCoderPropID::kPosStateBits,\r
++ NCoderPropID::kLitContextBits,\r
++ NCoderPropID::kLitPosBits,\r
++ NCoderPropID::kAlgorithm,\r
++ NCoderPropID::kNumFastBytes,\r
++ NCoderPropID::kMatchFinder,\r
++ NCoderPropID::kEndMarker\r
++ };\r
++ const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);\r
++ \r
++ PROPVARIANT properties[kNumProps];\r
++ for (int p = 0; p < 6; p++)\r
++ properties[p].vt = VT_UI4;\r
++ properties[0].ulVal = UInt32(1 << 15);\r
++ properties[1].ulVal = UInt32(ZLIB_PB);\r
++ properties[2].ulVal = UInt32(ZLIB_LC); // for normal files\r
++ properties[3].ulVal = UInt32(ZLIB_LP); // for normal files\r
++ properties[4].ulVal = UInt32(0);\r
++ properties[5].ulVal = UInt32(0x28);\r
++ \r
++ properties[6].vt = VT_BSTR;\r
++ properties[6].bstrVal = (BSTR)(const wchar_t *)L"BT4";\r
++ \r
++ properties[7].vt = VT_BOOL;\r
++ properties[7].boolVal = VARIANT_TRUE;\r
++ \r
++ if (encoderSpec->SetCoderProperties(propIDs, properties, kNumProps) != S_OK)\r
++ return Z_MEM_ERROR; // should not happen\r
++ \r
++ if (encoderSpec->WriteCoderProperties(outStream) != S_OK)\r
++ return Z_MEM_ERROR;\r
++ \r
++ HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0);\r
++ if (result == E_OUTOFMEMORY)\r
++ {\r
++ return Z_MEM_ERROR;\r
++ } \r
++ else if (result != S_OK)\r
++ {\r
++ return Z_BUF_ERROR; // should not happen\r
++ } \r
++ \r
++ UInt64 fileSize;\r
++ outStreamSpec->Seek(0, STREAM_SEEK_END, &fileSize);\r
++ *destLen = fileSize;\r
++ \r
++ /* Copy size of uncompressed string into first four bytes */\r
++ memcpy(dest, &sourceLen, 4);\r
++ \r
++ return Z_OK;\r
++}\r
++\r
++ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,\r
++ const Bytef *source, uLong sourceLen))\r
++{\r
++ CInMemoryStream *inStreamSpec = new CInMemoryStream(source+9, sourceLen-9);\r
++ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;\r
++ \r
++ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen);\r
++ CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;\r
++ \r
++ NCompress::NLZMA::CDecoder *decoderSpec = \r
++ new NCompress::NLZMA::CDecoder;\r
++ CMyComPtr<ICompressCoder> decoder = decoderSpec;\r
++ \r
++ //if (decoderSpec->SetDecoderPropertiesRaw(ZLIB_LC, \r
++ // ZLIB_LP, ZLIB_PB, (1 << 23)) != S_OK) return Z_DATA_ERROR;\r
++ \r
++ if (decoderSpec->SetDecoderProperties2(source+4, 5) != S_OK) \r
++ return Z_DATA_ERROR;\r
++ \r
++ UInt64 fileSize = *destLen;\r
++ \r
++ if (decoder->Code(inStream, outStream, 0, &fileSize, 0) != S_OK)\r
++ {\r
++ return Z_DATA_ERROR;\r
++ }\r
++ \r
++ outStreamSpec->Seek(0, STREAM_SEEK_END, &fileSize);\r
++ *destLen = fileSize;\r
++ \r
++ return Z_OK;\r
++}\r
+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\r
+ #define __COMMON_COMMANDLINEPARSER_H\r
+ \r
+-#include "Common/String.h"\r
++#include "String.h"\r
+ \r
+ namespace NCommandLineParser {\r
+ \r
+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\r
+ \r
+ #include "MyWindows.h"\r
+-#include "Common/String.h"\r
++#include "String.h"\r
+ #include "Types.h"\r
+ \r
+ UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP);\r
+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 <ctype.h>\r
+ #endif\r
+ \r
+-#include "Common/String.h"\r
++#include "String.h"\r
+ \r
+ \r
+ #ifdef _WIN32\r