enforce C90 compatibility for zlibWrapper
This commit is contained in:
parent
ad2a2785f7
commit
cb18fffe65
@ -202,7 +202,7 @@ static void ZSTD_copy16(void* dst, const void* src) { memcpy(dst, src, 16); }
|
||||
|
||||
typedef enum {
|
||||
ZSTD_no_overlap,
|
||||
ZSTD_overlap_src_before_dst,
|
||||
ZSTD_overlap_src_before_dst
|
||||
/* ZSTD_overlap_dst_before_src, */
|
||||
} ZSTD_overlap_e;
|
||||
|
||||
|
10
lib/zstd.h
10
lib/zstd.h
@ -398,7 +398,7 @@ typedef enum {
|
||||
ZSTD_c_experimentalParam4=1001,
|
||||
ZSTD_c_experimentalParam5=1002,
|
||||
ZSTD_c_experimentalParam6=1003,
|
||||
ZSTD_c_experimentalParam7=1004,
|
||||
ZSTD_c_experimentalParam7=1004
|
||||
} ZSTD_cParameter;
|
||||
|
||||
typedef struct {
|
||||
@ -1106,7 +1106,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */
|
||||
ZSTD_dlm_byRef = 1, /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
|
||||
ZSTD_dlm_byRef = 1 /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
|
||||
} ZSTD_dictLoadMethod_e;
|
||||
|
||||
typedef enum {
|
||||
@ -1120,7 +1120,7 @@ typedef enum {
|
||||
* This question could be kept for later, when there are actually multiple formats to support,
|
||||
* but there is also the question of pinning enum values, and pinning value `0` is especially important */
|
||||
ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */
|
||||
ZSTD_f_zstd1_magicless = 1, /* Variant of zstd frame format, without initial 4-bytes magic number.
|
||||
ZSTD_f_zstd1_magicless = 1 /* Variant of zstd frame format, without initial 4-bytes magic number.
|
||||
* Useful to save 4 bytes per generated frame.
|
||||
* Decoder cannot recognise automatically this format, requiring this instruction. */
|
||||
} ZSTD_format_e;
|
||||
@ -1154,7 +1154,7 @@ typedef enum {
|
||||
*/
|
||||
ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
|
||||
ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */
|
||||
ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */
|
||||
ZSTD_dictForceCopy = 2 /* Always copy the dictionary. */
|
||||
} ZSTD_dictAttachPref_e;
|
||||
|
||||
typedef enum {
|
||||
@ -1163,7 +1163,7 @@ typedef enum {
|
||||
* levels will be compressed. */
|
||||
ZSTD_lcm_huffman = 1, /**< Always attempt Huffman compression. Uncompressed literals will still be
|
||||
* emitted if Huffman compression is not profitable. */
|
||||
ZSTD_lcm_uncompressed = 2, /**< Always emit uncompressed literals. */
|
||||
ZSTD_lcm_uncompressed = 2 /**< Always emit uncompressed literals. */
|
||||
} ZSTD_literalCompressionMode_e;
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ TEST_FILE = ../doc/zstd_compression_format.md
|
||||
|
||||
CPPFLAGS = -DXXH_NAMESPACE=ZSTD_ -I$(ZLIB_PATH) -I$(PROGRAMS_PATH) \
|
||||
-I$(ZSTDLIBDIR) -I$(ZSTDLIBDIR)/common -I$(ZLIBWRAPPER_PATH)
|
||||
CFLAGS ?= $(MOREFLAGS) -O3 -std=gnu99
|
||||
CFLAGS ?= $(MOREFLAGS) -O3 -std=c90 -pedantic -Wno-long-long -Wno-variadic-macros
|
||||
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \
|
||||
-Wdeclaration-after-statement -Wstrict-prototypes -Wundef \
|
||||
-Wstrict-aliasing=1
|
||||
|
@ -180,8 +180,8 @@ int main(int argc, char **argv)
|
||||
if (ret == Z_STREAM_END && def.avail_out >= EXCESS) {
|
||||
/* write block to stdout */
|
||||
have = size + EXCESS - def.avail_out;
|
||||
// if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
|
||||
// quit("error writing output");
|
||||
/* if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
|
||||
* quit("error writing output"); */
|
||||
|
||||
/* clean up and print results to stderr */
|
||||
ret = deflateEnd(&def);
|
||||
@ -237,8 +237,8 @@ int main(int argc, char **argv)
|
||||
|
||||
/* done -- write block to stdout */
|
||||
have = size - def.avail_out;
|
||||
// if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
|
||||
// quit("error writing output");
|
||||
/* if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
|
||||
* quit("error writing output"); */
|
||||
|
||||
/* clean up and print results to stderr */
|
||||
free(tmp);
|
||||
|
@ -19,7 +19,7 @@ int ZEXPORT gzclose(file)
|
||||
|
||||
if (file == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
return state.state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
|
||||
#else
|
||||
|
@ -325,7 +325,7 @@ int ZEXPORT gzbuffer(file, size)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return -1;
|
||||
|
||||
@ -351,7 +351,7 @@ int ZEXPORT gzrewind(file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading and that there's no error */
|
||||
if (state.state->mode != GZ_READ ||
|
||||
@ -378,7 +378,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return -1;
|
||||
|
||||
@ -463,7 +463,7 @@ z_off64_t ZEXPORT gztell64(file)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return -1;
|
||||
|
||||
@ -491,7 +491,7 @@ z_off64_t ZEXPORT gzoffset64(file)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return -1;
|
||||
|
||||
@ -523,7 +523,7 @@ int ZEXPORT gzeof(file)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return 0;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return 0;
|
||||
|
||||
@ -541,7 +541,7 @@ const char * ZEXPORT gzerror(file, errnum)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return NULL;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return NULL;
|
||||
|
||||
@ -561,7 +561,7 @@ void ZEXPORT gzclearerr(file)
|
||||
/* get internal structure and check integrity */
|
||||
if (file == NULL)
|
||||
return;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
|
||||
return;
|
||||
|
||||
|
@ -386,7 +386,7 @@ int ZEXPORT gzread(file, buf, len)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading and that there's no (serious) error */
|
||||
if (state.state->mode != GZ_READ ||
|
||||
@ -424,7 +424,7 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return 0;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading and that there's no (serious) error */
|
||||
if (state.state->mode != GZ_READ ||
|
||||
@ -470,7 +470,7 @@ int ZEXPORT gzgetc(file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading and that there's no (serious) error */
|
||||
if (state.state->mode != GZ_READ ||
|
||||
@ -485,7 +485,7 @@ int ZEXPORT gzgetc(file)
|
||||
}
|
||||
|
||||
/* nothing there -- try gz_read() */
|
||||
ret = (unsigned)gz_read(state, buf, 1);
|
||||
ret = (int)gz_read(state, buf, 1);
|
||||
return ret < 1 ? -1 : buf[0];
|
||||
}
|
||||
|
||||
@ -505,7 +505,7 @@ int ZEXPORT gzungetc(c, file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading and that there's no (serious) error */
|
||||
if (state.state->mode != GZ_READ ||
|
||||
@ -569,7 +569,7 @@ char * ZEXPORT gzgets(file, buf, len)
|
||||
/* check parameters and get internal structure */
|
||||
if (file == NULL || buf == NULL || len < 1)
|
||||
return NULL;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading and that there's no (serious) error */
|
||||
if (state.state->mode != GZ_READ ||
|
||||
@ -628,7 +628,7 @@ int ZEXPORT gzdirect(file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return 0;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* if the state is not known, but we can find out, then do so (this is
|
||||
mainly for right after a gzopen() or gzdopen()) */
|
||||
@ -649,7 +649,7 @@ int ZEXPORT gzclose_r(file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're reading */
|
||||
if (state.state->mode != GZ_READ)
|
||||
|
@ -258,7 +258,7 @@ int ZEXPORT gzwrite(file, buf, len)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return 0;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
|
||||
@ -289,7 +289,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
||||
assert(size != 0);
|
||||
if (file == NULL)
|
||||
return 0;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
|
||||
@ -319,7 +319,7 @@ int ZEXPORT gzputc(file, c)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
strm = &(state.state->strm);
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
@ -366,7 +366,7 @@ int ZEXPORT gzputs(file, str)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
|
||||
@ -393,7 +393,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
strm = &(state.state->strm);
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
@ -565,7 +565,7 @@ int ZEXPORT gzflush(file, flush)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
|
||||
@ -599,7 +599,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
strm = &(state.state->strm);
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
@ -639,7 +639,7 @@ int ZEXPORT gzclose_w(file)
|
||||
/* get internal structure */
|
||||
if (file == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (gz_statep)file;
|
||||
state.file = file;
|
||||
|
||||
/* check that we're writing */
|
||||
if (state.state->mode != GZ_WRITE)
|
||||
|
@ -54,7 +54,7 @@ int ZWRAP_isUsingZSTDcompression(void) { return g_ZWRAP_useZSTDcompression; }
|
||||
|
||||
static ZWRAP_decompress_type g_ZWRAPdecompressionType = ZWRAP_AUTO;
|
||||
|
||||
void ZWRAP_setDecompressionType(ZWRAP_decompress_type type) { g_ZWRAPdecompressionType = type; };
|
||||
void ZWRAP_setDecompressionType(ZWRAP_decompress_type type) { g_ZWRAPdecompressionType = type; }
|
||||
|
||||
ZWRAP_decompress_type ZWRAP_getDecompressionType(void) { return g_ZWRAPdecompressionType; }
|
||||
|
||||
@ -121,8 +121,10 @@ static ZWRAP_CCtx* ZWRAP_createCCtx(z_streamp strm)
|
||||
if (zwc==NULL) return NULL;
|
||||
memset(zwc, 0, sizeof(ZWRAP_CCtx));
|
||||
memcpy(&zwc->allocFunc, strm, sizeof(z_stream));
|
||||
{ ZSTD_customMem const ZWRAP_customMem = { ZWRAP_allocFunction, ZWRAP_freeFunction, &zwc->allocFunc };
|
||||
zwc->customMem = ZWRAP_customMem; }
|
||||
{ ZSTD_customMem ZWRAP_customMem = { ZWRAP_allocFunction, ZWRAP_freeFunction, NULL };
|
||||
ZWRAP_customMem.opaque = &zwc->allocFunc;
|
||||
zwc->customMem = ZWRAP_customMem;
|
||||
}
|
||||
} else {
|
||||
zwc = (ZWRAP_CCtx*)calloc(1, sizeof(*zwc));
|
||||
if (zwc==NULL) return NULL;
|
||||
@ -462,8 +464,10 @@ static ZWRAP_DCtx* ZWRAP_createDCtx(z_streamp strm)
|
||||
if (zwd==NULL) return NULL;
|
||||
memset(zwd, 0, sizeof(ZWRAP_DCtx));
|
||||
zwd->allocFunc = *strm; /* just to copy zalloc, zfree & opaque */
|
||||
{ ZSTD_customMem const ZWRAP_customMem = { ZWRAP_allocFunction, ZWRAP_freeFunction, &zwd->allocFunc };
|
||||
zwd->customMem = ZWRAP_customMem; }
|
||||
{ ZSTD_customMem ZWRAP_customMem = { ZWRAP_allocFunction, ZWRAP_freeFunction, NULL };
|
||||
ZWRAP_customMem.opaque = &zwd->allocFunc;
|
||||
zwd->customMem = ZWRAP_customMem;
|
||||
}
|
||||
} else {
|
||||
zwd = (ZWRAP_DCtx*)calloc(1, sizeof(*zwd));
|
||||
if (zwd==NULL) return NULL;
|
||||
@ -1003,7 +1007,7 @@ ZEXTERN int ZEXPORT z_inflateBackEnd OF((z_streamp strm))
|
||||
}
|
||||
|
||||
|
||||
ZEXTERN uLong ZEXPORT z_zlibCompileFlags OF((void)) { return zlibCompileFlags(); };
|
||||
ZEXTERN uLong ZEXPORT z_zlibCompileFlags OF((void)) { return zlibCompileFlags(); }
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user