Single-file decoder script can now (optionally) create an encoder
To complement the single-file decoder a new script was added to create an amalgamated single-file of all of the Zstd source, along with examples and (simple) tests.
This commit is contained in:
@@ -626,7 +626,9 @@ size_t FSE_compress_usingCTable (void* dst, size_t dstSize,
|
||||
size_t FSE_compressBound(size_t size) { return FSE_COMPRESSBOUND(size); }
|
||||
|
||||
#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e
|
||||
#ifndef CHECK_F
|
||||
#define CHECK_F(f) { CHECK_V_F(_var_err__, f); }
|
||||
#endif
|
||||
|
||||
/* FSE_compress_wksp() :
|
||||
* Same as FSE_compress2(), but using an externally allocated scratch buffer (`workSpace`).
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
#define HUF_isError ERR_isError
|
||||
#define HUF_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c) /* use only *after* variable declarations */
|
||||
#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e
|
||||
#ifndef CHECK_F
|
||||
#define CHECK_F(f) { CHECK_V_F(_var_err__, f); }
|
||||
#endif
|
||||
|
||||
|
||||
/* **************************************************************
|
||||
|
||||
@@ -3749,13 +3749,16 @@ static size_t ZSTD_nextInputSizeHint(const ZSTD_CCtx* cctx)
|
||||
return hintInSize;
|
||||
}
|
||||
|
||||
static size_t ZSTD_limitCopy(void* dst, size_t dstCapacity,
|
||||
const void* src, size_t srcSize)
|
||||
#ifndef ZSTD_DECOMPRESS_INTERNAL_H /* zstd_decompress.c has the same function */
|
||||
MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
|
||||
{
|
||||
size_t const length = MIN(dstCapacity, srcSize);
|
||||
if (length) memcpy(dst, src, length);
|
||||
if (length > 0) {
|
||||
memcpy(dst, src, length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** ZSTD_compressStream_generic():
|
||||
* internal function for all *compressStream*() variants
|
||||
|
||||
@@ -1498,6 +1498,7 @@ size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize)
|
||||
|
||||
/* ***** Decompression ***** */
|
||||
|
||||
#ifndef ZSTD_COMPRESS_H /* zstd_compress.c has the same function */
|
||||
MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
|
||||
{
|
||||
size_t const length = MIN(dstCapacity, srcSize);
|
||||
@@ -1506,7 +1507,7 @@ MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, const void* src,
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user