misc/quazip/unzip.h
author unc0rr
Fri, 28 Oct 2011 19:20:35 +0400
changeset 6223 cc3eb9b7230f
parent 5752 ea95ee97c805
child 7889 57b117d441b9
permissions -rw-r--r--
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5752
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     1
/* unzip.h -- IO for uncompress .zip files using zlib
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     2
   Version 1.01e, February 12th, 2005
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     3
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     4
   Copyright (C) 1998-2005 Gilles Vollant
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     5
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     6
   This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     7
     WinZip, InfoZip tools and compatible.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     8
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
     9
   Multi volume ZipFile (span) are not supported.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    10
   Encryption compatible with pkzip 2.04g only supported
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    11
   Old compressions used by old PKZip 1.x are not supported
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    12
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    13
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    14
   I WAIT FEEDBACK at mail info@winimage.com
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    15
   Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    16
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    17
   Condition of use and distribution are the same than zlib :
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    18
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    19
  This software is provided 'as-is', without any express or implied
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    20
  warranty.  In no event will the authors be held liable for any damages
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    21
  arising from the use of this software.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    22
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    23
  Permission is granted to anyone to use this software for any purpose,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    24
  including commercial applications, and to alter it and redistribute it
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    25
  freely, subject to the following restrictions:
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    26
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    27
  1. The origin of this software must not be misrepresented; you must not
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    28
     claim that you wrote the original software. If you use this software
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    29
     in a product, an acknowledgment in the product documentation would be
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    30
     appreciated but is not required.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    31
  2. Altered source versions must be plainly marked as such, and must not be
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    32
     misrepresented as being the original software.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    33
  3. This notice may not be removed or altered from any source distribution.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    34
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    35
   Modified by Sergey A. Tachenov to integrate with Qt.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    36
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    37
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    38
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    39
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    40
/* for more info about .ZIP format, see
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    41
      http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    42
      http://www.info-zip.org/pub/infozip/doc/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    43
   PkWare has also a specification at :
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    44
      ftp://ftp.pkware.com/probdesc.zip
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    45
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    46
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    47
#ifndef _unz_H
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    48
#define _unz_H
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    49
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    50
#ifdef __cplusplus
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    51
extern "C" {
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    52
#endif
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    53
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    54
#ifndef _ZLIB_H
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    55
#include "zlib.h"
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    56
#endif
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    57
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    58
#ifndef _ZLIBIOAPI_H
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    59
#include "ioapi.h"
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    60
#endif
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    61
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    62
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    63
/* like the STRICT of WIN32, we define a pointer that cannot be converted
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    64
    from (void*) without cast */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    65
typedef struct TagunzFile__ { int unused; } unzFile__;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    66
typedef unzFile__ *unzFile;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    67
#else
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    68
typedef voidp unzFile;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    69
#endif
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    70
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    71
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    72
#define UNZ_OK                          (0)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    73
#define UNZ_END_OF_LIST_OF_FILE         (-100)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    74
#define UNZ_ERRNO                       (Z_ERRNO)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    75
#define UNZ_EOF                         (0)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    76
#define UNZ_PARAMERROR                  (-102)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    77
#define UNZ_BADZIPFILE                  (-103)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    78
#define UNZ_INTERNALERROR               (-104)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    79
#define UNZ_CRCERROR                    (-105)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    80
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    81
/* tm_unz contain date/time info */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    82
typedef struct tm_unz_s
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    83
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    84
    uInt tm_sec;            /* seconds after the minute - [0,59] */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    85
    uInt tm_min;            /* minutes after the hour - [0,59] */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    86
    uInt tm_hour;           /* hours since midnight - [0,23] */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    87
    uInt tm_mday;           /* day of the month - [1,31] */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    88
    uInt tm_mon;            /* months since January - [0,11] */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    89
    uInt tm_year;           /* years - [1980..2044] */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    90
} tm_unz;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    91
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    92
/* unz_global_info structure contain global data about the ZIPfile
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    93
   These data comes from the end of central dir */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    94
typedef struct unz_global_info_s
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    95
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    96
    uLong number_entry;         /* total number of entries in
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    97
                       the central dir on this disk */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    98
    uLong size_comment;         /* size of the global comment of the zipfile */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
    99
} unz_global_info;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   100
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   101
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   102
/* unz_file_info contain information about a file in the zipfile */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   103
typedef struct unz_file_info_s
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   104
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   105
    uLong version;              /* version made by                 2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   106
    uLong version_needed;       /* version needed to extract       2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   107
    uLong flag;                 /* general purpose bit flag        2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   108
    uLong compression_method;   /* compression method              2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   109
    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   110
    uLong crc;                  /* crc-32                          4 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   111
    uLong compressed_size;      /* compressed size                 4 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   112
    uLong uncompressed_size;    /* uncompressed size               4 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   113
    uLong size_filename;        /* filename length                 2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   114
    uLong size_file_extra;      /* extra field length              2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   115
    uLong size_file_comment;    /* file comment length             2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   116
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   117
    uLong disk_num_start;       /* disk number start               2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   118
    uLong internal_fa;          /* internal file attributes        2 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   119
    uLong external_fa;          /* external file attributes        4 bytes */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   120
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   121
    tm_unz tmu_date;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   122
} unz_file_info;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   123
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   124
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   125
                                                 const char* fileName2,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   126
                                                 int iCaseSensitivity));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   127
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   128
   Compare two filename (fileName1,fileName2).
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   129
   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   130
   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   131
                                or strcasecmp)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   132
   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   133
    (like 1 on Unix, 2 on Windows)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   134
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   135
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   136
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   137
extern unzFile ZEXPORT unzOpen OF((voidpf file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   138
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   139
  Open a Zip file. path contain whatever zopen_file from the IO API
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   140
  accepts. For Qt implementation it is a pointer to QIODevice, for
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   141
  fopen() implementation it's a file name.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   142
     If the zipfile cannot be opened (file don't exist or in not valid), the
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   143
       return value is NULL.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   144
     Else, the return value is a unzFile Handle, usable with other function
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   145
       of this unzip package.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   146
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   147
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   148
extern unzFile ZEXPORT unzOpen2 OF((voidpf file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   149
                                    zlib_filefunc_def* pzlib_filefunc_def));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   150
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   151
   Open a Zip file, like unzOpen, but provide a set of file low level API
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   152
      for read/write the zip file (see ioapi.h)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   153
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   154
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   155
extern int ZEXPORT unzClose OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   156
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   157
  Close a ZipFile opened with unzipOpen.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   158
  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   159
    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   160
  return UNZ_OK if there is no problem. */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   161
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   162
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   163
                                        unz_global_info *pglobal_info));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   164
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   165
  Write info about the ZipFile in the *pglobal_info structure.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   166
  No preparation of the structure is needed
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   167
  return UNZ_OK if there is no problem. */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   168
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   169
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   170
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   171
                                           char *szComment,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   172
                                           uLong uSizeBuf));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   173
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   174
  Get the global comment string of the ZipFile, in the szComment buffer.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   175
  uSizeBuf is the size of the szComment buffer.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   176
  return the number of byte copied or an error code <0
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   177
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   178
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   179
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   180
/***************************************************************************/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   181
/* Unzip package allow you browse the directory of the zipfile */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   182
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   183
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   184
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   185
  Set the current file of the zipfile to the first file.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   186
  return UNZ_OK if there is no problem
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   187
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   188
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   189
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   190
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   191
  Set the current file of the zipfile to the next file.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   192
  return UNZ_OK if there is no problem
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   193
  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   194
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   195
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   196
extern int ZEXPORT unzLocateFile OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   197
                     const char *szFileName,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   198
                     int iCaseSensitivity));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   199
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   200
  Try locate the file szFileName in the zipfile.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   201
  For the iCaseSensitivity signification, see unzStringFileNameCompare
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   202
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   203
  return value :
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   204
  UNZ_OK if the file is found. It becomes the current file.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   205
  UNZ_END_OF_LIST_OF_FILE if the file is not found
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   206
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   207
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   208
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   209
/* ****************************************** */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   210
/* Ryan supplied functions */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   211
/* unz_file_info contain information about a file in the zipfile */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   212
typedef struct unz_file_pos_s
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   213
{
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   214
    uLong pos_in_zip_directory;   /* offset in zip file directory */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   215
    uLong num_of_file;            /* # of file */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   216
} unz_file_pos;
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   217
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   218
extern int ZEXPORT unzGetFilePos(
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   219
    unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   220
    unz_file_pos* file_pos);
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   221
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   222
extern int ZEXPORT unzGoToFilePos(
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   223
    unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   224
    unz_file_pos* file_pos);
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   225
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   226
/* ****************************************** */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   227
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   228
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   229
                         unz_file_info *pfile_info,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   230
                         char *szFileName,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   231
                         uLong fileNameBufferSize,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   232
                         void *extraField,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   233
                         uLong extraFieldBufferSize,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   234
                         char *szComment,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   235
                         uLong commentBufferSize));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   236
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   237
  Get Info about the current file
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   238
  if pfile_info!=NULL, the *pfile_info structure will contain somes info about
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   239
        the current file
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   240
  if szFileName!=NULL, the filemane string will be copied in szFileName
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   241
            (fileNameBufferSize is the size of the buffer)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   242
  if extraField!=NULL, the extra field information will be copied in extraField
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   243
            (extraFieldBufferSize is the size of the buffer).
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   244
            This is the Central-header version of the extra field
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   245
  if szComment!=NULL, the comment string of the file will be copied in szComment
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   246
            (commentBufferSize is the size of the buffer)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   247
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   248
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   249
/***************************************************************************/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   250
/* for reading the content of the current zipfile, you can open it, read data
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   251
   from it, and close it (you can close it before reading all the file)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   252
   */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   253
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   254
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   255
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   256
  Open for reading data the current file in the zipfile.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   257
  If there is no error, the return value is UNZ_OK.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   258
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   259
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   260
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   261
                                                  const char* password));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   262
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   263
  Open for reading data the current file in the zipfile.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   264
  password is a crypting password
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   265
  If there is no error, the return value is UNZ_OK.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   266
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   267
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   268
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   269
                                           int* method,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   270
                                           int* level,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   271
                                           int raw));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   272
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   273
  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   274
    if raw==1
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   275
  *method will receive method of compression, *level will receive level of
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   276
     compression
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   277
  note : you can set level parameter as NULL (if you did not want known level,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   278
         but you CANNOT set method parameter as NULL
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   279
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   280
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   281
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   282
                                           int* method,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   283
                                           int* level,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   284
                                           int raw,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   285
                                           const char* password));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   286
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   287
  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   288
    if raw==1
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   289
  *method will receive method of compression, *level will receive level of
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   290
     compression
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   291
  note : you can set level parameter as NULL (if you did not want known level,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   292
         but you CANNOT set method parameter as NULL
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   293
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   294
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   295
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   296
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   297
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   298
  Close the file in zip opened with unzOpenCurrentFile
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   299
  Return UNZ_CRCERROR if all the file was read but the CRC is not good
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   300
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   301
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   302
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   303
                      voidp buf,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   304
                      unsigned len));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   305
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   306
  Read bytes from the current file (opened by unzOpenCurrentFile)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   307
  buf contain buffer where data must be copied
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   308
  len the size of buf.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   309
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   310
  return the number of byte copied if somes bytes are copied
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   311
  return 0 if the end of file was reached
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   312
  return <0 with error code if there is an error
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   313
    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   314
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   315
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   316
extern z_off_t ZEXPORT unztell OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   317
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   318
  Give the current position in uncompressed data
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   319
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   320
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   321
extern int ZEXPORT unzeof OF((unzFile file));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   322
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   323
  return 1 if the end of file was reached, 0 elsewhere
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   324
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   325
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   326
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   327
                                             voidp buf,
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   328
                                             unsigned len));
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   329
/*
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   330
  Read extra field from the current file (opened by unzOpenCurrentFile)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   331
  This is the local-header version of the extra field (sometimes, there is
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   332
    more info in the local-header version than in the central-header)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   333
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   334
  if buf==NULL, it return the size of the local extra field
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   335
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   336
  if buf!=NULL, len is the size of the buffer, the extra header is copied in
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   337
    buf.
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   338
  the return value is the number of bytes copied in buf, or (if <0)
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   339
    the error code
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   340
*/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   341
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   342
/***************************************************************************/
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   343
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   344
/* Get the current file offset */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   345
extern uLong ZEXPORT unzGetOffset (unzFile file);
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   346
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   347
/* Set the current file offset */
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   348
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   349
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   350
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   351
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   352
#ifdef __cplusplus
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   353
}
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   354
#endif
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   355
ea95ee97c805 Add QuaZIP library to build system
unc0rr
parents:
diff changeset
   356
#endif /* _unz_H */