Merge branch 'dev' into donotdelete
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||
-Wstrict-prototypes -Wundef -Wformat-security \
|
||||
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
||||
-Wredundant-decls
|
||||
-Wredundant-decls -Wmissing-prototypes
|
||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
|
||||
+11
-11
@@ -127,14 +127,14 @@ static ZSTD_DCtx* g_zdc = NULL;
|
||||
|
||||
#ifndef ZSTD_DLL_IMPORT
|
||||
extern size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* ctx, const void* src, size_t srcSize);
|
||||
size_t local_ZSTD_decodeLiteralsBlock(const void* src, size_t srcSize, void* dst, size_t dstSize, void* buff2)
|
||||
static size_t local_ZSTD_decodeLiteralsBlock(const void* src, size_t srcSize, void* dst, size_t dstSize, void* buff2)
|
||||
{
|
||||
(void)src; (void)srcSize; (void)dst; (void)dstSize;
|
||||
return ZSTD_decodeLiteralsBlock((ZSTD_DCtx*)g_zdc, buff2, g_cSize);
|
||||
}
|
||||
|
||||
extern size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeq, const void* src, size_t srcSize);
|
||||
size_t local_ZSTD_decodeSeqHeaders(const void* src, size_t srcSize, void* dst, size_t dstSize, void* buff2)
|
||||
static size_t local_ZSTD_decodeSeqHeaders(const void* src, size_t srcSize, void* dst, size_t dstSize, void* buff2)
|
||||
{
|
||||
int nbSeq;
|
||||
(void)src; (void)srcSize; (void)dst; (void)dstSize;
|
||||
@@ -263,9 +263,9 @@ local_ZSTD_decompressStream(const void* src, size_t srcSize,
|
||||
}
|
||||
|
||||
#ifndef ZSTD_DLL_IMPORT
|
||||
size_t local_ZSTD_compressContinue(const void* src, size_t srcSize,
|
||||
void* dst, size_t dstCapacity,
|
||||
void* buff2)
|
||||
static size_t local_ZSTD_compressContinue(const void* src, size_t srcSize,
|
||||
void* dst, size_t dstCapacity,
|
||||
void* buff2)
|
||||
{
|
||||
ZSTD_parameters p;
|
||||
ZSTD_frameParameters f = { 1 /* contentSizeHeader*/, 0, 0 };
|
||||
@@ -276,9 +276,9 @@ size_t local_ZSTD_compressContinue(const void* src, size_t srcSize,
|
||||
}
|
||||
|
||||
#define FIRST_BLOCK_SIZE 8
|
||||
size_t local_ZSTD_compressContinue_extDict(const void* src, size_t srcSize,
|
||||
void* dst, size_t dstCapacity,
|
||||
void* buff2)
|
||||
static size_t local_ZSTD_compressContinue_extDict(const void* src, size_t srcSize,
|
||||
void* dst, size_t dstCapacity,
|
||||
void* buff2)
|
||||
{
|
||||
BYTE firstBlockBuf[FIRST_BLOCK_SIZE];
|
||||
|
||||
@@ -305,9 +305,9 @@ size_t local_ZSTD_compressContinue_extDict(const void* src, size_t srcSize,
|
||||
srcSize - FIRST_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
size_t local_ZSTD_decompressContinue(const void* src, size_t srcSize,
|
||||
void* dst, size_t dstCapacity,
|
||||
void* buff2)
|
||||
static size_t local_ZSTD_decompressContinue(const void* src, size_t srcSize,
|
||||
void* dst, size_t dstCapacity,
|
||||
void* buff2)
|
||||
{
|
||||
size_t regeneratedSize = 0;
|
||||
const BYTE* ip = (const BYTE*)buff2;
|
||||
|
||||
@@ -72,6 +72,8 @@ static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER;
|
||||
*********************************************************/
|
||||
#undef MIN
|
||||
#undef MAX
|
||||
/* Declaring the function is it isn't unused */
|
||||
void FUZ_bug976(void);
|
||||
void FUZ_bug976(void)
|
||||
{ /* these constants shall not depend on MIN() macro */
|
||||
assert(ZSTD_HASHLOG_MAX < 31);
|
||||
@@ -1291,6 +1293,20 @@ static int basicUnitTests(U32 seed, double compressibility)
|
||||
if (r != blockSize) goto _output_error; }
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
/* very long stream of block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : Huge block streaming compression test : ", testNb++);
|
||||
CHECK( ZSTD_compressBegin(cctx, -99) ); /* we just want to quickly overflow internal U32 index */
|
||||
CHECK( ZSTD_getBlockSize(cctx) >= blockSize);
|
||||
{ U64 const toCompress = 5000000000ULL; /* > 4 GB */
|
||||
U64 compressed = 0;
|
||||
while (compressed < toCompress) {
|
||||
size_t const blockCSize = ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), CNBuffer, blockSize);
|
||||
if (ZSTD_isError(cSize)) goto _output_error;
|
||||
compressed += blockCSize;
|
||||
}
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
/* dictionary block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : Dictionary Block compression test : ", testNb++);
|
||||
CHECK( ZSTD_compressBegin_usingDict(cctx, CNBuffer, dictSize, 5) );
|
||||
|
||||
+3
-2
@@ -36,7 +36,7 @@ size_t const COMPRESSED_SIZE = 917;
|
||||
const char* const EXPECTED; /* content is at end of file */
|
||||
|
||||
|
||||
int testSimpleAPI(void)
|
||||
static int testSimpleAPI(void)
|
||||
{
|
||||
size_t const size = strlen(EXPECTED);
|
||||
char* const output = malloc(size);
|
||||
@@ -71,7 +71,8 @@ int testSimpleAPI(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int testStreamingAPI(void)
|
||||
|
||||
static int testStreamingAPI(void)
|
||||
{
|
||||
size_t const outBuffSize = ZSTD_DStreamOutSize();
|
||||
char* const outBuff = malloc(outBuffSize);
|
||||
|
||||
+8
-8
@@ -17,25 +17,25 @@
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
#include "zstd.h"
|
||||
|
||||
int compress(ZSTD_CStream *ctx, ZSTD_outBuffer out, const void *data, size_t size) {
|
||||
static int
|
||||
compress(ZSTD_CStream *ctx, ZSTD_outBuffer out, const void *data, size_t size)
|
||||
{
|
||||
ZSTD_inBuffer in = { data, size, 0 };
|
||||
while (in.pos < in.size) {
|
||||
ZSTD_outBuffer tmp = out;
|
||||
const size_t rc = ZSTD_compressStream(ctx, &tmp, &in);
|
||||
if (ZSTD_isError(rc)) {
|
||||
return 1;
|
||||
}
|
||||
if (ZSTD_isError(rc)) return 1;
|
||||
}
|
||||
{
|
||||
ZSTD_outBuffer tmp = out;
|
||||
{ ZSTD_outBuffer tmp = out;
|
||||
const size_t rc = ZSTD_flushStream(ctx, &tmp);
|
||||
if (rc != 0) { return 1; }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv) {
|
||||
ZSTD_CStream *ctx;
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
ZSTD_CStream* ctx;
|
||||
ZSTD_parameters params;
|
||||
size_t rc;
|
||||
unsigned windowLog;
|
||||
|
||||
+3
-3
@@ -374,7 +374,7 @@ static U32 FUZ_rotl32(U32 x, U32 r)
|
||||
return ((x << r) | (x >> (32 - r)));
|
||||
}
|
||||
|
||||
U32 FUZ_rand(U32* src)
|
||||
static U32 FUZ_rand(U32* src)
|
||||
{
|
||||
const U32 prime1 = 2654435761U;
|
||||
const U32 prime2 = 2246822519U;
|
||||
@@ -1937,8 +1937,8 @@ static int benchSample(double compressibility, int cLevel)
|
||||
/* benchFiles() :
|
||||
* note: while this function takes a table of filenames,
|
||||
* in practice, only the first filename will be used */
|
||||
int benchFiles(const char** fileNamesTable, int nbFiles,
|
||||
const char* dictFileName, int cLevel)
|
||||
static int benchFiles(const char** fileNamesTable, int nbFiles,
|
||||
const char* dictFileName, int cLevel)
|
||||
{
|
||||
buffers_t buf;
|
||||
contexts_t ctx;
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ static U64 g_clockTime = 0;
|
||||
@return : a 27 bits random value, from a 32-bits `seed`.
|
||||
`seed` is also modified */
|
||||
#define FUZ_rotl32(x,r) ((x << r) | (x >> (32 - r)))
|
||||
unsigned int FUZ_rand(unsigned int* seedPtr)
|
||||
static unsigned int FUZ_rand(unsigned int* seedPtr)
|
||||
{
|
||||
static const U32 prime2 = 2246822519U;
|
||||
U32 rand32 = *seedPtr;
|
||||
@@ -2040,7 +2040,7 @@ _output_error:
|
||||
/*-*******************************************************
|
||||
* Command line
|
||||
*********************************************************/
|
||||
int FUZ_usage(const char* programName)
|
||||
static int FUZ_usage(const char* programName)
|
||||
{
|
||||
DISPLAY( "Usage :\n");
|
||||
DISPLAY( " %s [args]\n", programName);
|
||||
|
||||
Reference in New Issue
Block a user