Regards, /Pete
From 331ec3f7567f3f86e4d4d78fd173079d39d4eb8d Mon Sep 17 00:00:00 2001 From: Pete Batard <p...@akeo.ie> Date: Thu, 3 Aug 2017 16:20:31 +0100 Subject: [PATCH 3/3] io: add a GZ prefix to gzio specific defines
* This is done to avoid a conflict with a PACKED define in the EDK2 --- grub-core/io/gzio.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c index 0f2ea6b..150e250 100644 --- a/grub-core/io/gzio.c +++ b/grub-core/io/gzio.c @@ -140,24 +140,24 @@ eat_field (grub_file_t file, int len) #define OLD_GZIP_MAGIC grub_le_to_cpu16 (0x9E1F) /* Compression methods (see algorithm.doc) */ -#define STORED 0 -#define COMPRESSED 1 -#define PACKED 2 -#define LZHED 3 +#define GZ_STORED 0 +#define GZ_COMPRESSED 1 +#define GZ_PACKED 2 +#define GZ_LZHED 3 /* methods 4 to 7 reserved */ -#define DEFLATED 8 -#define MAX_METHODS 9 +#define GZ_DEFLATED 8 +#define GZ_MAX_METHODS 9 /* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ -#define RESERVED 0xC0 /* bit 6,7: reserved */ +#define GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define GZ_CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#define GZ_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define GZ_ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define GZ_COMMENT 0x10 /* bit 4 set: file comment present */ +#define GZ_ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define GZ_RESERVED 0xC0 /* bit 6,7: reserved */ -#define UNSUPPORTED_FLAGS (CONTINUATION | ENCRYPTED | RESERVED) +#define GZ_UNSUPPORTED_FLAGS (GZ_CONTINUATION | GZ_ENCRYPTED | GZ_RESERVED) /* inflate block codes */ #define INFLATE_STORED 0 @@ -201,14 +201,14 @@ test_gzip_header (grub_file_t file) * problem occurs from here on, then we have corrupt or otherwise * bad data, and the error should be reported to the user. */ - if (hdr.method != DEFLATED - || (hdr.flags & UNSUPPORTED_FLAGS) - || ((hdr.flags & EXTRA_FIELD) + if (hdr.method != GZ_DEFLATED + || (hdr.flags & GZ_UNSUPPORTED_FLAGS) + || ((hdr.flags & GZ_EXTRA_FIELD) && (grub_file_read (gzio->file, &extra_len, 2) != 2 || eat_field (gzio->file, grub_le_to_cpu16 (extra_len)))) - || ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1)) - || ((hdr.flags & COMMENT) && eat_field (gzio->file, -1))) + || ((hdr.flags & GZ_ORIG_NAME) && eat_field (gzio->file, -1)) + || ((hdr.flags & GZ_COMMENT) && eat_field (gzio->file, -1))) return 0; gzio->data_offset = grub_file_tell (gzio->file); @@ -1183,7 +1183,7 @@ test_zlib_header (grub_gzio_t gzio) flg = get_byte (gzio); /* Check that compression method is DEFLATE. */ - if ((cmf & 0xf) != DEFLATED) + if ((cmf & 0xf) != GZ_DEFLATED) { /* TRANSLATORS: It's about given file having some strange format, not complete lack of gzip support. */ -- 2.9.3.windows.2
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel