This commit is contained in:
Igor Pavlov
2021-11-28 19:03:01 -08:00
committed by fn ⌃ ⌥
parent d789d4137d
commit 1194dc9353
152 changed files with 6049 additions and 946 deletions

60
CPP/Common/CksumReg.cpp Normal file
View File

@@ -0,0 +1,60 @@
// CksumReg.cpp
#include "StdAfx.h"
#include "../../C/CpuArch.h"
#include "../Common/MyCom.h"
#include "../7zip/Common/RegisterCodec.h"
#include "../7zip/Compress/BZip2Crc.h"
class CCksumHasher:
public IHasher,
public CMyUnknownImp
{
CBZip2Crc _crc;
UInt64 _size;
Byte mtDummy[1 << 7];
public:
CCksumHasher()
{
_crc.Init(0);
_size = 0;
}
MY_UNKNOWN_IMP1(IHasher)
INTERFACE_IHasher(;)
};
STDMETHODIMP_(void) CCksumHasher::Init() throw()
{
_crc.Init(0);
_size = 0;
}
STDMETHODIMP_(void) CCksumHasher::Update(const void *data, UInt32 size) throw()
{
_size += size;
CBZip2Crc crc = _crc;
for (UInt32 i = 0; i < size; i++)
crc.UpdateByte(((const Byte *)data)[i]);
_crc = crc;
}
STDMETHODIMP_(void) CCksumHasher::Final(Byte *digest) throw()
{
UInt64 size = _size;
CBZip2Crc crc = _crc;
while (size)
{
crc.UpdateByte((Byte)size);
size >>= 8;
}
const UInt32 val = crc.GetDigest();
SetUi32(digest, val);
}
REGISTER_HASHER(CCksumHasher, 0x203, "CKSUM", 4)

View File

@@ -230,8 +230,8 @@ public:
#define MY_ADDREF_RELEASE \
STDMETHOD_(ULONG, AddRef)() throw() { return ++__m_RefCount; } \
STDMETHOD_(ULONG, Release)() { if (--__m_RefCount != 0) \
return __m_RefCount; delete this; return 0; }
STDMETHOD_(ULONG, Release)() { if (--__m_RefCount != 0) return __m_RefCount; \
delete this; return 0; }
#define MY_UNKNOWN_IMP_SPEC(i) \
MY_QUERYINTERFACE_BEGIN \

View File

@@ -322,6 +322,17 @@ bool IsString1PrefixedByString2(const wchar_t *s1, const char *s2) throw()
}
}
bool IsString1PrefixedByString2_NoCase_Ascii(const char *s1, const char *s2) throw()
{
for (;;)
{
char c2 = *s2++; if (c2 == 0) return true;
char c1 = *s1++;
if (c1 != c2 && MyCharLower_Ascii(c1) != MyCharLower_Ascii(c2))
return false;
}
}
bool IsString1PrefixedByString2_NoCase_Ascii(const wchar_t *s1, const char *s2) throw()
{
for (;;)

View File

@@ -198,6 +198,7 @@ bool StringsAreEqualNoCase(const wchar_t *s1, const wchar_t *s2) throw();
bool IsString1PrefixedByString2(const char *s1, const char *s2) throw();
bool IsString1PrefixedByString2(const wchar_t *s1, const wchar_t *s2) throw();
bool IsString1PrefixedByString2(const wchar_t *s1, const char *s2) throw();
bool IsString1PrefixedByString2_NoCase_Ascii(const char *s1, const char *s2) throw();
bool IsString1PrefixedByString2_NoCase_Ascii(const wchar_t *u, const char *a) throw();
bool IsString1PrefixedByString2_NoCase(const wchar_t *s1, const wchar_t *s2) throw();

View File

@@ -25,6 +25,12 @@ struct CBoolPair
Val = true;
Def = true;
}
void SetVal_as_Defined(bool val)
{
Val = val;
Def = true;
}
};
#define CLASS_NO_COPY(cls) \

View File

@@ -59,8 +59,18 @@ class CCensorNode MY_UNCOPYABLE
bool CheckPathCurrent(bool include, const UStringVector &pathParts, bool isFile) const;
void AddItemSimple(bool include, CItem &item);
public:
CCensorNode(): Parent(NULL) { };
CCensorNode(const UString &name, CCensorNode *parent): Parent(parent), Name(name) { };
// bool ExcludeDirItems;
CCensorNode():
Parent(NULL)
// , ExcludeDirItems(false)
{};
CCensorNode(const UString &name, CCensorNode *parent):
Parent(parent)
// , ExcludeDirItems(false)
, Name(name)
{}
UString Name; // WIN32 doesn't support wildcards in file names
CObjectVector<CCensorNode> SubNodes;
@@ -151,6 +161,14 @@ class CCensor MY_UNCOPYABLE
public:
CObjectVector<CPair> Pairs;
bool ExcludeDirItems;
bool ExcludeFileItems;
CCensor():
ExcludeDirItems(false),
ExcludeFileItems(false)
{}
CObjectVector<NWildcard::CCensorPath> CensorPaths;
bool AllAreRelative() const