• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef PRIVATE_H
2 #define PRIVATE_H
3 
4 #include <stddef.h>
5 #include <stdint.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <stdlib.h>
9 
10 typedef struct Zipentry {
11     unsigned long fileNameLength;
12     const unsigned char* fileName;
13     unsigned short compressionMethod;
14     unsigned int uncompressedSize;
15     unsigned int compressedSize;
16     const unsigned char* data;
17 
18     struct Zipentry* next;
19 } Zipentry;
20 
21 typedef struct Zipfile
22 {
23     const unsigned char *buf;
24     ssize_t bufsize;
25 
26     // Central directory
27     unsigned short  disknum;            //mDiskNumber;
28     unsigned short  diskWithCentralDir; //mDiskWithCentralDir;
29     unsigned short  entryCount;         //mNumEntries;
30     unsigned short  totalEntryCount;    //mTotalNumEntries;
31     unsigned int    centralDirSize;     //mCentralDirSize;
32     unsigned int    centralDirOffest;  // offset from first disk  //mCentralDirOffset;
33     unsigned short  commentLen;         //mCommentLen;
34     const unsigned char*  comment;            //mComment;
35 
36     Zipentry* entries;
37 } Zipfile;
38 
39 int read_central_dir(Zipfile* file);
40 
41 unsigned int read_le_int(const unsigned char* buf);
42 unsigned int read_le_short(const unsigned char* buf);
43 
44 #endif // PRIVATE_H
45 
46