ReactOS  0.4.15-dev-5608-gafb953a
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 114 of file unzip.c.

◆ BUFREADCOMMENT

#define BUFREADCOMMENT   (0x400)

Definition at line 407 of file unzip.c.

◆ CASESENSITIVITYDEFAULT_NO

#define CASESENSITIVITYDEFAULT_NO

Definition at line 100 of file unzip.c.

◆ CASESENSITIVITYDEFAULTVALUE

#define CASESENSITIVITYDEFAULTVALUE   2

Definition at line 374 of file unzip.c.

◆ local

#define local   static

Definition at line 93 of file unzip.c.

◆ NOUNCRYPT

#define NOUNCRYPT

Definition at line 73 of file unzip.c.

◆ SIZECENTRALDIRITEM

#define SIZECENTRALDIRITEM   (0x2e)

Definition at line 120 of file unzip.c.

◆ SIZEZIPLOCALHEADER

#define SIZEZIPLOCALHEADER   (0x1e)

Definition at line 121 of file unzip.c.

◆ STRCMPCASENOSENTIVEFUNCTION

#define STRCMPCASENOSENTIVEFUNCTION   strcmpcasenosensitive_internal

Definition at line 380 of file unzip.c.

◆ TRYFREE

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

Definition at line 117 of file unzip.c.

◆ UNZ_BUFSIZE

#define UNZ_BUFSIZE   (16384)

Definition at line 106 of file unzip.c.

◆ UNZ_MAXFILENAMEINZIP

#define UNZ_MAXFILENAMEINZIP   (256)

Definition at line 110 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 351 of file unzip.c.

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

◆ unz64local_CheckCurrentFileCoherencyHeader()

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

Definition at line 1390 of file unzip.c.

1393 {
1394  uLong uMagic,uData,uFlags;
1395  uLong size_filename;
1396  uLong size_extra_field;
1397  int err=UNZ_OK;
1398 
1399  *piSizeVar = 0;
1400  *poffset_local_extrafield = 0;
1401  *psize_local_extrafield = 0;
1402 
1403  if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
1404  s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
1405  return UNZ_ERRNO;
1406 
1407 
1408  if (err==UNZ_OK)
1409  {
1410  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
1411  err=UNZ_ERRNO;
1412  else if (uMagic!=0x04034b50)
1414  }
1415 
1416  if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
1417  err=UNZ_ERRNO;
1418 /*
1419  else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
1420  err=UNZ_BADZIPFILE;
1421 */
1422  if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
1423  err=UNZ_ERRNO;
1424 
1425  if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
1426  err=UNZ_ERRNO;
1427  else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
1429 
1430  if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
1431 /* #ifdef HAVE_BZIP2 */
1432  (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
1433 /* #endif */
1434  (s->cur_file_info.compression_method!=Z_DEFLATED))
1436 
1437  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
1438  err=UNZ_ERRNO;
1439 
1440  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
1441  err=UNZ_ERRNO;
1442  else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0))
1444 
1445  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
1446  err=UNZ_ERRNO;
1447  else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0))
1449 
1450  if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
1451  err=UNZ_ERRNO;
1452  else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0))
1454 
1455  if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
1456  err=UNZ_ERRNO;
1457  else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
1459 
1460  *piSizeVar += (uInt)size_filename;
1461 
1462  if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
1463  err=UNZ_ERRNO;
1464  *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
1465  SIZEZIPLOCALHEADER + size_filename;
1466  *psize_local_extrafield = (uInt)size_extra_field;
1467 
1468  *piSizeVar += (uInt)size_extra_field;
1469 
1470  return err;
1471 }
#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:268
UINT uFlags
Definition: api.c:59
unsigned long uLong
Definition: zlib.h:39
#define Z_BZIP2ED
Definition: unzip.h:62
GLdouble s
Definition: gl.h:2039
#define err(...)
#define Z_DEFLATED
Definition: zlib.h:146
unsigned int uInt
Definition: zlib.h:38
#define UNZ_ERRNO
Definition: unzip.h:76
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
int unz64local_getShort(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uLong *pX)
Definition: unzip.c:241
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
#define SIZEZIPLOCALHEADER
Definition: unzip.c:121

Referenced by unzOpenCurrentFile3().

◆ unz64local_DosDateToTmuDate()

void unz64local_DosDateToTmuDate ( ZPOS64_T  ulDosDate,
tm_unz ptm 
)

Definition at line 857 of file unzip.c.

858 {
859  ZPOS64_T uDate;
860  uDate = (ZPOS64_T)(ulDosDate>>16);
861  ptm->tm_mday = (int)(uDate&0x1f) ;
862  ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
863  ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
864 
865  ptm->tm_hour = (int) ((ulDosDate &0xF800)/0x800);
866  ptm->tm_min = (int) ((ulDosDate&0x7E0)/0x20) ;
867  ptm->tm_sec = (int) (2*(ulDosDate&0x1f)) ;
868 }
int tm_min
Definition: unzip.h:87
int tm_mon
Definition: unzip.h:90
int tm_year
Definition: unzip.h:91
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
int tm_mday
Definition: unzip.h:89
int tm_hour
Definition: unzip.h:88
int tm_sec
Definition: unzip.h:86
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by unz64local_GetCurrentFileInfoInternal().

◆ unz64local_getByte()

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

Definition at line 214 of file unzip.c.

215 {
216  unsigned char c;
217  int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
218  if (err==1)
219  {
220  *pi = (int)c;
221  return UNZ_OK;
222  }
223  else
224  {
225  if (ZERROR64(*pzlib_filefunc_def,filestream))
226  return UNZ_ERRNO;
227  else
228  return UNZ_EOF;
229  }
230 }
#define UNZ_OK
Definition: unzip.h:74
#define ZERROR64(filefunc, filestream)
Definition: ioapi.h:194
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
static refpint_t pi[]
Definition: server.c:96
const GLubyte * c
Definition: glext.h:8905
#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:31

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 884 of file unzip.c.

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

271 {
272  uLong x ;
273  int i = 0;
274  int err;
275 
276  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
277  x = (uLong)i;
278 
279  if (err==UNZ_OK)
280  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
281  x |= ((uLong)i)<<8;
282 
283  if (err==UNZ_OK)
284  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
285  x |= ((uLong)i)<<16;
286 
287  if (err==UNZ_OK)
288  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
289  x += ((uLong)i)<<24;
290 
291  if (err==UNZ_OK)
292  *pX = x;
293  else
294  *pX = 0;
295  return err;
296 }
#define UNZ_OK
Definition: unzip.h:74
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned long uLong
Definition: zlib.h:39
#define err(...)
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
int unz64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
Definition: unzip.c:214

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 304 of file unzip.c.

307 {
308  ZPOS64_T x ;
309  int i = 0;
310  int err;
311 
312  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
313  x = (ZPOS64_T)i;
314 
315  if (err==UNZ_OK)
316  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
317  x |= ((ZPOS64_T)i)<<8;
318 
319  if (err==UNZ_OK)
320  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
321  x |= ((ZPOS64_T)i)<<16;
322 
323  if (err==UNZ_OK)
324  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
325  x |= ((ZPOS64_T)i)<<24;
326 
327  if (err==UNZ_OK)
328  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
329  x |= ((ZPOS64_T)i)<<32;
330 
331  if (err==UNZ_OK)
332  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
333  x |= ((ZPOS64_T)i)<<40;
334 
335  if (err==UNZ_OK)
336  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
337  x |= ((ZPOS64_T)i)<<48;
338 
339  if (err==UNZ_OK)
340  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
341  x |= ((ZPOS64_T)i)<<56;
342 
343  if (err==UNZ_OK)
344  *pX = x;
345  else
346  *pX = 0;
347  return err;
348 }
#define UNZ_OK
Definition: unzip.h:74
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
#define err(...)
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
int unz64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
Definition: unzip.c:214

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 241 of file unzip.c.

244 {
245  uLong x ;
246  int i = 0;
247  int err;
248 
249  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
250  x = (uLong)i;
251 
252  if (err==UNZ_OK)
253  err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
254  x |= ((uLong)i)<<8;
255 
256  if (err==UNZ_OK)
257  *pX = x;
258  else
259  *pX = 0;
260  return err;
261 }
#define UNZ_OK
Definition: unzip.h:74
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned long uLong
Definition: zlib.h:39
#define err(...)
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
int unz64local_getByte(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, int *pi)
Definition: unzip.c:214

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 415 of file unzip.c.

416 {
417  unsigned char* buf;
418  ZPOS64_T uSizeFile;
419  ZPOS64_T uBackRead;
420  ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
421  ZPOS64_T uPosFound=0;
422 
423  if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
424  return 0;
425 
426 
427  uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
428 
429  if (uMaxBack>uSizeFile)
430  uMaxBack = uSizeFile;
431 
432  buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
433  if (buf==NULL)
434  return 0;
435 
436  uBackRead = 4;
437  while (uBackRead<uMaxBack)
438  {
439  uLong uReadSize;
440  ZPOS64_T uReadPos ;
441  int i;
442  if (uBackRead+BUFREADCOMMENT>uMaxBack)
443  uBackRead = uMaxBack;
444  else
445  uBackRead+=BUFREADCOMMENT;
446  uReadPos = uSizeFile-uBackRead ;
447 
448  uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
449  (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
450  if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
451  break;
452 
453  if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
454  break;
455 
456  for (i=(int)uReadSize-3; (i--)>0;)
457  if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
458  ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
459  {
460  uPosFound = uReadPos+(unsigned)i;
461  break;
462  }
463 
464  if (uPosFound!=0)
465  break;
466  }
467  TRYFREE(buf);
468  return uPosFound;
469 }
#define BUFREADCOMMENT
Definition: unzip.c:407
unsigned long uLong
Definition: zlib.h:39
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
#define ZTELL64(filefunc, filestream)
Definition: ioapi.h:203
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 NULL
Definition: types.h:112
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
#define ZLIB_FILEFUNC_SEEK_END
Definition: ioapi.h:115
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
#define TRYFREE(p)
Definition: unzip.c:117
static unsigned(__cdecl *hash_bstr)(bstr_t s)
#define ALLOC(size)
Definition: unzip.c:114

Referenced by unzOpenInternal().

◆ unz64local_SearchCentralDir64()

ZPOS64_T unz64local_SearchCentralDir64 ( const zlib_filefunc64_32_def pzlib_filefunc_def,
voidpf  filestream 
)

Definition at line 480 of file unzip.c.

482 {
483  unsigned char* buf;
484  ZPOS64_T uSizeFile;
485  ZPOS64_T uBackRead;
486  ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
487  ZPOS64_T uPosFound=0;
488  uLong uL;
489  ZPOS64_T relativeOffset;
490 
491  if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
492  return 0;
493 
494 
495  uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
496 
497  if (uMaxBack>uSizeFile)
498  uMaxBack = uSizeFile;
499 
500  buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
501  if (buf==NULL)
502  return 0;
503 
504  uBackRead = 4;
505  while (uBackRead<uMaxBack)
506  {
507  uLong uReadSize;
508  ZPOS64_T uReadPos;
509  int i;
510  if (uBackRead+BUFREADCOMMENT>uMaxBack)
511  uBackRead = uMaxBack;
512  else
513  uBackRead+=BUFREADCOMMENT;
514  uReadPos = uSizeFile-uBackRead ;
515 
516  uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
517  (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
518  if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
519  break;
520 
521  if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
522  break;
523 
524  for (i=(int)uReadSize-3; (i--)>0;)
525  if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
526  ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
527  {
528  uPosFound = uReadPos+(unsigned)i;
529  break;
530  }
531 
532  if (uPosFound!=0)
533  break;
534  }
535  TRYFREE(buf);
536  if (uPosFound == 0)
537  return 0;
538 
539  /* Zip64 end of central directory locator */
540  if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
541  return 0;
542 
543  /* the signature, already checked */
544  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
545  return 0;
546 
547  /* number of the disk with the start of the zip64 end of central directory */
548  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
549  return 0;
550  if (uL != 0)
551  return 0;
552 
553  /* relative offset of the zip64 end of central directory record */
554  if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
555  return 0;
556 
557  /* total number of disks */
558  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
559  return 0;
560  if (uL != 1)
561  return 0;
562 
563  /* Goto end of central directory record */
564  if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
565  return 0;
566 
567  /* the signature */
568  if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
569  return 0;
570 
571  if (uL != 0x06064b50)
572  return 0;
573 
574  return relativeOffset;
575 }
#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:268
#define BUFREADCOMMENT
Definition: unzip.c:407
unsigned long uLong
Definition: zlib.h:39
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
int unz64local_getLong64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
Definition: unzip.c:304
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
#define ZTELL64(filefunc, filestream)
Definition: ioapi.h:203
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 NULL
Definition: types.h:112
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
#define ZLIB_FILEFUNC_SEEK_END
Definition: ioapi.h:115
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
#define TRYFREE(p)
Definition: unzip.c:117
static unsigned(__cdecl *hash_bstr)(bstr_t s)
#define ALLOC(size)
Definition: unzip.c:114

Referenced by unzOpenInternal().

◆ unzClose()

int ZEXPORT unzClose ( unzFile  file)

Definition at line 813 of file unzip.c.

814 {
815  unz64_s* s;
816  if (file==NULL)
817  return UNZ_PARAMERROR;
818  s=(unz64_s*)file;
819 
820  if (s->pfile_in_zip_read!=NULL)
822 
823  ZCLOSE64(s->z_filefunc, s->filestream);
824  TRYFREE(s);
825  return UNZ_OK;
826 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
#define ZCLOSE64(filefunc, filestream)
Definition: ioapi.h:193
int ZEXPORT unzCloseCurrentFile(unzFile file)
Definition: unzip.c:2012
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
Definition: unzip.c:167
#define TRYFREE(p)
Definition: unzip.c:117
Definition: fci.c:126

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

◆ unzCloseCurrentFile()

int ZEXPORT unzCloseCurrentFile ( unzFile  file)

Definition at line 2012 of file unzip.c.

2013 {
2014  int err=UNZ_OK;
2015 
2016  unz64_s* s;
2017  file_in_zip64_read_info_s* pfile_in_zip_read_info;
2018  if (file==NULL)
2019  return UNZ_PARAMERROR;
2020  s=(unz64_s*)file;
2021  pfile_in_zip_read_info=s->pfile_in_zip_read;
2022 
2023  if (pfile_in_zip_read_info==NULL)
2024  return UNZ_PARAMERROR;
2025 
2026 
2027  if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
2028  (!pfile_in_zip_read_info->raw))
2029  {
2030  if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
2031  err=UNZ_CRCERROR;
2032  }
2033 
2034 
2035  TRYFREE(pfile_in_zip_read_info->read_buffer);
2036  pfile_in_zip_read_info->read_buffer = NULL;
2037  if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
2038  inflateEnd(&pfile_in_zip_read_info->stream);
2039 #ifdef HAVE_BZIP2
2040  else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
2041  BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
2042 #endif
2043 
2044 
2045  pfile_in_zip_read_info->stream_initialised = 0;
2046  TRYFREE(pfile_in_zip_read_info);
2047 
2048  s->pfile_in_zip_read=NULL;
2049 
2050  return err;
2051 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
#define Z_BZIP2ED
Definition: unzip.h:62
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:156
int inflateEnd(z_streamp strm)
Definition: inflate.c:1910
GLdouble s
Definition: gl.h:2039
#define err(...)
#define Z_DEFLATED
Definition: zlib.h:146
#define NULL
Definition: types.h:112
#define UNZ_CRCERROR
Definition: unzip.h:81
Definition: unzip.c:167
#define TRYFREE(p)
Definition: unzip.c:117
Definition: fci.c:126

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

◆ unzeof()

int ZEXPORT unzeof ( unzFile  file)

Definition at line 1932 of file unzip.c.

1933 {
1934  unz64_s* s;
1935  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1936  if (file==NULL)
1937  return UNZ_PARAMERROR;
1938  s=(unz64_s*)file;
1939  pfile_in_zip_read_info=s->pfile_in_zip_read;
1940 
1941  if (pfile_in_zip_read_info==NULL)
1942  return UNZ_PARAMERROR;
1943 
1944  if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
1945  return 1;
1946  else
1947  return 0;
1948 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:156
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
Definition: unzip.c:167
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 1141 of file unzip.c.

1146 {
1147  int err;
1148  unz_file_info64 file_info64;
1150  szFileName,fileNameBufferSize,
1151  extraField,extraFieldBufferSize,
1152  szComment,commentBufferSize);
1153  if ((err==UNZ_OK) && (pfile_info != NULL))
1154  {
1155  pfile_info->version = file_info64.version;
1156  pfile_info->version_needed = file_info64.version_needed;
1157  pfile_info->flag = file_info64.flag;
1158  pfile_info->compression_method = file_info64.compression_method;
1159  pfile_info->dosDate = file_info64.dosDate;
1160  pfile_info->crc = file_info64.crc;
1161 
1162  pfile_info->size_filename = file_info64.size_filename;
1163  pfile_info->size_file_extra = file_info64.size_file_extra;
1164  pfile_info->size_file_comment = file_info64.size_file_comment;
1165 
1166  pfile_info->disk_num_start = file_info64.disk_num_start;
1167  pfile_info->internal_fa = file_info64.internal_fa;
1168  pfile_info->external_fa = file_info64.external_fa;
1169 
1170  pfile_info->tmu_date = file_info64.tmu_date,
1171 
1172 
1173  pfile_info->compressed_size = (uLong)file_info64.compressed_size;
1174  pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
1175 
1176  }
1177  return err;
1178 }
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
unsigned long uLong
Definition: zlib.h:39
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:884
uLong size_file_comment
Definition: unzip.h:144
uLong size_filename
Definition: unzip.h:142
ZPOS64_T compressed_size
Definition: unzip.h:119
uLong external_fa
Definition: unzip.h:127
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
#define NULL
Definition: types.h:112
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 1129 of file unzip.c.

1134 {
1136  szFileName,fileNameBufferSize,
1137  extraField,extraFieldBufferSize,
1138  szComment,commentBufferSize);
1139 }
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:884
#define NULL
Definition: types.h:112
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 1663 of file unzip.c.

1664 {
1665  unz64_s* s;
1666  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1667  s=(unz64_s*)file;
1668  if (file==NULL)
1669  return 0; //UNZ_PARAMERROR;
1670  pfile_in_zip_read_info=s->pfile_in_zip_read;
1671  if (pfile_in_zip_read_info==NULL)
1672  return 0; //UNZ_PARAMERROR;
1673  return pfile_in_zip_read_info->pos_in_zipfile +
1674  pfile_in_zip_read_info->byte_before_the_zipfile;
1675 }
ZPOS64_T byte_before_the_zipfile
Definition: unzip.c:160
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
ZPOS64_T pos_in_zipfile
Definition: unzip.c:145
Definition: unzip.c:167
Definition: fci.c:126

◆ unzGetFilePos()

int ZEXPORT unzGetFilePos ( unzFile  file,
unz_file_pos file_pos 
)

Definition at line 1329 of file unzip.c.

1332 {
1333  unz64_file_pos file_pos64;
1334  int err = unzGetFilePos64(file,&file_pos64);
1335  if (err==UNZ_OK)
1336  {
1337  file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
1338  file_pos->num_of_file = (uLong)file_pos64.num_of_file;
1339  }
1340  return err;
1341 }
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:1313
uLong pos_in_zip_directory
Definition: unzip.h:260
unsigned long uLong
Definition: zlib.h:39
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
#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 1313 of file unzip.c.

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

Referenced by unzGetFilePos().

◆ unzGetGlobalComment()

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

Definition at line 2059 of file unzip.c.

2060 {
2061  unz64_s* s;
2062  uLong uReadThis ;
2063  if (file==NULL)
2064  return (int)UNZ_PARAMERROR;
2065  s=(unz64_s*)file;
2066 
2067  uReadThis = uSizeBuf;
2068  if (uReadThis>s->gi.size_comment)
2069  uReadThis = s->gi.size_comment;
2070 
2071  if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
2072  return UNZ_ERRNO;
2073 
2074  if (uReadThis>0)
2075  {
2076  *szComment='\0';
2077  if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
2078  return UNZ_ERRNO;
2079  }
2080 
2081  if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
2082  *(szComment+s->gi.size_comment)='\0';
2083  return (int)uReadThis;
2084 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
unsigned long uLong
Definition: zlib.h:39
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
GLdouble s
Definition: gl.h:2039
#define UNZ_ERRNO
Definition: unzip.h:76
#define NULL
Definition: types.h:112
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
Definition: unzip.c:167
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 843 of file unzip.c.

844 {
845  unz64_s* s;
846  if (file==NULL)
847  return UNZ_PARAMERROR;
848  s=(unz64_s*)file;
849  /* to do : check if number_entry is not truncated */
850  pglobal_info32->number_entry = (uLong)s->gi.number_entry;
851  pglobal_info32->size_comment = s->gi.size_comment;
852  return UNZ_OK;
853 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
unsigned long uLong
Definition: zlib.h:39
GLdouble s
Definition: gl.h:2039
uLong number_entry
Definition: unzip.h:105
#define NULL
Definition: types.h:112
Definition: unzip.c:167
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 833 of file unzip.c.

834 {
835  unz64_s* s;
836  if (file==NULL)
837  return UNZ_PARAMERROR;
838  s=(unz64_s*)file;
839  *pglobal_info=s->gi;
840  return UNZ_OK;
841 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define UNZ_OK
Definition: unzip.h:74
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
Definition: unzip.c:167
Definition: fci.c:126

Referenced by CZipExtract::Extract().

◆ unzGetLocalExtrafield()

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

Definition at line 1964 of file unzip.c.

1965 {
1966  unz64_s* s;
1967  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1968  uInt read_now;
1969  ZPOS64_T size_to_read;
1970 
1971  if (file==NULL)
1972  return UNZ_PARAMERROR;
1973  s=(unz64_s*)file;
1974  pfile_in_zip_read_info=s->pfile_in_zip_read;
1975 
1976  if (pfile_in_zip_read_info==NULL)
1977  return UNZ_PARAMERROR;
1978 
1979  size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
1980  pfile_in_zip_read_info->pos_local_extrafield);
1981 
1982  if (buf==NULL)
1983  return (int)size_to_read;
1984 
1985  if (len>size_to_read)
1986  read_now = (uInt)size_to_read;
1987  else
1988  read_now = (uInt)len ;
1989 
1990  if (read_now==0)
1991  return 0;
1992 
1993  if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,
1994  pfile_in_zip_read_info->filestream,
1995  pfile_in_zip_read_info->offset_local_extrafield +
1996  pfile_in_zip_read_info->pos_local_extrafield,
1998  return UNZ_ERRNO;
1999 
2000  if (ZREAD64(pfile_in_zip_read_info->z_filefunc,
2001  pfile_in_zip_read_info->filestream,
2002  buf,read_now)!=read_now)
2003  return UNZ_ERRNO;
2004 
2005  return (int)read_now;
2006 }
#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:150
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
ZPOS64_T offset_local_extrafield
Definition: unzip.c:148
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
zlib_filefunc64_32_def z_filefunc
Definition: unzip.c:157
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
unsigned int uInt
Definition: zlib.h:38
#define UNZ_ERRNO
Definition: unzip.h:76
#define NULL
Definition: types.h:112
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
Definition: unzip.c:167
Definition: fci.c:126

◆ unzGetOffset()

uLong ZEXPORT unzGetOffset ( unzFile  file)

Definition at line 2102 of file unzip.c.

2103 {
2104  ZPOS64_T offset64;
2105 
2106  if (file==NULL)
2107  return 0; //UNZ_PARAMERROR;
2108  offset64 = unzGetOffset64(file);
2109  return (uLong)offset64;
2110 }
unsigned long uLong
Definition: zlib.h:39
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
Definition: unzip.c:2087
#define NULL
Definition: types.h:112
Definition: fci.c:126

◆ unzGetOffset64()

ZPOS64_T ZEXPORT unzGetOffset64 ( unzFile  file)

Definition at line 2087 of file unzip.c.

2088 {
2089  unz64_s* s;
2090 
2091  if (file==NULL)
2092  return 0; //UNZ_PARAMERROR;
2093  s=(unz64_s*)file;
2094  if (!s->current_file_ok)
2095  return 0;
2096  if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
2097  if (s->num_file==s->gi.number_entry)
2098  return 0;
2099  return s->pos_in_central_dir;
2100 }
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
Definition: unzip.c:167
Definition: fci.c:126

Referenced by unzGetOffset().

◆ unzGoToFilePos()

int ZEXPORT unzGoToFilePos ( unzFile  file,
unz_file_pos file_pos 
)

Definition at line 1365 of file unzip.c.

1368 {
1369  unz64_file_pos file_pos64;
1370  if (file_pos == NULL)
1371  return UNZ_PARAMERROR;
1372 
1373  file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
1374  file_pos64.num_of_file = file_pos->num_of_file;
1375  return unzGoToFilePos64(file,&file_pos64);
1376 }
#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:1343
uLong pos_in_zip_directory
Definition: unzip.h:260
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
uLong num_of_file
Definition: unzip.h:261
#define NULL
Definition: types.h:112
Definition: fci.c:126

◆ unzGoToFilePos64()

int ZEXPORT unzGoToFilePos64 ( unzFile  file,
const unz64_file_pos file_pos 
)

Definition at line 1343 of file unzip.c.

1344 {
1345  unz64_s* s;
1346  int err;
1347 
1348  if (file==NULL || file_pos==NULL)
1349  return UNZ_PARAMERROR;
1350  s=(unz64_s*)file;
1351 
1352  /* jump to the right spot */
1353  s->pos_in_central_dir = file_pos->pos_in_zip_directory;
1354  s->num_file = file_pos->num_of_file;
1355 
1356  /* set the current file */
1357  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1358  &s->cur_file_info_internal,
1359  NULL,0,NULL,0,NULL,0);
1360  /* return results */
1361  s->current_file_ok = (err == UNZ_OK);
1362  return err;
1363 }
#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:884
ZPOS64_T pos_in_zip_directory
Definition: unzip.h:274
GLdouble s
Definition: gl.h:2039
#define err(...)
#define NULL
Definition: types.h:112
Definition: unzip.c:167
Definition: fci.c:126

Referenced by unzGoToFilePos().

◆ unzGoToFirstFile()

int ZEXPORT unzGoToFirstFile ( unzFile  file)

Definition at line 1183 of file unzip.c.

1184 {
1185  int err=UNZ_OK;
1186  unz64_s* s;
1187  if (file==NULL)
1188  return UNZ_PARAMERROR;
1189  s=(unz64_s*)file;
1190  s->pos_in_central_dir=s->offset_central_dir;
1191  s->num_file=0;
1193  &s->cur_file_info_internal,
1194  NULL,0,NULL,0,NULL,0);
1195  s->current_file_ok = (err == UNZ_OK);
1196  return err;
1197 }
#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:884
GLdouble s
Definition: gl.h:2039
#define err(...)
#define NULL
Definition: types.h:112
Definition: unzip.c:167
Definition: fci.c:126

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

◆ unzGoToNextFile()

int ZEXPORT unzGoToNextFile ( unzFile  file)

Definition at line 1204 of file unzip.c.

1205 {
1206  unz64_s* s;
1207  int err;
1208 
1209  if (file==NULL)
1210  return UNZ_PARAMERROR;
1211  s=(unz64_s*)file;
1212  if (!s->current_file_ok)
1213  return UNZ_END_OF_LIST_OF_FILE;
1214  if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
1215  if (s->num_file+1==s->gi.number_entry)
1216  return UNZ_END_OF_LIST_OF_FILE;
1217 
1218  s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
1219  s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
1220  s->num_file++;
1221  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1222  &s->cur_file_info_internal,
1223  NULL,0,NULL,0,NULL,0);
1224  s->current_file_ok = (err == UNZ_OK);
1225  return err;
1226 }
#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:884
GLdouble s
Definition: gl.h:2039
#define err(...)
#define NULL
Definition: types.h:112
#define SIZECENTRALDIRITEM
Definition: unzip.c:120
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:167
Definition: fci.c:126

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

◆ unzLocateFile()

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

Definition at line 1237 of file unzip.c.

1238 {
1239  unz64_s* s;
1240  int err;
1241 
1242  /* We remember the 'current' position in the file so that we can jump
1243  * back there if we fail.
1244  */
1245  unz_file_info64 cur_file_infoSaved;
1246  unz_file_info64_internal cur_file_info_internalSaved;
1247  ZPOS64_T num_fileSaved;
1248  ZPOS64_T pos_in_central_dirSaved;
1249 
1250 
1251  if (file==NULL)
1252  return UNZ_PARAMERROR;
1253 
1254  if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
1255  return UNZ_PARAMERROR;
1256 
1257  s=(unz64_s*)file;
1258  if (!s->current_file_ok)
1259  return UNZ_END_OF_LIST_OF_FILE;
1260 
1261  /* Save the current state */
1262  num_fileSaved = s->num_file;
1263  pos_in_central_dirSaved = s->pos_in_central_dir;
1264  cur_file_infoSaved = s->cur_file_info;
1265  cur_file_info_internalSaved = s->cur_file_info_internal;
1266 
1268 
1269  while (err == UNZ_OK)
1270  {
1271  char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
1273  szCurrentFileName,sizeof(szCurrentFileName)-1,
1274  NULL,0,NULL,0);
1275  if (err == UNZ_OK)
1276  {
1277  if (unzStringFileNameCompare(szCurrentFileName,
1278  szFileName,iCaseSensitivity)==0)
1279  return UNZ_OK;
1281  }
1282  }
1283 
1284  /* We failed, so restore the state of the 'current file' to where we
1285  * were.
1286  */
1287  s->num_file = num_fileSaved ;
1288  s->pos_in_central_dir = pos_in_central_dirSaved ;
1289  s->cur_file_info = cur_file_infoSaved;
1290  s->cur_file_info_internal = cur_file_info_internalSaved;
1291  return err;
1292 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition: unzip.c:1183
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:1204
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
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:1129
#define err(...)
int ZEXPORT unzStringFileNameCompare(const char *fileName1, const char *fileName2, int iCaseSensitivity)
Definition: unzip.c:392
#define UNZ_MAXFILENAMEINZIP
Definition: unzip.c:110
#define NULL
Definition: types.h:112
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:167
Definition: fci.c:126

◆ unzOpen()

unzFile ZEXPORT unzOpen ( const char path)

Definition at line 798 of file unzip.c.

799 {
800  return unzOpenInternal(path, NULL, 0);
801 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:586
#define NULL
Definition: types.h:112

◆ unzOpen2()

unzFile ZEXPORT unzOpen2 ( const char path,
zlib_filefunc_def pzlib_filefunc32_def 
)

Definition at line 769 of file unzip.c.

771 {
772  if (pzlib_filefunc32_def != NULL)
773  {
774  zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
775  fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
776  return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);
777  }
778  else
779  return unzOpenInternal(path, NULL, 0);
780 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:586
#define NULL
Definition: types.h:112
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 783 of file unzip.c.

785 {
786  if (pzlib_filefunc_def != NULL)
787  {
788  zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
789  zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
790  zlib_filefunc64_32_def_fill.ztell32_file = NULL;
791  zlib_filefunc64_32_def_fill.zseek32_file = NULL;
792  return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
793  }
794  else
795  return unzOpenInternal(path, NULL, 1);
796 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:586
seek_file_func zseek32_file
Definition: ioapi.h:185
zlib_filefunc64_def zfile_func64
Definition: ioapi.h:182
tell_file_func ztell32_file
Definition: ioapi.h:184
#define NULL
Definition: types.h:112

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

◆ unzOpen64()

unzFile ZEXPORT unzOpen64 ( const void path)

Definition at line 803 of file unzip.c.

804 {
805  return unzOpenInternal(path, NULL, 1);
806 }
unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction)
Definition: unzip.c:586
#define NULL
Definition: types.h:112

◆ unzOpenCurrentFile()

int ZEXPORT unzOpenCurrentFile ( unzFile  file)

Definition at line 1646 of file unzip.c.

1647 {
1648  return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
1649 }
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
Definition: unzip.c:1477
#define NULL
Definition: types.h:112
Definition: fci.c:126

Referenced by CZipExtract::ExtractSingle().

◆ unzOpenCurrentFile2()

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

Definition at line 1656 of file unzip.c.

1657 {
1658  return unzOpenCurrentFile3(file, method, level, raw, NULL);
1659 }
GLint level
Definition: gl.h:1546
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
Definition: unzip.c:1477
method
Definition: dragdrop.c:53
#define NULL
Definition: types.h:112
Definition: fci.c:126

◆ unzOpenCurrentFile3()

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

Definition at line 1477 of file unzip.c.

1479 {
1480  int err=UNZ_OK;
1481  uInt iSizeVar;
1482  unz64_s* s;
1483  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1484  ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
1485  uInt size_local_extrafield; /* size of the local extra field */
1486 # ifndef NOUNCRYPT
1487  char source[12];
1488 # else
1489  if (password != NULL)
1490  return UNZ_PARAMERROR;
1491 # endif
1492 
1493  if (file==NULL)
1494  return UNZ_PARAMERROR;
1495  s=(unz64_s*)file;
1496  if (!s->current_file_ok)
1497  return UNZ_PARAMERROR;
1498 
1499  if (s->pfile_in_zip_read != NULL)
1501 
1502  if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
1503  return UNZ_BADZIPFILE;
1504 
1505  pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
1506  if (pfile_in_zip_read_info==NULL)
1507  return UNZ_INTERNALERROR;
1508 
1509  pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
1510  pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
1511  pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
1512  pfile_in_zip_read_info->pos_local_extrafield=0;
1513  pfile_in_zip_read_info->raw=raw;
1514 
1515  if (pfile_in_zip_read_info->read_buffer==NULL)
1516  {
1517  TRYFREE(pfile_in_zip_read_info);
1518  return UNZ_INTERNALERROR;
1519  }
1520 
1521  pfile_in_zip_read_info->stream_initialised=0;
1522 
1523  if (method!=NULL)
1524  *method = (int)s->cur_file_info.compression_method;
1525 
1526  if (level!=NULL)
1527  {
1528  *level = 6;
1529  switch (s->cur_file_info.flag & 0x06)
1530  {
1531  case 6 : *level = 1; break;
1532  case 4 : *level = 2; break;
1533  case 2 : *level = 9; break;
1534  }
1535  }
1536 
1537  if ((s->cur_file_info.compression_method!=0) &&
1538 /* #ifdef HAVE_BZIP2 */
1539  (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
1540 /* #endif */
1541  (s->cur_file_info.compression_method!=Z_DEFLATED))
1542 
1544 
1545  pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
1546  pfile_in_zip_read_info->crc32=0;
1547  pfile_in_zip_read_info->total_out_64=0;
1548  pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method;
1549  pfile_in_zip_read_info->filestream=s->filestream;
1550  pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
1551  pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
1552 
1553  pfile_in_zip_read_info->stream.total_out = 0;
1554 
1555  if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw))
1556  {
1557 #ifdef HAVE_BZIP2
1558  pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0;
1559  pfile_in_zip_read_info->bstream.bzfree = (free_func)0;
1560  pfile_in_zip_read_info->bstream.opaque = (voidpf)0;
1561  pfile_in_zip_read_info->bstream.state = (voidpf)0;
1562 
1563  pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
1564  pfile_in_zip_read_info->stream.zfree = (free_func)0;
1565  pfile_in_zip_read_info->stream.opaque = (voidpf)0;
1566  pfile_in_zip_read_info->stream.next_in = (voidpf)0;
1567  pfile_in_zip_read_info->stream.avail_in = 0;
1568 
1569  err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
1570  if (err == Z_OK)
1571  pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
1572  else
1573  {
1574  TRYFREE(pfile_in_zip_read_info);
1575  return err;
1576  }
1577 #else
1578  pfile_in_zip_read_info->raw=1;
1579 #endif
1580  }
1581  else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
1582  {
1583  pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
1584  pfile_in_zip_read_info->stream.zfree = (free_func)0;
1585  pfile_in_zip_read_info->stream.opaque = (voidpf)0;
1586  pfile_in_zip_read_info->stream.next_in = 0;
1587  pfile_in_zip_read_info->stream.avail_in = 0;
1588 
1589  err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
1590  if (err == Z_OK)
1591  pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
1592  else
1593  {
1594  TRYFREE(pfile_in_zip_read_info);
1595  return err;
1596  }
1597  /* windowBits is passed < 0 to tell that there is no zlib header.
1598  * Note that in this case inflate *requires* an extra "dummy" byte
1599  * after the compressed stream in order to complete decompression and
1600  * return Z_STREAM_END.
1601  * In unzip, i don't wait absolutely Z_STREAM_END because I known the
1602  * size of both compressed and uncompressed data
1603  */
1604  }
1605  pfile_in_zip_read_info->rest_read_compressed =
1606  s->cur_file_info.compressed_size ;
1607  pfile_in_zip_read_info->rest_read_uncompressed =
1608  s->cur_file_info.uncompressed_size ;
1609 
1610 
1611  pfile_in_zip_read_info->pos_in_zipfile =
1612  s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
1613  iSizeVar;
1614 
1615  pfile_in_zip_read_info->stream.avail_in = (uInt)0;
1616 
1617  s->pfile_in_zip_read = pfile_in_zip_read_info;
1618  s->encrypted = 0;
1619 
1620 # ifndef NOUNCRYPT
1621  if (password != NULL)
1622  {
1623  int i;
1624  s->pcrc_32_tab = get_crc_table();
1625  init_keys(password,s->keys,s->pcrc_32_tab);
1626  if (ZSEEK64(s->z_filefunc, s->filestream,
1627  s->pfile_in_zip_read->pos_in_zipfile +
1628  s->pfile_in_zip_read->byte_before_the_zipfile,
1629  SEEK_SET)!=0)
1630  return UNZ_INTERNALERROR;
1631  if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12)
1632  return UNZ_INTERNALERROR;
1633 
1634  for (i = 0; i<12; i++)
1635  zdecode(s->keys,s->pcrc_32_tab,source[i]);
1636 
1637  s->pfile_in_zip_read->pos_in_zipfile+=12;
1638  s->encrypted=1;
1639  }
1640 # endif
1641 
1642 
1643  return UNZ_OK;
1644 }
GLint level
Definition: gl.h:1546
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T rest_read_compressed
Definition: unzip.c:155
void FAR * voidpf
Definition: zlib.h:42
#define Z_OK
Definition: zlib.h:114
#define UNZ_OK
Definition: unzip.h:74
uInt avail_in
Definition: zlib.h:60
#define UNZ_BADZIPFILE
Definition: unzip.h:79
#define UNZ_INTERNALERROR
Definition: unzip.h:80
#define MAX_WBITS
Definition: zlib.h:151
if(dx==0 &&dy==0)
Definition: linetemp.h:174
voidpf opaque
Definition: zlib.h:72
ZPOS64_T pos_local_extrafield
Definition: unzip.c:150
free_func zfree
Definition: zlib.h:71
#define Z_BZIP2ED
Definition: unzip.h:62
z_const Bytef * next_in
Definition: zlib.h:59
#define SEEK_SET
Definition: jmemansi.c:26
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
void(* free_func)(voidpf opaque, voidpf address)
Definition: zlib.h:54
int ZEXPORT unzCloseCurrentFile(unzFile file)
Definition: unzip.c:2012
ZPOS64_T offset_local_extrafield
Definition: unzip.c:148
alloc_func zalloc
Definition: zlib.h:70
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:156
ZPOS64_T byte_before_the_zipfile
Definition: unzip.c:160
method
Definition: dragdrop.c:53
#define zdecode(pkeys, pcrc_32_tab, c)
Definition: crypt.h:77
zlib_filefunc64_32_def z_filefunc
Definition: unzip.c:157
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
const z_crc_t FAR *ZEXPORT get_crc_table()
Definition: crc32.c:586
GLdouble s
Definition: gl.h:2039
#define err(...)
#define Z_DEFLATED
Definition: zlib.h:146
uLong total_out
Definition: zlib.h:65
unsigned int uInt
Definition: zlib.h:38
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
int unz64local_CheckCurrentFileCoherencyHeader(unz64_s *s, uInt *piSizeVar, ZPOS64_T *poffset_local_extrafield, uInt *psize_local_extrafield)
Definition: unzip.c:1390
#define NULL
Definition: types.h:112
#define inflateInit2(strm, windowBits)
Definition: zlib.h:1817
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
#define UNZ_BUFSIZE
Definition: unzip.c:106
voidpf(* alloc_func)(voidpf opaque, uInt items, uInt size)
Definition: zlib.h:53
ZPOS64_T pos_in_zipfile
Definition: unzip.c:145
Definition: unzip.c:167
#define SIZEZIPLOCALHEADER
Definition: unzip.c:121
#define TRYFREE(p)
Definition: unzip.c:117
#define ALLOC(size)
Definition: unzip.c:114
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
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 1651 of file unzip.c.

1652 {
1653  return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
1654 }
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
Definition: unzip.c:1477
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
#define NULL
Definition: types.h:112
Definition: fci.c:126

Referenced by CZipExtract::ExtractSingle().

◆ unzOpenInternal()

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

Definition at line 586 of file unzip.c.

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

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 1689 of file unzip.c.

1690 {
1691  int err=UNZ_OK;
1692  uInt iRead = 0;
1693  unz64_s* s;
1694  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1695  if (file==NULL)
1696  return UNZ_PARAMERROR;
1697  s=(unz64_s*)file;
1698  pfile_in_zip_read_info=s->pfile_in_zip_read;
1699 
1700  if (pfile_in_zip_read_info==NULL)
1701  return UNZ_PARAMERROR;
1702 
1703 
1704  if (pfile_in_zip_read_info->read_buffer == NULL)
1705  return UNZ_END_OF_LIST_OF_FILE;
1706  if (len==0)
1707  return 0;
1708 
1709  pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
1710 
1711  pfile_in_zip_read_info->stream.avail_out = (uInt)len;
1712 
1713  if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
1714  (!(pfile_in_zip_read_info->raw)))
1715  pfile_in_zip_read_info->stream.avail_out =
1716  (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
1717 
1718  if ((len>pfile_in_zip_read_info->rest_read_compressed+
1719  pfile_in_zip_read_info->stream.avail_in) &&
1720  (pfile_in_zip_read_info->raw))
1721  pfile_in_zip_read_info->stream.avail_out =
1722  (uInt)pfile_in_zip_read_info->rest_read_compressed+
1723  pfile_in_zip_read_info->stream.avail_in;
1724 
1725  while (pfile_in_zip_read_info->stream.avail_out>0)
1726  {
1727  if ((pfile_in_zip_read_info->stream.avail_in==0) &&
1728  (pfile_in_zip_read_info->rest_read_compressed>0))
1729  {
1730  uInt uReadThis = UNZ_BUFSIZE;
1731  if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
1732  uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
1733  if (uReadThis == 0)
1734  return UNZ_EOF;
1735  if (ZSEEK64(pfile_in_zip_read_info->z_filefunc,
1736  pfile_in_zip_read_info->filestream,
1737  pfile_in_zip_read_info->pos_in_zipfile +
1738  pfile_in_zip_read_info->byte_before_the_zipfile,
1740  return UNZ_ERRNO;
1741  if (ZREAD64(pfile_in_zip_read_info->z_filefunc,
1742  pfile_in_zip_read_info->filestream,
1743  pfile_in_zip_read_info->read_buffer,
1744  uReadThis)!=uReadThis)
1745  return UNZ_ERRNO;
1746 
1747 
1748 # ifndef NOUNCRYPT
1749  if(s->encrypted)
1750  {
1751  uInt i;
1752  for(i=0;i<uReadThis;i++)
1753  pfile_in_zip_read_info->read_buffer[i] =
1754  zdecode(s->keys,s->pcrc_32_tab,
1755  pfile_in_zip_read_info->read_buffer[i]);
1756  }
1757 # endif
1758 
1759 
1760  pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
1761 
1762  pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
1763 
1764  pfile_in_zip_read_info->stream.next_in =
1765  (Bytef*)pfile_in_zip_read_info->read_buffer;
1766  pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
1767  }
1768 
1769  if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
1770  {
1771  uInt uDoCopy,i ;
1772 
1773  if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
1774  (pfile_in_zip_read_info->rest_read_compressed == 0))
1775  return (iRead==0) ? UNZ_EOF : (int)iRead;
1776 
1777  if (pfile_in_zip_read_info->stream.avail_out <
1778  pfile_in_zip_read_info->stream.avail_in)
1779  uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
1780  else
1781  uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
1782 
1783  for (i=0;i<uDoCopy;i++)
1784  *(pfile_in_zip_read_info->stream.next_out+i) =
1785  *(pfile_in_zip_read_info->stream.next_in+i);
1786 
1787  pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy;
1788 
1789  pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
1790  pfile_in_zip_read_info->stream.next_out,
1791  uDoCopy);
1792  pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
1793  pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
1794  pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
1795  pfile_in_zip_read_info->stream.next_out += uDoCopy;
1796  pfile_in_zip_read_info->stream.next_in += uDoCopy;
1797  pfile_in_zip_read_info->stream.total_out += uDoCopy;
1798  iRead += uDoCopy;
1799  }
1800  else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED)
1801  {
1802 #ifdef HAVE_BZIP2
1803  uLong uTotalOutBefore,uTotalOutAfter;
1804  const Bytef *bufBefore;
1805  uLong uOutThis;
1806 
1807  pfile_in_zip_read_info->bstream.next_in = (char*)pfile_in_zip_read_info->stream.next_in;
1808  pfile_in_zip_read_info->bstream.avail_in = pfile_in_zip_read_info->stream.avail_in;
1809  pfile_in_zip_read_info->bstream.total_in_lo32 = pfile_in_zip_read_info->stream.total_in;
1810  pfile_in_zip_read_info->bstream.total_in_hi32 = 0;
1811  pfile_in_zip_read_info->bstream.next_out = (char*)pfile_in_zip_read_info->stream.next_out;
1812  pfile_in_zip_read_info->bstream.avail_out = pfile_in_zip_read_info->stream.avail_out;
1813  pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out;
1814  pfile_in_zip_read_info->bstream.total_out_hi32 = 0;
1815 
1816  uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32;
1817  bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out;
1818 
1819  err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream);
1820 
1821  uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32;
1822  uOutThis = uTotalOutAfter-uTotalOutBefore;
1823 
1824  pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
1825 
1826  pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis));
1827  pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;
1828  iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
1829 
1830  pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->bstream.next_in;
1831  pfile_in_zip_read_info->stream.avail_in = pfile_in_zip_read_info->bstream.avail_in;
1832  pfile_in_zip_read_info->stream.total_in = pfile_in_zip_read_info->bstream.total_in_lo32;
1833  pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out;
1834  pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out;
1835  pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32;
1836 
1837  if (err==BZ_STREAM_END)
1838  return (iRead==0) ? UNZ_EOF : iRead;
1839  if (err!=BZ_OK)
1840  break;
1841 #endif
1842  } // end Z_BZIP2ED
1843  else
1844  {
1845  ZPOS64_T uTotalOutBefore,uTotalOutAfter;
1846  const Bytef *bufBefore;
1847  ZPOS64_T uOutThis;
1848  int flush=Z_SYNC_FLUSH;
1849 
1850  uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
1851  bufBefore = pfile_in_zip_read_info->stream.next_out;
1852 
1853  /*
1854  if ((pfile_in_zip_read_info->rest_read_uncompressed ==
1855  pfile_in_zip_read_info->stream.avail_out) &&
1856  (pfile_in_zip_read_info->rest_read_compressed == 0))
1857  flush = Z_FINISH;
1858  */
1859  err=inflate(&pfile_in_zip_read_info->stream,flush);
1860 
1861  if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
1862  err = Z_DATA_ERROR;
1863 
1864  uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
1865  /* Detect overflow, because z_stream.total_out is uLong (32 bits) */
1866  if (uTotalOutAfter<uTotalOutBefore)
1867  uTotalOutAfter += 1LL << 32; /* Add maximum value of uLong + 1 */
1868  uOutThis = uTotalOutAfter-uTotalOutBefore;
1869 
1870  pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
1871 
1872  pfile_in_zip_read_info->crc32 =
1873  crc32(pfile_in_zip_read_info->crc32,bufBefore,
1874  (uInt)(uOutThis));
1875 
1876  pfile_in_zip_read_info->rest_read_uncompressed -=
1877  uOutThis;
1878 
1879  iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
1880 
1881  if (err==Z_STREAM_END)
1882  return (iRead==0) ? UNZ_EOF : (int)iRead;
1883  if (err!=Z_OK)
1884  break;
1885  }
1886  }
1887 
1888  if (err==Z_OK)
1889  return (int)iRead;
1890  return err;
1891 }
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
#define UNZ_PARAMERROR
Definition: unzip.h:78
ZPOS64_T rest_read_compressed
Definition: unzip.c:155
#define LL
Definition: tui.h:150
#define Z_OK
Definition: zlib.h:114
#define UNZ_OK
Definition: unzip.h:74
uInt avail_in
Definition: zlib.h:60
z_const char * msg
Definition: zlib.h:67
if(dx==0 &&dy==0)
Definition: linetemp.h:174
unsigned long uLong
Definition: zlib.h:39
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define Z_STREAM_END
Definition: zlib.h:115
#define Z_SYNC_FLUSH
Definition: zlib.h:107
#define Z_BZIP2ED
Definition: unzip.h:62
z_const Bytef * next_in
Definition: zlib.h:59
int flush
Definition: zlib.h:309
#define ZREAD64(filefunc, filestream, buf, size)
Definition: ioapi.h:189
uLong total_in
Definition: zlib.h:61
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
ZPOS64_T rest_read_uncompressed
Definition: unzip.c:156
ZPOS64_T byte_before_the_zipfile
Definition: unzip.c:160
#define UNZ_EOF
Definition: unzip.h:77
#define zdecode(pkeys, pcrc_32_tab, c)
Definition: crypt.h:77
zlib_filefunc64_32_def z_filefunc
Definition: unzip.c:157
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define err(...)
uLong total_out
Definition: zlib.h:65
unsigned int uInt
Definition: zlib.h:38
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 UNZ_ERRNO
Definition: unzip.h:76
#define NULL
Definition: types.h:112
uInt avail_out
Definition: zlib.h:64
Byte FAR Bytef
Definition: zlib.h:41
#define crc32(crc, buf, len)
Definition: inflate.c:1081
#define ZSEEK64(filefunc, filestream, pos, mode)
Definition: ioapi.h:204
#define UNZ_BUFSIZE
Definition: unzip.c:106
#define Z_DATA_ERROR
Definition: zlib.h:119
int inflate(z_streamp strm, int flush)
Definition: inflate.c:1257
ZPOS64_T pos_in_zipfile
Definition: unzip.c:145
Bytef * next_out
Definition: zlib.h:63
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
Definition: unzip.c:167
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
Definition: fci.c:126

Referenced by CZipExtract::ExtractSingle().

◆ unzSetOffset()

int ZEXPORT unzSetOffset ( unzFile  file,
uLong  pos 
)

Definition at line 2130 of file unzip.c.

2131 {
2132  return unzSetOffset64(file,pos);
2133 }
int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
Definition: unzip.c:2112
Definition: fci.c:126

◆ unzSetOffset64()

int ZEXPORT unzSetOffset64 ( unzFile  file,
ZPOS64_T  pos 
)

Definition at line 2112 of file unzip.c.

2113 {
2114  unz64_s* s;
2115  int err;
2116 
2117  if (file==NULL)
2118  return UNZ_PARAMERROR;
2119  s=(unz64_s*)file;
2120 
2121  s->pos_in_central_dir = pos;
2122  s->num_file = s->gi.number_entry; /* hack */
2123  err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info,
2124  &s->cur_file_info_internal,
2125  NULL,0,NULL,0,NULL,0);
2126  s->current_file_ok = (err == UNZ_OK);
2127  return err;
2128 }
#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:884
GLdouble s
Definition: gl.h:2039
#define err(...)
#define NULL
Definition: types.h:112
Definition: unzip.c:167
Definition: fci.c:126

Referenced by unzSetOffset().

◆ unzStringFileNameCompare()

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

Definition at line 392 of file unzip.c.

396 {
397  if (iCaseSensitivity==0)
398  iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
399 
400  if (iCaseSensitivity==1)
401  return strcmp(fileName1,fileName2);
402 
403  return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
404 }
#define STRCMPCASENOSENTIVEFUNCTION
Definition: unzip.c:380
#define CASESENSITIVITYDEFAULTVALUE
Definition: unzip.c:374
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 1897 of file unzip.c.

1898 {
1899  unz64_s* s;
1900  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1901  if (file==NULL)
1902  return UNZ_PARAMERROR;
1903  s=(unz64_s*)file;
1904  pfile_in_zip_read_info=s->pfile_in_zip_read;
1905 
1906  if (pfile_in_zip_read_info==NULL)
1907  return UNZ_PARAMERROR;
1908 
1909  return (z_off_t)pfile_in_zip_read_info->stream.total_out;
1910 }
#define UNZ_PARAMERROR
Definition: unzip.h:78
#define z_off_t
Definition: zconf.h:504
GLdouble s
Definition: gl.h:2039
uLong total_out
Definition: zlib.h:65
#define NULL
Definition: types.h:112
Definition: unzip.c:167
Definition: fci.c:126

◆ unztell64()

ZPOS64_T ZEXPORT unztell64 ( unzFile  file)

Definition at line 1912 of file unzip.c.

1913 {
1914 
1915  unz64_s* s;
1916  file_in_zip64_read_info_s* pfile_in_zip_read_info;
1917  if (file==NULL)
1918  return (ZPOS64_T)-1;
1919  s=(unz64_s*)file;
1920  pfile_in_zip_read_info=s->pfile_in_zip_read;
1921 
1922  if (pfile_in_zip_read_info==NULL)
1923  return (ZPOS64_T)-1;
1924 
1925  return pfile_in_zip_read_info->total_out_64;
1926 }
unsigned long long int ZPOS64_T
Definition: ioapi.h:99
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
Definition: unzip.c:167
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 124 of file unzip.c.

Referenced by unzOpenInternal().