diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-04-17 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:50 +0300 |
commit | a145bfc7cf17f7bbcfae8f0064333c8ea75b455c (patch) | |
tree | 4ea458c9f35956fe080562989a702ea8c9af4b90 /CPP/7zip/Compress/Deflate | |
parent | d9666cf046a8453b33b3e2fbf4d82295a9f87df3 (diff) |
4.45 beta
Diffstat (limited to 'CPP/7zip/Compress/Deflate')
-rwxr-xr-x | CPP/7zip/Compress/Deflate/Deflate.dsp | 43 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/Deflate64Register.cpp | 19 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/DeflateDecoder.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/DeflateDecoder.h | 6 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/DeflateEncoder.cpp | 5 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp | 13 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/DeflateRegister.cpp | 19 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/DllExports.cpp | 157 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Deflate/makefile | 22 |
9 files changed, 96 insertions, 190 deletions
diff --git a/CPP/7zip/Compress/Deflate/Deflate.dsp b/CPP/7zip/Compress/Deflate/Deflate.dsp index a1baccad..11854458 100755 --- a/CPP/7zip/Compress/Deflate/Deflate.dsp +++ b/CPP/7zip/Compress/Deflate/Deflate.dsp @@ -97,7 +97,11 @@ SOURCE=..\Codec.def # End Source File # Begin Source File -SOURCE=.\DllExports.cpp +SOURCE=..\CodecExports.cpp +# End Source File +# Begin Source File + +SOURCE=..\DllExports.cpp # End Source File # Begin Source File @@ -166,22 +170,6 @@ SOURCE=..\..\Common\OutBuffer.h # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - SOURCE=..\..\..\Common\NewHandler.cpp # End Source File # Begin Source File @@ -230,6 +218,15 @@ SOURCE=..\..\..\..\C\7zCrc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\Alloc.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\Alloc.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h # End Source File # Begin Source File @@ -299,6 +296,10 @@ SOURCE=..\..\..\..\C\Sort.h # End Group # Begin Source File +SOURCE=.\Deflate64Register.cpp +# End Source File +# Begin Source File + SOURCE=.\DeflateConst.h # End Source File # Begin Source File @@ -337,5 +338,13 @@ SOURCE=.\DeflateEncoder.cpp SOURCE=.\DeflateEncoder.h # End Source File +# Begin Source File + +SOURCE=.\DeflateNsisRegister.cpp +# End Source File +# Begin Source File + +SOURCE=.\DeflateRegister.cpp +# End Source File # End Target # End Project diff --git a/CPP/7zip/Compress/Deflate/Deflate64Register.cpp b/CPP/7zip/Compress/Deflate/Deflate64Register.cpp new file mode 100755 index 00000000..554e0153 --- /dev/null +++ b/CPP/7zip/Compress/Deflate/Deflate64Register.cpp @@ -0,0 +1,19 @@ +// Deflate64Register.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterCodec.h" + +#include "DeflateDecoder.h" +static void *CreateCodecDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder64); } +#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY) +#include "DeflateEncoder.h" +static void *CreateCodecOutDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder64); } +#else +#define CreateCodecOutDeflate64 0 +#endif + +static CCodecInfo g_CodecInfo = + { CreateCodecDeflate64, CreateCodecOutDeflate64, 0x040109, L"Deflate64", 1, false }; + +REGISTER_CODEC(Deflate64) diff --git a/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp b/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp index 0de5534b..7569df38 100755 --- a/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp +++ b/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp @@ -318,7 +318,7 @@ STDMETHODIMP CCoder::SetOutStreamSize(const UInt64 * /* outSize */) return S_OK; } -#ifdef _ST_MODE +#ifndef NO_READ_FROM_CODER STDMETHODIMP CCoder::Read(void *data, UInt32 size, UInt32 *processedSize) { diff --git a/CPP/7zip/Compress/Deflate/DeflateDecoder.h b/CPP/7zip/Compress/Deflate/DeflateDecoder.h index 99928b72..eebe52f0 100755 --- a/CPP/7zip/Compress/Deflate/DeflateDecoder.h +++ b/CPP/7zip/Compress/Deflate/DeflateDecoder.h @@ -20,7 +20,7 @@ namespace NDecoder { class CCoder: public ICompressCoder, public ICompressGetInStreamProcessedSize, - #ifdef _ST_MODE + #ifndef NO_READ_FROM_CODER public ICompressSetInStream, public ICompressSetOutStreamSize, public ISequentialInStream, @@ -83,7 +83,7 @@ public: ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); - #ifdef _ST_MODE + #ifndef NO_READ_FROM_CODER MY_UNKNOWN_IMP4( ICompressGetInStreamProcessedSize, ICompressSetInStream, @@ -103,7 +103,7 @@ public: STDMETHOD(ReleaseInStream)(); STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); - #ifdef _ST_MODE + #ifndef NO_READ_FROM_CODER STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); #endif diff --git a/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp b/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp index 4e9ffe6d..a574fa3c 100755 --- a/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp +++ b/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp @@ -6,7 +6,10 @@ #include "Windows/Defs.h" #include "Common/ComTry.h" -#include "../../../Common/Alloc.h" +extern "C" +{ +#include "../../../../C/Alloc.h" +} // #include "../LZ/BinTree/BinTree3Z.h" #if _MSC_VER >= 1300 diff --git a/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp b/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp new file mode 100755 index 00000000..db181021 --- /dev/null +++ b/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp @@ -0,0 +1,13 @@ +// DeflateNsisRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterCodec.h" + +#include "DeflateDecoder.h" +static void *CreateCodecDeflateNsis() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CNsisCOMCoder); } + +static CCodecInfo g_CodecInfo = + { CreateCodecDeflateNsis, 0, 0x040901, L"DeflateNSIS", 1, false }; + +REGISTER_CODEC(DeflateNsis) diff --git a/CPP/7zip/Compress/Deflate/DeflateRegister.cpp b/CPP/7zip/Compress/Deflate/DeflateRegister.cpp new file mode 100755 index 00000000..ab3789fd --- /dev/null +++ b/CPP/7zip/Compress/Deflate/DeflateRegister.cpp @@ -0,0 +1,19 @@ +// DeflateRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterCodec.h" + +#include "DeflateDecoder.h" +static void *CreateCodecDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder); } +#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY) +#include "DeflateEncoder.h" +static void *CreateCodecOutDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder); } +#else +#define CreateCodecOutDeflate 0 +#endif + +static CCodecInfo g_CodecInfo = + { CreateCodecDeflate, CreateCodecOutDeflate, 0x040108, L"Deflate", 1, false }; + +REGISTER_CODEC(Deflate) diff --git a/CPP/7zip/Compress/Deflate/DllExports.cpp b/CPP/7zip/Compress/Deflate/DllExports.cpp deleted file mode 100755 index a0b23562..00000000 --- a/CPP/7zip/Compress/Deflate/DllExports.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" - -#include "DeflateEncoder.h" -#include "DeflateDecoder.h" - -#ifdef CRC_GENERATE_TABLE -extern "C" -{ - #include "../../../../C/7zCrc.h" -} -#endif - -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-090000000000} -DEFINE_GUID(CLSID_CCompressDeflate64Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-090000000100} -DEFINE_GUID(CLSID_CCompressDeflate64Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00); - - -// {23170F69-40C1-278B-0409-010000000000} -DEFINE_GUID(CLSID_CCompressDeflateNsisDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - #ifdef CRC_GENERATE_TABLE - CrcGenerateTable(); - #endif - } - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr<ICompressCoder> coder; - if (*clsid == CLSID_CCompressDeflateDecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder(); - } - else if (*clsid == CLSID_CCompressDeflateNsisDecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CNsisCOMCoder(); - } - else if (*clsid == CLSID_CCompressDeflateEncoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NEncoder::CCOMCoder(); - } - else if (*clsid == CLSID_CCompressDeflate64Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder64(); - } - else if (*clsid == CLSID_CCompressDeflate64Encoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NEncoder::CCOMCoder64(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -struct CDeflateMethodItem -{ - char ID[3]; - const wchar_t *UserName; - const GUID *Decoder; - const GUID *Encoder; -}; - -#define METHOD_ITEM(Name, id, UserName) \ - { { 0x04, 0x01, id }, UserName, \ - &CLSID_CCompress ## Name ## Decoder, \ - &CLSID_CCompress ## Name ## Encoder } - -#define METHOD_ITEM_DE(Name, id1, id2, UserName) \ - { { 0x04, id1, id2 }, UserName, \ - &CLSID_CCompress ## Name ## Decoder, NULL } - - -static CDeflateMethodItem g_Methods[] = -{ - METHOD_ITEM(Deflate, 0x08, L"Deflate"), - METHOD_ITEM(Deflate64, 0x09, L"Deflate64"), - METHOD_ITEM_DE(DeflateNsis, 0x09, 0x01, L"DeflateNSIS") -}; - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = sizeof(g_Methods) / sizeof(g_Methods[0]); - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index > sizeof(g_Methods) / sizeof(g_Methods[0])) - return E_INVALIDARG; - VariantClear((tagVARIANT *)value); - const CDeflateMethodItem &method = g_Methods[index]; - switch(propID) - { - case NMethodPropID::kID: - if ((value->bstrVal = ::SysAllocStringByteLen(method.ID, - sizeof(method.ID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if (method.Encoder) - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Encoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - } - return S_OK; - } - return S_OK; -} diff --git a/CPP/7zip/Compress/Deflate/makefile b/CPP/7zip/Compress/Deflate/makefile index c533d7cc..302d2888 100755 --- a/CPP/7zip/Compress/Deflate/makefile +++ b/CPP/7zip/Compress/Deflate/makefile @@ -1,18 +1,18 @@ PROG = Deflate.dll DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -D_ST_MODE +CFLAGS = $(CFLAGS) -I ../../../ LIBS = $(LIBS) oleaut32.lib -DEFLATE_OBJS = \ +COMPRESS_OBJS = \ + $O\CodecExports.obj \ $O\DllExports.obj \ DEFLATE_OPT_OBJS = \ $O\DeflateDecoder.obj \ $O\DeflateEncoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ + $O\DeflateRegister.obj \ + $O\Deflate64Register.obj \ + $O\DeflateNsisRegister.obj \ 7ZIP_COMMON_OBJS = \ $O\InBuffer.obj \ @@ -24,18 +24,19 @@ LZ_OBJS = \ $O\LZOutWindow.obj \ C_OBJS = \ + $O\Alloc.obj \ $O\7zCrc.obj \ $O\Sort.obj \ C_LZ_OBJS = \ $O\MatchFinder.obj \ +!include "../../Crc2.mak" OBJS = \ $O\StdAfx.obj \ - $(DEFLATE_OBJS) \ + $(COMPRESS_OBJS) \ $(DEFLATE_OPT_OBJS) \ - $(COMMON_OBJS) \ $(7ZIP_COMMON_OBJS) \ $(LZ_OBJS) \ $(C_OBJS) \ @@ -45,12 +46,10 @@ OBJS = \ !include "../../../Build.mak" -$(DEFLATE_OBJS): $(*B).cpp +$(COMPRESS_OBJS): ../$(*B).cpp $(COMPL) $(DEFLATE_OPT_OBJS): $(*B).cpp $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp $(COMPL) $(LZ_OBJS): ../LZ/$(*B).cpp @@ -61,3 +60,4 @@ $(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c $(COMPL_O2) $O\HuffmanEncode.obj: ../../../../C/Compress/Huffman/$(*B).c $(COMPL_O2) +!include "../../Crc.mak" |