diff options
Diffstat (limited to 'CPP/7zip/Compress/BZip2')
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2.dsp | 316 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2.dsw | 29 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Decoder.cpp | 30 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Decoder.h | 12 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Encoder.cpp | 38 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/BZip2Encoder.h | 10 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/makefile | 58 | ||||
-rwxr-xr-x | CPP/7zip/Compress/BZip2/resource.rc | 3 |
8 files changed, 46 insertions, 450 deletions
diff --git a/CPP/7zip/Compress/BZip2/BZip2.dsp b/CPP/7zip/Compress/BZip2/BZip2.dsp deleted file mode 100755 index e26819a0..00000000 --- a/CPP/7zip/Compress/BZip2/BZip2.dsp +++ /dev/null @@ -1,316 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BZip2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=BZip2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak" CFG="BZip2 - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BZip2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "BZip2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "BZ_NO_STDIO" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\BZip2.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\BZip2.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "BZip2 - Win32 Release" -# Name "BZip2 - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=..\CodecExports.cpp -# End Source File -# Begin Source File - -SOURCE=..\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Huffman\HuffmanDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.c - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\C\Sort.c - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\C\Sort.h -# End Source File -# End Group -# Begin Group "7-Zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# End Group -# Begin Group "BWT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\BWT\BlockSort.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\BWT\BlockSort.h -# End Source File -# Begin Source File - -SOURCE=..\BWT\Mtf8.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Group "Ñ" - -# PROP Default_Filter "" -# 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 -# End Group -# Begin Source File - -SOURCE=.\BZip2Const.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2CRC.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2CRC.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Decoder.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\BZip2Decoder.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Encoder.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\BZip2Encoder.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Register.cpp -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Compress/BZip2/BZip2.dsw b/CPP/7zip/Compress/BZip2/BZip2.dsw deleted file mode 100755 index 697e5095..00000000 --- a/CPP/7zip/Compress/BZip2/BZip2.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "BZip2"=.\BZip2.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp b/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp index 3f7dbc58..47ffa7c8 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp +++ b/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp @@ -432,10 +432,12 @@ CDecoder::~CDecoder() Free(); } -HRes CDecoder::Create() +#define RINOK_THREAD(x) { WRes __result_ = (x); if(__result_ != 0) return __result_; } + +HRESULT CDecoder::Create() { - RINOK(CanProcessEvent.CreateIfNotCreated()); - RINOK(CanStartWaitingEvent.CreateIfNotCreated()); + RINOK_THREAD(CanProcessEvent.CreateIfNotCreated()); + RINOK_THREAD(CanStartWaitingEvent.CreateIfNotCreated()); if (m_States != 0 && m_NumThreadsPrev == NumThreads) return S_OK; Free(); @@ -454,7 +456,7 @@ HRes CDecoder::Create() ti.Decoder = this; if (MtMode) { - HRes res = ti.Create(); + HRESULT res = ti.Create(); if (res != S_OK) { NumThreads = t; @@ -524,9 +526,12 @@ HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress) CState &s = m_States[t]; if (!s.Alloc()) return E_OUTOFMEMORY; - s.StreamWasFinishedEvent.Reset(); - s.WaitingWasStartedEvent.Reset(); - s.CanWriteEvent.Reset(); + if (MtMode) + { + RINOK(s.StreamWasFinishedEvent.Reset()); + RINOK(s.WaitingWasStartedEvent.Reset()); + RINOK(s.CanWriteEvent.Reset()); + } } #else if (!m_States[0].Alloc()) @@ -647,12 +652,13 @@ STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) static THREAD_FUNC_DECL MFThread(void *p) { ((CState *)p)->ThreadFunc(); return 0; } -HRes CState::Create() +HRESULT CState::Create() { - RINOK(StreamWasFinishedEvent.CreateIfNotCreated()); - RINOK(WaitingWasStartedEvent.CreateIfNotCreated()); - RINOK(CanWriteEvent.CreateIfNotCreated()); - return Thread.Create(MFThread, this); + RINOK_THREAD(StreamWasFinishedEvent.CreateIfNotCreated()); + RINOK_THREAD(WaitingWasStartedEvent.CreateIfNotCreated()); + RINOK_THREAD(CanWriteEvent.CreateIfNotCreated()); + RINOK_THREAD(Thread.Create(MFThread, this)); + return S_OK; } void CState::FinishStream() diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.h b/CPP/7zip/Compress/BZip2/BZip2Decoder.h index 9c965b49..511302d5 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Decoder.h +++ b/CPP/7zip/Compress/BZip2/BZip2Decoder.h @@ -17,13 +17,7 @@ #include "../../../Windows/Synchronization.h" #endif -#if _MSC_VER >= 1300 -#define NO_INLINE __declspec(noinline) __fastcall -#else -#ifdef _MSC_VER -#define NO_INLINE __fastcall -#endif -#endif +#define NO_INLINE MY_FAST_CALL namespace NCompress { namespace NBZip2 { @@ -50,7 +44,7 @@ struct CState Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size. - HRes Create(); + HRESULT Create(); void FinishStream(); void ThreadFunc(); @@ -126,7 +120,7 @@ public: UInt32 BlockSizeMax; CDecoder(); ~CDecoder(); - HRes Create(); + HRESULT Create(); void Free(); #else diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp b/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp index ac5f78e1..2491ef17 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp +++ b/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp @@ -5,19 +5,15 @@ extern "C" { #include "../../../../C/Alloc.h" +#include "../../../../C/BwtSort.h" +#include "../../../../C/HuffEnc.h" } #include "BZip2Encoder.h" -#include "../BWT/BlockSort.h" #include "../BWT/Mtf8.h" #include "BZip2CRC.h" -extern "C" -{ - #include "../../../../C/Compress/Huffman/HuffmanEncode.h" -} - namespace NCompress { namespace NBZip2 { @@ -61,12 +57,15 @@ static THREAD_FUNC_DECL MFThread(void *threadCoderInfo) return ((CThreadInfo *)threadCoderInfo)->ThreadFunc(); } -HRes CThreadInfo::Create() +#define RINOK_THREAD(x) { WRes __result_ = (x); if(__result_ != 0) return __result_; } + +HRESULT CThreadInfo::Create() { - RINOK(StreamWasFinishedEvent.Create()); - RINOK(WaitingWasStartedEvent.Create()); - RINOK(CanWriteEvent.Create()); - return Thread.Create(MFThread, this); + RINOK_THREAD(StreamWasFinishedEvent.Create()); + RINOK_THREAD(WaitingWasStartedEvent.Create()); + RINOK_THREAD(CanWriteEvent.Create()); + RINOK_THREAD(Thread.Create(MFThread, this)); + return S_OK; } void CThreadInfo::FinishStream(bool needLeave) @@ -145,10 +144,10 @@ CEncoder::~CEncoder() Free(); } -HRes CEncoder::Create() +HRESULT CEncoder::Create() { - RINOK(CanProcessEvent.CreateIfNotCreated()); - RINOK(CanStartWaitingEvent.CreateIfNotCreated()); + RINOK_THREAD(CanProcessEvent.CreateIfNotCreated()); + RINOK_THREAD(CanStartWaitingEvent.CreateIfNotCreated()); if (ThreadsInfo != 0 && m_NumThreadsPrev == NumThreads) return S_OK; try @@ -167,7 +166,7 @@ HRes CEncoder::Create() ti.Encoder = this; if (MtMode) { - HRes res = ti.Create(); + HRESULT res = ti.Create(); if (res != S_OK) { NumThreads = t; @@ -733,9 +732,12 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, { #ifdef COMPRESS_BZIP2_MT CThreadInfo &ti = ThreadsInfo[t]; - ti.StreamWasFinishedEvent.Reset(); - ti.WaitingWasStartedEvent.Reset(); - ti.CanWriteEvent.Reset(); + if (MtMode) + { + RINOK(ti.StreamWasFinishedEvent.Reset()); + RINOK(ti.WaitingWasStartedEvent.Reset()); + RINOK(ti.CanWriteEvent.Reset()); + } #else CThreadInfo &ti = ThreadsInfo; ti.Encoder = this; diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.h b/CPP/7zip/Compress/BZip2/BZip2Encoder.h index 02d4cde3..98cd20d6 100755 --- a/CPP/7zip/Compress/BZip2/BZip2Encoder.h +++ b/CPP/7zip/Compress/BZip2/BZip2Encoder.h @@ -70,9 +70,9 @@ public: void SetPos(UInt32 bitPos) { m_Pos = bitPos / 8; - m_BitPos = 8 - (bitPos & 7); + m_BitPos = 8 - ((int)bitPos & 7); } - void SetCurState(UInt32 bitPos, Byte curByte) + void SetCurState(int bitPos, Byte curByte) { m_BitPos = 8 - bitPos; m_CurByte = curByte; @@ -103,7 +103,7 @@ private: UInt32 m_CRCs[1 << kNumPassesMax]; UInt32 m_NumCrcs; - int m_BlockIndex; + UInt32 m_BlockIndex; void WriteBits2(UInt32 value, UInt32 numBits); void WriteByte2(Byte b); @@ -128,7 +128,7 @@ public: UInt64 m_PackSize; Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size. - HRes Create(); + HRESULT Create(); void FinishStream(bool needLeave); DWORD ThreadFunc(); #endif @@ -189,7 +189,7 @@ public: void WriteCRC(UInt32 v); #ifdef COMPRESS_BZIP2_MT - HRes Create(); + HRESULT Create(); void Free(); #endif diff --git a/CPP/7zip/Compress/BZip2/makefile b/CPP/7zip/Compress/BZip2/makefile deleted file mode 100755 index 6e467583..00000000 --- a/CPP/7zip/Compress/BZip2/makefile +++ /dev/null @@ -1,58 +0,0 @@ -PROG = BZip2.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_BZIP2_MT -D_7ZIP_LARGE_PAGES -LIBS = $(LIBS) oleaut32.lib - -COMPRESS_OBJS = \ - $O\CodecExports.obj \ - $O\DllExports.obj \ - -BZIP2_OBJS = \ - $O\BZip2CRC.obj \ - $O\BZip2Register.obj \ - -BZIP2_OPT_OBJS = \ - $O\BZip2Decoder.obj \ - $O\BZip2Encoder.obj \ - -WIN_OBJS = \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - -C_OBJS = \ - $O\Alloc.obj \ - $O\Sort.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(COMPRESS_OBJS) \ - $(BZIP2_OBJS) \ - $(BZIP2_OPT_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\BlockSort.obj \ - $(C_OBJS) \ - $O\HuffmanEncode.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(COMPRESS_OBJS): ../$(*B).cpp - $(COMPL) -$(BZIP2_OBJS): $(*B).cpp - $(COMPL) -$(BZIP2_OPT_OBJS): $(*B).cpp - $(COMPL_O2) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$O\BlockSort.obj: ../BWT/$(*B).cpp - $(COMPL_O2) -$(C_OBJS): ../../../../C/$(*B).c - $(COMPL_O2) -$O\HuffmanEncode.obj: ../../../../C/Compress/Huffman/$(*B).c - $(COMPL_O2) diff --git a/CPP/7zip/Compress/BZip2/resource.rc b/CPP/7zip/Compress/BZip2/resource.rc deleted file mode 100755 index c5bea782..00000000 --- a/CPP/7zip/Compress/BZip2/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("BZip2 Codec", "BZip2") |