ensure dependency for zlib wrapper
This commit is contained in:
parent
42a02ab745
commit
da55865e47
14
Makefile
14
Makefile
@ -30,8 +30,7 @@ default: lib-release zstd-release
|
|||||||
all: allmost examples manual contrib
|
all: allmost examples manual contrib
|
||||||
|
|
||||||
.PHONY: allmost
|
.PHONY: allmost
|
||||||
allmost: allzstd
|
allmost: allzstd zlibwrapper
|
||||||
$(MAKE) -C $(ZWRAPDIR) all
|
|
||||||
|
|
||||||
#skip zwrapper, can't build that on alternate architectures without the proper zlib installed
|
#skip zwrapper, can't build that on alternate architectures without the proper zlib installed
|
||||||
.PHONY: allzstd
|
.PHONY: allzstd
|
||||||
@ -44,8 +43,9 @@ all32:
|
|||||||
$(MAKE) -C $(PRGDIR) zstd32
|
$(MAKE) -C $(PRGDIR) zstd32
|
||||||
$(MAKE) -C $(TESTDIR) all32
|
$(MAKE) -C $(TESTDIR) all32
|
||||||
|
|
||||||
.PHONY: lib lib-release
|
.PHONY: lib lib-release libzstd.a
|
||||||
lib lib-release:
|
lib : libzstd.a
|
||||||
|
lib lib-release libzstd.a:
|
||||||
@$(MAKE) -C $(ZSTDDIR) $@
|
@$(MAKE) -C $(ZSTDDIR) $@
|
||||||
|
|
||||||
.PHONY: zstd zstd-release
|
.PHONY: zstd zstd-release
|
||||||
@ -59,8 +59,8 @@ zstdmt:
|
|||||||
cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
|
cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
|
||||||
|
|
||||||
.PHONY: zlibwrapper
|
.PHONY: zlibwrapper
|
||||||
zlibwrapper:
|
zlibwrapper: libzstd.a
|
||||||
$(MAKE) -C $(ZWRAPDIR) test
|
$(MAKE) -C $(ZWRAPDIR) all
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: MOREFLAGS += -g -DDEBUGLEVEL=1 -Werror
|
test: MOREFLAGS += -g -DDEBUGLEVEL=1 -Werror
|
||||||
@ -353,5 +353,5 @@ bmi32build: clean
|
|||||||
|
|
||||||
staticAnalyze:
|
staticAnalyze:
|
||||||
$(CC) -v
|
$(CC) -v
|
||||||
CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
|
CC=$(CC) CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
|
||||||
endif
|
endif
|
||||||
|
@ -573,10 +573,10 @@ static size_t BMK_findMaxMem(U64 requiredMem)
|
|||||||
do {
|
do {
|
||||||
testmem = (BYTE*)malloc((size_t)requiredMem);
|
testmem = (BYTE*)malloc((size_t)requiredMem);
|
||||||
requiredMem -= step;
|
requiredMem -= step;
|
||||||
} while (!testmem);
|
} while (!testmem && requiredMem); /* do not allocate zero bytes */
|
||||||
|
|
||||||
free(testmem);
|
free(testmem);
|
||||||
return (size_t)(requiredMem);
|
return (size_t)(requiredMem+1); /* avoid zero */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
|
static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
|
||||||
@ -734,7 +734,7 @@ static void BMK_benchFileTable(const char** fileNamesTable, unsigned nbFiles,
|
|||||||
if ((U64)benchedSize > totalSizeToLoad) benchedSize = (size_t)totalSizeToLoad;
|
if ((U64)benchedSize > totalSizeToLoad) benchedSize = (size_t)totalSizeToLoad;
|
||||||
if (benchedSize < totalSizeToLoad)
|
if (benchedSize < totalSizeToLoad)
|
||||||
DISPLAY("Not enough memory; testing %u MB only...\n", (U32)(benchedSize >> 20));
|
DISPLAY("Not enough memory; testing %u MB only...\n", (U32)(benchedSize >> 20));
|
||||||
srcBuffer = malloc(benchedSize);
|
srcBuffer = malloc(benchedSize + !benchedSize);
|
||||||
if (!srcBuffer) EXM_THROW(12, "not enough memory");
|
if (!srcBuffer) EXM_THROW(12, "not enough memory");
|
||||||
|
|
||||||
/* Load input buffer */
|
/* Load input buffer */
|
||||||
|
@ -111,7 +111,7 @@ local gzFile gz_open(path, fd, mode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* allocate gzFile structure to return */
|
/* allocate gzFile structure to return */
|
||||||
state = (gz_statep)(gz_state*)malloc(sizeof(gz_state));
|
state.state = (gz_state*)malloc(sizeof(gz_state));
|
||||||
if (state.state == NULL)
|
if (state.state == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
state.state->size = 0; /* no buffers allocated yet */
|
state.state->size = 0; /* no buffers allocated yet */
|
||||||
@ -266,7 +266,7 @@ local gzFile gz_open(path, fd, mode)
|
|||||||
gz_reset(state);
|
gz_reset(state);
|
||||||
|
|
||||||
/* return stream */
|
/* return stream */
|
||||||
return (gzFile)state.file;
|
return state.file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* For conditions of distribution and use, see http://www.zlib.net/zlib_license.html
|
* For conditions of distribution and use, see http://www.zlib.net/zlib_license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "gzguts.h"
|
#include "gzguts.h"
|
||||||
|
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
@ -24,7 +26,7 @@ local int gz_init(state)
|
|||||||
z_streamp strm = &(state.state->strm);
|
z_streamp strm = &(state.state->strm);
|
||||||
|
|
||||||
/* allocate input buffer (double size for gzprintf) */
|
/* allocate input buffer (double size for gzprintf) */
|
||||||
state.state->in = (unsigned char *)malloc(state.state->want << 1);
|
state.state->in = (unsigned char*)malloc(state.state->want << 1);
|
||||||
if (state.state->in == NULL) {
|
if (state.state->in == NULL) {
|
||||||
gz_error(state, Z_MEM_ERROR, "out of memory");
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -33,7 +35,7 @@ local int gz_init(state)
|
|||||||
/* only need output buffer and deflate state if compressing */
|
/* only need output buffer and deflate state if compressing */
|
||||||
if (!state.state->direct) {
|
if (!state.state->direct) {
|
||||||
/* allocate output buffer */
|
/* allocate output buffer */
|
||||||
state.state->out = (unsigned char *)malloc(state.state->want);
|
state.state->out = (unsigned char*)malloc(state.state->want);
|
||||||
if (state.state->out == NULL) {
|
if (state.state->out == NULL) {
|
||||||
free(state.state->in);
|
free(state.state->in);
|
||||||
gz_error(state, Z_MEM_ERROR, "out of memory");
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
@ -284,6 +286,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
|||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
assert(size != 0);
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
state = (gz_statep)file;
|
state = (gz_statep)file;
|
||||||
@ -294,7 +297,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
|||||||
|
|
||||||
/* compute bytes to read -- error on overflow */
|
/* compute bytes to read -- error on overflow */
|
||||||
len = nitems * size;
|
len = nitems * size;
|
||||||
if (size && len / size != nitems) {
|
if (size && (len / size != nitems)) {
|
||||||
gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
|
gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user