Applied changes same as on previous source (nw)

This commit is contained in:
Miodrag Milanovic 2015-01-11 08:30:12 +01:00
parent 05bb04cd29
commit d67caf1860
11 changed files with 75 additions and 39 deletions

View File

@ -6,10 +6,7 @@
#define kCrcPoly 0xEDB88320
#ifdef MY_CPU_X86_OR_AMD64
#define CRC_NUM_TABLES 8
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#elif defined(MY_CPU_LE)
#if defined(MY_CPU_LE)
#define CRC_NUM_TABLES 4
#else
#define CRC_NUM_TABLES 5

View File

@ -3,7 +3,7 @@
Igor Pavlov
Public domain */
#ifdef _WIN32
#ifdef _WIN32_7Z
#include <windows.h>
#endif
#include <stdlib.h>
@ -44,7 +44,7 @@ void MyFree(void *address)
free(address);
}
#ifdef _WIN32
#ifdef _WIN32_7Z
void *MidAlloc(size_t size)
{

View File

@ -13,7 +13,7 @@ extern "C" {
void *MyAlloc(size_t size);
void MyFree(void *address);
#ifdef _WIN32
#ifdef _WIN32_7Z
void SetLargePageSize();

View File

@ -72,16 +72,28 @@ static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
#else
__asm__ __volatile__ (
"cpuid"
: "=a" (*a) ,
"=b" (*b) ,
"=c" (*c) ,
"=d" (*d)
: "0" (function)) ;
#endif
#ifdef __PIC__
__asm__ __volatile__ (
"mov %%ebx, %%edi;"
"cpuid;"
"xchgl %%ebx, %%edi;"
: "=a" (*a) ,
"=D" (*b) , /* edi */
"=c" (*c) ,
"=d" (*d)
: "0" (function)) ;
#else // __PIC__
__asm__ __volatile__ (
"cpuid"
: "=a" (*a) ,
"=b" (*b) ,
"=c" (*c) ,
"=d" (*d)
: "0" (function)) ;
#endif // __PIC__
#endif
#else
int CPUInfo[4];
@ -123,7 +135,7 @@ int x86cpuid_GetFirm(const Cx86cpuid *p)
return -1;
}
Bool CPU_Is_InOrder()
Bool CPU_Is_InOrder(void)
{
Cx86cpuid p;
int firm;
@ -142,8 +154,8 @@ Bool CPU_Is_InOrder()
return True;
}
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
static Bool CPU_Sys_Is_SSE_Supported()
#if !defined(MY_CPU_AMD64) && defined(_WIN32_7Z)
static Bool CPU_Sys_Is_SSE_Supported(void)
{
OSVERSIONINFO vi;
vi.dwOSVersionInfoSize = sizeof(vi);
@ -156,7 +168,7 @@ static Bool CPU_Sys_Is_SSE_Supported()
#define CHECK_SYS_SSE_SUPPORT
#endif
Bool CPU_Is_Aes_Supported()
Bool CPU_Is_Aes_Supported(void)
{
Cx86cpuid p;
CHECK_SYS_SSE_SUPPORT

View File

@ -20,7 +20,7 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla
#define MY_CPU_AMD64
#endif
#if defined(MY_CPU_AMD64) || defined(_M_IA64)
#ifdef PTR64
#define MY_CPU_64BIT
#endif
@ -36,11 +36,11 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla
#define MY_CPU_32BIT
#endif
#if defined(_WIN32) && defined(_M_ARM)
#if defined(_WIN32_7Z) && defined(_M_ARM)
#define MY_CPU_ARM_LE
#endif
#if defined(_WIN32) && defined(_M_IA64)
#if defined(_WIN32_7Z) && defined(_M_IA64)
#define MY_CPU_IA64_LE
#endif
@ -52,7 +52,7 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla
#define MY_CPU_LE
#endif
#if defined(__BIG_ENDIAN__) || defined(__m68k__) || defined(__ARMEB__) || defined(__MIPSEB__)
#ifdef BIGENDIAN
#define MY_CPU_BE
#endif
@ -97,7 +97,8 @@ Stop_Compiling_Bad_Endian
#endif
#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300)
#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (defined(_MSC_VER) && (_MSC_VER >= 1300))
#include <stdlib.h>
#pragma intrinsic(_byteswap_ulong)
#pragma intrinsic(_byteswap_uint64)
@ -145,8 +146,8 @@ int x86cpuid_GetFirm(const Cx86cpuid *p);
#define x86cpuid_GetModel(p) (((p)->ver >> 4) & 0xF00F)
#define x86cpuid_GetStepping(p) ((p)->ver & 0xF)
Bool CPU_Is_InOrder();
Bool CPU_Is_Aes_Supported();
Bool CPU_Is_InOrder(void);
Bool CPU_Is_Aes_Supported(void);
#endif

View File

@ -967,6 +967,27 @@ SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAll
return SZ_OK;
}
// why isn't there an interface to pass in the properties directly????
SRes LzmaDec_Allocate_MAME(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
{
SizeT dicBufSize;
RINOK(LzmaDec_AllocateProbs2(p, propNew, alloc));
dicBufSize = propNew->dicSize;
if (p->dic == 0 || dicBufSize != p->dicBufSize)
{
LzmaDec_FreeDict(p, alloc);
p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
if (p->dic == 0)
{
LzmaDec_FreeProbs(p, alloc);
return SZ_ERROR_MEM;
}
}
p->dicBufSize = dicBufSize;
p->prop = *propNew;
return SZ_OK;
}
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
ELzmaStatus *status, ISzAlloc *alloc)

View File

@ -224,6 +224,11 @@ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
ELzmaStatus *status, ISzAlloc *alloc);
/*
* Why isn't there an interface to pass in the properties directly????
*/
SRes LzmaDec_Allocate_MAME(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc);
#ifdef __cplusplus
}
#endif

View File

@ -1905,11 +1905,13 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
{
UInt32 beforeSize = kNumOpts;
Bool btMode;
if (!RangeEnc_Alloc(&p->rc, alloc))
return SZ_ERROR_MEM;
btMode = (p->matchFinderBase.btMode != 0);
#ifndef _7ZIP_ST
Bool btMode;
#endif
if (!RangeEnc_Alloc(&p->rc, alloc))
return SZ_ERROR_MEM;
#ifndef _7ZIP_ST
btMode = (p->matchFinderBase.btMode != 0);
p->mtMode = (p->multiThread && !p->fastMode && btMode);
#endif
@ -2085,8 +2087,6 @@ void LzmaEnc_Finish(CLzmaEncHandle pp)
CLzmaEnc *p = (CLzmaEnc *)pp;
if (p->mtMode)
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
#else
pp = pp;
#endif
}

View File

@ -2,7 +2,7 @@
2010-03-12 : Igor Pavlov : Public domain
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
#include <memory.h>
#include <string.h>
#include "Ppmd7.h"

View File

@ -1,7 +1,7 @@
/* Threads.c -- multithreading library
2009-09-20 : Igor Pavlov : Public domain */
#ifndef _WIN32_WCE
#ifndef _WIN32_7Z_WCE
#include <process.h>
#endif

View File

@ -6,7 +6,7 @@
#include <stddef.h>
#ifdef _WIN32
#ifdef _WIN32_7Z
#include <windows.h>
#endif
@ -42,7 +42,7 @@ EXTERN_C_BEGIN
typedef int SRes;
#ifdef _WIN32
#ifdef _WIN32_7Z
typedef DWORD WRes;
#else
typedef int WRes;
@ -97,7 +97,7 @@ typedef int Bool;
#define False 0
#ifdef _WIN32
#ifdef _WIN32_7Z
#define MY_STD_CALL __stdcall
#else
#define MY_STD_CALL
@ -233,7 +233,7 @@ typedef struct
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
#define IAlloc_Free(p, a) (p)->Free((p), a)
#ifdef _WIN32
#ifdef _WIN32_7Z
#define CHAR_PATH_SEPARATOR '\\'
#define WCHAR_PATH_SEPARATOR L'\\'