modules/libjar/zipstruct.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef _zipstruct_h
michael@0 7 #define _zipstruct_h
michael@0 8
michael@0 9
michael@0 10 /*
michael@0 11 * Certain constants and structures for
michael@0 12 * the Phil Katz ZIP archive format.
michael@0 13 *
michael@0 14 */
michael@0 15
michael@0 16 typedef struct ZipLocal_
michael@0 17 {
michael@0 18 unsigned char signature [4];
michael@0 19 unsigned char word [2];
michael@0 20 unsigned char bitflag [2];
michael@0 21 unsigned char method [2];
michael@0 22 unsigned char time [2];
michael@0 23 unsigned char date [2];
michael@0 24 unsigned char crc32 [4];
michael@0 25 unsigned char size [4];
michael@0 26 unsigned char orglen [4];
michael@0 27 unsigned char filename_len [2];
michael@0 28 unsigned char extrafield_len [2];
michael@0 29 } ZipLocal;
michael@0 30
michael@0 31 /*
michael@0 32 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
michael@0 33 * As the internals of a jar/zip file must not depend on the target
michael@0 34 * architecture (i386, ppc, ARM, ...), use a fixed value instead.
michael@0 35 */
michael@0 36 #define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2)
michael@0 37
michael@0 38 typedef struct ZipCentral_
michael@0 39 {
michael@0 40 unsigned char signature [4];
michael@0 41 unsigned char version_made_by [2];
michael@0 42 unsigned char version [2];
michael@0 43 unsigned char bitflag [2];
michael@0 44 unsigned char method [2];
michael@0 45 unsigned char time [2];
michael@0 46 unsigned char date [2];
michael@0 47 unsigned char crc32 [4];
michael@0 48 unsigned char size [4];
michael@0 49 unsigned char orglen [4];
michael@0 50 unsigned char filename_len [2];
michael@0 51 unsigned char extrafield_len [2];
michael@0 52 unsigned char commentfield_len [2];
michael@0 53 unsigned char diskstart_number [2];
michael@0 54 unsigned char internal_attributes [2];
michael@0 55 unsigned char external_attributes [4];
michael@0 56 unsigned char localhdr_offset [4];
michael@0 57 } ZipCentral;
michael@0 58
michael@0 59 /*
michael@0 60 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
michael@0 61 * As the internals of a jar/zip file must not depend on the target
michael@0 62 * architecture (i386, ppc, ARM, ...), use a fixed value instead.
michael@0 63 */
michael@0 64 #define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4)
michael@0 65
michael@0 66 typedef struct ZipEnd_
michael@0 67 {
michael@0 68 unsigned char signature [4];
michael@0 69 unsigned char disk_nr [2];
michael@0 70 unsigned char start_central_dir [2];
michael@0 71 unsigned char total_entries_disk [2];
michael@0 72 unsigned char total_entries_archive [2];
michael@0 73 unsigned char central_dir_size [4];
michael@0 74 unsigned char offset_central_dir [4];
michael@0 75 unsigned char commentfield_len [2];
michael@0 76 } ZipEnd;
michael@0 77
michael@0 78 /*
michael@0 79 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
michael@0 80 * As the internals of a jar/zip file must not depend on the target
michael@0 81 * architecture (i386, ppc, ARM, ...), use a fixed value instead.
michael@0 82 */
michael@0 83 #define ZIPEND_SIZE (4+2+2+2+2+4+4+2)
michael@0 84
michael@0 85 /* signatures */
michael@0 86 #define LOCALSIG 0x04034B50l
michael@0 87 #define CENTRALSIG 0x02014B50l
michael@0 88 #define ENDSIG 0x06054B50l
michael@0 89
michael@0 90 /* extra fields */
michael@0 91 #define EXTENDED_TIMESTAMP_FIELD 0x5455
michael@0 92 #define EXTENDED_TIMESTAMP_MODTIME 0x01
michael@0 93
michael@0 94 /* compression methods */
michael@0 95 #define STORED 0
michael@0 96 #define SHRUNK 1
michael@0 97 #define REDUCED1 2
michael@0 98 #define REDUCED2 3
michael@0 99 #define REDUCED3 4
michael@0 100 #define REDUCED4 5
michael@0 101 #define IMPLODED 6
michael@0 102 #define TOKENIZED 7
michael@0 103 #define DEFLATED 8
michael@0 104 #define UNSUPPORTED 0xFF
michael@0 105
michael@0 106
michael@0 107 #endif /* _zipstruct_h */

mercurial