Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* zip.h |
michael@0 | 6 | * Structures and functions for creating ZIP archives. |
michael@0 | 7 | */ |
michael@0 | 8 | #ifndef ZIP_H |
michael@0 | 9 | #define ZIP_H |
michael@0 | 10 | |
michael@0 | 11 | /* For general information on ZIP formats, you can look at jarfile.h |
michael@0 | 12 | * in ns/security/lib/jar. Or look it up on the web... |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | /* One entry in a ZIPfile. This corresponds to one file in the archive. |
michael@0 | 16 | * We have to save this information because first all the files go into |
michael@0 | 17 | * the archive with local headers; then at the end of the file we have to |
michael@0 | 18 | * put the central directory entries for each file. |
michael@0 | 19 | */ |
michael@0 | 20 | typedef struct ZIPentry_s { |
michael@0 | 21 | struct ZipLocal local; /* local header info */ |
michael@0 | 22 | struct ZipCentral central; /* central directory info */ |
michael@0 | 23 | char *filename; /* name of file */ |
michael@0 | 24 | char *comment; /* comment for this file -- optional */ |
michael@0 | 25 | |
michael@0 | 26 | struct ZIPentry_s *next; |
michael@0 | 27 | } ZIPentry; |
michael@0 | 28 | |
michael@0 | 29 | /* This structure contains the necessary data for putting a ZIP file |
michael@0 | 30 | * together. Has some overall information and a list of ZIPentrys. |
michael@0 | 31 | */ |
michael@0 | 32 | typedef struct ZIPfile_s { |
michael@0 | 33 | char *filename; /* ZIP file name */ |
michael@0 | 34 | char *comment; /* ZIP file comment -- may be NULL */ |
michael@0 | 35 | PRFileDesc *fp; /* ZIP file pointer */ |
michael@0 | 36 | ZIPentry *list; /* one entry for each file in the archive */ |
michael@0 | 37 | unsigned int time; /* the GMT time of creation, in DOS format */ |
michael@0 | 38 | unsigned int date; /* the GMT date of creation, in DOS format */ |
michael@0 | 39 | unsigned long central_start; /* starting offset of central directory */ |
michael@0 | 40 | unsigned long central_end; /*index right after the last byte of central*/ |
michael@0 | 41 | } ZIPfile; |
michael@0 | 42 | |
michael@0 | 43 | |
michael@0 | 44 | /* Open a new ZIP file. Takes the name of the zip file and an optional |
michael@0 | 45 | * comment to be included in the file. Returns a new ZIPfile structure |
michael@0 | 46 | * which is used by JzipAdd and JzipClose |
michael@0 | 47 | */ |
michael@0 | 48 | ZIPfile* JzipOpen(char *filename, char *comment); |
michael@0 | 49 | |
michael@0 | 50 | /* Add a file to a ZIP archive. Fullname is the path relative to the |
michael@0 | 51 | * current directory. Filename is what the name will be stored as in the |
michael@0 | 52 | * archive, and thus what it will be restored as. zipfile is a structure |
michael@0 | 53 | * returned from a previous call to JzipOpen. |
michael@0 | 54 | * |
michael@0 | 55 | * Non-zero return code means error (although usually the function will |
michael@0 | 56 | * call exit() rather than return an error--gotta fix this). |
michael@0 | 57 | */ |
michael@0 | 58 | int JzipAdd(char *fullname, char *filename, ZIPfile *zipfile, |
michael@0 | 59 | int compression_level); |
michael@0 | 60 | |
michael@0 | 61 | /* Finalize a ZIP archive. Adds all the footer information to the end of |
michael@0 | 62 | * the file and closes it. Also DELETES THE ZIPFILE STRUCTURE that was |
michael@0 | 63 | * passed in. So you never have to allocate or free a ZIPfile yourself. |
michael@0 | 64 | * |
michael@0 | 65 | * Non-zero return code means error (although usually the function will |
michael@0 | 66 | * call exit() rather than return an error--gotta fix this). |
michael@0 | 67 | */ |
michael@0 | 68 | int JzipClose (ZIPfile *zipfile); |
michael@0 | 69 | |
michael@0 | 70 | |
michael@0 | 71 | #endif /* ZIP_H */ |