mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 20:07:05 -06:00
4.25 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
47f4915611
commit
af1fe52701
@@ -51,7 +51,7 @@ void CCRC::UpdateUInt64(UInt64 v)
|
||||
UpdateByte((Byte)(v >> (8 * i)));
|
||||
}
|
||||
|
||||
void CCRC::Update(const void *data, UInt32 size)
|
||||
void CCRC::Update(const void *data, size_t size)
|
||||
{
|
||||
UInt32 v = _value;
|
||||
const Byte *p = (const Byte *)data;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#ifndef __COMMON_CRC_H
|
||||
#define __COMMON_CRC_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "Types.h"
|
||||
|
||||
class CCRC
|
||||
@@ -18,15 +19,15 @@ public:
|
||||
void UpdateUInt16(UInt16 v);
|
||||
void UpdateUInt32(UInt32 v);
|
||||
void UpdateUInt64(UInt64 v);
|
||||
void Update(const void *data, UInt32 size);
|
||||
void Update(const void *data, size_t size);
|
||||
UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
|
||||
static UInt32 CalculateDigest(const void *data, UInt32 size)
|
||||
static UInt32 CalculateDigest(const void *data, size_t size)
|
||||
{
|
||||
CCRC crc;
|
||||
crc.Update(data, size);
|
||||
return crc.GetDigest();
|
||||
}
|
||||
static bool VerifyDigest(UInt32 digest, const void *data, UInt32 size)
|
||||
static bool VerifyDigest(UInt32 digest, const void *data, size_t size)
|
||||
{
|
||||
return (CalculateDigest(data, size) == digest);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ void CRandom::Init(unsigned int seed)
|
||||
{ srand(seed); }
|
||||
|
||||
void CRandom::Init()
|
||||
{ Init(time(NULL)); }
|
||||
{ Init((unsigned int)time(NULL)); }
|
||||
|
||||
int CRandom::Generate() const
|
||||
{ return rand(); }
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
#define __STDAFX_H
|
||||
|
||||
// #include "MyWindows.h"
|
||||
#include "NewHandler.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
static const char *kTrimDefaultCharSet = " \n\t";
|
||||
|
||||
template <class T>
|
||||
inline size_t MyStringLen(const T *s)
|
||||
inline int MyStringLen(const T *s)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; s[i] != '\0'; i++);
|
||||
@@ -112,7 +112,7 @@ class CStringBase
|
||||
const T *p = _chars;
|
||||
while (charSet.Find(*p) >= 0 && (*p != 0))
|
||||
p = GetNextCharPointer(p);
|
||||
Delete(0, p - _chars);
|
||||
Delete(0, (int)(p - _chars));
|
||||
}
|
||||
void TrimRightWithCharSet(const CStringBase &charSet)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ class CStringBase
|
||||
}
|
||||
if(pLast != NULL)
|
||||
{
|
||||
int i = pLast - _chars;
|
||||
int i = (int)(pLast - _chars);
|
||||
Delete(i, _length - i);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
while (true)
|
||||
{
|
||||
if (*p == c)
|
||||
return p - _chars;
|
||||
return (int)(p - _chars);
|
||||
if (*p == 0)
|
||||
return -1;
|
||||
p = GetNextCharPointer(p);
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
while (true)
|
||||
{
|
||||
if (*p == c)
|
||||
return p - _chars;
|
||||
return (int)(p - _chars);
|
||||
if (p == _chars)
|
||||
return -1;
|
||||
p = GetPrevCharPointer(_chars, p);
|
||||
|
||||
Reference in New Issue
Block a user