ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zip.h File Reference
#include "zlib.h"
#include "ioapi.h"
+ Include dependency graph for zip.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tm_zip_s
 
struct  zip_fileinfo
 

Macros

#define Z_BZIP2ED   12
 
#define ZIP_OK   (0)
 
#define ZIP_EOF   (0)
 
#define ZIP_ERRNO   (Z_ERRNO)
 
#define ZIP_PARAMERROR   (-102)
 
#define ZIP_BADZIPFILE   (-103)
 
#define ZIP_INTERNALERROR   (-104)
 
#define ZIP_WRITE_DATA_DESCRIPTOR   0x8u
 
#define ZIP_AUTO_CLOSE   0x1u
 
#define ZIP_SEQUENTIAL   0x2u
 
#define ZIP_DEFAULT_FLAGS   (ZIP_AUTO_CLOSE | ZIP_WRITE_DATA_DESCRIPTOR)
 
#define DEF_MEM_LEVEL   MAX_MEM_LEVEL
 
#define APPEND_STATUS_CREATE   (0)
 
#define APPEND_STATUS_CREATEAFTER   (1)
 
#define APPEND_STATUS_ADDINZIP   (2)
 

Typedefs

typedef voidp zipFile
 
typedef struct tm_zip_s tm_zip
 
typedef const char * zipcharpc
 

Functions

zipFile ZEXPORT zipOpen _Z_OF ((voidpf file, int append))
 
zipFile ZEXPORT zipOpen2 _Z_OF ((voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc_def *pzlib_filefunc_def))
 
zipFile ZEXPORT zipOpen2_64 _Z_OF ((voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc64_def *pzlib_filefunc_def))
 
zipFile ZEXPORT zipOpen3 (voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, unsigned flags)
 
int ZEXPORT zipOpenNewFileInZip _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level))
 
int ZEXPORT zipOpenNewFileInZip64 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int zip64))
 
int ZEXPORT zipOpenNewFileInZip2 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw))
 
int ZEXPORT zipOpenNewFileInZip2_64 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int zip64))
 
int ZEXPORT zipOpenNewFileInZip3 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting))
 
int ZEXPORT zipOpenNewFileInZip3_64 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, int zip64))
 
int ZEXPORT zipOpenNewFileInZip4 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase))
 
int ZEXPORT zipOpenNewFileInZip4_64 _Z_OF ((zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase, int zip64))
 
int ZEXPORT zipWriteInFileInZip _Z_OF ((zipFile file, const void *buf, unsigned len))
 
int ZEXPORT zipCloseFileInZip _Z_OF ((zipFile file))
 
int ZEXPORT zipCloseFileInZipRaw _Z_OF ((zipFile file, uLong uncompressed_size, uLong crc32))
 
int ZEXPORT zipCloseFileInZipRaw64 _Z_OF ((zipFile file, ZPOS64_T uncompressed_size, uLong crc32))
 
int ZEXPORT zipClose _Z_OF ((zipFile file, const char *global_comment))
 
int ZEXPORT zipRemoveExtraInfoBlock _Z_OF ((char *pData, int *dataLen, short sHeader))
 
int ZEXPORT zipSetFlags (zipFile file, unsigned flags)
 
int ZEXPORT zipClearFlags (zipFile file, unsigned flags)
 

Data Structure Documentation

struct tm_zip_s

Definition at line 100 of file zip.h.

+ Collaboration diagram for tm_zip_s:
Data Fields
uInt tm_hour
uInt tm_mday
uInt tm_min
uInt tm_mon
uInt tm_sec
uInt tm_year
struct zip_fileinfo

Definition at line 110 of file zip.h.

+ Collaboration diagram for zip_fileinfo:
Data Fields
uLong dosDate
uLong external_fa
uLong internal_fa
tm_zip tmz_date

Macro Definition Documentation

#define APPEND_STATUS_ADDINZIP   (2)

Definition at line 125 of file zip.h.

Referenced by QuaZip::open(), and zipOpen3().

#define APPEND_STATUS_CREATE   (0)

Definition at line 123 of file zip.h.

Referenced by QuaZip::open(), and zipOpen3().

#define APPEND_STATUS_CREATEAFTER   (1)

Definition at line 124 of file zip.h.

Referenced by QuaZip::open(), and zipOpen3().

#define DEF_MEM_LEVEL   MAX_MEM_LEVEL
#define Z_BZIP2ED   12

Definition at line 67 of file zip.h.

#define ZIP_AUTO_CLOSE   0x1u

Definition at line 86 of file zip.h.

Referenced by LoadCentralDirectoryRecord(), QuaZip::open(), zipClose(), and zipOpen3().

#define ZIP_BADZIPFILE   (-103)

Definition at line 82 of file zip.h.

Referenced by LoadCentralDirectoryRecord(), and zipCloseFileInZipRaw64().

#define ZIP_DEFAULT_FLAGS   (ZIP_AUTO_CLOSE | ZIP_WRITE_DATA_DESCRIPTOR)

Definition at line 88 of file zip.h.

Referenced by zipOpen(), zipOpen2(), zipOpen2_64(), and zipOpen64().

#define ZIP_EOF   (0)

Definition at line 79 of file zip.h.

Referenced by zip64local_getByte().

#define ZIP_INTERNALERROR   (-104)

Definition at line 83 of file zip.h.

Referenced by add_data_in_datablock(), and zipOpenNewFileInZip4_64().

#define ZIP_PARAMERROR   (-102)
#define ZIP_SEQUENTIAL   0x2u
#define ZIP_WRITE_DATA_DESCRIPTOR   0x8u

Typedef Documentation

typedef struct tm_zip_s tm_zip
typedef const char* zipcharpc

Definition at line 120 of file zip.h.

typedef voidp zipFile

Definition at line 75 of file zip.h.

Function Documentation

zipFile ZEXPORT zipOpen _Z_OF ( (voidpf file, int append)  )
zipFile ZEXPORT zipOpen2 _Z_OF ( (voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc_def *pzlib_filefunc_def)  )
zipFile ZEXPORT zipOpen2_64 _Z_OF ( (voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc64_def *pzlib_filefunc_def)  )
int ZEXPORT zipOpenNewFileInZip _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level)  )
int ZEXPORT zipOpenNewFileInZip64 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int zip64)  )
int ZEXPORT zipOpenNewFileInZip2 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw)  )
int ZEXPORT zipOpenNewFileInZip2_64 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int zip64)  )
int ZEXPORT zipOpenNewFileInZip3 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting)  )
int ZEXPORT zipOpenNewFileInZip3_64 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, int zip64)  )
int ZEXPORT zipOpenNewFileInZip4 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase)  )
int ZEXPORT zipOpenNewFileInZip4_64 _Z_OF ( (zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase, int zip64)  )
int ZEXPORT zipWriteInFileInZip _Z_OF ( (zipFile file, const void *buf, unsigned len)  )
int ZEXPORT zipCloseFileInZip _Z_OF ( (zipFile file)  )
int ZEXPORT zipCloseFileInZipRaw _Z_OF ( (zipFile file, uLong uncompressed_size, uLong crc32)  )
int ZEXPORT zipCloseFileInZipRaw64 _Z_OF ( (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)  )
int ZEXPORT zipClose _Z_OF ( (zipFile file, const char *global_comment)  )
int ZEXPORT zipRemoveExtraInfoBlock _Z_OF ( (char *pData, int *dataLen, short sHeader)  )
int ZEXPORT zipClearFlags ( zipFile  file,
unsigned  flags 
)

Definition at line 2091 of file zip.c.

References zip64_internal::flags, ZIP_OK, ZIP_PARAMERROR, ZIP_SEQUENTIAL, and ZIP_WRITE_DATA_DESCRIPTOR.

Referenced by QuaZipFile::open().

2092 {
2093  zip64_internal* zi;
2094  if (file == NULL)
2095  return ZIP_PARAMERROR;
2096  zi = (zip64_internal*)file;
2097  zi->flags &= ~flags;
2098  // If the data descriptor is not written, we can't use a non-seekable output.
2099  if ((zi->flags & ZIP_WRITE_DATA_DESCRIPTOR) == 0) {
2100  zi->flags &= ~ZIP_SEQUENTIAL;
2101  }
2102  return ZIP_OK;
2103 }
#define ZIP_OK
Definition: zip.h:78
#define ZIP_WRITE_DATA_DESCRIPTOR
Definition: zip.h:85
unsigned flags
Definition: zip.c:188
#define ZIP_PARAMERROR
Definition: zip.h:81
#define ZIP_SEQUENTIAL
Definition: zip.h:87

+ Here is the caller graph for this function:

zipFile ZEXPORT zipOpen3 ( voidpf  file,
int  append,
zipcharpc globalcomment,
zlib_filefunc64_32_def pzlib_filefunc64_32_def,
unsigned  flags 
)

Definition at line 862 of file zip.c.

References zip64_internal::add_position_when_writting_offset, ALLOC, APPEND_STATUS_ADDINZIP, APPEND_STATUS_CREATE, APPEND_STATUS_CREATEAFTER, zip64_internal::begin_pos, zip64_internal::central_dir, zip64_internal::ci, zip64_internal::filestream, fill_qiodevice64_filefunc(), zip64_internal::flags, zip64_internal::globalcomment, zip64_internal::in_opened_file_inzip, init_linkedlist(), LoadCentralDirectoryRecord(), zip64_internal::number_entry, SEEK_END, curfile64_info::stream_initialised, TRYFREE, zip64_internal::z_filefunc, ZCLOSE64, ZFAKECLOSE64, zlib_filefunc64_32_def_s::zfile_func64, ZIP_AUTO_CLOSE, ZIP_OK, ZLIB_FILEFUNC_MODE_CREATE, ZLIB_FILEFUNC_MODE_EXISTING, ZLIB_FILEFUNC_MODE_READ, ZLIB_FILEFUNC_MODE_WRITE, ZOPEN64, zlib_filefunc64_32_def_s::zseek32_file, ZSEEK64, zlib_filefunc64_32_def_s::ztell32_file, and ZTELL64.

Referenced by QuaZip::open(), zipOpen(), zipOpen2(), zipOpen2_64(), and zipOpen64().

864 {
865  zip64_internal ziinit;
866  zip64_internal* zi;
867  int err=ZIP_OK;
868 
869  ziinit.flags = flags;
870  ziinit.z_filefunc.zseek32_file = NULL;
871  ziinit.z_filefunc.ztell32_file = NULL;
872  if (pzlib_filefunc64_32_def==NULL)
874  else
875  ziinit.z_filefunc = *pzlib_filefunc64_32_def;
876 
877  ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
878  file,
879  (append == APPEND_STATUS_CREATE) ?
882 
883  if (ziinit.filestream == NULL)
884  return NULL;
885 
886  if (append == APPEND_STATUS_CREATEAFTER)
887  ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END);
888 
889  ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream);
890  ziinit.in_opened_file_inzip = 0;
891  ziinit.ci.stream_initialised = 0;
892  ziinit.number_entry = 0;
894  init_linkedlist(&(ziinit.central_dir));
895 
896 
897 
898  zi = (zip64_internal*)ALLOC(sizeof(zip64_internal));
899  if (zi==NULL)
900  {
901  if ((ziinit.flags & ZIP_AUTO_CLOSE) != 0) {
902  ZCLOSE64(ziinit.z_filefunc,ziinit.filestream);
903  } else {
904  ZFAKECLOSE64(ziinit.z_filefunc,ziinit.filestream);
905  }
906  return NULL;
907  }
908 
909  /* now we add file in a zipfile */
910 # ifndef NO_ADDFILEINEXISTINGZIP
911  ziinit.globalcomment = NULL;
912  if (append == APPEND_STATUS_ADDINZIP)
913  {
914  /* Read and Cache Central Directory Records */
915  err = LoadCentralDirectoryRecord(&ziinit);
916  }
917 
918  if (globalcomment)
919  {
920  *globalcomment = ziinit.globalcomment;
921  }
922 # endif /* !NO_ADDFILEINEXISTINGZIP*/
923 
924  if (err != ZIP_OK)
925  {
926 # ifndef NO_ADDFILEINEXISTINGZIP
927  TRYFREE(ziinit.globalcomment);
928 # endif /* !NO_ADDFILEINEXISTINGZIP*/
929  TRYFREE(zi);
930  return NULL;
931  }
932  else
933  {
934  *zi = ziinit;
935  return (zipFile)zi;
936  }
937 }
#define ZIP_OK
Definition: zip.h:78
char * globalcomment
Definition: zip.c:185
void fill_qiodevice64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def)
Definition: qioapi.cpp:331
#define APPEND_STATUS_CREATEAFTER
Definition: zip.h:124
#define ZLIB_FILEFUNC_MODE_READ
Definition: ioapi.h:113
int stream_initialised
Definition: zip.c:144
zlib_filefunc64_def zfile_func64
Definition: ioapi.h:178
tell_file_func ztell32_file
Definition: ioapi.h:180
int in_opened_file_inzip
Definition: zip.c:177
voidp zipFile
Definition: zip.h:75
voidpf filestream
Definition: zip.c:175
unsigned flags
Definition: zip.c:188
#define ZCLOSE64(filefunc, filestream)
Definition: ioapi.h:189
#define ZFAKECLOSE64(filefunc, filestream)
Definition: ioapi.h:190
#define SEEK_END
Definition: zip.c:90
#define ZOPEN64(filefunc, filename, mode)
Definition: ioapi.h:199
ZPOS64_T add_position_when_writting_offset
Definition: zip.c:181
int LoadCentralDirectoryRecord(zip64_internal *pziinit)
Definition: zip.c:649
linkedlist_data central_dir
Definition: zip.c:176
#define TRYFREE(p)
Definition: zip.c:71
#define ZIP_AUTO_CLOSE
Definition: zip.h:86
#define ZLIB_FILEFUNC_MODE_CREATE
Definition: ioapi.h:118
#define ZLIB_FILEFUNC_MODE_EXISTING
Definition: ioapi.h:117
zlib_filefunc64_32_def z_filefunc
Definition: zip.c:174
#define ZTELL64(filefunc, filestream)
Definition: ioapi.h:200
static void init_linkedlist(linkedlist_data *ll)
Definition: zip.c:222
ZPOS64_T number_entry
Definition: zip.c:182
seek_file_func zseek32_file
Definition: ioapi.h:181
#define ALLOC(size)
Definition: zip.c:68
curfile64_info ci
Definition: zip.c:178
#define ZLIB_FILEFUNC_MODE_WRITE
Definition: ioapi.h:114
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:201
ZPOS64_T begin_pos
Definition: zip.c:180
#define APPEND_STATUS_ADDINZIP
Definition: zip.h:125
#define APPEND_STATUS_CREATE
Definition: zip.h:123

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ZEXPORT zipSetFlags ( zipFile  file,
unsigned  flags 
)

Definition at line 2077 of file zip.c.

References zip64_internal::flags, ZIP_OK, ZIP_PARAMERROR, ZIP_SEQUENTIAL, and ZIP_WRITE_DATA_DESCRIPTOR.

Referenced by QuaZip::open(), and QuaZipFile::open().

2078 {
2079  zip64_internal* zi;
2080  if (file == NULL)
2081  return ZIP_PARAMERROR;
2082  zi = (zip64_internal*)file;
2083  zi->flags |= flags;
2084  // If the output is non-seekable, the data descriptor is needed.
2085  if ((zi->flags & ZIP_SEQUENTIAL) != 0) {
2087  }
2088  return ZIP_OK;
2089 }
#define ZIP_OK
Definition: zip.h:78
#define ZIP_WRITE_DATA_DESCRIPTOR
Definition: zip.h:85
unsigned flags
Definition: zip.c:188
#define ZIP_PARAMERROR
Definition: zip.h:81
#define ZIP_SEQUENTIAL
Definition: zip.h:87

+ Here is the caller graph for this function: