Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Compress/Rar')
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar29.dsp8
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar2Decoder.cpp14
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar2Decoder.h8
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar3Decoder.cpp6
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar3Vm.h46
-rwxr-xr-xCPP/7zip/Compress/Rar/makefile2
6 files changed, 16 insertions, 68 deletions
diff --git a/CPP/7zip/Compress/Rar/Rar29.dsp b/CPP/7zip/Compress/Rar/Rar29.dsp
index c5ee2228..9eb36ac3 100755
--- a/CPP/7zip/Compress/Rar/Rar29.dsp
+++ b/CPP/7zip/Compress/Rar/Rar29.dsp
@@ -182,19 +182,19 @@ SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\NewHandler.cpp
+SOURCE=..\..\..\Common\MyVector.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\NewHandler.h
+SOURCE=..\..\..\Common\MyVector.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Vector.cpp
+SOURCE=..\..\..\Common\NewHandler.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Vector.h
+SOURCE=..\..\..\Common\NewHandler.h
# End Source File
# End Group
# Begin Group "Rar3"
diff --git a/CPP/7zip/Compress/Rar/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
index 057a1a60..28d50213 100755
--- a/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
+++ b/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
@@ -69,16 +69,6 @@ Byte CFilter::Decode(int &channelDelta, Byte deltaByte)
}
}
-class CException
-{
-public:
- enum ECauseType
- {
- kData
- } Cause;
- CException(ECauseType cause): Cause(cause) {}
-};
-
static const char *kNumberErrorMessage = "Number error";
static const UInt32 kHistorySize = 1 << 20;
@@ -307,7 +297,7 @@ bool CDecoder::DecodeLz(Int32 pos)
return true;
}
-STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
@@ -373,7 +363,7 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
}
}
if (pos > unPackSize)
- throw CException(CException::kData);
+ return S_FALSE;
if (!ReadLastTables())
return S_FALSE;
diff --git a/CPP/7zip/Compress/Rar/Rar2Decoder.h b/CPP/7zip/Compress/Rar/Rar2Decoder.h
index 9567de0a..7906b1fc 100755
--- a/CPP/7zip/Compress/Rar/Rar2Decoder.h
+++ b/CPP/7zip/Compress/Rar/Rar2Decoder.h
@@ -147,6 +147,10 @@ class CDecoder :
bool DecodeMm(UInt32 pos);
bool DecodeLz(Int32 pos);
+ HRESULT CodeReal(ISequentialInStream *inStream,
+ ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
+ ICompressProgressInfo *progress);
+
public:
CDecoder();
@@ -158,10 +162,6 @@ public:
m_InBitStream.ReleaseStream();
}
- STDMETHOD(CodeReal)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
STDMETHOD(Code)(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
diff --git a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
index e629f4df..5ba13646 100755
--- a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
+++ b/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
@@ -58,11 +58,7 @@ CDecoder::~CDecoder()
HRESULT CDecoder::WriteDataToStream(const Byte *data, UInt32 size)
{
- UInt32 processedSize;
- HRESULT res = WriteStream(_outStream, data, size, &processedSize);
- if (res == S_OK && processedSize != size)
- res = E_FAIL;
- return res;
+ return WriteStream(_outStream, data, size);
}
HRESULT CDecoder::WriteData(const Byte *data, UInt32 size)
diff --git a/CPP/7zip/Compress/Rar/Rar3Vm.h b/CPP/7zip/Compress/Rar/Rar3Vm.h
index d31fcd0a..8b2e01f1 100755
--- a/CPP/7zip/Compress/Rar/Rar3Vm.h
+++ b/CPP/7zip/Compress/Rar/Rar3Vm.h
@@ -11,9 +11,6 @@
#include "../../../../C/CpuArch.h"
#define RARVM_STANDARD_FILTERS
-#ifdef LITTLE_ENDIAN_UNALIGN
-#define RARVM_LITTLE_ENDIAN_UNALIGN
-#endif
namespace NCompress {
namespace NRar3 {
@@ -37,27 +34,8 @@ public:
namespace NVm {
-inline UInt32 GetValue32(const void *addr)
-{
- #ifdef RARVM_LITTLE_ENDIAN_UNALIGN
- return *(const UInt32 *)addr;
- #else
- const Byte *b = (const Byte *)addr;
- return UInt32((UInt32)b[0]|((UInt32)b[1]<<8)|((UInt32)b[2]<<16)|((UInt32)b[3]<<24));
- #endif
-}
-
-inline void SetValue32(void *addr, UInt32 value)
-{
- #ifdef RARVM_LITTLE_ENDIAN_UNALIGN
- *(UInt32 *)addr = value;
- #else
- ((Byte *)addr)[0] = (Byte)value;
- ((Byte *)addr)[1] = (Byte)(value >> 8);
- ((Byte *)addr)[2] = (Byte)(value >> 16);
- ((Byte *)addr)[3] = (Byte)(value >> 24);
- #endif
-}
+inline UInt32 GetValue32(const void *addr) { return GetUi32(addr); }
+inline void SetValue32(void *addr, UInt32 value) { SetUi32(addr, value); }
UInt32 ReadEncodedUInt32(CMemBitDecoder &inp);
@@ -147,14 +125,7 @@ class CVm
if (byteMode)
return(*(const Byte *)addr);
else
- {
- #ifdef RARVM_LITTLE_ENDIAN_UNALIGN
- return *(const UInt32 *)addr;
- #else
- const Byte *b = (const Byte *)addr;
- return UInt32((UInt32)b[0]|((UInt32)b[1]<<8)|((UInt32)b[2]<<16)|((UInt32)b[3]<<24));
- #endif
- }
+ return GetUi32(addr);
}
static void SetValue(bool byteMode, void *addr, UInt32 value)
@@ -162,16 +133,7 @@ class CVm
if (byteMode)
*(Byte *)addr = (Byte)value;
else
- {
- #ifdef RARVM_LITTLE_ENDIAN_UNALIGN
- *(UInt32 *)addr = value;
- #else
- ((Byte *)addr)[0] = (Byte)value;
- ((Byte *)addr)[1] = (Byte)(value >> 8);
- ((Byte *)addr)[2] = (Byte)(value >> 16);
- ((Byte *)addr)[3] = (Byte)(value >> 24);
- #endif
- }
+ SetUi32(addr, value);
}
UInt32 GetFixedGlobalValue32(UInt32 globalOffset) { return GetValue(false, &Mem[kGlobalOffset + globalOffset]); }
diff --git a/CPP/7zip/Compress/Rar/makefile b/CPP/7zip/Compress/Rar/makefile
index f55bf17e..27cedbd9 100755
--- a/CPP/7zip/Compress/Rar/makefile
+++ b/CPP/7zip/Compress/Rar/makefile
@@ -16,7 +16,7 @@ RAR29_OPT_OBJS = \
COMMON_OBJS = \
$O\CRC.obj \
- $O\Vector.obj \
+ $O\MyVector.obj \
7ZIP_COMMON_OBJS = \
$O\InBuffer.obj \