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