mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 22:07:08 -06:00
4.27 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
31e7b924e8
commit
d66cf2fcf3
@@ -477,6 +477,14 @@ SOURCE=..\..\Common\OutBuffer.cpp
|
||||
|
||||
SOURCE=..\..\Common\OutBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "../../../Common/StringToInt.h"
|
||||
|
||||
#include "../../Common/FileStreams.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
|
||||
#include "../LZMA/LZMADecoder.h"
|
||||
#include "../LZMA/LZMAEncoder.h"
|
||||
@@ -35,6 +36,8 @@ extern "C"
|
||||
using namespace NCommandLineParser;
|
||||
|
||||
static const char *kCantAllocate = "Can not allocate memory";
|
||||
static const char *kReadError = "Read error";
|
||||
static const char *kWriteError = "Write error";
|
||||
|
||||
namespace NKey {
|
||||
enum Enum
|
||||
@@ -131,7 +134,7 @@ static bool GetNumber(const wchar_t *s, UInt32 &value)
|
||||
|
||||
int main2(int n, const char *args[])
|
||||
{
|
||||
fprintf(stderr, "\nLZMA 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-02\n");
|
||||
fprintf(stderr, "\nLZMA 4.27 Copyright (c) 1999-2005 Igor Pavlov 2005-08-07\n");
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
@@ -269,7 +272,7 @@ int main2(int n, const char *args[])
|
||||
}
|
||||
|
||||
UInt32 processedSize;
|
||||
if (inStream->Read(inBuffer, (UInt32)inSize, &processedSize) != S_OK)
|
||||
if (ReadStream(inStream, inBuffer, (UInt32)inSize, &processedSize) != S_OK)
|
||||
throw "Can not read";
|
||||
if ((UInt32)inSize != processedSize)
|
||||
throw "Read size error";
|
||||
@@ -311,8 +314,8 @@ int main2(int n, const char *args[])
|
||||
if (res != 0)
|
||||
throw "LzmaDecoder error";
|
||||
}
|
||||
if (outStream->Write(outBuffer, (UInt32)outSizeProcessed, &processedSize) != S_OK)
|
||||
throw "Can not write";
|
||||
if (WriteStream(outStream, outBuffer, (UInt32)outSizeProcessed, &processedSize) != S_OK)
|
||||
throw kWriteError;
|
||||
MyFree(outBuffer);
|
||||
MyFree(inBuffer);
|
||||
return 0;
|
||||
@@ -408,9 +411,9 @@ int main2(int n, const char *args[])
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Byte b = Byte(fileSize >> (8 * i));
|
||||
if (outStream->Write(&b, sizeof(b), 0) != S_OK)
|
||||
if (outStream->Write(&b, 1, 0) != S_OK)
|
||||
{
|
||||
fprintf(stderr, "Write error");
|
||||
fprintf(stderr, kWriteError);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -434,14 +437,14 @@ int main2(int n, const char *args[])
|
||||
const UInt32 kPropertiesSize = 5;
|
||||
Byte properties[kPropertiesSize];
|
||||
UInt32 processedSize;
|
||||
if (inStream->Read(properties, kPropertiesSize, &processedSize) != S_OK)
|
||||
if (ReadStream(inStream, properties, kPropertiesSize, &processedSize) != S_OK)
|
||||
{
|
||||
fprintf(stderr, "Read error");
|
||||
fprintf(stderr, kReadError);
|
||||
return 1;
|
||||
}
|
||||
if (processedSize != kPropertiesSize)
|
||||
{
|
||||
fprintf(stderr, "Read error");
|
||||
fprintf(stderr, kReadError);
|
||||
return 1;
|
||||
}
|
||||
if (decoderSpec->SetDecoderProperties2(properties, kPropertiesSize) != S_OK)
|
||||
@@ -453,14 +456,14 @@ int main2(int n, const char *args[])
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Byte b;
|
||||
if (inStream->Read(&b, sizeof(b), &processedSize) != S_OK)
|
||||
if (inStream->Read(&b, 1, &processedSize) != S_OK)
|
||||
{
|
||||
fprintf(stderr, "Read error");
|
||||
fprintf(stderr, kReadError);
|
||||
return 1;
|
||||
}
|
||||
if (processedSize != 1)
|
||||
{
|
||||
fprintf(stderr, "Read error");
|
||||
fprintf(stderr, kReadError);
|
||||
return 1;
|
||||
}
|
||||
fileSize |= ((UInt64)b) << (8 * i);
|
||||
|
||||
@@ -148,7 +148,6 @@ public:
|
||||
Pos = 0;
|
||||
}
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
@@ -157,20 +156,13 @@ STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processed
|
||||
if (size > remain)
|
||||
size = remain;
|
||||
for (UInt32 i = 0; i < size; i++)
|
||||
{
|
||||
((Byte *)data)[i] = Data[Pos + i];
|
||||
}
|
||||
Pos += size;
|
||||
if(processedSize != NULL)
|
||||
*processedSize = size;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CBenchmarkInStream::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Read(data, size, processedSize);
|
||||
}
|
||||
|
||||
class CBenchmarkOutStream:
|
||||
public ISequentialOutStream,
|
||||
public CMyUnknownImp
|
||||
@@ -193,7 +185,6 @@ public:
|
||||
}
|
||||
MY_UNKNOWN_IMP
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
@@ -211,11 +202,6 @@ STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *p
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CBenchmarkOutStream::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Write(data, size, processedSize);
|
||||
}
|
||||
|
||||
class CCrcOutStream:
|
||||
public ISequentialOutStream,
|
||||
public CMyUnknownImp
|
||||
@@ -225,7 +211,6 @@ public:
|
||||
MY_UNKNOWN_IMP
|
||||
void Init() { CRC.Init(); }
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
@@ -236,11 +221,6 @@ STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *process
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCrcOutStream::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Write(data, size, processedSize);
|
||||
}
|
||||
|
||||
static UInt64 GetTimeCount()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
Pos = 0;
|
||||
}
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
STDMETHODIMP CInStreamRam::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
@@ -36,20 +35,13 @@ STDMETHODIMP CInStreamRam::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
if (size > remain)
|
||||
size = remain;
|
||||
for (UInt32 i = 0; i < size; i++)
|
||||
{
|
||||
((Byte *)data)[i] = Data[Pos + i];
|
||||
}
|
||||
Pos += size;
|
||||
if(processedSize != NULL)
|
||||
*processedSize = size;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CInStreamRam::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Read(data, size, processedSize);
|
||||
}
|
||||
|
||||
class COutStreamRam:
|
||||
public ISequentialOutStream,
|
||||
public CMyUnknownImp
|
||||
@@ -83,7 +75,6 @@ public:
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
@@ -101,11 +92,6 @@ STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *process
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP COutStreamRam::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Write(data, size, processedSize);
|
||||
}
|
||||
|
||||
#define SZE_FAIL (1)
|
||||
#define SZE_OUTOFMEMORY (2)
|
||||
#define SZE_OUT_OVERFLOW (3)
|
||||
|
||||
@@ -41,12 +41,10 @@ COMMON_OBJS = \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\Synchronization.obj
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\InBuffer.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
LZ_OBJS = \
|
||||
$O\LZInWindow.obj \
|
||||
@@ -57,7 +55,6 @@ OBJS = \
|
||||
$(LZMA_OBJS) \
|
||||
$(LZMA_OPT_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
$(WIN_OBJS) \
|
||||
$(7ZIP_COMMON_OBJS) \
|
||||
$(LZ_OBJS) \
|
||||
$O\LzmaRamDecode.obj \
|
||||
@@ -85,8 +82,6 @@ $(LZMA_OPT_OBJS): ../LZMA/$(*B).cpp
|
||||
$(COMPL_O2)
|
||||
$(COMMON_OBJS): ../../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_OBJS): ../../../Windows/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(LZ_OBJS): ../LZ/$(*B).cpp
|
||||
|
||||
Reference in New Issue
Block a user