PhysicsFS 2.0.3 imported.
This commit is contained in:
parent
bcc0937726
commit
993311d151
459 changed files with 87785 additions and 0 deletions
26
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARM.c
Normal file
26
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARM.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* BranchARM.c */
|
||||
|
||||
#include "BranchARM.h"
|
||||
|
||||
UInt32 ARM_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i + 4 <= size; i += 4)
|
||||
{
|
||||
if (data[i + 3] == 0xEB)
|
||||
{
|
||||
UInt32 dest;
|
||||
UInt32 src = (data[i + 2] << 16) | (data[i + 1] << 8) | (data[i + 0]);
|
||||
src <<= 2;
|
||||
if (encoding)
|
||||
dest = nowPos + i + 8 + src;
|
||||
else
|
||||
dest = src - (nowPos + i + 8);
|
||||
dest >>= 2;
|
||||
data[i + 2] = (Byte)(dest >> 16);
|
||||
data[i + 1] = (Byte)(dest >> 8);
|
||||
data[i + 0] = (Byte)dest;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARM.h
Normal file
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARM.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* BranchARM.h */
|
||||
|
||||
#ifndef __BRANCH_ARM_H
|
||||
#define __BRANCH_ARM_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
UInt32 ARM_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
|
||||
|
||||
#endif
|
35
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARMThumb.c
Normal file
35
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARMThumb.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* BranchARMThumb.c */
|
||||
|
||||
#include "BranchARMThumb.h"
|
||||
|
||||
UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i + 4 <= size; i += 2)
|
||||
{
|
||||
if ((data[i + 1] & 0xF8) == 0xF0 &&
|
||||
(data[i + 3] & 0xF8) == 0xF8)
|
||||
{
|
||||
UInt32 dest;
|
||||
UInt32 src =
|
||||
((data[i + 1] & 0x7) << 19) |
|
||||
(data[i + 0] << 11) |
|
||||
((data[i + 3] & 0x7) << 8) |
|
||||
(data[i + 2]);
|
||||
|
||||
src <<= 1;
|
||||
if (encoding)
|
||||
dest = nowPos + i + 4 + src;
|
||||
else
|
||||
dest = src - (nowPos + i + 4);
|
||||
dest >>= 1;
|
||||
|
||||
data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7));
|
||||
data[i + 0] = (Byte)(dest >> 11);
|
||||
data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7));
|
||||
data[i + 2] = (Byte)dest;
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARMThumb.h
Normal file
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchARMThumb.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* BranchARMThumb.h */
|
||||
|
||||
#ifndef __BRANCH_ARM_THUMB_H
|
||||
#define __BRANCH_ARM_THUMB_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
|
||||
|
||||
#endif
|
66
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchIA64.c
Normal file
66
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchIA64.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* BranchIA64.c */
|
||||
|
||||
#include "BranchIA64.h"
|
||||
|
||||
const Byte kBranchTable[32] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
4, 4, 6, 6, 0, 0, 7, 7,
|
||||
4, 4, 0, 0, 4, 4, 0, 0
|
||||
};
|
||||
|
||||
UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i + 16 <= size; i += 16)
|
||||
{
|
||||
UInt32 instrTemplate = data[i] & 0x1F;
|
||||
UInt32 mask = kBranchTable[instrTemplate];
|
||||
UInt32 bitPos = 5;
|
||||
int slot;
|
||||
for (slot = 0; slot < 3; slot++, bitPos += 41)
|
||||
{
|
||||
UInt32 bytePos, bitRes;
|
||||
UInt64 instruction, instNorm;
|
||||
int j;
|
||||
if (((mask >> slot) & 1) == 0)
|
||||
continue;
|
||||
bytePos = (bitPos >> 3);
|
||||
bitRes = bitPos & 0x7;
|
||||
instruction = 0;
|
||||
for (j = 0; j < 6; j++)
|
||||
instruction += (UInt64)(data[i + j + bytePos]) << (8 * j);
|
||||
|
||||
instNorm = instruction >> bitRes;
|
||||
if (((instNorm >> 37) & 0xF) == 0x5
|
||||
&& ((instNorm >> 9) & 0x7) == 0
|
||||
/* && (instNorm & 0x3F)== 0 */
|
||||
)
|
||||
{
|
||||
UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
|
||||
UInt32 dest;
|
||||
src |= ((UInt32)(instNorm >> 36) & 1) << 20;
|
||||
|
||||
src <<= 4;
|
||||
|
||||
if (encoding)
|
||||
dest = nowPos + i + src;
|
||||
else
|
||||
dest = src - (nowPos + i);
|
||||
|
||||
dest >>= 4;
|
||||
|
||||
instNorm &= ~((UInt64)(0x8FFFFF) << 13);
|
||||
instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
|
||||
instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
|
||||
|
||||
instruction &= (1 << bitRes) - 1;
|
||||
instruction |= (instNorm << bitRes);
|
||||
for (j = 0; j < 6; j++)
|
||||
data[i + j + bytePos] = (Byte)(instruction >> (8 * j));
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchIA64.h
Normal file
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchIA64.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* BranchIA64.h */
|
||||
|
||||
#ifndef __BRANCH_IA64_H
|
||||
#define __BRANCH_IA64_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
|
||||
|
||||
#endif
|
36
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchPPC.c
Normal file
36
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchPPC.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* BranchPPC.c */
|
||||
|
||||
#include "BranchPPC.h"
|
||||
|
||||
UInt32 PPC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i + 4 <= size; i += 4)
|
||||
{
|
||||
/* PowerPC branch 6(48) 24(Offset) 1(Abs) 1(Link) */
|
||||
if ((data[i] >> 2) == 0x12 &&
|
||||
(
|
||||
(data[i + 3] & 3) == 1
|
||||
/* || (data[i+3] & 3) == 3 */
|
||||
)
|
||||
)
|
||||
{
|
||||
UInt32 src = ((data[i + 0] & 3) << 24) |
|
||||
(data[i + 1] << 16) |
|
||||
(data[i + 2] << 8) |
|
||||
(data[i + 3] & (~3));
|
||||
|
||||
UInt32 dest;
|
||||
if (encoding)
|
||||
dest = nowPos + i + src;
|
||||
else
|
||||
dest = src - (nowPos + i);
|
||||
data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3));
|
||||
data[i + 1] = (Byte)(dest >> 16);
|
||||
data[i + 2] = (Byte)(dest >> 8);
|
||||
data[i + 3] &= 0x3;
|
||||
data[i + 3] |= dest;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchPPC.h
Normal file
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchPPC.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* BranchPPC.h */
|
||||
|
||||
#ifndef __BRANCH_PPC_H
|
||||
#define __BRANCH_PPC_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
UInt32 PPC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
|
||||
|
||||
#endif
|
36
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchSPARC.c
Normal file
36
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchSPARC.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* BranchSPARC.c */
|
||||
|
||||
#include "BranchSPARC.h"
|
||||
|
||||
UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i + 4 <= size; i += 4)
|
||||
{
|
||||
if (data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00 ||
|
||||
data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)
|
||||
{
|
||||
UInt32 src =
|
||||
((UInt32)data[i + 0] << 24) |
|
||||
((UInt32)data[i + 1] << 16) |
|
||||
((UInt32)data[i + 2] << 8) |
|
||||
((UInt32)data[i + 3]);
|
||||
UInt32 dest;
|
||||
|
||||
src <<= 2;
|
||||
if (encoding)
|
||||
dest = nowPos + i + src;
|
||||
else
|
||||
dest = src - (nowPos + i);
|
||||
dest >>= 2;
|
||||
|
||||
dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
|
||||
|
||||
data[i + 0] = (Byte)(dest >> 24);
|
||||
data[i + 1] = (Byte)(dest >> 16);
|
||||
data[i + 2] = (Byte)(dest >> 8);
|
||||
data[i + 3] = (Byte)dest;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchSPARC.h
Normal file
10
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchSPARC.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* BranchSPARC.h */
|
||||
|
||||
#ifndef __BRANCH_SPARC_H
|
||||
#define __BRANCH_SPARC_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
|
||||
|
||||
#endif
|
51
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchTypes.h
Normal file
51
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchTypes.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* BranchTypes.h */
|
||||
|
||||
#ifndef __BRANCHTYPES_H
|
||||
#define __BRANCHTYPES_H
|
||||
|
||||
#ifndef _7ZIP_BYTE_DEFINED
|
||||
#define _7ZIP_BYTE_DEFINED
|
||||
typedef unsigned char Byte;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT16_DEFINED
|
||||
#define _7ZIP_UINT16_DEFINED
|
||||
typedef unsigned short UInt16;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT32_DEFINED
|
||||
#define _7ZIP_UINT32_DEFINED
|
||||
#ifdef _LZMA_UINT32_IS_ULONG
|
||||
typedef unsigned long UInt32;
|
||||
#else
|
||||
typedef unsigned int UInt32;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT64_DEFINED
|
||||
#define _7ZIP_UINT64_DEFINED
|
||||
#ifdef _SZ_NO_INT_64
|
||||
typedef unsigned long UInt64;
|
||||
#else
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 UInt64;
|
||||
#else
|
||||
typedef unsigned long long int UInt64;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* #define _LZMA_NO_SYSTEM_SIZE_T */
|
||||
/* You can use it, if you don't want <stddef.h> */
|
||||
|
||||
#ifndef _7ZIP_SIZET_DEFINED
|
||||
#define _7ZIP_SIZET_DEFINED
|
||||
#ifdef _LZMA_NO_SYSTEM_SIZE_T
|
||||
typedef UInt32 SizeT;
|
||||
#else
|
||||
#include <stddef.h>
|
||||
typedef size_t SizeT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
84
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86.c
Normal file
84
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/* BranchX86.c */
|
||||
|
||||
#include "BranchX86.h"
|
||||
|
||||
#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
|
||||
|
||||
const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0};
|
||||
const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3};
|
||||
|
||||
SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *prevMaskMix, int encoding)
|
||||
{
|
||||
SizeT bufferPos = 0, prevPosT;
|
||||
UInt32 prevMask = *prevMaskMix & 0x7;
|
||||
if (endPos < 5)
|
||||
return 0;
|
||||
nowPos += 5;
|
||||
prevPosT = (SizeT)0 - 1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
Byte *p = buffer + bufferPos;
|
||||
Byte *limit = buffer + endPos - 4;
|
||||
for (; p < limit; p++)
|
||||
if ((*p & 0xFE) == 0xE8)
|
||||
break;
|
||||
bufferPos = (SizeT)(p - buffer);
|
||||
if (p >= limit)
|
||||
break;
|
||||
prevPosT = bufferPos - prevPosT;
|
||||
if (prevPosT > 3)
|
||||
prevMask = 0;
|
||||
else
|
||||
{
|
||||
prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7;
|
||||
if (prevMask != 0)
|
||||
{
|
||||
Byte b = p[4 - kMaskToBitNumber[prevMask]];
|
||||
if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b))
|
||||
{
|
||||
prevPosT = bufferPos;
|
||||
prevMask = ((prevMask << 1) & 0x7) | 1;
|
||||
bufferPos++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
prevPosT = bufferPos;
|
||||
|
||||
if (Test86MSByte(p[4]))
|
||||
{
|
||||
UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]);
|
||||
UInt32 dest;
|
||||
for (;;)
|
||||
{
|
||||
Byte b;
|
||||
int index;
|
||||
if (encoding)
|
||||
dest = (nowPos + (UInt32)bufferPos) + src;
|
||||
else
|
||||
dest = src - (nowPos + (UInt32)bufferPos);
|
||||
if (prevMask == 0)
|
||||
break;
|
||||
index = kMaskToBitNumber[prevMask] * 8;
|
||||
b = (Byte)(dest >> (24 - index));
|
||||
if (!Test86MSByte(b))
|
||||
break;
|
||||
src = dest ^ ((1 << (32 - index)) - 1);
|
||||
}
|
||||
p[4] = (Byte)(~(((dest >> 24) & 1) - 1));
|
||||
p[3] = (Byte)(dest >> 16);
|
||||
p[2] = (Byte)(dest >> 8);
|
||||
p[1] = (Byte)dest;
|
||||
bufferPos += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
prevMask = ((prevMask << 1) & 0x7) | 1;
|
||||
bufferPos++;
|
||||
}
|
||||
}
|
||||
prevPosT = bufferPos - prevPosT;
|
||||
*prevMaskMix = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7));
|
||||
return bufferPos;
|
||||
}
|
12
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86.h
Normal file
12
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* BranchX86.h */
|
||||
|
||||
#ifndef __BRANCHX86_H
|
||||
#define __BRANCHX86_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
#define x86_Convert_Init(state) { state = 0; }
|
||||
|
||||
SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *state, int encoding);
|
||||
|
||||
#endif
|
135
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86_2.c
Normal file
135
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86_2.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
// BranchX86_2.c
|
||||
|
||||
#include "BranchX86_2.h"
|
||||
|
||||
#include "../../Alloc.h"
|
||||
|
||||
#ifdef _LZMA_PROB32
|
||||
#define CProb UInt32
|
||||
#else
|
||||
#define CProb UInt16
|
||||
#endif
|
||||
|
||||
#define IsJcc(b0, b1) ((b0) == 0x0F && ((b1) & 0xF0) == 0x80)
|
||||
#define IsJ(b0, b1) ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1))
|
||||
|
||||
#define kNumTopBits 24
|
||||
#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
|
||||
#define kNumBitModelTotalBits 11
|
||||
#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
#define kNumMoveBits 5
|
||||
|
||||
#define RC_READ_BYTE (*Buffer++)
|
||||
|
||||
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
|
||||
{ int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
|
||||
|
||||
#define RC_TEST { if (Buffer == BufferLim) return BCJ2_RESULT_DATA_ERROR; }
|
||||
|
||||
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
|
||||
|
||||
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
|
||||
|
||||
#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
|
||||
#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
|
||||
#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
|
||||
// #define UpdateBit0(p) Range = bound; *(p) = (CProb)(*(p) + ((kBitModelTotal - *(p)) >> kNumMoveBits));
|
||||
// #define UpdateBit1(p) Range -= bound; Code -= bound; *(p) = (CProb)(*(p) - (*(p) >> kNumMoveBits));
|
||||
|
||||
int x86_2_Decode(
|
||||
const Byte *buf0, SizeT size0,
|
||||
const Byte *buf1, SizeT size1,
|
||||
const Byte *buf2, SizeT size2,
|
||||
const Byte *buf3, SizeT size3,
|
||||
Byte *outBuf, SizeT outSize)
|
||||
{
|
||||
CProb p[256 + 2];
|
||||
SizeT inPos = 0, outPos = 0;
|
||||
|
||||
const Byte *Buffer, *BufferLim;
|
||||
UInt32 Range, Code;
|
||||
Byte prevByte = 0;
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < sizeof(p) / sizeof(p[0]); i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
RC_INIT(buf3, size3);
|
||||
|
||||
if (outSize == 0)
|
||||
return BCJ2_RESULT_OK;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
Byte b;
|
||||
CProb *prob;
|
||||
UInt32 bound;
|
||||
|
||||
SizeT limit = size0 - inPos;
|
||||
if (outSize - outPos < limit)
|
||||
limit = outSize - outPos;
|
||||
while (limit != 0)
|
||||
{
|
||||
Byte b = buf0[inPos];
|
||||
outBuf[outPos++] = b;
|
||||
if (IsJ(prevByte, b))
|
||||
break;
|
||||
inPos++;
|
||||
prevByte = b;
|
||||
limit--;
|
||||
}
|
||||
|
||||
if (limit == 0 || outPos == outSize)
|
||||
break;
|
||||
|
||||
b = buf0[inPos++];
|
||||
|
||||
if (b == 0xE8)
|
||||
prob = p + prevByte;
|
||||
else if (b == 0xE9)
|
||||
prob = p + 256;
|
||||
else
|
||||
prob = p + 257;
|
||||
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob)
|
||||
prevByte = b;
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 dest;
|
||||
const Byte *v;
|
||||
UpdateBit1(prob)
|
||||
if (b == 0xE8)
|
||||
{
|
||||
v = buf1;
|
||||
if (size1 < 4)
|
||||
return BCJ2_RESULT_DATA_ERROR;
|
||||
buf1 += 4;
|
||||
size1 -= 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
v = buf2;
|
||||
if (size2 < 4)
|
||||
return BCJ2_RESULT_DATA_ERROR;
|
||||
buf2 += 4;
|
||||
size2 -= 4;
|
||||
}
|
||||
dest = (((UInt32)v[0] << 24) | ((UInt32)v[1] << 16) |
|
||||
((UInt32)v[2] << 8) | ((UInt32)v[3])) - ((UInt32)outPos + 4);
|
||||
outBuf[outPos++] = (Byte)dest;
|
||||
if (outPos == outSize)
|
||||
break;
|
||||
outBuf[outPos++] = (Byte)(dest >> 8);
|
||||
if (outPos == outSize)
|
||||
break;
|
||||
outBuf[outPos++] = (Byte)(dest >> 16);
|
||||
if (outPos == outSize)
|
||||
break;
|
||||
outBuf[outPos++] = prevByte = (Byte)(dest >> 24);
|
||||
}
|
||||
}
|
||||
return (outPos == outSize) ? BCJ2_RESULT_OK : BCJ2_RESULT_DATA_ERROR;
|
||||
}
|
28
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86_2.h
Normal file
28
lib/physfs-2.0.3/lzma/C/Compress/Branch/BranchX86_2.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// BranchX86_2.h
|
||||
|
||||
#ifndef __BRANCHX86_2_H
|
||||
#define __BRANCHX86_2_H
|
||||
|
||||
#include "BranchTypes.h"
|
||||
|
||||
#define BCJ2_RESULT_OK 0
|
||||
#define BCJ2_RESULT_DATA_ERROR 1
|
||||
|
||||
/*
|
||||
Conditions:
|
||||
outSize <= FullOutputSize,
|
||||
where FullOutputSize is full size of output stream of x86_2 filter.
|
||||
|
||||
If buf0 overlaps outBuf, there are two required conditions:
|
||||
1) (buf0 >= outBuf)
|
||||
2) (buf0 + size0 >= outBuf + FullOutputSize).
|
||||
*/
|
||||
|
||||
int x86_2_Decode(
|
||||
const Byte *buf0, SizeT size0,
|
||||
const Byte *buf1, SizeT size1,
|
||||
const Byte *buf2, SizeT size2,
|
||||
const Byte *buf3, SizeT size3,
|
||||
Byte *outBuf, SizeT outSize);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue