mirror of
https://github.com/facebook/zstd.git
synced 2025-08-05 19:15:58 +03:00
Added library version check
This commit is contained in:
@@ -289,7 +289,7 @@ zstd-noxz : LZMALD :=
|
|||||||
zstd-noxz : LZMA_MSG := - xz/lzma support is disabled
|
zstd-noxz : LZMA_MSG := - xz/lzma support is disabled
|
||||||
zstd-noxz : zstd
|
zstd-noxz : zstd
|
||||||
|
|
||||||
## zstd-dll: zstd executable linked to dynamic library libzstd (must already exist)
|
## zstd-dll: zstd executable linked to dynamic library libzstd (must have same version)
|
||||||
.PHONY: zstd-dll
|
.PHONY: zstd-dll
|
||||||
zstd-dll : LDFLAGS+= -L$(ZSTDDIR)
|
zstd-dll : LDFLAGS+= -L$(ZSTDDIR)
|
||||||
zstd-dll : LDLIBS += -lzstd
|
zstd-dll : LDLIBS += -lzstd
|
||||||
|
@@ -103,6 +103,24 @@ typedef enum { cover, fastCover, legacy } dictType;
|
|||||||
static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
|
static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
|
||||||
|
|
||||||
|
|
||||||
|
/*-************************************
|
||||||
|
* Check Version (when CLI linked to dynamic library)
|
||||||
|
**************************************/
|
||||||
|
|
||||||
|
/* Due to usage of experimental symbols and capabilities by the CLI,
|
||||||
|
* the CLI must be linked against a dynamic library of same version */
|
||||||
|
static void checkLibVersion(void)
|
||||||
|
{
|
||||||
|
if (strcmp(ZSTD_VERSION_STRING, ZSTD_versionString())) {
|
||||||
|
DISPLAYLEVEL(1, "Error : incorrect library version (expecting : %s ; actual : %s ) \n",
|
||||||
|
ZSTD_VERSION_STRING, ZSTD_versionString());
|
||||||
|
DISPLAYLEVEL(1, "Please update library to version %s, or use stand-alone zstd binary \n",
|
||||||
|
ZSTD_VERSION_STRING);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-************************************
|
/*-************************************
|
||||||
* Command Line
|
* Command Line
|
||||||
**************************************/
|
**************************************/
|
||||||
@@ -753,6 +771,7 @@ int main(int const argCount, const char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
|
checkLibVersion();
|
||||||
(void)recursive; (void)cLevelLast; /* not used when ZSTD_NOBENCH set */
|
(void)recursive; (void)cLevelLast; /* not used when ZSTD_NOBENCH set */
|
||||||
(void)memLimit;
|
(void)memLimit;
|
||||||
assert(argCount >= 1);
|
assert(argCount >= 1);
|
||||||
@@ -1281,15 +1300,15 @@ int main(int const argCount, const char* argv[])
|
|||||||
DISPLAY("error : can't use --patch-from=# on multiple files \n");
|
DISPLAY("error : can't use --patch-from=# on multiple files \n");
|
||||||
CLEAN_RETURN(1);
|
CLEAN_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No status message in pipe mode (stdin - stdout) */
|
/* No status message in pipe mode (stdin - stdout) */
|
||||||
hasStdout = outFileName && !strcmp(outFileName,stdoutmark);
|
hasStdout = outFileName && !strcmp(outFileName,stdoutmark);
|
||||||
|
|
||||||
if (hasStdout && (g_displayLevel==2)) g_displayLevel=1;
|
if (hasStdout && (g_displayLevel==2)) g_displayLevel=1;
|
||||||
|
|
||||||
/* IO Stream/File */
|
/* IO Stream/File */
|
||||||
FIO_setHasStdoutOutput(fCtx, hasStdout);
|
FIO_setHasStdoutOutput(fCtx, hasStdout);
|
||||||
FIO_setNbFilesTotal(fCtx, (int)filenames->tableSize);
|
FIO_setNbFilesTotal(fCtx, (int)filenames->tableSize);
|
||||||
FIO_determineHasStdinInput(fCtx, filenames);
|
FIO_determineHasStdinInput(fCtx, filenames);
|
||||||
FIO_setNotificationLevel(g_displayLevel);
|
FIO_setNotificationLevel(g_displayLevel);
|
||||||
FIO_setPatchFromMode(prefs, patchFromDictFileName != NULL);
|
FIO_setPatchFromMode(prefs, patchFromDictFileName != NULL);
|
||||||
|
Reference in New Issue
Block a user