diff options
author | Renato Botelho <renato@netgate.com> | 2016-12-14 13:59:40 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-12-14 13:59:40 -0200 |
commit | cc9fac304cafadab4656653aa1a62fdad74b4e94 (patch) | |
tree | 43fee446af0c829986548dcbe6862d3ac31bae2e /contrib/file/src/compress.c | |
parent | 812767d2bb4e201b4f826fd31924d2cafb8fe0ae (diff) | |
parent | 6d3cdf0ab519f1b7bad6bd132eda48242f0ff7c8 (diff) | |
download | FreeBSD-src-cc9fac304cafadab4656653aa1a62fdad74b4e94.zip FreeBSD-src-cc9fac304cafadab4656653aa1a62fdad74b4e94.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'contrib/file/src/compress.c')
-rw-r--r-- | contrib/file/src/compress.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/file/src/compress.c b/contrib/file/src/compress.c index 1988fe7..95f0955 100644 --- a/contrib/file/src/compress.c +++ b/contrib/file/src/compress.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: compress.c,v 1.97 2016/05/13 23:02:28 christos Exp $") +FILE_RCSID("@(#)$File: compress.c,v 1.100 2016/10/24 18:02:17 christos Exp $") #endif #include "magic.h" @@ -132,6 +132,9 @@ static const char *lrzip_args[] = { static const char *lz4_args[] = { "lz4", "-cd", NULL }; +static const char *zstd_args[] = { + "zstd", "-cd", NULL +}; private const struct { const void *magic; @@ -154,8 +157,9 @@ private const struct { { "\3757zXZ\0", 6, xz_args }, /* XZ Utils */ { "LRZI", 4, lrzip_args }, /* LRZIP */ { "\004\"M\030",4, lz4_args }, /* LZ4 */ + { "\x28\xB5\x2F\xFD", 4, zstd_args }, /* zstd */ #ifdef ZLIBSUPPORT - { zlibcmp, 0, zlib_args }, /* zlib */ + { RCAST(const void *, zlibcmp), 0, zlib_args }, /* zlib */ #endif }; @@ -204,7 +208,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name, continue; #ifdef ZLIBSUPPORT if (compr[i].maglen == 0) - zm = (CAST(int (*)(const unsigned char *), + zm = (RCAST(int (*)(const unsigned char *), CCAST(void *, compr[i].magic)))(buf); else #endif @@ -362,7 +366,7 @@ nocheck: return rn - n; default: n -= rv; - buf = ((char *)buf) + rv; + buf = CAST(char *, CCAST(void *, buf)) + rv; break; } while (n > 0); @@ -517,7 +521,7 @@ uncompresszlib(const unsigned char *old, unsigned char **newch, return OKDATA; err: - strlcpy((char *)*newch, z.msg, bytes_max); + strlcpy((char *)*newch, z.msg ? z.msg : zError(rc), bytes_max); *n = strlen((char *)*newch); return ERRDATA; } |