4.59 beta

This commit is contained in:
Igor Pavlov
2008-08-13 00:00:00 +00:00
committed by Kornel Lesiński
parent 3901bf0ab8
commit 173c07e166
781 changed files with 22124 additions and 13650 deletions

View File

@@ -49,7 +49,7 @@ static inline bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -80,7 +80,7 @@ enum Enum
};
}
static const CSwitchForm kSwitchForms[] =
static const CSwitchForm kSwitchForms[] =
{
{ L"?", NSwitchType::kSimple, false },
{ L"H", NSwitchType::kSimple, false },
@@ -135,7 +135,7 @@ static void IncorrectCommand()
PrintHelpAndExit("Incorrect command");
}
static void WriteArgumentsToStringList(int numArguments, const char *arguments[],
static void WriteArgumentsToStringList(int numArguments, const char *arguments[],
UStringVector &strings)
{
for(int i = 1; i < numArguments; i++)
@@ -176,7 +176,7 @@ int main2(int n, const char *args[])
{
fprintf(stderr, "Unsupported base types. Edit Common/Types.h and recompile");
return 1;
}
}
UStringVector commandStrings;
WriteArgumentsToStringList(n, args, commandStrings);
@@ -185,7 +185,7 @@ int main2(int n, const char *args[])
{
parser.ParseStrings(kSwitchForms, commandStrings);
}
catch(...)
catch(...)
{
IncorrectCommand();
}
@@ -200,7 +200,7 @@ int main2(int n, const char *args[])
int paramIndex = 0;
if (paramIndex >= nonSwitchStrings.Size())
IncorrectCommand();
const UString &command = nonSwitchStrings[paramIndex++];
const UString &command = nonSwitchStrings[paramIndex++];
bool dictionaryIsDefined = false;
UInt32 dictionary = (UInt32)-1;
@@ -268,12 +268,12 @@ int main2(int n, const char *args[])
{
if (paramIndex >= nonSwitchStrings.Size())
IncorrectCommand();
const UString &inputName = nonSwitchStrings[paramIndex++];
const UString &inputName = nonSwitchStrings[paramIndex++];
inStreamSpec = new CInFileStream;
inStream = inStreamSpec;
if (!inStreamSpec->Open(GetSystemString(inputName)))
{
fprintf(stderr, "\nError: can not open input file %s\n",
fprintf(stderr, "\nError: can not open input file %s\n",
(const char *)GetOemString(inputName));
return 1;
}
@@ -290,12 +290,12 @@ int main2(int n, const char *args[])
{
if (paramIndex >= nonSwitchStrings.Size())
IncorrectCommand();
const UString &outputName = nonSwitchStrings[paramIndex++];
const UString &outputName = nonSwitchStrings[paramIndex++];
outStreamSpec = new COutFileStream;
outStream = outStreamSpec;
if (!outStreamSpec->Create(GetSystemString(outputName), true))
{
fprintf(stderr, "\nError: can not open output file %s\n",
fprintf(stderr, "\nError: can not open output file %s\n",
(const char *)GetOemString(outputName));
return 1;
}
@@ -314,7 +314,7 @@ int main2(int n, const char *args[])
Byte *inBuffer = 0;
if (inSize != 0)
{
inBuffer = (Byte *)MyAlloc((size_t)inSize);
inBuffer = (Byte *)MyAlloc((size_t)inSize);
if (inBuffer == 0)
throw kCantAllocate;
}
@@ -330,7 +330,7 @@ int main2(int n, const char *args[])
outSize = (size_t)fileSize / 20 * 21 + (1 << 16);
if (outSize != 0)
{
outBuffer = (Byte *)MyAlloc((size_t)outSize);
outBuffer = (Byte *)MyAlloc((size_t)outSize);
if (outBuffer == 0)
throw kCantAllocate;
}
@@ -354,7 +354,7 @@ int main2(int n, const char *args[])
throw "too big";
if (outSize != 0)
{
outBuffer = (Byte *)MyAlloc(outSize);
outBuffer = (Byte *)MyAlloc(outSize);
if (outBuffer == 0)
throw kCantAllocate;
}
@@ -414,7 +414,7 @@ int main2(int n, const char *args[])
if (!GetNumber(parser[NKey::kPosBits].PostStrings[0], posStateBits))
IncorrectCommand();
PROPID propIDs[] =
PROPID propIDs[] =
{
NCoderPropID::kDictionarySize,
NCoderPropID::kPosStateBits,
@@ -480,12 +480,12 @@ int main2(int n, const char *args[])
{
fprintf(stderr, "\nError: Can not allocate memory\n");
return 1;
}
}
else if (result != S_OK)
{
fprintf(stderr, "\nEncoder error = %X\n", (unsigned int)result);
return 1;
}
}
}
else
{
@@ -511,7 +511,7 @@ int main2(int n, const char *args[])
{
fprintf(stderr, "Decoder error");
return 1;
}
}
}
if (outStreamSpec != NULL)
{
@@ -527,14 +527,14 @@ int main2(int n, const char *args[])
int MY_CDECL main(int n, const char *args[])
{
try { return main2(n, args); }
catch(const char *s)
{
catch(const char *s)
{
fprintf(stderr, "\nError: %s\n", s);
return 1;
return 1;
}
catch(...)
{
catch(...)
{
fprintf(stderr, "\nError\n");
return 1;
return 1;
}
}

View File

@@ -28,8 +28,8 @@
#endif
#endif
extern "C"
{
extern "C"
{
#include "../../../../C/Alloc.h"
#include "../../../../C/7zCrc.h"
}
@@ -60,9 +60,9 @@ class CBaseRandomGenerator
public:
CBaseRandomGenerator() { Init(); }
void Init() { A1 = 362436069; A2 = 521288629;}
UInt32 GetRnd()
UInt32 GetRnd()
{
return
return
((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
}
@@ -73,14 +73,14 @@ class CBenchBuffer
public:
size_t BufferSize;
Byte *Buffer;
CBenchBuffer(): Buffer(0) {}
CBenchBuffer(): Buffer(0) {}
virtual ~CBenchBuffer() { Free(); }
void Free()
{
void Free()
{
::MidFree(Buffer);
Buffer = 0;
}
bool Alloc(size_t bufferSize)
bool Alloc(size_t bufferSize)
{
if (Buffer != 0 && BufferSize == bufferSize)
return true;
@@ -96,14 +96,14 @@ class CBenchRandomGenerator: public CBenchBuffer
CBaseRandomGenerator *RG;
public:
void Set(CBaseRandomGenerator *rg) { RG = rg; }
UInt32 GetVal(UInt32 &res, int numBits)
UInt32 GetVal(UInt32 &res, int numBits)
{
UInt32 val = res & (((UInt32)1 << numBits) - 1);
res >>= numBits;
return val;
}
UInt32 GetLen(UInt32 &res)
{
UInt32 GetLen(UInt32 &res)
{
UInt32 len = GetVal(res, 2);
return GetVal(res, 1 + len);
}
@@ -145,7 +145,7 @@ public:
};
class CBenchmarkInStream:
class CBenchmarkInStream:
public ISequentialInStream,
public CMyUnknownImp
{
@@ -179,7 +179,7 @@ STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processed
return S_OK;
}
class CBenchmarkOutStream:
class CBenchmarkOutStream:
public ISequentialOutStream,
public CBenchBuffer,
public CMyUnknownImp
@@ -187,8 +187,8 @@ class CBenchmarkOutStream:
// bool _overflow;
public:
UInt32 Pos;
// CBenchmarkOutStream(): _overflow(false) {}
void Init()
// CBenchmarkOutStream(): _overflow(false) {}
void Init()
{
// _overflow = false;
Pos = 0;
@@ -214,7 +214,7 @@ STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *p
return S_OK;
}
class CCrcOutStream:
class CCrcOutStream:
public ISequentialOutStream,
public CMyUnknownImp
{
@@ -251,7 +251,7 @@ static UInt64 GetTimeCount()
return value.QuadPart;
*/
return GetTickCount();
#endif
#endif
}
static UInt64 GetFreq()
@@ -261,7 +261,7 @@ static UInt64 GetFreq()
return 1000000;
#else
return 1;
#endif
#endif
#else
/*
LARGE_INTEGER value;
@@ -269,7 +269,7 @@ static UInt64 GetFreq()
return value.QuadPart;
*/
return 1000;
#endif
#endif
}
#ifndef USE_POSIX_TIME
@@ -284,7 +284,7 @@ static UInt64 GetUserTime()
if (::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime) != 0)
return GetTime64(userTime) + GetTime64(kernelTime);
return (UInt64)GetTickCount() * 10000;
#endif
#endif
}
static UInt64 GetUserFreq()
@@ -293,18 +293,18 @@ static UInt64 GetUserFreq()
return CLOCKS_PER_SEC;
#else
return 10000000;
#endif
#endif
}
class CBenchProgressStatus
{
#ifdef BENCH_MT
NWindows::NSynchronization::CCriticalSection CS;
NWindows::NSynchronization::CCriticalSection CS;
#endif
public:
HRESULT Res;
bool EncodeMode;
void SetResult(HRESULT res)
void SetResult(HRESULT res)
{
#ifdef BENCH_MT
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
@@ -450,7 +450,7 @@ UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt
}
#ifdef EXTERNAL_LZMA
typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
const GUID *interfaceID, void **outObject);
#endif
@@ -571,9 +571,9 @@ HRESULT CEncoderInfo::Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandom
return E_OUTOFMEMORY;
propStreamSpec->Init();
PROPID propIDs[] =
{
NCoderPropID::kDictionarySize,
PROPID propIDs[] =
{
NCoderPropID::kDictionarySize,
NCoderPropID::kMultiThread
};
const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
@@ -664,13 +664,13 @@ HRESULT LzmaBench(
#endif
UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback)
{
UInt32 numEncoderThreads =
UInt32 numEncoderThreads =
#ifdef BENCH_MT
(numThreads > 1 ? numThreads / 2 : 1);
#else
1;
#endif
UInt32 numSubDecoderThreads =
UInt32 numSubDecoderThreads =
#ifdef BENCH_MT
(numThreads > 1 ? 2 : 1);
#else
@@ -838,7 +838,7 @@ HRESULT LzmaBench(
inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
{
{
UInt32 hs = dictionary - 1;
hs |= (hs >> 1);
hs |= (hs >> 2);
@@ -849,7 +849,7 @@ inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
if (hs > (1 << 24))
hs >>= 1;
hs++;
return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
(1 << 20) + (multiThread ? (6 << 20) : 0);
}
@@ -905,10 +905,10 @@ struct CCrcThreads
Items[i].Wait();
NumThreads = 0;
}
~CCrcThreads()
{
~CCrcThreads()
{
WaitAll();
delete []Items;
delete []Items;
}
};
#endif

View File

@@ -12,8 +12,8 @@
struct CBenchInfo
{
UInt64 GlobalTime;
UInt64 GlobalFreq;
UInt64 UserTime;
UInt64 GlobalFreq;
UInt64 UserTime;
UInt64 UserFreq;
UInt64 UnpackSize;
UInt64 PackSize;

View File

@@ -24,18 +24,18 @@ struct CTotalBenchRes
UInt64 Usage;
UInt64 RPU;
void Init() { NumIterations = 0; Rating = 0; Usage = 0; RPU = 0; }
void Normalize()
{
if (NumIterations == 0)
void Normalize()
{
if (NumIterations == 0)
return;
Rating /= NumIterations;
Usage /= NumIterations;
RPU /= NumIterations;
Rating /= NumIterations;
Usage /= NumIterations;
RPU /= NumIterations;
NumIterations = 1;
}
void SetMid(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
{
Rating = (r1.Rating + r2.Rating) / 2;
void SetMid(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
{
Rating = (r1.Rating + r2.Rating) / 2;
Usage = (r1.Usage + r2.Usage) / 2;
RPU = (r1.RPU + r2.RPU) / 2;
NumIterations = (r1.NumIterations + r2.NumIterations) / 2;
@@ -168,7 +168,7 @@ HRESULT LzmaBenchCon(
if (!CrcInternalTest())
return S_FALSE;
#ifdef BENCH_MT
UInt64 ramSize = NWindows::NSystem::GetRamSize(); //
UInt64 ramSize = NWindows::NSystem::GetRamSize(); //
UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
if (numThreads == (UInt32)-1)

View File

@@ -12,7 +12,7 @@ endif
ifdef IS_MINGW
FILE_IO =FileIO
FILE_IO_2 =Windows/$(FILE_IO)
LIB2 = -luuid
LIB2 = -luuid
else
FILE_IO =C_FileIO
FILE_IO_2 =Common/$(FILE_IO)