mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Fix detection of zip-compressed file.
(compression_type): add COMPRESSION_ZIP value. (decompress_extension): support COMPRESSION_ZIP. (get_compression_type): fix zip-file detection. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
395569c685
commit
b42e58dfbc
@ -840,12 +840,10 @@ get_compression_type (int fd, const char *name)
|
||||
if (mc_read (fd, (char *) magic, 2) != 2)
|
||||
return COMPRESSION_NONE;
|
||||
|
||||
/* Gzip can handle only deflated (8) or stored (0) files */
|
||||
if ((magic[0] != 8 && magic[0] != 0) || magic[1] != 0)
|
||||
return COMPRESSION_NONE;
|
||||
|
||||
/* Compatible with gzip */
|
||||
return COMPRESSION_GZIP;
|
||||
return COMPRESSION_ZIP;
|
||||
}
|
||||
|
||||
/* PACK_MAGIC and LZH_MAGIC and compress magic */
|
||||
@ -910,6 +908,8 @@ decompress_extension (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case COMPRESSION_ZIP:
|
||||
return "/uz" VFS_PATH_URL_DELIMITER;
|
||||
case COMPRESSION_GZIP:
|
||||
return "/ugz" VFS_PATH_URL_DELIMITER;
|
||||
case COMPRESSION_BZIP:
|
||||
|
@ -77,6 +77,7 @@ typedef enum
|
||||
enum compression_type
|
||||
{
|
||||
COMPRESSION_NONE,
|
||||
COMPRESSION_ZIP,
|
||||
COMPRESSION_GZIP,
|
||||
COMPRESSION_BZIP,
|
||||
COMPRESSION_BZIP2,
|
||||
|
Loading…
Reference in New Issue
Block a user