2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public License
7 * version 2 as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
23 #ifdef HAVE_PRAGMA_PACK
29 #define ATTRIBUTE_PACKED __attribute__ ((packed))
31 #define ATTRIBUTE_PACKED
34 #define zip_split_sig 0x08074b50
35 #define zip_split_sig_rev 0x504b0708
41 #define zip_lfh_sig 0x04034b50
42 #define zip_lfh_sig_rev 0x504b0304
45 //! ZIP local file header structure.
47 //! See the documentation of the ZIP format for the meaning
50 int ziplocsig; //!< local file header signature
51 short zipver; //!< minimum zip spec version needed to extract
52 short zipgenfld; //!< general purpose flags
53 short zipmthd; //!< compression method
54 short ziptime; //!< file modification time
55 short zipdate; //!< file modification date
56 int zipcrc; //!< CRC-32 checksum
57 unsigned int zipsize; //!< file size (after compression)
58 unsigned int zipuncmp; //!< file size (uncompressed)
59 unsigned short zipfnln; //!< file name length
60 unsigned short zipxtraln; //!< extra filed length (unused?)
61 char zipname[0]; //!< file name (length as given above)
64 #define zip_cd_sig 0x02014b50
65 #define zip_cd_sig_rev 0x504b0102
67 //! ZIP central directory structure.
69 //! See the documentation of the ZIP format for the meaning
72 int zipcensig; //!< central directory signature
73 char zipcver; //!< zip spec version of creating software
74 char zipcos; //!< os compatibility of the file attribute information
75 char zipcvxt; //!< minimum zip spec version needed to extract
76 char zipcexos; //!< unused (?)
77 short zipcflg; //!< general purpose flag
78 short zipcmthd; //!< compression method
79 short ziptim; //!< file modification time
80 short zipdat; //!< file modification date
81 int zipccrc; //!< CRC-32 checksum
82 unsigned int zipcsiz; //!< file size (after compression)
83 unsigned int zipcunc; //!< file size (uncompressed)
84 unsigned short zipcfnl; //!< file name length
85 unsigned short zipcxtl; //!< extra field length
86 unsigned short zipccml; //!< comment length
87 unsigned short zipdsk; //!< disk number of file
88 unsigned short zipint; //!< internal attributes
89 unsigned int zipext; //!< external attributes
90 unsigned int zipofst; //!< offset to start of local file header
91 char zipcfn[0]; //!< file name (length as given above)
95 * @brief Placeholder value for size field in the central directory if
96 * the size is 64bit. See the documentation for the Zip64 Extended
97 * Information Extra Field.
99 #define zip_size_64bit_placeholder 0xffffffff
102 * @brief Header ID for extra field "ZIP64".
104 #define zip_extra_header_id_zip64 0x0001
106 //! ZIP extra field structure.
108 //! See the documentation of the ZIP format for the meaning
111 short tag; //!< extra field header ID
112 short size; //!< extra field data size
113 unsigned long long zipofst; //!< offset to start of local file header (only valid if the struct is for a ZIP64 extra field)
120 char vendor_id1,vendor_id2;
121 char encryption_strength;
122 short compress_method;
125 #define zip_eoc_sig 0x6054b50
126 #define zip_eoc_sig_rev 0x504b0506
128 //! ZIP end of central directory structure.
130 //! See the documentation of the ZIP format for the meaning
133 int zipesig; /* end of central dir signature */
134 unsigned short zipedsk; /* number of this disk */
135 unsigned short zipecen; /* number of the disk with the start of the central directory */
136 unsigned short zipenum; /* total number of entries in the central directory on this disk */
137 unsigned short zipecenn; /* total number of entries in the central directory */
138 unsigned int zipecsz; /* size of the central directory */
139 unsigned int zipeofst; /* offset of start of central directory with respect to the starting disk number */
140 short zipecoml; /* .ZIP file comment length */
141 char zipecom[0]; /* .ZIP file comment */
144 #define zip64_eoc_sig 0x6064b50
145 #define zip64_eoc_sig_rev 0x504b0606
148 int zip64esig; /* zip64 end of central dir signature */
149 unsigned long long zip64esize; /* size of zip64 end of central directory record */
150 unsigned short zip64ever; /* version made by */
151 unsigned short zip64eneed; /* version needed to extract */
152 unsigned int zip64edsk; /* number of this disk */
153 unsigned int zip64ecen; /* number of the disk with the start of the central directory */
154 unsigned long long zip64enum; /* total number of entries in the central directory on this disk */
155 unsigned long long zip64ecenn; /* total number of entries in the central directory */
156 unsigned long long zip64ecsz; /* size of the central directory */
157 unsigned long long zip64eofst; /* offset of start of central directory with respect to the starting disk number */
158 char zip64ecom[0]; /* zip64 extensible data sector */
161 #define zip64_eocl_sig 0x07064b50
166 long long zip64lofst;
170 struct zip_alignment_check {
171 int x[sizeof(struct zip_cd) == 46 ? 1:-1];
174 #ifdef HAVE_PRAGMA_PACK