diff options
Diffstat (limited to 'CPP/7zip/Compress/PPMD')
-rwxr-xr-x | CPP/7zip/Compress/PPMD/DllExports.cpp | 93 | ||||
-rwxr-xr-x | CPP/7zip/Compress/PPMD/PPMD.dsp | 21 | ||||
-rwxr-xr-x | CPP/7zip/Compress/PPMD/PPMDDecoder.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Compress/PPMD/PPMDDecoder.h | 6 | ||||
-rwxr-xr-x | CPP/7zip/Compress/PPMD/PPMDRegister.cpp | 19 | ||||
-rwxr-xr-x | CPP/7zip/Compress/PPMD/PPMDSubAlloc.h | 5 | ||||
-rwxr-xr-x | CPP/7zip/Compress/PPMD/makefile | 22 |
7 files changed, 56 insertions, 112 deletions
diff --git a/CPP/7zip/Compress/PPMD/DllExports.cpp b/CPP/7zip/Compress/PPMD/DllExports.cpp deleted file mode 100755 index 8159a2f8..00000000 --- a/CPP/7zip/Compress/PPMD/DllExports.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#ifdef _WIN32 -#include "Common/Alloc.h" -#endif - -#include "PPMDEncoder.h" -#include "PPMDDecoder.h" - -// {23170F69-40C1-278B-0304-010000000000} -DEFINE_GUID(CLSID_CCompressPPMDDecoder, -0x23170F69, 0x40C1, 0x278B, 0x03, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0304-010000000100} -DEFINE_GUID(CLSID_CCompressPPMDEncoder, -0x23170F69, 0x40C1, 0x278B, 0x03, 0x04, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/) -{ - #ifdef _WIN32 - if (dwReason == DLL_PROCESS_ATTACH) - SetLargePageSize(); - #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_CCompressPPMDDecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NPPMD::CDecoder(); - } - else if (*clsid == CLSID_CCompressPPMDEncoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NPPMD::CEncoder(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x03, 0x04, 0x01 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"PPMD")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressPPMDDecoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressPPMDEncoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/CPP/7zip/Compress/PPMD/PPMD.dsp b/CPP/7zip/Compress/PPMD/PPMD.dsp index 9e512f6c..c98d809d 100755 --- a/CPP/7zip/Compress/PPMD/PPMD.dsp +++ b/CPP/7zip/Compress/PPMD/PPMD.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,6 +170,10 @@ SOURCE=.\PPMDEncoder.h # End Source File # Begin Source File +SOURCE=.\PPMDRegister.cpp +# End Source File +# Begin Source File + SOURCE=.\PPMDSubAlloc.h # End Source File # Begin Source File @@ -214,15 +222,20 @@ SOURCE=..\RangeCoder\RangeCoder.h # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\..\Common\Alloc.cpp +SOURCE=..\..\..\Common\Types.h # End Source File +# End Group +# Begin Group "Ñ" + +# PROP Default_Filter "" # Begin Source File -SOURCE=..\..\..\Common\Alloc.h +SOURCE=..\..\..\..\C\Alloc.c +# SUBTRACT CPP /YX /Yc /Yu # End Source File # Begin Source File -SOURCE=..\..\..\Common\Types.h +SOURCE=..\..\..\..\C\Alloc.h # End Source File # End Group # End Target diff --git a/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp b/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp index 2d0a2f52..f24c2408 100755 --- a/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp +++ b/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp @@ -164,7 +164,7 @@ STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize) return S_OK; } -#ifdef _ST_MODE +#ifndef NO_READ_FROM_CODER STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize) { diff --git a/CPP/7zip/Compress/PPMD/PPMDDecoder.h b/CPP/7zip/Compress/PPMD/PPMDDecoder.h index 8e30c35c..cbb88ad5 100755 --- a/CPP/7zip/Compress/PPMD/PPMDDecoder.h +++ b/CPP/7zip/Compress/PPMD/PPMDDecoder.h @@ -17,7 +17,7 @@ namespace NPPMD { class CDecoder : public ICompressCoder, public ICompressSetDecoderProperties2, - #ifdef _ST_MODE + #ifndef NO_READ_FROM_CODER public ICompressSetInStream, public ICompressSetOutStreamSize, public ISequentialInStream, @@ -41,7 +41,7 @@ class CDecoder : HRESULT CodeSpec(UInt32 num, Byte *memStream); public: - #ifdef _ST_MODE + #ifndef NO_READ_FROM_CODER MY_UNKNOWN_IMP4( ICompressSetDecoderProperties2, ICompressSetInStream, @@ -76,7 +76,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/PPMD/PPMDRegister.cpp b/CPP/7zip/Compress/PPMD/PPMDRegister.cpp new file mode 100755 index 00000000..2f6dd7cd --- /dev/null +++ b/CPP/7zip/Compress/PPMD/PPMDRegister.cpp @@ -0,0 +1,19 @@ +// PPMDRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterCodec.h" + +#include "PPMDDecoder.h" +static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NPPMD::CDecoder); } +#ifndef EXTRACT_ONLY +#include "PPMDEncoder.h" +static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NPPMD::CEncoder); } +#else +#define CreateCodecOut 0 +#endif + +static CCodecInfo g_CodecInfo = + { CreateCodec, CreateCodecOut, 0x030401, L"PPMD", 1, false }; + +REGISTER_CODEC(PPMD) diff --git a/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h b/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h index dce765d6..5162f0a1 100755 --- a/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h +++ b/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h @@ -6,7 +6,10 @@ #include "PPMDType.h" -#include "../../../Common/Alloc.h" +extern "C" +{ +#include "../../../../C/Alloc.h" +} const UINT N1=4, N2=4, N3=4, N4=(128+3-1*N1-2*N2-3*N3)/4; const UINT UNIT_SIZE=12, N_INDEXES=N1+N2+N3+N4; diff --git a/CPP/7zip/Compress/PPMD/makefile b/CPP/7zip/Compress/PPMD/makefile index 2e687a70..f146edb0 100755 --- a/CPP/7zip/Compress/PPMD/makefile +++ b/CPP/7zip/Compress/PPMD/makefile @@ -1,41 +1,43 @@ PROG = PPMd.dll DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ +CFLAGS = $(CFLAGS) -I ../../../ -D_7ZIP_LARGE_PAGES LIBS = $(LIBS) oleaut32.lib -PPMD_OBJS = \ +COMPRESS_OBJS = \ + $O\CodecExports.obj \ $O\DllExports.obj \ PPMD_OPT_OBJS = \ $O\PPMDDecoder.obj \ $O\PPMDEncoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ + $O\PPMDRegister.obj \ 7ZIP_COMMON_OBJS = \ $O\InBuffer.obj \ $O\OutBuffer.obj \ $O\StreamUtils.obj \ +C_OBJS = \ + $O\Alloc.obj \ OBJS = \ $O\StdAfx.obj \ - $(PPMD_OBJS) \ + $(COMPRESS_OBJS) \ $(PPMD_OPT_OBJS) \ - $(COMMON_OBJS) \ $(7ZIP_COMMON_OBJS) \ + $(C_OBJS) \ $O\resource.res !include "../../../Build.mak" -$(PPMD_OBJS): $(*B).cpp +$(COMPRESS_OBJS): ../$(*B).cpp $(COMPL) $(PPMD_OPT_OBJS): $(*B).cpp $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp $(COMPL) +$(C_OBJS): ../../../../C/$(*B).c + $(COMPL_O2) + |