diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:11:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:11:51 +0000 |
commit | a6f3675fc4e21b3f899286b9a02005368d913f74 (patch) | |
tree | c9bfa92b223783ff03b8e941c3bb0d36c68d3b5e /lib/util.c | |
parent | Releasing progress-linux version 3:4.8.30-1~progress7.99u1. (diff) | |
download | mc-a6f3675fc4e21b3f899286b9a02005368d913f74.tar.xz mc-a6f3675fc4e21b3f899286b9a02005368d913f74.zip |
Merging upstream version 3:4.8.31.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | lib/util.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1,7 +1,7 @@ /* Various utilities - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -256,6 +256,9 @@ name_quote (const char *s, gboolean quote_percent) { GString *ret; + if (s == NULL || *s == '\0') + return NULL; + ret = g_string_sized_new (64); if (*s == '-') @@ -305,7 +308,7 @@ name_quote (const char *s, gboolean quote_percent) g_string_append_c (ret, *s); } - return g_string_free (ret, FALSE); + return g_string_free (ret, ret->len == 0); } /* --------------------------------------------------------------------------------------------- */ @@ -314,7 +317,8 @@ char * fake_name_quote (const char *s, gboolean quote_percent) { (void) quote_percent; - return g_strdup (s); + + return (s == NULL || *s == '\0' ? NULL : g_strdup (s)); } /* --------------------------------------------------------------------------------------------- */ @@ -887,6 +891,11 @@ get_compression_type (int fd, const char *name) && magic[2] == 'Z' && magic[3] == 'M' && magic[4] == 'A' && magic[5] == 0x00) return COMPRESSION_LZMA; + /* LZO format - \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data */ + if (magic[0] == 0x89 && magic[1] == 0x4c && + magic[2] == 0x5a && magic[3] == 0x4f && magic[4] == 0x00 && magic[5] == 0x0d) + return COMPRESSION_LZO; + /* XZ compression magic */ if (magic[0] == 0xFD && magic[1] == 0x37 @@ -926,6 +935,8 @@ decompress_extension (int type) return "/ulz4" VFS_PATH_URL_DELIMITER; case COMPRESSION_LZMA: return "/ulzma" VFS_PATH_URL_DELIMITER; + case COMPRESSION_LZO: + return "/ulzo" VFS_PATH_URL_DELIMITER; case COMPRESSION_XZ: return "/uxz" VFS_PATH_URL_DELIMITER; case COMPRESSION_ZSTD: |