aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-02 14:14:48 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-02 14:14:48 +0200
commit26b6ccf340243ec3acd594c6928b18e95d3deea9 (patch)
tree90955d90056adbd8724db164f7cbb3e56833ed8b /include
parentabb154ba02f9a9a98465cb1f816f974cca536392 (diff)
downloadbusybox-26b6ccf340243ec3acd594c6928b18e95d3deea9.tar.gz
*: simplify checks for gz/bz2/xz magic
function old new delta send_tree 360 355 -5 rpm2cpio_main 249 220 -29 setup_unzip_on_fd 150 118 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-66) Total: -66 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r--include/unarchive.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/unarchive.h b/include/unarchive.h
index aa7ecec55..8009de282 100644
--- a/include/unarchive.h
+++ b/include/unarchive.h
@@ -4,6 +4,22 @@
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
+enum {
+#if BB_BIG_ENDIAN
+ COMPRESS_MAGIC = 0x1f9d,
+ GZIP_MAGIC = 0x1f8b,
+ BZIP2_MAGIC = ('B'<<8) + 'Z',
+ XZ_MAGIC1 = (0xfd<<8) + '7',
+ XZ_MAGIC2 = ((((('z'<<8) + 'X')<<8) + 'Z')<<8) + 0,
+#else
+ COMPRESS_MAGIC = 0x9d1f,
+ GZIP_MAGIC = 0x8b1f,
+ BZIP2_MAGIC = ('Z'<<8) + 'B',
+ XZ_MAGIC1 = ('7'<<8) + 0xfd,
+ XZ_MAGIC2 = (((((0<<8) + 'Z')<<8) + 'X')<<8) + 'z',
+#endif
+};
+
typedef struct file_header_t {
char *name;
char *link_target;