This commit is contained in:
Igor Pavlov
2021-11-28 19:01:13 -08:00
committed by fn ⌃ ⌥
parent 585698650f
commit d789d4137d
88 changed files with 5996 additions and 1875 deletions

View File

@@ -0,0 +1,7 @@
// Sha256Prepare.cpp
#include "StdAfx.h"
#include "../../C/LzFind.h"
static struct CLzFindPrepare { CLzFindPrepare() { LzFindPrepare(); } } g_CLzFindPrepare;

View File

@@ -25,6 +25,19 @@ public:
operator const Byte *() const { return _data; }
size_t Size() const { return _size; }
void Alloc(size_t size)
{
if (!_data || size != _size)
{
::MidFree(_data);
_size = 0;
_data = NULL;
_data = (Byte *)::MidAlloc(size);
if (_data)
_size = size;
}
}
void AllocAtLeast(size_t size)
{
if (!_data || size > _size)
@@ -105,5 +118,22 @@ public:
}
};
/*
CMidAlignedBuffer must return aligned pointer.
- in Windows it uses CMidBuffer(): MidAlloc() : VirtualAlloc()
VirtualAlloc(): Memory allocated is automatically initialized to zero.
MidAlloc(0) returns NULL
- in non-Windows systems it uses g_AlignedAlloc.
g_AlignedAlloc::Alloc(size = 0) can return non NULL.
*/
typedef
#ifdef _WIN32
CMidBuffer
#else
CAlignedBuffer
#endif
CMidAlignedBuffer;
#endif