|
@@ -151,9 +151,6 @@ typedef struct
|
|
|
(output(*size) < input(*size)) is allowed */
|
|
(output(*size) < input(*size)) is allowed */
|
|
|
} ISeqInStream;
|
|
} ISeqInStream;
|
|
|
|
|
|
|
|
-/* it can return SZ_ERROR_INPUT_EOF */
|
|
|
|
|
-static SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
|
|
|
|
|
-
|
|
|
|
|
typedef struct
|
|
typedef struct
|
|
|
{
|
|
{
|
|
|
size_t (*Write)(void *p, const void *buf, size_t size);
|
|
size_t (*Write)(void *p, const void *buf, size_t size);
|
|
@@ -188,7 +185,6 @@ typedef struct
|
|
|
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
|
|
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
|
|
|
} ILookInStream;
|
|
} ILookInStream;
|
|
|
|
|
|
|
|
-static SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
|
|
|
|
|
static SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
|
|
static SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
|
|
|
|
|
|
|
|
/* reads via ILookInStream::Read */
|
|
/* reads via ILookInStream::Read */
|
|
@@ -468,8 +464,6 @@ EXTERN_C_END
|
|
|
|
|
|
|
|
EXTERN_C_BEGIN
|
|
EXTERN_C_BEGIN
|
|
|
|
|
|
|
|
-/*static UInt32 g_CrcTable[];*/
|
|
|
|
|
-
|
|
|
|
|
/* Call CrcGenerateTable one time before other CRC functions */
|
|
/* Call CrcGenerateTable one time before other CRC functions */
|
|
|
static void MY_FAST_CALL CrcGenerateTable(void);
|
|
static void MY_FAST_CALL CrcGenerateTable(void);
|
|
|
|
|
|
|
@@ -1603,36 +1597,12 @@ static Bool CPU_Sys_Is_SSE_Supported()
|
|
|
|
|
|
|
|
/*#include "7zTypes.h"*/
|
|
/*#include "7zTypes.h"*/
|
|
|
|
|
|
|
|
-static SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType)
|
|
|
|
|
-{
|
|
|
|
|
- while (size != 0)
|
|
|
|
|
- {
|
|
|
|
|
- size_t processed = size;
|
|
|
|
|
- RINOK(stream->Read(stream, buf, &processed));
|
|
|
|
|
- if (processed == 0)
|
|
|
|
|
- return errorType;
|
|
|
|
|
- buf = (void *)((Byte *)buf + processed);
|
|
|
|
|
- size -= processed;
|
|
|
|
|
- }
|
|
|
|
|
- return SZ_OK;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
static SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset)
|
|
static SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset)
|
|
|
{
|
|
{
|
|
|
Int64 t = offset;
|
|
Int64 t = offset;
|
|
|
return stream->Seek(stream, &t, SZ_SEEK_SET);
|
|
return stream->Seek(stream, &t, SZ_SEEK_SET);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
|
|
|
|
|
-{
|
|
|
|
|
- const void *lookBuf;
|
|
|
|
|
- if (*size == 0)
|
|
|
|
|
- return SZ_OK;
|
|
|
|
|
- RINOK(stream->Look(stream, &lookBuf, size));
|
|
|
|
|
- memcpy(buf, lookBuf, *size);
|
|
|
|
|
- return stream->Skip(stream, *size);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
static SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType)
|
|
static SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType)
|
|
|
{
|
|
{
|
|
|
while (size != 0)
|
|
while (size != 0)
|
|
@@ -5748,38 +5718,6 @@ static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned props
|
|
|
return SZ_OK;
|
|
return SZ_OK;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
|
|
|
|
-{
|
|
|
|
|
- CLzmaProps propNew;
|
|
|
|
|
- SizeT dicBufSize;
|
|
|
|
|
- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
|
|
|
|
|
- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- UInt32 dictSize = propNew.dicSize;
|
|
|
|
|
- SizeT mask = ((UInt32)1 << 12) - 1;
|
|
|
|
|
- if (dictSize >= ((UInt32)1 << 30)) mask = ((UInt32)1 << 22) - 1;
|
|
|
|
|
- else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;;
|
|
|
|
|
- dicBufSize = ((SizeT)dictSize + mask) & ~mask;
|
|
|
|
|
- if (dicBufSize < dictSize)
|
|
|
|
|
- dicBufSize = dictSize;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!p->dic || dicBufSize != p->dicBufSize)
|
|
|
|
|
- {
|
|
|
|
|
- LzmaDec_FreeDict(p, alloc);
|
|
|
|
|
- p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
|
|
|
|
|
- if (!p->dic)
|
|
|
|
|
- {
|
|
|
|
|
- LzmaDec_FreeProbs(p, alloc);
|
|
|
|
|
- return SZ_ERROR_MEM;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- p->dicBufSize = dicBufSize;
|
|
|
|
|
- p->prop = propNew;
|
|
|
|
|
- return SZ_OK;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/* Lzma2Dec.c -- LZMA2 Decoder
|
|
/* Lzma2Dec.c -- LZMA2 Decoder
|
|
|
2015-11-09 : Igor Pavlov : Public domain */
|
|
2015-11-09 : Igor Pavlov : Public domain */
|
|
|
|
|
|