mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
fixed minor compatibility issues with older compilers
This commit is contained in:
@ -15,7 +15,7 @@ LIBZSTD = $(LIBDIR)/libzstd.a
|
|||||||
CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/common -I$(LIBDIR)/dictBuilder -I$(PROGDIR)
|
CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/common -I$(LIBDIR)/dictBuilder -I$(PROGDIR)
|
||||||
|
|
||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
CFLAGS += -std=c99
|
CFLAGS += -std=gnu99
|
||||||
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum \
|
-Wstrict-aliasing=1 -Wswitch-enum \
|
||||||
-Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
|
-Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
/*--- Macros ---*/
|
/*--- Macros ---*/
|
||||||
#define CONTROL(c) assert(c)
|
#define CONTROL(c) assert(c)
|
||||||
|
#undef MIN
|
||||||
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
|
|
||||||
/*--- Display Macros ---*/
|
/*--- Display Macros ---*/
|
||||||
@ -472,9 +474,6 @@ static size_t compressBlocks(size_t* cSizes, /* optional (can be NULL). If pre
|
|||||||
|
|
||||||
/* --- Benchmark --- */
|
/* --- Benchmark --- */
|
||||||
|
|
||||||
typedef size_t (*BMK_benchFn_t)(const void* src, size_t srcSize, void* dst, size_t dstCapacity, void* customPayload);
|
|
||||||
typedef size_t (*BMK_initFn_t)(void* initPayload);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ZSTD_DCtx* dctx;
|
ZSTD_DCtx* dctx;
|
||||||
size_t nbDicts;
|
size_t nbDicts;
|
||||||
|
@ -319,15 +319,17 @@ UTIL_STATIC U32 UTIL_isDirectory(const char* infilename)
|
|||||||
|
|
||||||
UTIL_STATIC U32 UTIL_isLink(const char* infilename)
|
UTIL_STATIC U32 UTIL_isLink(const char* infilename)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
/* macro guards, as defined in : https://linux.die.net/man/2/lstat */
|
||||||
/* no symlinks on windows */
|
#if defined(_BSD_SOURCE) \
|
||||||
(void)infilename;
|
|| (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)) \
|
||||||
#else
|
|| (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) \
|
||||||
|
|| (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||||
int r;
|
int r;
|
||||||
stat_t statbuf;
|
stat_t statbuf;
|
||||||
r = lstat(infilename, &statbuf);
|
r = lstat(infilename, &statbuf);
|
||||||
if (!r && S_ISLNK(statbuf.st_mode)) return 1;
|
if (!r && S_ISLNK(statbuf.st_mode)) return 1;
|
||||||
#endif
|
#endif
|
||||||
|
(void)infilename;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user