summaryrefslogtreecommitdiff
path: root/navit/zipfile.h
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-01-29 19:19:48 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-01-29 19:19:48 +0000
commit06c69325b7d7e49c5ba9a129277ff7a9ebcebe70 (patch)
tree61d4cc04bddcf99ef666fe62585502c203cb96a5 /navit/zipfile.h
parenteba3c3d24167a6d0005ada1cb61b683c8b3a80c9 (diff)
downloadnavit-svn-06c69325b7d7e49c5ba9a129277ff7a9ebcebe70.tar.gz
Fix:core:Add comments and some #defines for constants
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4917 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/zipfile.h')
-rw-r--r--navit/zipfile.h99
1 files changed, 64 insertions, 35 deletions
diff --git a/navit/zipfile.h b/navit/zipfile.h
index 11be7981..bb3ed1c5 100644
--- a/navit/zipfile.h
+++ b/navit/zipfile.h
@@ -41,51 +41,76 @@ struct zip_split {
#define zip_lfh_sig 0x04034b50
#define zip_lfh_sig_rev 0x504b0304
+
+//! ZIP local file header structure.
+
+//! See the documentation of the ZIP format for the meaning
+//! of these fields.
struct zip_lfh {
- int ziplocsig;
- short zipver; // 4
- short zipgenfld; // 6
- short zipmthd; // 8
- short ziptime; // 10
- short zipdate; // 12
- int zipcrc; // 14
- unsigned int zipsize; // 18
- unsigned int zipuncmp; // 22
- unsigned short zipfnln; // 26
- unsigned short zipxtraln; // 30
- char zipname[0]; // 34
+ int ziplocsig; //!< local file header signature
+ short zipver; //!< minimum zip spec version needed to extract
+ short zipgenfld; //!< general purpose flags
+ short zipmthd; //!< compression method
+ short ziptime; //!< file modification time
+ short zipdate; //!< file modification date
+ int zipcrc; //!< CRC-32 checksum
+ unsigned int zipsize; //!< file size (after compression)
+ unsigned int zipuncmp; //!< file size (uncompressed)
+ unsigned short zipfnln; //!< file name length
+ unsigned short zipxtraln; //!< extra filed length (unused?)
+ char zipname[0]; //!< file name (length as given above)
} ATTRIBUTE_PACKED;
#define zip_cd_sig 0x02014b50
#define zip_cd_sig_rev 0x504b0102
+//! ZIP central directory structure.
+
+//! See the documentation of the ZIP format for the meaning
+//! of these fields.
struct zip_cd {
- int zipcensig;
- char zipcver;
- char zipcos;
- char zipcvxt;
- char zipcexos;
- short zipcflg;
- short zipcmthd;
- short ziptim;
- short zipdat;
- int zipccrc;
- unsigned int zipcsiz;
- unsigned int zipcunc;
- unsigned short zipcfnl;
- unsigned short zipcxtl;
- unsigned short zipccml;
- unsigned short zipdsk;
- unsigned short zipint;
- unsigned int zipext;
- unsigned int zipofst;
- char zipcfn[0];
+ int zipcensig; //!< central directory signature
+ char zipcver; //!< zip spec version of creating software
+ char zipcos; //!< os compatibility of the file attribute information
+ char zipcvxt; //!< minimum zip spec version needed to extract
+ char zipcexos; //!< unused (?)
+ short zipcflg; //!< general purpose flag
+ short zipcmthd; //!< compression method
+ short ziptim; //!< file modification time
+ short zipdat; //!< file modification date
+ int zipccrc; //!< CRC-32 checksum
+ unsigned int zipcsiz; //!< file size (after compression)
+ unsigned int zipcunc; //!< file size (uncompressed)
+ unsigned short zipcfnl; //!< file name length
+ unsigned short zipcxtl; //!< extra field length
+ unsigned short zipccml; //!< comment length
+ unsigned short zipdsk; //!< disk number of file
+ unsigned short zipint; //!< internal attributes
+ unsigned int zipext; //!< external attributes
+ unsigned int zipofst; //!< offset to start of local file header
+ char zipcfn[0]; //!< file name (length as given above)
} ATTRIBUTE_PACKED;
+/**
+* @brief Placeholder value for size field in the central directory if
+* the size is 64bit. See the documentation for the Zip64 Extended
+* Information Extra Field.
+*/
+#define zip_size_64bit_placeholder 0xffffffff
+
+/**
+* @brief Header ID for extra field "ZIP64".
+*/
+#define zip_extra_header_id_zip64 0x0001
+
+//! ZIP extra field structure.
+
+//! See the documentation of the ZIP format for the meaning
+//! of these fields.
struct zip_cd_ext {
- short tag;
- short size;
- unsigned long long zipofst;
+ short tag; //!< extra field header ID
+ short size; //!< extra field data size
+ unsigned long long zipofst; //!< offset to start of local file header (only valid if the struct is for a ZIP64 extra field)
} ATTRIBUTE_PACKED;
struct zip_enc {
@@ -100,6 +125,10 @@ struct zip_enc {
#define zip_eoc_sig 0x6054b50
#define zip_eoc_sig_rev 0x504b0506
+//! ZIP end of central directory structure.
+
+//! See the documentation of the ZIP format for the meaning
+//! of these fields.
struct zip_eoc {
int zipesig; /* end of central dir signature */
unsigned short zipedsk; /* number of this disk */