From 55b87f732ed1000a9a31d4ca485ef72f56f5a32c Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sun, 5 Jan 2014 15:55:21 +0000 Subject: [PATCH] Add lz4 support (Ville Skytta) --- magic/Magdir/compress | 8 +++++++- src/compress.c | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/magic/Magdir/compress b/magic/Magdir/compress index 23267145..1abe5e0a 100644 --- a/magic/Magdir/compress +++ b/magic/Magdir/compress @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: compress,v 1.51 2013/11/19 20:38:57 christos Exp $ +# $File: compress,v 1.52 2013/12/11 17:55:00 christos Exp $ # compress: file(1) magic for pure-compression formats (no archives) # # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. @@ -209,6 +209,12 @@ >5 byte x \b.%d !:mime application/x-lrzip +# http://fastcompression.blogspot.fi/2013/04/lz4-streaming-format-final.html +0 lelong 0x184d2204 LZ4 compressed data +!:mime application/x-lz4 +0 lelong 0x184c2102 LZ4 compressed data, legacy format +!:mime application/x-lz4 + # AFX compressed files (Wolfram Kleff) 2 string -afx- AFX compressed file data diff --git a/src/compress.c b/src/compress.c index 675e9f67..1567f742 100644 --- a/src/compress.c +++ b/src/compress.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: compress.c,v 1.71 2013/07/21 21:06:41 rrt Exp $") +FILE_RCSID("@(#)$File: compress.c,v 1.72 2013/11/18 17:54:58 christos Exp $") #endif #include "magic.h" @@ -80,6 +80,7 @@ private const struct { { "LZIP", 4, { "lzip", "-cdq", NULL }, 1 }, { "\3757zXZ\0",6,{ "xz", "-cd", NULL }, 1 }, /* XZ Utils */ { "LRZI", 4, { "lrzip", "-dqo-", NULL }, 1 }, /* LRZIP */ + { "\004\"M\030", 4, { "lz4", "-cd", NULL }, 1 }, /* LZ4 */ }; #define NODATA ((size_t)~0) -- 2.40.0