ReactOS  0.4.12-dev-396-g37af787
unzip.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "unzip.h"
#include <errno.h>
Include dependency graph for unzip.c:

Go to the source code of this file.

Classes

struct  unz_file_info64_internal_s
 
struct  file_in_zip64_read_info_s
 
struct  unz64_s
 

Macros

#define NOUNCRYPT
 
#define local   static
 
#define CASESENSITIVITYDEFAULT_NO
 
#define UNZ_BUFSIZE   (16384)
 
#define UNZ_MAXFILENAMEINZIP   (256)
 
#define ALLOC(size)   (malloc(size))
 
#define TRYFREE(p)   {if (p) free(p);}
 
#define SIZECENTRALDIRITEM   (0x2e)
 
#define SIZEZIPLOCALHEADER   (0x1e)
 
#define CASESENSITIVITYDEFAULTVALUE   2
 
#define STRCMPCASENOSENTIVEFUNCTION   strcmpcasenosensitive_internal
 
#define BUFREADCOMMENT   (0x400)
 

Typedefs

typedef struct unz_file_info64_internal_s unz_file_info64_internal
 

Functions

int unz64local_getByte OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi))
 
int unz64local_getByte (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
 
int unz64local_getShort OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX))
 
int unz64local_getShort (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
 
int unz64local_getLong (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
 
int unz64local_getLong64 OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX))
 
int unz64local_getLong64 (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
 
int strcmpcasenosensitive_internal (const char *fileName1, const char *fileName2)
 
int ZEXPORT unzStringFileNameCompare (const char *fileName1, const char *fileName2, int iCaseSensitivity)
 
ZPOS64_T unz64local_SearchCentralDir OF ((const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream))
 
ZPOS64_T unz64local_SearchCentralDir (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
 
ZPOS64_T unz64local_SearchCentralDir64 (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
 
unzFile unzOpenInternal (const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
 
unzFile ZEXPORT unzOpen2 (const char *path, zlib_filefunc_def *pzlib_filefunc32_def)
 
unzFile ZEXPORT unzOpen2_64 (const void *path, zlib_filefunc64_def *pzlib_filefunc_def)
 
unzFile ZEXPORT unzOpen (const char *path)
 
unzFile ZEXPORT unzOpen64 (const void *path)
 
int ZEXPORT unzClose (unzFile file)
 
int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64 *pglobal_info)
 
int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info *pglobal_info32)
 
void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz *ptm)
 
int unz64local_GetCurrentFileInfoInternal OF ((unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize))
 
int unz64local_GetCurrentFileInfoInternal (unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
 
int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
 
int ZEXPORT unzGetCurrentFileInfo (unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
 
int ZEXPORT unzGoToFirstFile (unzFile file)
 
int ZEXPORT unzGoToNextFile (unzFile file)
 
int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
 
int ZEXPORT unzGetFilePos64 (unzFile file, unz64_file_pos *file_pos)
 
int ZEXPORT unzGetFilePos (unzFile file, unz_file_pos *file_pos)
 
int ZEXPORT unzGoToFilePos64 (unzFile file, const unz64_file_pos *file_pos)
 
int ZEXPORT unzGoToFilePos (unzFile file, unz_file_pos *file_pos)
 
int unz64local_CheckCurrentFileCoherencyHeader (unz64_s *s, uInt *piSizeVar, ZPOS64_T *poffset_local_extrafield, uInt *psize_local_extrafield)
 
int ZEXPORT unzOpenCurrentFile3 (unzFile file, int *method, int *level, int raw, const char *password)
 
int ZEXPORT unzOpenCurrentFile (unzFile file)
 
int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char *password)
 
int ZEXPORT unzOpenCurrentFile2 (unzFile file, int *method, int *level, int raw)
 
ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 (unzFile file)
 
int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
 
z_off_t ZEXPORT unztell (unzFile file)
 
ZPOS64_T ZEXPORT unztell64 (unzFile file)
 
int ZEXPORT unzeof (unzFile file)
 
int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
 
int ZEXPORT unzCloseCurrentFile (unzFile file)
 
int ZEXPORT unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf)
 
ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file)
 
uLong ZEXPORT unzGetOffset (unzFile file)
 
int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos)
 
int ZEXPORT unzSetOffset (unzFile file, uLong pos)
 

Variables

const char unz_copyright []
 

Macro Definition Documentation

◆ ALLOC

#define ALLOC (   size)    (malloc(size))

Definition at line 112 of file unzip.c.

◆ BUFREADCOMMENT

#define BUFREADCOMMENT   (0x400)

Definition at line 405 of file unzip.c.

◆ CASESENSITIVITYDEFAULT_NO

#define CASESENSITIVITYDEFAULT_NO

Definition at line 98 of file unzip.c.

◆ CASESENSITIVITYDEFAULTVALUE

#define CASESENSITIVITYDEFAULTVALUE   2

Definition at line 372 of file unzip.c.

◆ local

#define local   static

Definition at line 91 of file unzip.c.

◆ NOUNCRYPT

#define NOUNCRYPT

Definition at line 72 of file unzip.c.

◆ SIZECENTRALDIRITEM

#define SIZECENTRALDIRITEM   (0x2e)

Definition at line 118 of file unzip.c.

◆ SIZEZIPLOCALHEADER

#define SIZEZIPLOCALHEADER   (0x1e)

Definition at line 119 of file unzip.c.

◆ STRCMPCASENOSENTIVEFUNCTION

#define STRCMPCASENOSENTIVEFUNCTION   strcmpcasenosensitive_internal

Definition at line 378 of file unzip.c.

◆ TRYFREE

#define TRYFREE (   p)    {if (p) free(p);}

Definition at line 115 of file unzip.c.

◆ UNZ_BUFSIZE

#define UNZ_BUFSIZE   (16384)

Definition at line 104 of file unzip.c.

◆ UNZ_MAXFILENAMEINZIP

#define UNZ_MAXFILENAMEINZIP   (256)

Definition at line 108 of file unzip.c.

Typedef Documentation

◆ unz_file_info64_internal

Function Documentation

◆ OF() [1/5]

int unz64local_getByte OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi )

◆ OF() [2/5]

int unz64local_getShort OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)  )

◆ OF() [3/5]

int unz64local_getLong64 OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)  )

◆ OF() [4/5]

ZPOS64_T unz64local_SearchCentralDir OF ( (const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)  )

◆ OF() [5/5]

int unz64local_GetCurrentFileInfoInternal OF ( (unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)  )

◆ strcmpcasenosensitive_internal()

int strcmpcasenosensitive_internal ( const char fileName1,
const char fileName2 
)

Definition at line 349 of file unzip.c.

350 {
351  for (;;)
352  {
353  char c1=*(fileName1++);
354  char c2=*(fileName2++);
355  if ((c1>='a') && (c1<='z'))
356  c1 -= 0x20;
357  if ((c2>='a') && (c2<='z'))
358  c2 -= 0x20;
359  if (c1=='\0')
360  return ((c2=='\0') ? 0 : -1);
361  if (c2=='\0')
362  return 1;
363  if (c1<c2)
364  return -1;
365  if (c1>c2)
366  return 1;
367  }
368 }

◆ unz64local_CheckCurrentFileCoherencyHeader()

int unz64local_CheckCurrentFileCoherencyHeader ( unz64_s s,
uInt piSizeVar,
ZPOS64_T poffset_local_extrafield,
uInt psize_local_extrafield 
)

Definition at line 1388 of file unzip.c.

1391 {
1392  uLong uMagic,uData,uFlags;
1393  uLong size_filename;
1394  uLong size_extra_field;
1395  int err=UNZ_OK;
1396 
1397  *piSizeVar = 0;
1398  *poffset_local_extrafield = 0;
1399  *psize_local_extrafield = 0;
1400 
1401  if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
1402  s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
1403  return UNZ_ERRNO;
1404 
1405 
1406  if (err==UNZ_OK)
1407  {
1408  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
1409  err=UNZ_ERRNO;
1410  else if (uMagic!=0x04034b50)
1412  }
1413 
1414  if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
1415  err=UNZ_ERRNO;
1416 /*
1417  else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
1418  err=UNZ_BADZIPFILE;
1419 */
1420  if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
1421  err=UNZ_ERRNO;
1422 
1423  if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
1424  err=UNZ_ERRNO;
1425  else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
1427 
1428  if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
1429 /* #ifdef HAVE_BZIP2 */
1430  (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
1431 /* #endif */
1432  (s->cur_file_info.compression_method!=Z_DEFLATED))
1434 
1435  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
1436  err=UNZ_ERRNO;
1437 
1438  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
1439  err=UNZ_ERRNO;
1440  else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0))
1442 
1443  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
1444  err=UNZ_ERRNO;
1445  else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0))
1447 
1448  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
1449  err=UNZ_ERRNO;
1450  else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0))
1452 
1453  if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
1454  err=UNZ_ERRNO;
1455  else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
1457 
1458  *piSizeVar += (uInt)size_filename;
1459 
1460  if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
1461  err=UNZ_ERRNO;
1462  *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
1463  SIZEZIPLOCALHEADER + size_filename;
1464  *psize_local_extrafield = (uInt)size_extra_field;
1465 
1466  *piSizeVar += (uInt)size_extra_field;
1467 
1468  return err;
1469 }
#define UNZ_OK
Definition: unzip.h:74
#define UNZ_BADZIPFILE
Definition: unzip.h:79
int unz64local_getLong(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:266
UINT uFlags
Definition: api.c:60
#define Z_DEFLATED
Definition: zlib.h:209
#define Z_BZIP2ED
Definition: unzip.h:62
unsigned long uLong
Definition: zconf.h:394
GLdouble s
Definition: gl.h:2039
#define err(...)
#define UNZ_ERRNO
Definition: unzip.h:76
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
int unz64local_getShort(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:239
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
#define SIZEZIPLOCALHEADER
Definition: unzip.c:119
unsigned int uInt
Definition: zconf.h:393

Referenced by unzOpenCurrentFile3().

◆ unz64local_DosDateToTmuDate()

void unz64local_DosDateToTmuDate ( ZPOS64_T  ulDosDate,
tm_unz ptm 
)

Definition at line 855 of file unzip.c.

856 {
857  ZPOS64_T uDate;
858  uDate = (ZPOS64_T)(ulDosDate>>16);
859  ptm->tm_mday = (uInt)(uDate&0x1f) ;
860  ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
861  ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
862 
863  ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
864  ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
865  ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
866 }
uInt tm_mon
Definition: unzip.h:90
uInt tm_mday
Definition: unzip.h:89
uInt tm_hour
Definition: unzip.h:88
uInt tm_min
Definition: unzip.h:87
uInt tm_sec
Definition: unzip.h:86
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
uInt tm_year
Definition: unzip.h:91
unsigned int uInt
Definition: zconf.h:393

Referenced by unz64local_GetCurrentFileInfoInternal().

◆ unz64local_getByte()

int unz64local_getByte ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
int pi 
)

Definition at line 212 of file unzip.c.

213 {
214  unsigned char c;
215  int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
216  if (err==1)
217  {
218  *pi = (int)c;
219  return UNZ_OK;
220  }
221  else
222  {
223  if (ZERROR64(*pzlib_filefunc_def,filestream))
224  return UNZ_ERRNO;
225  else
226  return UNZ_EOF;
227  }
228 }
#define UNZ_OK
Definition: unzip.h:74
#define ZERROR64(filefunc, filestream)
Definition: ioapi.h:192
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
const GLubyte * c
Definition: glext.h:8905
static DWORD pi
Definition: protocol.c:150
#define UNZ_EOF
Definition: unzip.h:77
#define err(...)
#define UNZ_ERRNO
Definition: unzip.h:76
#define c
Definition: ke_i.h:80
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29

Referenced by unz64local_getLong(), unz64local_getLong64(), and unz64local_getShort().

◆ unz64local_GetCurrentFileInfoInternal()

int unz64local_GetCurrentFileInfoInternal ( unzFile  file,
unz_file_info64 pfile_info,
unz_file_info64_internal pfile_info_internal,
char szFileName,
uLong  fileNameBufferSize,
void extraField,
uLong  extraFieldBufferSize,
char szComment,
uLong  commentBufferSize 
)

Definition at line 882 of file unzip.c.

892 {
893  unz64_s* s;
895  unz_file_info64_internal file_info_internal;
896  int err=UNZ_OK;
897  uLong uMagic;
898  long lSeek=0;
899  uLong uL;
900 
901  if (file==NULL)
902  return UNZ_PARAMERROR;
903  s=(unz64_s*)file;
904  if (ZSEEK64(s->z_filefunc, s->filestream,
905  s->pos_in_central_dir+s->byte_before_the_zipfile,
907  err=UNZ_ERRNO;
908 
909 
910  /* we check the magic */
911  if (err==UNZ_OK)
912  {
913  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
914  err=UNZ_ERRNO;
915  else if (uMagic!=0x02014b50)
917  }
918 
919  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
920  err=UNZ_ERRNO;
921 
922  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
923  err=UNZ_ERRNO;
924 
925  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
926  err=UNZ_ERRNO;
927 
928  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
929  err=UNZ_ERRNO;
930 
931  if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
932  err=UNZ_ERRNO;
933 
935 
936  if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
937  err=UNZ_ERRNO;
938 
939  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
940  err=UNZ_ERRNO;
941  file_info.compressed_size = uL;
942 
943  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
944  err=UNZ_ERRNO;
945  file_info.uncompressed_size = uL;
946 
947  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
948  err=UNZ_ERRNO;
949 
950  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
951  err=UNZ_ERRNO;
952 
953  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
954  err=UNZ_ERRNO;
955 
956  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
957  err=UNZ_ERRNO;
958 
959  if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
960  err=UNZ_ERRNO;
961 
962  if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
963  err=UNZ_ERRNO;
964 
965  // relative offset of local header
966  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
967  err=UNZ_ERRNO;
968  file_info_internal.offset_curfile = uL;
969 
970  lSeek+=file_info.size_filename;
971  if ((err==UNZ_OK) && (szFileName!=NULL))
972  {
973  uLong uSizeRead ;
974  if (file_info.size_filename<fileNameBufferSize)
975  {
976  *(szFileName+file_info.size_filename)='\0';
977  uSizeRead = file_info.size_filename;
978  }
979  else
980  uSizeRead = fileNameBufferSize;
981 
982  if ((file_info.size_filename>0) && (fileNameBufferSize>0))
983  if (ZREAD64(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
984  err=UNZ_ERRNO;
985  lSeek -= uSizeRead;
986  }
987 
988  // Read extrafield
989  if ((err==UNZ_OK) && (extraField!=NULL))
990  {
991  ZPOS64_T uSizeRead ;
992  if (file_info.size_file_extra<extraFieldBufferSize)
993  uSizeRead = file_info.size_file_extra;
994  else
995  uSizeRead = extraFieldBufferSize;
996 
997  if (lSeek!=0)
998  {
999  if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
1000  lSeek=0;
1001  else
1002  err=UNZ_ERRNO;
1003  }
1004 
1005  if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
1006  if (ZREAD64(s->z_filefunc, s->filestream,extraField,(uLong)uSizeRead)!=uSizeRead)
1007  err=UNZ_ERRNO;
1008 
1009  lSeek += file_info.size_file_extra - (uLong)uSizeRead;
1010  }
1011  else
1012  lSeek += file_info.size_file_extra;
1013 
1014 
1015  if ((err==UNZ_OK) && (file_info.size_file_extra != 0))
1016  {
1017  uLong acc = 0;
1018 
1019  // since lSeek now points to after the extra field we need to move back
1020  lSeek -= file_info.size_file_extra;
1021 
1022  if (lSeek!=0)
1023  {
1024  if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
1025  lSeek=0;
1026  else
1027  err=UNZ_ERRNO;
1028  }
1029 
1030  while(acc < file_info.size_file_extra)
1031  {
1032  uLong headerId;
1033  uLong dataSize;
1034 
1035  if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)
1036  err=UNZ_ERRNO;
1037 
1038  if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK)
1039  err=UNZ_ERRNO;
1040 
1041  /* ZIP64 extra fields */
1042  if (headerId == 0x0001)
1043  {
1044  uLong uL;
1045 
1046  if(file_info.uncompressed_size == MAXU32)
1047  {
1048  if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
1049  err=UNZ_ERRNO;
1050  }
1051 
1052  if(file_info.compressed_size == MAXU32)
1053  {
1054  if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
1055  err=UNZ_ERRNO;
1056  }
1057 
1058  if(file_info_internal.offset_curfile == MAXU32)
1059  {
1060  /* Relative Header offset */
1061  if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
1062  err=UNZ_ERRNO;
1063  }
1064 
1065  if(file_info.disk_num_start == MAXU32)
1066  {
1067  /* Disk Start Number */
1068  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
1069  err=UNZ_ERRNO;
1070  }
1071 
1072  }
1073  else
1074  {
1075  if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
1076  err=UNZ_ERRNO;
1077  }
1078 
1079  acc += 2 + 2 + dataSize;
1080  }
1081  }
1082 
1083  if ((err==UNZ_OK) && (szComment!=NULL))
1084  {
1085  uLong uSizeRead ;
1086  if (file_info.size_file_comment<commentBufferSize)
1087  {
1088  *(szComment+file_info.size_file_comment)='\0';
1089  uSizeRead = file_info.size_file_comment;
1090  }
1091  else
1092  uSizeRead = commentBufferSize;
1093 
1094  if (lSeek!=0)
1095  {
1096  if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
1097  lSeek=0;
1098  else
1099  err=UNZ_ERRNO;
1100  }
1101 
1102  if ((file_info.size_file_comment>0) && (commentBufferSize>0))
1103  if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
1104  err=UNZ_ERRNO;
1105  lSeek+=file_info.size_file_comment - uSizeRead;
1106  }
1107  else
1108  lSeek+=file_info.size_file_comment;
1109 
1110 
1111  if ((err==UNZ_OK) && (pfile_info!=NULL))
1112  *pfile_info=file_info;
1113 
1114  if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
1115  *pfile_info_internal=file_info_internal;
1116 
1117  return err;
1118 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
#define UNZ_BADZIPFILE
Definition: unzip.h:79
int unz64local_getLong(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:266
void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz *ptm)
Definition: unzip.c:855
#define ZLIB_FILEFUNC_SEEK_CUR
Definition: ioapi.h:112
smooth NULL
Definition: ftsmooth.c:416
unsigned long uLong
Definition: zconf.h:394
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
int unz64local_getLong64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
Definition: unzip.c:302
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
GLdouble s
Definition: gl.h:2039
#define err(...)
#define UNZ_ERRNO
Definition: unzip.h:76
GLenum GLsizei dataSize
Definition: glext.h:11123
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define MAXU32
Definition: ioapi.h:95
int unz64local_getShort(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:239
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
Definition: unzip.c:165
static const WCHAR szComment[]
Definition: domdoc.c:1167
Definition: fci.c:126

Referenced by unzGetCurrentFileInfo(), unzGetCurrentFileInfo64(), unzGoToFilePos64(), unzGoToFirstFile(), unzGoToNextFile(), and unzSetOffset64().

◆ unz64local_getLong()

int unz64local_getLong ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
uLong pX 
)

Definition at line 266 of file unzip.c.

269 {
270  uLong x ;
271  int i = 0;
272  int err;
273 
274  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
275  x = (uLong)i;
276 
277  if (err==UNZ_OK)
278  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
279  x |= ((uLong)i)<<8;
280 
281  if (err==UNZ_OK)
282  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
283  x |= ((uLong)i)<<16;
284 
285  if (err==UNZ_OK)
286  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
287  x += ((uLong)i)<<24;
288 
289  if (err==UNZ_OK)
290  *pX = x;
291  else
292  *pX = 0;
293  return err;
294 }
#define UNZ_OK
Definition: unzip.h:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned long uLong
Definition: zconf.h:394
#define err(...)
INT x
Definition: msvc.h:62
int unz64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
Definition: unzip.c:212

Referenced by unz64local_CheckCurrentFileCoherencyHeader(), unz64local_GetCurrentFileInfoInternal(), unz64local_SearchCentralDir64(), and unzOpenInternal().

◆ unz64local_getLong64()

int unz64local_getLong64 ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
ZPOS64_T pX 
)

Definition at line 302 of file unzip.c.

305 {
306  ZPOS64_T x ;
307  int i = 0;
308  int err;
309 
310  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
311  x = (ZPOS64_T)i;
312 
313  if (err==UNZ_OK)
314  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
315  x |= ((ZPOS64_T)i)<<8;
316 
317  if (err==UNZ_OK)
318  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
319  x |= ((ZPOS64_T)i)<<16;
320 
321  if (err==UNZ_OK)
322  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
323  x |= ((ZPOS64_T)i)<<24;
324 
325  if (err==UNZ_OK)
326  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
327  x |= ((ZPOS64_T)i)<<32;
328 
329  if (err==UNZ_OK)
330  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
331  x |= ((ZPOS64_T)i)<<40;
332 
333  if (err==UNZ_OK)
334  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
335  x |= ((ZPOS64_T)i)<<48;
336 
337  if (err==UNZ_OK)
338  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
339  x |= ((ZPOS64_T)i)<<56;
340 
341  if (err==UNZ_OK)
342  *pX = x;
343  else
344  *pX = 0;
345  return err;
346 }
#define UNZ_OK
Definition: unzip.h:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
#define err(...)
INT x
Definition: msvc.h:62
int unz64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
Definition: unzip.c:212

Referenced by unz64local_GetCurrentFileInfoInternal(), unz64local_SearchCentralDir64(), and unzOpenInternal().

◆ unz64local_getShort()

int unz64local_getShort ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream,
uLong pX 
)

Definition at line 239 of file unzip.c.

242 {
243  uLong x ;
244  int i = 0;
245  int err;
246 
247  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
248  x = (uLong)i;
249 
250  if (err==UNZ_OK)
251  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
252  x |= ((uLong)i)<<8;
253 
254  if (err==UNZ_OK)
255  *pX = x;
256  else
257  *pX = 0;
258  return err;
259 }
#define UNZ_OK
Definition: unzip.h:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned long uLong
Definition: zconf.h:394
#define err(...)
INT x
Definition: msvc.h:62
int unz64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
Definition: unzip.c:212

Referenced by unz64local_CheckCurrentFileCoherencyHeader(), unz64local_GetCurrentFileInfoInternal(), and unzOpenInternal().

◆ unz64local_SearchCentralDir()

ZPOS64_T unz64local_SearchCentralDir ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream 
)

Definition at line 413 of file unzip.c.

414 {
415  unsigned char* buf;
416  ZPOS64_T uSizeFile;
417  ZPOS64_T uBackRead;
418  ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
419  ZPOS64_T uPosFound=0;
420 
421  if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
422  return 0;
423 
424 
425  uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
426 
427  if (uMaxBack>uSizeFile)
428  uMaxBack = uSizeFile;
429 
430  buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
431  if (buf==NULL)
432  return 0;
433 
434  uBackRead = 4;
435  while (uBackRead<uMaxBack)
436  {
437  uLong uReadSize;
438  ZPOS64_T uReadPos ;
439  int i;
440  if (uBackRead+BUFREADCOMMENT>uMaxBack)
441  uBackRead = uMaxBack;
442  else
443  uBackRead+=BUFREADCOMMENT;
444  uReadPos = uSizeFile-uBackRead ;
445 
446  uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
447  (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
448  if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
449  break;
450 
451  if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
452  break;
453 
454  for (i=(int)uReadSize-3; (i--)>0;)
455  if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
456  ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
457  {
458  uPosFound = uReadPos+i;
459  break;
460  }
461 
462  if (uPosFound!=0)
463  break;
464  }
465  TRYFREE(buf);
466  return uPosFound;
467 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define BUFREADCOMMENT
Definition: unzip.c:405
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
unsigned long uLong
Definition: zconf.h:394
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
#define ZTELL64(filefunc, filestream)
Definition: ioapi.h:201
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define ZLIB_FILEFUNC_SEEK_END
Definition: ioapi.h:113
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
#define TRYFREE(p)
Definition: unzip.c:115
#define ALLOC(size)
Definition: unzip.c:112

Referenced by unzOpenInternal().

◆ unz64local_SearchCentralDir64()

ZPOS64_T unz64local_SearchCentralDir64 ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream 
)

Definition at line 478 of file unzip.c.

480 {
481  unsigned char* buf;
482  ZPOS64_T uSizeFile;
483  ZPOS64_T uBackRead;
484  ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
485  ZPOS64_T uPosFound=0;
486  uLong uL;
487  ZPOS64_T relativeOffset;
488 
489  if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
490  return 0;
491 
492 
493  uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
494 
495  if (uMaxBack>uSizeFile)
496  uMaxBack = uSizeFile;
497 
498  buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
499  if (buf==NULL)
500  return 0;
501 
502  uBackRead = 4;
503  while (uBackRead<uMaxBack)
504  {
505  uLong uReadSize;
506  ZPOS64_T uReadPos;
507  int i;
508  if (uBackRead+BUFREADCOMMENT>uMaxBack)
509  uBackRead = uMaxBack;
510  else
511  uBackRead+=BUFREADCOMMENT;
512  uReadPos = uSizeFile-uBackRead ;
513 
514  uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
515  (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
516  if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
517  break;
518 
519  if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
520  break;
521 
522  for (i=(int)uReadSize-3; (i--)>0;)
523  if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
524  ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
525  {
526  uPosFound = uReadPos+i;
527  break;
528  }
529 
530  if (uPosFound!=0)
531  break;
532  }
533  TRYFREE(buf);
534  if (uPosFound == 0)
535  return 0;
536 
537  /* Zip64 end of central directory locator */
538  if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
539  return 0;
540 
541  /* the signature, already checked */
542  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
543  return 0;
544 
545  /* number of the disk with the start of the zip64 end of central directory */
546  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
547  return 0;
548  if (uL != 0)
549  return 0;
550 
551  /* relative offset of the zip64 end of central directory record */
552  if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
553  return 0;
554 
555  /* total number of disks */
556  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
557  return 0;
558  if (uL != 1)
559  return 0;
560 
561  /* Goto end of central directory record */
562  if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
563  return 0;
564 
565  /* the signature */
566  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
567  return 0;
568 
569  if (uL != 0x06064b50)
570  return 0;
571 
572  return relativeOffset;
573 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define UNZ_OK
Definition: unzip.h:74
int unz64local_getLong(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:266
#define BUFREADCOMMENT
Definition: unzip.c:405
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
unsigned long uLong
Definition: zconf.h:394
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
int unz64local_getLong64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
Definition: unzip.c:302
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
#define ZTELL64(filefunc, filestream)
Definition: ioapi.h:201
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define ZLIB_FILEFUNC_SEEK_END
Definition: ioapi.h:113
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
#define TRYFREE(p)
Definition: unzip.c:115
#define ALLOC(size)
Definition: unzip.c:112

Referenced by unzOpenInternal().

◆ unzClose()

int ZEXPORT unzClose ( unzFile  file)

Definition at line 811 of file unzip.c.

812 {
813  unz64_s* s;
814  if (file==NULL)
815  return UNZ_PARAMERROR;
816  s=(unz64_s*)file;
817 
818  if (s->pfile_in_zip_read!=NULL)
820 
821  ZCLOSE64(s->z_filefunc, s->filestream);
822  TRYFREE(s);
823  return UNZ_OK;
824 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
smooth NULL
Definition: ftsmooth.c:416
#define ZCLOSE64(filefunc, filestream)
Definition: ioapi.h:191
int ZEXPORT unzCloseCurrentFile(unzFile file)
Definition: unzip.c:2007
GLdouble s
Definition: gl.h:2039
Definition: unzip.c:165
#define TRYFREE(p)
Definition: unzip.c:115
Definition: fci.c:126

Referenced by CZipExtract::Close(), and CZipFolder::Close().

◆ unzCloseCurrentFile()

int ZEXPORT unzCloseCurrentFile ( unzFile  file)

Definition at line 2007 of file unzip.c.

2008 {
2009  int err=UNZ_OK;
2010 
2011  unz64_s* s;
2012  file_in_zip64_read_info_s* pfile_in_zip_read_info;
2013  if (file==NULL)
2014  return UNZ_PARAMERROR;
2015  s=(unz64_s*)file;
2016  pfile_in_zip_read_info=s->pfile_in_zip_read;
2017 
2018  if (pfile_in_zip_read_info==NULL)
2019  return UNZ_PARAMERROR;
2020 
2021 
2022  if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
2023  (!pfile_in_zip_read_info->raw))
2024  {
2025  if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
2026  err=UNZ_CRCERROR;
2027  }
2028 
2029 
2030  TRYFREE(pfile_in_zip_read_info->read_buffer);
2031  pfile_in_zip_read_info->read_buffer = NULL;
2032  if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
2033  inflateEnd(&pfile_in_zip_read_info->stream);
2034 #ifdef HAVE_BZIP2
2035  else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
2036  BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
2037 #endif
2038 
2039 
2040  pfile_in_zip_read_info->stream_initialised = 0;
2041  TRYFREE(pfile_in_zip_read_info);
2042 
2043  s->pfile_in_zip_read=NULL;
2044 
2045  return err;
2046 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
int ZEXPORT inflateEnd(z_streamp strm)
Definition: inflate.c:1277
smooth NULL
Definition: ftsmooth.c:416
#define Z_DEFLATED
Definition: zlib.h:209
#define Z_BZIP2ED
Definition: unzip.h:62
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:154
GLdouble s
Definition: gl.h:2039
#define err(...)
int BZ_API() BZ2_bzDecompressEnd(bz_stream *strm)
Definition: bzlib.c:877
#define UNZ_CRCERROR
Definition: unzip.h:81
Definition: unzip.c:165
#define TRYFREE(p)
Definition: unzip.c:115
Definition: fci.c:126

Referenced by CZipExtract::Extract(), unzClose(), and unzOpenCurrentFile3().

◆ unzeof()

int ZEXPORT unzeof ( unzFile  file)

Definition at line 1927 of file unzip.c.

1928 {
1929  unz64_s* s;
1930  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1931  if (file==NULL)
1932  return UNZ_PARAMERROR;
1933  s=(unz64_s*)file;
1934  pfile_in_zip_read_info=s->pfile_in_zip_read;
1935 
1936  if (pfile_in_zip_read_info==NULL)
1937  return UNZ_PARAMERROR;
1938 
1939  if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
1940  return 1;
1941  else
1942  return 0;
1943 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
smooth NULL
Definition: ftsmooth.c:416
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:154
GLdouble s
Definition: gl.h:2039
Definition: unzip.c:165
Definition: fci.c:126

◆ unzGetCurrentFileInfo()

int ZEXPORT unzGetCurrentFileInfo ( unzFile  file,
unz_file_info pfile_info,
char szFileName,
uLong  fileNameBufferSize,
void extraField,
uLong  extraFieldBufferSize,
char szComment,
uLong  commentBufferSize 
)

Definition at line 1139 of file unzip.c.

1144 {
1145  int err;
1146  unz_file_info64 file_info64;
1148  szFileName,fileNameBufferSize,
1149  extraField,extraFieldBufferSize,
1150  szComment,commentBufferSize);
1151  if ((err==UNZ_OK) && (pfile_info != NULL))
1152  {
1153  pfile_info->version = file_info64.version;
1154  pfile_info->version_needed = file_info64.version_needed;
1155  pfile_info->flag = file_info64.flag;
1156  pfile_info->compression_method = file_info64.compression_method;
1157  pfile_info->dosDate = file_info64.dosDate;
1158  pfile_info->crc = file_info64.crc;
1159 
1160  pfile_info->size_filename = file_info64.size_filename;
1161  pfile_info->size_file_extra = file_info64.size_file_extra;
1162  pfile_info->size_file_comment = file_info64.size_file_comment;
1163 
1164  pfile_info->disk_num_start = file_info64.disk_num_start;
1165  pfile_info->internal_fa = file_info64.internal_fa;
1166  pfile_info->external_fa = file_info64.external_fa;
1167 
1168  pfile_info->tmu_date = file_info64.tmu_date,
1169 
1170 
1171  pfile_info->compressed_size = (uLong)file_info64.compressed_size;
1172  pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
1173 
1174  }
1175  return err;
1176 }
uLong version_needed
Definition: unzip.h:114
uLong size_filename
Definition: unzip.h:121
uLong disk_num_start
Definition: unzip.h:125
#define UNZ_OK
Definition: unzip.h:74
tm_unz tmu_date
Definition: unzip.h:150
uLong size_file_extra
Definition: unzip.h:143
uLong uncompressed_size
Definition: unzip.h:141
int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:882
uLong size_file_comment
Definition: unzip.h:144
smooth NULL
Definition: ftsmooth.c:416
uLong size_filename
Definition: unzip.h:142
ZPOS64_T compressed_size
Definition: unzip.h:119
uLong external_fa
Definition: unzip.h:127
unsigned long uLong
Definition: zconf.h:394
uLong internal_fa
Definition: unzip.h:147
uLong disk_num_start
Definition: unzip.h:146
uLong compression_method
Definition: unzip.h:137
uLong version
Definition: unzip.h:134
uLong internal_fa
Definition: unzip.h:126
tm_unz tmu_date
Definition: unzip.h:129
uLong size_file_extra
Definition: unzip.h:122
uLong crc
Definition: unzip.h:139
#define err(...)
uLong version
Definition: unzip.h:113
uLong version_needed
Definition: unzip.h:135
uLong compressed_size
Definition: unzip.h:140
uLong size_file_comment
Definition: unzip.h:123
ZPOS64_T uncompressed_size
Definition: unzip.h:120
uLong dosDate
Definition: unzip.h:138
uLong compression_method
Definition: unzip.h:116
uLong flag
Definition: unzip.h:136
uLong external_fa
Definition: unzip.h:148
static const WCHAR szComment[]
Definition: domdoc.c:1167
uLong dosDate
Definition: unzip.h:117
Definition: fci.c:126

◆ unzGetCurrentFileInfo64()

int ZEXPORT unzGetCurrentFileInfo64 ( unzFile  file,
unz_file_info64 pfile_info,
char szFileName,
uLong  fileNameBufferSize,
void extraField,
uLong  extraFieldBufferSize,
char szComment,
uLong  commentBufferSize 
)

Definition at line 1127 of file unzip.c.

1132 {
1134  szFileName,fileNameBufferSize,
1135  extraField,extraFieldBufferSize,
1136  szComment,commentBufferSize);
1137 }
int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:882
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR szComment[]
Definition: domdoc.c:1167
Definition: fci.c:126

Referenced by CZipEnumerator::next(), and unzLocateFile().

◆ unzGetCurrentFileZStreamPos64()

ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 ( unzFile  file)

Addition for GDAL : START

Definition at line 1661 of file unzip.c.

1662 {
1663  unz64_s* s;
1664  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1665  s=(unz64_s*)file;
1666  if (file==NULL)
1667  return 0; //UNZ_PARAMERROR;
1668  pfile_in_zip_read_info=s->pfile_in_zip_read;
1669  if (pfile_in_zip_read_info==NULL)
1670  return 0; //UNZ_PARAMERROR;
1671  return pfile_in_zip_read_info->pos_in_zipfile +
1672  pfile_in_zip_read_info->byte_before_the_zipfile;
1673 }
smooth NULL
Definition: ftsmooth.c:416
ZPOS64_T byte_before_the_zipfile
Definition: unzip.c:158
GLdouble s
Definition: gl.h:2039
ZPOS64_T pos_in_zipfile
Definition: unzip.c:143
Definition: unzip.c:165
Definition: fci.c:126

◆ unzGetFilePos()

int ZEXPORT unzGetFilePos ( unzFile  file,
unz_file_pos file_pos 
)

Definition at line 1327 of file unzip.c.

1330 {
1331  unz64_file_pos file_pos64;
1332  int err = unzGetFilePos64(file,&file_pos64);
1333  if (err==UNZ_OK)
1334  {
1335  file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
1336  file_pos->num_of_file = (uLong)file_pos64.num_of_file;
1337  }
1338  return err;
1339 }
ZPOS64_T num_of_file
Definition: unzip.h:275
#define UNZ_OK
Definition: unzip.h:74
int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos *file_pos)
Definition: unzip.c:1311
uLong pos_in_zip_directory
Definition: unzip.h:260
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
unsigned long uLong
Definition: zconf.h:394
#define err(...)
uLong num_of_file
Definition: unzip.h:261
Definition: fci.c:126

◆ unzGetFilePos64()

int ZEXPORT unzGetFilePos64 ( unzFile  file,
unz64_file_pos file_pos 
)

Definition at line 1311 of file unzip.c.

1312 {
1313  unz64_s* s;
1314 
1315  if (file==NULL || file_pos==NULL)
1316  return UNZ_PARAMERROR;
1317  s=(unz64_s*)file;
1318  if (!s->current_file_ok)
1319  return UNZ_END_OF_LIST_OF_FILE;
1320 
1321  file_pos->pos_in_zip_directory = s->pos_in_central_dir;
1322  file_pos->num_of_file = s->num_file;
1323 
1324  return UNZ_OK;
1325 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T num_of_file
Definition: unzip.h:275
#define UNZ_OK
Definition: unzip.h:74
smooth NULL
Definition: ftsmooth.c:416
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
GLdouble s
Definition: gl.h:2039
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:165
Definition: fci.c:126

Referenced by unzGetFilePos().

◆ unzGetGlobalComment()

int ZEXPORT unzGetGlobalComment ( unzFile  file,
char szComment,
uLong  uSizeBuf 
)

Definition at line 2054 of file unzip.c.

2055 {
2056  unz64_s* s;
2057  uLong uReadThis ;
2058  if (file==NULL)
2059  return (int)UNZ_PARAMERROR;
2060  s=(unz64_s*)file;
2061 
2062  uReadThis = uSizeBuf;
2063  if (uReadThis>s->gi.size_comment)
2064  uReadThis = s->gi.size_comment;
2065 
2066  if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
2067  return UNZ_ERRNO;
2068 
2069  if (uReadThis>0)
2070  {
2071  *szComment='\0';
2072  if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
2073  return UNZ_ERRNO;
2074  }
2075 
2076  if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
2077  *(szComment+s->gi.size_comment)='\0';
2078  return (int)uReadThis;
2079 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
smooth NULL
Definition: ftsmooth.c:416
unsigned long uLong
Definition: zconf.h:394
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
GLdouble s
Definition: gl.h:2039
#define UNZ_ERRNO
Definition: unzip.h:76
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
Definition: unzip.c:165
static const WCHAR szComment[]
Definition: domdoc.c:1167
Definition: fci.c:126

◆ unzGetGlobalInfo()

int ZEXPORT unzGetGlobalInfo ( unzFile  file,
unz_global_info pglobal_info32 
)

Definition at line 841 of file unzip.c.

842 {
843  unz64_s* s;
844  if (file==NULL)
845  return UNZ_PARAMERROR;
846  s=(unz64_s*)file;
847  /* to do : check if number_entry is not truncated */
848  pglobal_info32->number_entry = (uLong)s->gi.number_entry;
849  pglobal_info32->size_comment = s->gi.size_comment;
850  return UNZ_OK;
851 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
smooth NULL
Definition: ftsmooth.c:416
unsigned long uLong
Definition: zconf.h:394
GLdouble s
Definition: gl.h:2039
uLong number_entry
Definition: unzip.h:105
Definition: unzip.c:165
uLong size_comment
Definition: unzip.h:107
Definition: fci.c:126

◆ unzGetGlobalInfo64()

int ZEXPORT unzGetGlobalInfo64 ( unzFile  file,
unz_global_info64 pglobal_info 
)

Definition at line 831 of file unzip.c.

832 {
833  unz64_s* s;
834  if (file==NULL)
835  return UNZ_PARAMERROR;
836  s=(unz64_s*)file;
837  *pglobal_info=s->gi;
838  return UNZ_OK;
839 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
Definition: unzip.c:165
Definition: fci.c:126

Referenced by CZipExtract::Extract().

◆ unzGetLocalExtrafield()

int ZEXPORT unzGetLocalExtrafield ( unzFile  file,
voidp  buf,
unsigned  len 
)

Definition at line 1959 of file unzip.c.

1960 {
1961  unz64_s* s;
1962  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1963  uInt read_now;
1964  ZPOS64_T size_to_read;
1965 
1966  if (file==NULL)
1967  return UNZ_PARAMERROR;
1968  s=(unz64_s*)file;
1969  pfile_in_zip_read_info=s->pfile_in_zip_read;
1970 
1971  if (pfile_in_zip_read_info==NULL)
1972  return UNZ_PARAMERROR;
1973 
1974  size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
1975  pfile_in_zip_read_info->pos_local_extrafield);
1976 
1977  if (buf==NULL)
1978  return (int)size_to_read;
1979 
1980  if (len>size_to_read)
1981  read_now = (uInt)size_to_read;
1982  else
1983  read_now = (uInt)len ;
1984 
1985  if (read_now==0)
1986  return 0;
1987 
1988  if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,
1989  pfile_in_zip_read_info->filestream,
1990  pfile_in_zip_read_info->offset_local_extrafield +
1991  pfile_in_zip_read_info->pos_local_extrafield,
1993  return UNZ_ERRNO;
1994 
1995  if (ZREAD64(pfile_in_zip_read_info->z_filefunc,
1996  pfile_in_zip_read_info->filestream,
1997  buf,read_now)!=read_now)
1998  return UNZ_ERRNO;
1999 
2000  return (int)read_now;
2001 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
ZPOS64_T pos_local_extrafield
Definition: unzip.c:148
smooth NULL
Definition: ftsmooth.c:416
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
ZPOS64_T offset_local_extrafield
Definition: unzip.c:146
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
zlib_filefunc64_32_def z_filefunc
Definition: unzip.c:155
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define UNZ_ERRNO
Definition: unzip.h:76
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
Definition: unzip.c:165
unsigned int uInt
Definition: zconf.h:393
Definition: fci.c:126

◆ unzGetOffset()

uLong ZEXPORT unzGetOffset ( unzFile  file)

Definition at line 2097 of file unzip.c.

2098 {
2099  ZPOS64_T offset64;
2100 
2101  if (file==NULL)
2102  return 0; //UNZ_PARAMERROR;
2103  offset64 = unzGetOffset64(file);
2104  return (uLong)offset64;
2105 }
smooth NULL
Definition: ftsmooth.c:416
unsigned long uLong
Definition: zconf.h:394
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
Definition: unzip.c:2082
Definition: fci.c:126

◆ unzGetOffset64()

ZPOS64_T ZEXPORT unzGetOffset64 ( unzFile  file)

Definition at line 2082 of file unzip.c.

2083 {
2084  unz64_s* s;
2085 
2086  if (file==NULL)
2087  return 0; //UNZ_PARAMERROR;
2088  s=(unz64_s*)file;
2089  if (!s->current_file_ok)
2090  return 0;
2091  if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
2092  if (s->num_file==s->gi.number_entry)
2093  return 0;
2094  return s->pos_in_central_dir;
2095 }
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
Definition: unzip.c:165
Definition: fci.c:126

Referenced by unzGetOffset().

◆ unzGoToFilePos()

int ZEXPORT unzGoToFilePos ( unzFile  file,
unz_file_pos file_pos 
)

Definition at line 1363 of file unzip.c.

1366 {
1367  unz64_file_pos file_pos64;
1368  if (file_pos == NULL)
1369  return UNZ_PARAMERROR;
1370 
1371  file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
1372  file_pos64.num_of_file = file_pos->num_of_file;
1373  return unzGoToFilePos64(file,&file_pos64);
1374 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T num_of_file
Definition: unzip.h:275
int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos)
Definition: unzip.c:1341
uLong pos_in_zip_directory
Definition: unzip.h:260
smooth NULL
Definition: ftsmooth.c:416
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
uLong num_of_file
Definition: unzip.h:261
Definition: fci.c:126

◆ unzGoToFilePos64()

int ZEXPORT unzGoToFilePos64 ( unzFile  file,
const unz64_file_pos file_pos 
)

Definition at line 1341 of file unzip.c.

1342 {
1343  unz64_s* s;
1344  int err;
1345 
1346  if (file==NULL || file_pos==NULL)
1347  return UNZ_PARAMERROR;
1348  s=(unz64_s*)file;
1349 
1350  /* jump to the right spot */
1351  s->pos_in_central_dir = file_pos->pos_in_zip_directory;
1352  s->num_file = file_pos->num_of_file;
1353 
1354  /* set the current file */
1355  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1356  &s->cur_file_info_internal,
1357  NULL,0,NULL,0,NULL,0);
1358  /* return results */
1359  s->current_file_ok = (err == UNZ_OK);
1360  return err;
1361 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T num_of_file
Definition: unzip.h:275
#define UNZ_OK
Definition: unzip.h:74
int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:882
smooth NULL
Definition: ftsmooth.c:416
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
GLdouble s
Definition: gl.h:2039
#define err(...)
Definition: unzip.c:165
Definition: fci.c:126

Referenced by unzGoToFilePos().

◆ unzGoToFirstFile()

int ZEXPORT unzGoToFirstFile ( unzFile  file)

Definition at line 1181 of file unzip.c.

1182 {
1183  int err=UNZ_OK;
1184  unz64_s* s;
1185  if (file==NULL)
1186  return UNZ_PARAMERROR;
1187  s=(unz64_s*)file;
1188  s->pos_in_central_dir=s->offset_central_dir;
1189  s->num_file=0;
1191  &s->cur_file_info_internal,
1192  NULL,0,NULL,0,NULL,0);
1193  s->current_file_ok = (err == UNZ_OK);
1194  return err;
1195 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:882
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
#define err(...)
Definition: unzip.c:165
Definition: fci.c:126

Referenced by CZipEnumerator::reset(), unzLocateFile(), and unzOpenInternal().

◆ unzGoToNextFile()

int ZEXPORT unzGoToNextFile ( unzFile  file)

Definition at line 1202 of file unzip.c.

1203 {
1204  unz64_s* s;
1205  int err;
1206 
1207  if (file==NULL)
1208  return UNZ_PARAMERROR;
1209  s=(unz64_s*)file;
1210  if (!s->current_file_ok)
1211  return UNZ_END_OF_LIST_OF_FILE;
1212  if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
1213  if (s->num_file+1==s->gi.number_entry)
1214  return UNZ_END_OF_LIST_OF_FILE;
1215 
1216  s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
1217  s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
1218  s->num_file++;
1219  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1220  &s->cur_file_info_internal,
1221  NULL,0,NULL,0,NULL,0);
1222  s->current_file_ok = (err == UNZ_OK);
1223  return err;
1224 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:882
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
#define err(...)
#define SIZECENTRALDIRITEM
Definition: unzip.c:118
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:165
Definition: fci.c:126

Referenced by CZipEnumerator::next(), and unzLocateFile().

◆ unzLocateFile()

int ZEXPORT unzLocateFile ( unzFile  file,
const char szFileName,
int  iCaseSensitivity 
)

Definition at line 1235 of file unzip.c.

1236 {
1237  unz64_s* s;
1238  int err;
1239 
1240  /* We remember the 'current' position in the file so that we can jump
1241  * back there if we fail.
1242  */
1243  unz_file_info64 cur_file_infoSaved;
1244  unz_file_info64_internal cur_file_info_internalSaved;
1245  ZPOS64_T num_fileSaved;
1246  ZPOS64_T pos_in_central_dirSaved;
1247 
1248 
1249  if (file==NULL)
1250  return UNZ_PARAMERROR;
1251 
1252  if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
1253  return UNZ_PARAMERROR;
1254 
1255  s=(unz64_s*)file;
1256  if (!s->current_file_ok)
1257  return UNZ_END_OF_LIST_OF_FILE;
1258 
1259  /* Save the current state */
1260  num_fileSaved = s->num_file;
1261  pos_in_central_dirSaved = s->pos_in_central_dir;
1262  cur_file_infoSaved = s->cur_file_info;
1263  cur_file_info_internalSaved = s->cur_file_info_internal;
1264 
1266 
1267  while (err == UNZ_OK)
1268  {
1269  char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
1271  szCurrentFileName,sizeof(szCurrentFileName)-1,
1272  NULL,0,NULL,0);
1273  if (err == UNZ_OK)
1274  {
1275  if (unzStringFileNameCompare(szCurrentFileName,
1276  szFileName,iCaseSensitivity)==0)
1277  return UNZ_OK;
1279  }
1280  }
1281 
1282  /* We failed, so restore the state of the 'current file' to where we
1283  * were.
1284  */
1285  s->num_file = num_fileSaved ;
1286  s->pos_in_central_dir = pos_in_central_dirSaved ;
1287  s->cur_file_info = cur_file_infoSaved;
1288  s->cur_file_info_internal = cur_file_info_internalSaved;
1289  return err;
1290 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition: unzip.c:1181
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define UNZ_OK
Definition: unzip.h:74
int ZEXPORT unzGoToNextFile(unzFile file)
Definition: unzip.c:1202
smooth NULL
Definition: ftsmooth.c:416
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
GLdouble s
Definition: gl.h:2039
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:1127
#define err(...)
int ZEXPORT unzStringFileNameCompare(const char *fileName1, const char *fileName2, int iCaseSensitivity)
Definition: unzip.c:390
#define UNZ_MAXFILENAMEINZIP
Definition: unzip.c:108
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:165
Definition: fci.c:126

◆ unzOpen()

unzFile ZEXPORT unzOpen ( const char path)

Definition at line 796 of file unzip.c.

797 {
798  return unzOpenInternal(path, NULL, 0);
799 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:584
smooth NULL
Definition: ftsmooth.c:416
Definition: services.c:325

◆ unzOpen2()

unzFile ZEXPORT unzOpen2 ( const char path,
zlib_filefunc_def pzlib_filefunc32_def 
)

Definition at line 767 of file unzip.c.

769 {
770  if (pzlib_filefunc32_def != NULL)
771  {
772  zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
773  fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
774  return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);
775  }
776  else
777  return unzOpenInternal(path, NULL, 0);
778 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:584
smooth NULL
Definition: ftsmooth.c:416
Definition: services.c:325
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32)
Definition: ioapi.c:70

◆ unzOpen2_64()

unzFile ZEXPORT unzOpen2_64 ( const void path,
zlib_filefunc64_def pzlib_filefunc_def 
)

Definition at line 781 of file unzip.c.

783 {
784  if (pzlib_filefunc_def != NULL)
785  {
786  zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
787  zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
788  zlib_filefunc64_32_def_fill.ztell32_file = NULL;
789  zlib_filefunc64_32_def_fill.zseek32_file = NULL;
790  return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
791  }
792  else
793  return unzOpenInternal(path, NULL, 1);
794 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:584
seek_file_func zseek32_file
Definition: ioapi.h:183
smooth NULL
Definition: ftsmooth.c:416
zlib_filefunc64_def zfile_func64
Definition: ioapi.h:180
tell_file_func ztell32_file
Definition: ioapi.h:182
Definition: services.c:325

Referenced by CZipExtract::Extract(), and CZipFolder::STDMETHODIMP_().

◆ unzOpen64()

unzFile ZEXPORT unzOpen64 ( const void path)

Definition at line 801 of file unzip.c.

802 {
803  return unzOpenInternal(path, NULL, 1);
804 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:584
smooth NULL
Definition: ftsmooth.c:416
Definition: services.c:325

◆ unzOpenCurrentFile()

int ZEXPORT unzOpenCurrentFile ( unzFile  file)

Definition at line 1644 of file unzip.c.

1645 {
1646  return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
1647 }
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
Definition: unzip.c:1475
smooth NULL
Definition: ftsmooth.c:416
Definition: fci.c:126

◆ unzOpenCurrentFile2()

int ZEXPORT unzOpenCurrentFile2 ( unzFile  file,
int method,
int level,
int  raw 
)

Definition at line 1654 of file unzip.c.

1655 {
1656  return unzOpenCurrentFile3(file, method, level, raw, NULL);
1657 }
GLint level
Definition: gl.h:1546
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
Definition: unzip.c:1475
smooth NULL
Definition: ftsmooth.c:416
method
Definition: dragdrop.c:53
Definition: fci.c:126

◆ unzOpenCurrentFile3()

int ZEXPORT unzOpenCurrentFile3 ( unzFile  file,
int method,
int level,
int  raw,
const char password 
)

Definition at line 1475 of file unzip.c.

1477 {
1478  int err=UNZ_OK;
1479  uInt iSizeVar;
1480  unz64_s* s;
1481  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1482  ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
1483  uInt size_local_extrafield; /* size of the local extra field */
1484 # ifndef NOUNCRYPT
1485  char source[12];
1486 # else
1487  if (password != NULL)
1488  return UNZ_PARAMERROR;
1489 # endif
1490 
1491  if (file==NULL)
1492  return UNZ_PARAMERROR;
1493  s=(unz64_s*)file;
1494  if (!s->current_file_ok)
1495  return UNZ_PARAMERROR;
1496 
1497  if (s->pfile_in_zip_read != NULL)
1499 
1500  if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
1501  return UNZ_BADZIPFILE;
1502 
1503  pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
1504  if (pfile_in_zip_read_info==NULL)
1505  return UNZ_INTERNALERROR;
1506 
1507  pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
1508  pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
1509  pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
1510  pfile_in_zip_read_info->pos_local_extrafield=0;
1511  pfile_in_zip_read_info->raw=raw;
1512 
1513  if (pfile_in_zip_read_info->read_buffer==NULL)
1514  {
1515  TRYFREE(pfile_in_zip_read_info);
1516  return UNZ_INTERNALERROR;
1517  }
1518 
1519  pfile_in_zip_read_info->stream_initialised=0;
1520 
1521  if (method!=NULL)
1522  *method = (int)s->cur_file_info.compression_method;
1523 
1524  if (level!=NULL)
1525  {
1526  *level = 6;
1527  switch (s->cur_file_info.flag & 0x06)
1528  {
1529  case 6 : *level = 1; break;
1530  case 4 : *level = 2; break;
1531  case 2 : *level = 9; break;
1532  }
1533  }
1534 
1535  if ((s->cur_file_info.compression_method!=0) &&
1536 /* #ifdef HAVE_BZIP2 */
1537  (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
1538 /* #endif */
1539  (s->cur_file_info.compression_method!=Z_DEFLATED))
1540 
1542 
1543  pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
1544  pfile_in_zip_read_info->crc32=0;
1545  pfile_in_zip_read_info->total_out_64=0;
1546  pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method;
1547  pfile_in_zip_read_info->filestream=s->filestream;
1548  pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
1549  pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
1550 
1551  pfile_in_zip_read_info->stream.total_out = 0;
1552 
1553  if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw))
1554  {
1555 #ifdef HAVE_BZIP2
1556  pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0;
1557  pfile_in_zip_read_info->bstream.bzfree = (free_func)0;
1558  pfile_in_zip_read_info->bstream.opaque = (voidpf)0;
1559  pfile_in_zip_read_info->bstream.state = (voidpf)0;
1560 
1561  pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
1562  pfile_in_zip_read_info->stream.zfree = (free_func)0;
1563  pfile_in_zip_read_info->stream.opaque = (voidpf)0;
1564  pfile_in_zip_read_info->stream.next_in = (voidpf)0;
1565  pfile_in_zip_read_info->stream.avail_in = 0;
1566 
1567  err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
1568  if (err == Z_OK)
1569  pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
1570  else
1571  {
1572  TRYFREE(pfile_in_zip_read_info);
1573  return err;
1574  }
1575 #else
1576  pfile_in_zip_read_info->raw=1;
1577 #endif
1578  }
1579  else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
1580  {
1581  pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
1582  pfile_in_zip_read_info->stream.zfree = (free_func)0;
1583  pfile_in_zip_read_info->stream.opaque = (voidpf)0;
1584  pfile_in_zip_read_info->stream.next_in = 0;
1585  pfile_in_zip_read_info->stream.avail_in = 0;
1586 
1587  err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
1588  if (err == Z_OK)
1589  pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
1590  else
1591  {
1592  TRYFREE(pfile_in_zip_read_info);
1593  return err;
1594  }
1595  /* windowBits is passed < 0 to tell that there is no zlib header.
1596  * Note that in this case inflate *requires* an extra "dummy" byte
1597  * after the compressed stream in order to complete decompression and
1598  * return Z_STREAM_END.
1599  * In unzip, i don't wait absolutely Z_STREAM_END because I known the
1600  * size of both compressed and uncompressed data
1601  */
1602  }
1603  pfile_in_zip_read_info->rest_read_compressed =
1604  s->cur_file_info.compressed_size ;
1605  pfile_in_zip_read_info->rest_read_uncompressed =
1606  s->cur_file_info.uncompressed_size ;
1607 
1608 
1609  pfile_in_zip_read_info->pos_in_zipfile =
1610  s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
1611  iSizeVar;
1612 
1613  pfile_in_zip_read_info->stream.avail_in = (uInt)0;
1614 
1615  s->pfile_in_zip_read = pfile_in_zip_read_info;
1616  s->encrypted = 0;
1617 
1618 # ifndef NOUNCRYPT
1619  if (password != NULL)
1620  {
1621  int i;
1622  s->pcrc_32_tab = get_crc_table();
1623  init_keys(password,s->keys,s->pcrc_32_tab);
1624  if (ZSEEK64(s->z_filefunc, s->filestream,
1625  s->pfile_in_zip_read->pos_in_zipfile +
1626  s->pfile_in_zip_read->byte_before_the_zipfile,
1627  SEEK_SET)!=0)
1628  return UNZ_INTERNALERROR;
1629  if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12)
1630  return UNZ_INTERNALERROR;
1631 
1632  for (i = 0; i<12; i++)
1633  zdecode(s->keys,s->pcrc_32_tab,source[i]);
1634 
1635  s->pfile_in_zip_read->pos_in_zipfile+=12;
1636  s->encrypted=1;
1637  }
1638 # endif
1639 
1640 
1641  return UNZ_OK;
1642 }
GLint level
Definition: gl.h:1546
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T rest_read_compressed
Definition: unzip.c:153
#define UNZ_OK
Definition: unzip.h:74
uInt avail_in
Definition: zlib.h:88
#define UNZ_BADZIPFILE
Definition: unzip.h:79
#define UNZ_INTERNALERROR
Definition: unzip.h:80
const z_crc_t FAR *ZEXPORT get_crc_table()
Definition: crc32.c:188
voidpf opaque
Definition: zlib.h:100
ZPOS64_T pos_local_extrafield
Definition: unzip.c:148
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
free_func zfree
Definition: zlib.h:99
#define Z_OK
Definition: zlib.h:177
smooth NULL
Definition: ftsmooth.c:416
#define Z_DEFLATED
Definition: zlib.h:209
#define Z_BZIP2ED
Definition: unzip.h:62
#define SEEK_SET
Definition: jmemansi.c:26
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
int ZEXPORT unzCloseCurrentFile(unzFile file)
Definition: unzip.c:2007
if(!(yy_init))
Definition: macro.lex.yy.c:717
ZPOS64_T offset_local_extrafield
Definition: unzip.c:146
alloc_func zalloc
Definition: zlib.h:98
#define inflateInit2(strm, windowBits)
Definition: zlib.h:1800
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:154
int BZ_API() BZ2_bzDecompressInit(bz_stream *strm, int verbosity, int small)
Definition: bzlib.c:501
ZPOS64_T byte_before_the_zipfile
Definition: unzip.c:158
method
Definition: dragdrop.c:53
#define zdecode(pkeys, pcrc_32_tab, c)
Definition: crypt.h:76
zlib_filefunc64_32_def z_filefunc
Definition: unzip.c:155
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
GLdouble s
Definition: gl.h:2039
#define err(...)
uLong total_out
Definition: zlib.h:93
Byte FAR * voidpf
Definition: zconf.h:413
int unz64local_CheckCurrentFileCoherencyHeader(unz64_s *s, uInt *piSizeVar, ZPOS64_T *poffset_local_extrafield, uInt *psize_local_extrafield)
Definition: unzip.c:1388
z_const Bytef * next_in
Definition: zlib.h:87
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define UNZ_BUFSIZE
Definition: unzip.c:104
ZPOS64_T pos_in_zipfile
Definition: unzip.c:143
#define MAX_WBITS
Definition: zconf.h:270
Definition: unzip.c:165
#define SIZEZIPLOCALHEADER
Definition: unzip.c:119
#define TRYFREE(p)
Definition: unzip.c:115
unsigned int uInt
Definition: zconf.h:393
#define ALLOC(size)
Definition: unzip.c:112
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29
static void init_keys(void)
Definition: nanoxwin.c:1097
Definition: fci.c:126

Referenced by unzOpenCurrentFile(), unzOpenCurrentFile2(), and unzOpenCurrentFilePassword().

◆ unzOpenCurrentFilePassword()

int ZEXPORT unzOpenCurrentFilePassword ( unzFile  file,
const char password 
)

Definition at line 1649 of file unzip.c.

1650 {
1651  return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
1652 }
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
Definition: unzip.c:1475
smooth NULL
Definition: ftsmooth.c:416
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
Definition: fci.c:126

Referenced by CZipExtract::Extract().

◆ unzOpenInternal()

unzFile unzOpenInternal ( const void path,
zlib_filefunc64_32_def pzlib_filefunc64_32_def,
int  is64bitOpenFunction 
)

Definition at line 584 of file unzip.c.

587 {
588  unz64_s us;
589  unz64_s *s;
590  ZPOS64_T central_pos;
591  uLong uL;
592 
593  uLong number_disk; /* number of the current dist, used for
594  spaning ZIP, unsupported, always 0*/
595  uLong number_disk_with_CD; /* number the the disk with central dir, used
596  for spaning ZIP, unsupported, always 0*/
597  ZPOS64_T number_entry_CD; /* total number of entries in
598  the central dir
599  (same than number_entry on nospan) */
600 
601  int err=UNZ_OK;
602 
603  if (unz_copyright[0]!=' ')
604  return NULL;
605 
606  us.z_filefunc.zseek32_file = NULL;
607  us.z_filefunc.ztell32_file = NULL;
608 #ifndef __REACTOS__
609  if (pzlib_filefunc64_32_def==NULL)
610  fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
611  else
612 #endif
613  us.z_filefunc = *pzlib_filefunc64_32_def;
614  us.is64bitOpenFunction = is64bitOpenFunction;
615 
616 
617 
618  us.filestream = ZOPEN64(us.z_filefunc,
619  path,
622  if (us.filestream==NULL)
623  return NULL;
624 
625  central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
626  if (central_pos)
627  {
628  uLong uS;
629  ZPOS64_T uL64;
630 
631  us.isZip64 = 1;
632 
633  if (ZSEEK64(us.z_filefunc, us.filestream,
634  central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
635  err=UNZ_ERRNO;
636 
637  /* the signature, already checked */
638  if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
639  err=UNZ_ERRNO;
640 
641  /* size of zip64 end of central directory record */
642  if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK)
643  err=UNZ_ERRNO;
644 
645  /* version made by */
646  if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK)
647  err=UNZ_ERRNO;
648 
649  /* version needed to extract */
650  if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK)
651  err=UNZ_ERRNO;
652 
653  /* number of this disk */
654  if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
655  err=UNZ_ERRNO;
656 
657  /* number of the disk with the start of the central directory */
658  if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
659  err=UNZ_ERRNO;
660 
661  /* total number of entries in the central directory on this disk */
662  if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
663  err=UNZ_ERRNO;
664 
665  /* total number of entries in the central directory */
666  if (unz64local_getLong64(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
667  err=UNZ_ERRNO;
668 
669  if ((number_entry_CD!=us.gi.number_entry) ||
670  (number_disk_with_CD!=0) ||
671  (number_disk!=0))
673 
674  /* size of the central directory */
675  if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
676  err=UNZ_ERRNO;
677 
678  /* offset of start of central directory with respect to the
679  starting disk number */
680  if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
681  err=UNZ_ERRNO;
682 
683  us.gi.size_comment = 0;
684  }
685  else
686  {
687  central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
688  if (central_pos==0)
689  err=UNZ_ERRNO;
690 
691  us.isZip64 = 0;
692 
693  if (ZSEEK64(us.z_filefunc, us.filestream,
694  central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
695  err=UNZ_ERRNO;
696 
697  /* the signature, already checked */
698  if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
699  err=UNZ_ERRNO;
700 
701  /* number of this disk */
702  if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
703  err=UNZ_ERRNO;
704 
705  /* number of the disk with the start of the central directory */
706  if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
707  err=UNZ_ERRNO;
708 
709  /* total number of entries in the central dir on this disk */
710  if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
711  err=UNZ_ERRNO;
712  us.gi.number_entry = uL;
713 
714  /* total number of entries in the central dir */
715  if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
716  err=UNZ_ERRNO;
717  number_entry_CD = uL;
718 
719  if ((number_entry_CD!=us.gi.number_entry) ||
720  (number_disk_with_CD!=0) ||
721  (number_disk!=0))
723 
724  /* size of the central directory */
725  if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
726  err=UNZ_ERRNO;
727  us.size_central_dir = uL;
728 
729  /* offset of start of central directory with respect to the
730  starting disk number */
731  if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
732  err=UNZ_ERRNO;
733  us.offset_central_dir = uL;
734 
735  /* zipfile comment length */
736  if (unz64local_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
737  err=UNZ_ERRNO;
738  }
739 
740  if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
741  (err==UNZ_OK))
743 
744  if (err!=UNZ_OK)
745  {
746  ZCLOSE64(us.z_filefunc, us.filestream);
747  return NULL;
748  }
749 
750  us.byte_before_the_zipfile = central_pos -
751  (us.offset_central_dir+us.size_central_dir);
752  us.central_pos = central_pos;
753  us.pfile_in_zip_read = NULL;
754  us.encrypted = 0;
755 
756 
757  s=(unz64_s*)ALLOC(sizeof(unz64_s));
758  if( s != NULL)
759  {
760  *s=us;
762  }
763  return (unzFile)s;
764 }
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition: unzip.c:1181
static const BYTE us[]
Definition: encode.c:689
voidp unzFile
Definition: unzip.h:70
#define UNZ_OK
Definition: unzip.h:74
#define UNZ_BADZIPFILE
Definition: unzip.h:79
int unz64local_getLong(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:266
#define ZLIB_FILEFUNC_MODE_READ
Definition: ioapi.h:116
smooth NULL
Definition: ftsmooth.c:416
ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
Definition: unzip.c:413
#define ZCLOSE64(filefunc, filestream)
Definition: ioapi.h:191
unsigned long uLong
Definition: zconf.h:394
#define ZOPEN64(filefunc, filename, mode)
Definition: ioapi.h:200
ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
Definition: unzip.c:478
const char unz_copyright[]
Definition: unzip.c:122
int unz64local_getLong64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
Definition: unzip.c:302
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def)
Definition: ioapi.c:238
#define ZLIB_FILEFUNC_MODE_EXISTING
Definition: ioapi.h:120
GLdouble s
Definition: gl.h:2039
#define err(...)
Definition: services.c:325
#define UNZ_ERRNO
Definition: unzip.h:76
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
int unz64local_getShort(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:239
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
Definition: unzip.c:165
#define ALLOC(size)
Definition: unzip.c:112

Referenced by unzOpen(), unzOpen2(), unzOpen2_64(), and unzOpen64().

◆ unzReadCurrentFile()

int ZEXPORT unzReadCurrentFile ( unzFile  file,
voidp  buf,
unsigned  len 
)

Addition for GDAL : END

Definition at line 1687 of file unzip.c.

1688 {
1689  int err=UNZ_OK;
1690  uInt iRead = 0;
1691  unz64_s* s;
1692  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1693  if (file==NULL)
1694  return UNZ_PARAMERROR;
1695  s=(unz64_s*)file;
1696  pfile_in_zip_read_info=s->pfile_in_zip_read;
1697 
1698  if (pfile_in_zip_read_info==NULL)
1699  return UNZ_PARAMERROR;
1700 
1701 
1702  if (pfile_in_zip_read_info->read_buffer == NULL)
1703  return UNZ_END_OF_LIST_OF_FILE;
1704  if (len==0)
1705  return 0;
1706 
1707  pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
1708 
1709  pfile_in_zip_read_info->stream.avail_out = (uInt)len;
1710 
1711  if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
1712  (!(pfile_in_zip_read_info->raw)))
1713  pfile_in_zip_read_info->stream.avail_out =
1714  (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
1715 
1716  if ((len>pfile_in_zip_read_info->rest_read_compressed+
1717  pfile_in_zip_read_info->stream.avail_in) &&
1718  (pfile_in_zip_read_info->raw))
1719  pfile_in_zip_read_info->stream.avail_out =
1720  (uInt)pfile_in_zip_read_info->rest_read_compressed+
1721  pfile_in_zip_read_info->stream.avail_in;
1722 
1723  while (pfile_in_zip_read_info->stream.avail_out>0)
1724  {
1725  if ((pfile_in_zip_read_info->stream.avail_in==0) &&
1726  (pfile_in_zip_read_info->rest_read_compressed>0))
1727  {
1728  uInt uReadThis = UNZ_BUFSIZE;
1729  if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
1730  uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
1731  if (uReadThis == 0)
1732  return UNZ_EOF;
1733  if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,
1734  pfile_in_zip_read_info->filestream,
1735  pfile_in_zip_read_info->pos_in_zipfile +
1736  pfile_in_zip_read_info->byte_before_the_zipfile,
1738  return UNZ_ERRNO;
1739  if (ZREAD64(pfile_in_zip_read_info->z_filefunc,
1740  pfile_in_zip_read_info->filestream,
1741  pfile_in_zip_read_info->read_buffer,
1742  uReadThis)!=uReadThis)
1743  return UNZ_ERRNO;
1744 
1745 
1746 # ifndef NOUNCRYPT
1747  if(s->encrypted)
1748  {
1749  uInt i;
1750  for(i=0;i<uReadThis;i++)
1751  pfile_in_zip_read_info->read_buffer[i] =
1752  zdecode(s->keys,s->pcrc_32_tab,
1753  pfile_in_zip_read_info->read_buffer[i]);
1754  }
1755 # endif
1756 
1757 
1758  pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
1759 
1760  pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
1761 
1762  pfile_in_zip_read_info->stream.next_in =
1763  (Bytef*)pfile_in_zip_read_info->read_buffer;
1764  pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
1765  }
1766 
1767  if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
1768  {
1769  uInt uDoCopy,i ;
1770 
1771  if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
1772  (pfile_in_zip_read_info->rest_read_compressed == 0))
1773  return (iRead==0) ? UNZ_EOF : iRead;
1774 
1775  if (pfile_in_zip_read_info->stream.avail_out <
1776  pfile_in_zip_read_info->stream.avail_in)
1777  uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
1778  else
1779  uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
1780 
1781  for (i=0;i<uDoCopy;i++)
1782  *(pfile_in_zip_read_info->stream.next_out+i) =
1783  *(pfile_in_zip_read_info->stream.next_in+i);
1784 
1785  pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy;
1786 
1787  pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
1788  pfile_in_zip_read_info->stream.next_out,
1789  uDoCopy);
1790  pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
1791  pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
1792  pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
1793  pfile_in_zip_read_info->stream.next_out += uDoCopy;
1794  pfile_in_zip_read_info->stream.next_in += uDoCopy;
1795  pfile_in_zip_read_info->stream.total_out += uDoCopy;
1796  iRead += uDoCopy;
1797  }
1798  else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED)
1799  {
1800 #ifdef HAVE_BZIP2
1801  uLong uTotalOutBefore,uTotalOutAfter;
1802  const Bytef *bufBefore;
1803  uLong uOutThis;
1804 
1805  pfile_in_zip_read_info->bstream.next_in = (char*)pfile_in_zip_read_info->stream.next_in;
1806  pfile_in_zip_read_info->bstream.avail_in = pfile_in_zip_read_info->stream.avail_in;
1807  pfile_in_zip_read_info->bstream.total_in_lo32 = pfile_in_zip_read_info->stream.total_in;
1808  pfile_in_zip_read_info->bstream.total_in_hi32 = 0;
1809  pfile_in_zip_read_info->bstream.next_out = (char*)pfile_in_zip_read_info->stream.next_out;
1810  pfile_in_zip_read_info->bstream.avail_out = pfile_in_zip_read_info->stream.avail_out;
1811  pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out;
1812  pfile_in_zip_read_info->bstream.total_out_hi32 = 0;
1813 
1814  uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32;
1815  bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out;
1816 
1817  err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream);
1818 
1819  uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32;
1820  uOutThis = uTotalOutAfter-uTotalOutBefore;
1821 
1822  pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
1823 
1824  pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis));
1825  pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;
1826  iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
1827 
1828  pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->bstream.next_in;
1829  pfile_in_zip_read_info->stream.avail_in = pfile_in_zip_read_info->bstream.avail_in;
1830  pfile_in_zip_read_info->stream.total_in = pfile_in_zip_read_info->bstream.total_in_lo32;
1831  pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out;
1832  pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out;
1833  pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32;
1834 
1835  if (err==BZ_STREAM_END)
1836  return (iRead==0) ? UNZ_EOF : iRead;
1837  if (err!=BZ_OK)
1838  break;
1839 #endif
1840  } // end Z_BZIP2ED
1841  else
1842  {
1843  ZPOS64_T uTotalOutBefore,uTotalOutAfter;
1844  const Bytef *bufBefore;
1845  ZPOS64_T uOutThis;
1846  int flush=Z_SYNC_FLUSH;
1847 
1848  uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
1849  bufBefore = pfile_in_zip_read_info->stream.next_out;
1850 
1851  /*
1852  if ((pfile_in_zip_read_info->rest_read_uncompressed ==
1853  pfile_in_zip_read_info->stream.avail_out) &&
1854  (pfile_in_zip_read_info->rest_read_compressed == 0))
1855  flush = Z_FINISH;
1856  */
1857  err=inflate(&pfile_in_zip_read_info->stream,flush);
1858 
1859  if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
1860  err = Z_DATA_ERROR;
1861 
1862  uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
1863  uOutThis = uTotalOutAfter-uTotalOutBefore;
1864 
1865  pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
1866 
1867  pfile_in_zip_read_info->crc32 =
1868  crc32(pfile_in_zip_read_info->crc32,bufBefore,
1869  (uInt)(uOutThis));
1870 
1871  pfile_in_zip_read_info->rest_read_uncompressed -=
1872  uOutThis;
1873 
1874  iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
1875 
1876  if (err==Z_STREAM_END)
1877  return (iRead==0) ? UNZ_EOF : iRead;
1878  if (err!=Z_OK)
1879  break;
1880  }
1881  }
1882 
1883  if (err==Z_OK)
1884  return iRead;
1885  return err;
1886 }
int BZ_API() BZ2_bzDecompress(bz_stream *strm)
Definition: bzlib.c:818
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T rest_read_compressed
Definition: unzip.c:153
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define UNZ_OK
Definition: unzip.h:74
uInt avail_in
Definition: zlib.h:88
UINT32 crc32
Definition: btrfs.c:3877
#define Z_STREAM_END
Definition: zlib.h:178
Byte FAR Bytef
Definition: zconf.h:400
while(1)
Definition: macro.lex.yy.c:743
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define Z_OK
Definition: zlib.h:177
smooth NULL
Definition: ftsmooth.c:416
#define Z_BZIP2ED
Definition: unzip.h:62
#define BZ_OK
Definition: bzlib.h:33
unsigned long uLong
Definition: zconf.h:394
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:187
z_const char * msg
Definition: zlib.h:95
uLong total_in
Definition: zlib.h:89
if(!(yy_init))
Definition: macro.lex.yy.c:717
#define BZ_STREAM_END
Definition: bzlib.h:37
int flush
Definition: zlib.h:309
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
#define Z_DATA_ERROR
Definition: zlib.h:182
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:154
ZPOS64_T byte_before_the_zipfile
Definition: unzip.c:158
int ZEXPORT inflate(z_streamp strm, int flush)
Definition: inflate.c:622
#define UNZ_EOF
Definition: unzip.h:77
#define zdecode(pkeys, pcrc_32_tab, c)
Definition: crypt.h:76
zlib_filefunc64_32_def z_filefunc
Definition: unzip.c:155
#define Z_SYNC_FLUSH
Definition: zlib.h:170
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define err(...)
uLong total_out
Definition: zlib.h:93
#define UNZ_ERRNO
Definition: unzip.h:76
uInt avail_out
Definition: zlib.h:92
z_const Bytef * next_in
Definition: zlib.h:87
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:202
#define UNZ_BUFSIZE
Definition: unzip.c:104
ZPOS64_T pos_in_zipfile
Definition: unzip.c:143
Bytef * next_out
Definition: zlib.h:91
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:114
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:165
unsigned int uInt
Definition: zconf.h:393
Definition: fci.c:126

Referenced by CZipExtract::Extract().

◆ unzSetOffset()

int ZEXPORT unzSetOffset ( unzFile  file,
uLong  pos 
)

Definition at line 2125 of file unzip.c.

2126 {
2127  return unzSetOffset64(file,pos);
2128 }
int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
Definition: unzip.c:2107
Definition: fci.c:126

◆ unzSetOffset64()

int ZEXPORT unzSetOffset64 ( unzFile  file,
ZPOS64_T  pos 
)

Definition at line 2107 of file unzip.c.

2108 {
2109  unz64_s* s;
2110  int err;
2111 
2112  if (file==NULL)
2113  return UNZ_PARAMERROR;
2114  s=(unz64_s*)file;
2115 
2116  s->pos_in_central_dir = pos;
2117  s->num_file = s->gi.number_entry; /* hack */
2118  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
2119  &s->cur_file_info_internal,
2120  NULL,0,NULL,0,NULL,0);
2121  s->current_file_ok = (err == UNZ_OK);
2122  return err;
2123 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, unz_file_info64_internal *pfile_info_internal, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:882
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
#define err(...)
Definition: unzip.c:165
Definition: fci.c:126

Referenced by unzSetOffset().

◆ unzStringFileNameCompare()

int ZEXPORT unzStringFileNameCompare ( const char fileName1,
const char fileName2,
int  iCaseSensitivity 
)

Definition at line 390 of file unzip.c.

394 {
395  if (iCaseSensitivity==0)
396  iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
397 
398  if (iCaseSensitivity==1)
399  return strcmp(fileName1,fileName2);
400 
401  return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
402 }
#define STRCMPCASENOSENTIVEFUNCTION
Definition: unzip.c:378
#define CASESENSITIVITYDEFAULTVALUE
Definition: unzip.c:372
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by unzLocateFile().

◆ unztell()

z_off_t ZEXPORT unztell ( unzFile  file)

Definition at line 1892 of file unzip.c.

1893 {
1894  unz64_s* s;
1895  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1896  if (file==NULL)
1897  return UNZ_PARAMERROR;
1898  s=(unz64_s*)file;
1899  pfile_in_zip_read_info=s->pfile_in_zip_read;
1900 
1901  if (pfile_in_zip_read_info==NULL)
1902  return UNZ_PARAMERROR;
1903 
1904  return (z_off_t)pfile_in_zip_read_info->stream.total_out;
1905 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define z_off_t
Definition: zconf.h:504
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
uLong total_out
Definition: zlib.h:93
Definition: unzip.c:165
Definition: fci.c:126

◆ unztell64()

ZPOS64_T ZEXPORT unztell64 ( unzFile  file)

Definition at line 1907 of file unzip.c.

1908 {
1909 
1910  unz64_s* s;
1911  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1912  if (file==NULL)
1913  return (ZPOS64_T)-1;
1914  s=(unz64_s*)file;
1915  pfile_in_zip_read_info=s->pfile_in_zip_read;
1916 
1917  if (pfile_in_zip_read_info==NULL)
1918  return (ZPOS64_T)-1;
1919 
1920  return pfile_in_zip_read_info->total_out_64;
1921 }
smooth NULL
Definition: ftsmooth.c:416
unsigned long long int ZPOS64_T
Definition: ioapi.h:100
GLdouble s
Definition: gl.h:2039
Definition: unzip.c:165
Definition: fci.c:126

Variable Documentation

◆ unz_copyright

const char unz_copyright[]
Initial value:
=
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"

Definition at line 122 of file unzip.c.

Referenced by unzOpenInternal().