+3
-3
@@ -181,15 +181,15 @@
|
|||||||
- COMPILER: "gcc"
|
- COMPILER: "gcc"
|
||||||
HOST: "mingw"
|
HOST: "mingw"
|
||||||
PLATFORM: "x64"
|
PLATFORM: "x64"
|
||||||
SCRIPT: "make allzstd"
|
SCRIPT: "CPPFLAGS=-DDEBUGLEVEL=2 CFLAGS=-Werror make -j allzstd DEBUGLEVEL=2"
|
||||||
- COMPILER: "gcc"
|
- COMPILER: "gcc"
|
||||||
HOST: "mingw"
|
HOST: "mingw"
|
||||||
PLATFORM: "x86"
|
PLATFORM: "x86"
|
||||||
SCRIPT: "make allzstd"
|
SCRIPT: "CFLAGS=-Werror make -j allzstd"
|
||||||
- COMPILER: "clang"
|
- COMPILER: "clang"
|
||||||
HOST: "mingw"
|
HOST: "mingw"
|
||||||
PLATFORM: "x64"
|
PLATFORM: "x64"
|
||||||
SCRIPT: "MOREFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make allzstd"
|
SCRIPT: "CFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make -j allzstd"
|
||||||
|
|
||||||
- COMPILER: "visual"
|
- COMPILER: "visual"
|
||||||
HOST: "visual"
|
HOST: "visual"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ OPTION(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
|
|||||||
OPTION(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" ON)
|
OPTION(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" ON)
|
||||||
|
|
||||||
IF(NOT ZSTD_BUILD_SHARED AND NOT ZSTD_BUILD_STATIC)
|
IF(NOT ZSTD_BUILD_SHARED AND NOT ZSTD_BUILD_STATIC)
|
||||||
MESSAGE(SEND_ERROR "You need to build at least one flavor of libstd")
|
MESSAGE(SEND_ERROR "You need to build at least one flavor of libzstd")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Define library directory, where sources and header files are located
|
# Define library directory, where sources and header files are located
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
|||||||
VERSION?= $(LIBVER)
|
VERSION?= $(LIBVER)
|
||||||
|
|
||||||
CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_
|
CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_
|
||||||
|
ifeq ($(OS),Windows_NT) # MinGW assumed
|
||||||
|
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
||||||
|
endif
|
||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||||
|
|||||||
@@ -1032,6 +1032,9 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms,
|
|||||||
|
|
||||||
ms->hashLog3 = hashLog3;
|
ms->hashLog3 = hashLog3;
|
||||||
memset(&ms->window, 0, sizeof(ms->window));
|
memset(&ms->window, 0, sizeof(ms->window));
|
||||||
|
ms->window.dictLimit = 1; /* start from 1, so that 1st position is valid */
|
||||||
|
ms->window.lowLimit = 1; /* it ensures first and later CCtx usages compress the same */
|
||||||
|
ms->window.nextSrc = ms->window.base + 1; /* see issue #1241 */
|
||||||
ZSTD_invalidateMatchState(ms);
|
ZSTD_invalidateMatchState(ms);
|
||||||
|
|
||||||
/* opt parser space */
|
/* opt parser space */
|
||||||
@@ -1281,8 +1284,9 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attachDict) {
|
if (attachDict) {
|
||||||
const U32 cdictLen = (U32)( cdict->matchState.window.nextSrc
|
const U32 cdictEnd = (U32)( cdict->matchState.window.nextSrc
|
||||||
- cdict->matchState.window.base);
|
- cdict->matchState.window.base);
|
||||||
|
const U32 cdictLen = cdictEnd - cdict->matchState.window.dictLimit;
|
||||||
if (cdictLen == 0) {
|
if (cdictLen == 0) {
|
||||||
/* don't even attach dictionaries with no contents */
|
/* don't even attach dictionaries with no contents */
|
||||||
DEBUGLOG(4, "skipping attaching empty dictionary");
|
DEBUGLOG(4, "skipping attaching empty dictionary");
|
||||||
@@ -1292,9 +1296,9 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
|
|||||||
|
|
||||||
/* prep working match state so dict matches never have negative indices
|
/* prep working match state so dict matches never have negative indices
|
||||||
* when they are translated to the working context's index space. */
|
* when they are translated to the working context's index space. */
|
||||||
if (cctx->blockState.matchState.window.dictLimit < cdictLen) {
|
if (cctx->blockState.matchState.window.dictLimit < cdictEnd) {
|
||||||
cctx->blockState.matchState.window.nextSrc =
|
cctx->blockState.matchState.window.nextSrc =
|
||||||
cctx->blockState.matchState.window.base + cdictLen;
|
cctx->blockState.matchState.window.base + cdictEnd;
|
||||||
ZSTD_window_clear(&cctx->blockState.matchState.window);
|
ZSTD_window_clear(&cctx->blockState.matchState.window);
|
||||||
}
|
}
|
||||||
cctx->blockState.matchState.loadedDictEnd = cctx->blockState.matchState.window.dictLimit;
|
cctx->blockState.matchState.loadedDictEnd = cctx->blockState.matchState.window.dictLimit;
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ endif
|
|||||||
CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
||||||
-I$(ZSTDDIR)/dictBuilder \
|
-I$(ZSTDDIR)/dictBuilder \
|
||||||
-DXXH_NAMESPACE=ZSTD_
|
-DXXH_NAMESPACE=ZSTD_
|
||||||
|
ifeq ($(OS),Windows_NT) # MinGW assumed
|
||||||
|
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
||||||
|
endif
|
||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
DEBUGFLAGS+=-Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
DEBUGFLAGS+=-Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ DEBUGLEVEL ?= 1
|
|||||||
DEBUGFLAGS = -g -DDEBUGLEVEL=$(DEBUGLEVEL)
|
DEBUGFLAGS = -g -DDEBUGLEVEL=$(DEBUGLEVEL)
|
||||||
CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
||||||
-I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
|
-I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
|
||||||
|
ifeq ($(OS),Windows_NT) # MinGW assumed
|
||||||
|
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
||||||
|
endif
|
||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||||
|
|||||||
@@ -412,6 +412,26 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
}
|
}
|
||||||
DISPLAYLEVEL(3, "OK \n");
|
DISPLAYLEVEL(3, "OK \n");
|
||||||
|
|
||||||
|
DISPLAYLEVEL(3, "test%3d : re-using a CCtx should compress the same : ", testNb++);
|
||||||
|
{ int i;
|
||||||
|
for (i=0; i<20; i++)
|
||||||
|
((char*)CNBuffer)[i] = (char)i; /* ensure no match during initial section */
|
||||||
|
memcpy((char*)CNBuffer + 20, CNBuffer, 10); /* create one match, starting from beginning of sample, which is the difficult case (see #1241) */
|
||||||
|
for (i=1; i<=19; i++) {
|
||||||
|
ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||||
|
size_t size1, size2;
|
||||||
|
DISPLAYLEVEL(5, "l%i ", i);
|
||||||
|
size1 = ZSTD_compressCCtx(cctx, compressedBuffer, compressedBufferSize, CNBuffer, 30, i);
|
||||||
|
CHECK_Z(size1);
|
||||||
|
size2 = ZSTD_compressCCtx(cctx, compressedBuffer, compressedBufferSize, CNBuffer, 30, i);
|
||||||
|
CHECK_Z(size2);
|
||||||
|
CHECK_EQ(size1, size2);
|
||||||
|
|
||||||
|
ZSTD_freeCCtx(cctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DISPLAYLEVEL(3, "OK \n");
|
||||||
|
|
||||||
DISPLAYLEVEL(3, "test%3d : ZSTD_CCtx_getParameter() : ", testNb++);
|
DISPLAYLEVEL(3, "test%3d : ZSTD_CCtx_getParameter() : ", testNb++);
|
||||||
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||||
ZSTD_outBuffer out = {NULL, 0, 0};
|
ZSTD_outBuffer out = {NULL, 0, 0};
|
||||||
|
|||||||
Reference in New Issue
Block a user