-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
+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
+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 @@
+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
+ CInMemoryStream *inStreamSpec = new CInMemoryStream(source, sourceLen);\r
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;\r
+ \r
-+ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen);\r
++ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest+4, (*destLen)-4);\r
+ CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;\r
-+ \r
++ \r
+ NCompress::NLZMA::CEncoder *encoderSpec = \r
+ new NCompress::NLZMA::CEncoder;\r
+ CMyComPtr<ICompressCoder> encoder = encoderSpec;\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[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(2);\r
-+ properties[5].ulVal = UInt32(128);\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
+ 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
+ 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, sourceLen);\r
++ CInMemoryStream *inStreamSpec = new CInMemoryStream(source+9, sourceLen-9);\r
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;\r
+ \r
+ COutMemoryStream *outStreamSpec = new COutMemoryStream(dest, *destLen);\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
++ //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
+ \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