archivers/unzip.h
author Ryan C. Gordon <icculus@icculus.org>
Wed, 10 Jul 2002 02:57:23 +0000
changeset 319 3b555459053e
parent 47 fbf5d37147eb
permissions -rw-r--r--
Updated.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/* unzip.h -- IO for uncompress .zip files using zlib 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
   Version 0.15 beta, Mar 19th, 1998,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
   Copyright (C) 1998 Gilles Vollant
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
   This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
     WinZip, InfoZip tools and compatible.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
   Encryption and multi volume ZipFile (span) are not supported.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
   Old compressions used by old PKZip 1.x are not supported
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
   THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
   CAN CHANGE IN FUTURE VERSION !!
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
   I WAIT FEEDBACK at mail info@winimage.com
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
   Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
   Condition of use and distribution are the same than zlib :
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
  This software is provided 'as-is', without any express or implied
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
  warranty.  In no event will the authors be held liable for any damages
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
  arising from the use of this software.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
  Permission is granted to anyone to use this software for any purpose,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
  including commercial applications, and to alter it and redistribute it
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
  freely, subject to the following restrictions:
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
  1. The origin of this software must not be misrepresented; you must not
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
     claim that you wrote the original software. If you use this software
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
     in a product, an acknowledgment in the product documentation would be
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
     appreciated but is not required.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
  2. Altered source versions must be plainly marked as such, and must not be
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
     misrepresented as being the original software.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
  3. This notice may not be removed or altered from any source distribution.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
/* for more info about .ZIP format, see 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
      ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
   PkWare has also a specification at :
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
      ftp://ftp.pkware.com/probdesc.zip */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
#ifndef _unz_H
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
#define _unz_H
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
#ifdef __cplusplus
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
extern "C" {
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
#endif
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
#ifndef _ZLIB_H
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
#include "zlib.h"
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
#endif
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
/* like the STRICT of WIN32, we define a pointer that cannot be converted
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
    from (void*) without cast */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
typedef struct TagunzFile__ { int unused; } unzFile__; 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
typedef unzFile__ *unzFile;
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
#else
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
typedef voidp unzFile;
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
#endif
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
#define UNZ_OK                                  (0)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
#define UNZ_END_OF_LIST_OF_FILE (-100)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
#define UNZ_ERRNO               (Z_ERRNO)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
#define UNZ_EOF                 (0)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
#define UNZ_PARAMERROR                  (-102)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
#define UNZ_BADZIPFILE                  (-103)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
#define UNZ_INTERNALERROR               (-104)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
#define UNZ_CRCERROR                    (-105)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
/* tm_unz contain date/time info */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
typedef struct tm_unz_s 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
{
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
	uInt tm_sec;            /* seconds after the minute - [0,59] */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
	uInt tm_min;            /* minutes after the hour - [0,59] */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
	uInt tm_hour;           /* hours since midnight - [0,23] */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
	uInt tm_mday;           /* day of the month - [1,31] */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
	uInt tm_mon;            /* months since January - [0,11] */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
	uInt tm_year;           /* years - [1980..2044] */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
} tm_unz;
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
/* unz_global_info structure contain global data about the ZIPfile
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
   These data comes from the end of central dir */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
typedef struct unz_global_info_s
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
{
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
	uLong number_entry;         /* total number of entries in
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
				       the central dir on this disk */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
	uLong size_comment;         /* size of the global comment of the zipfile */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
} unz_global_info;
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
/* unz_file_info contain information about a file in the zipfile */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
typedef struct unz_file_info_s
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
{
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
    uLong version;              /* version made by                 2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
    uLong version_needed;       /* version needed to extract       2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
    uLong flag;                 /* general purpose bit flag        2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
    uLong compression_method;   /* compression method              2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
    uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
    uLong crc;                  /* crc-32                          4 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
    uLong compressed_size;      /* compressed size                 4 bytes */ 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
    uLong uncompressed_size;    /* uncompressed size               4 bytes */ 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
    uLong size_filename;        /* filename length                 2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
    uLong size_file_extra;      /* extra field length              2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
    uLong size_file_comment;    /* file comment length             2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
    uLong disk_num_start;       /* disk number start               2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
    uLong internal_fa;          /* internal file attributes        2 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
    uLong external_fa;          /* external file attributes        4 bytes */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
    tm_unz tmu_date;
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
} unz_file_info;
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
												 const char* fileName2,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
												 int iCaseSensitivity));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
   Compare two filename (fileName1,fileName2).
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
								or strcasecmp)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
	(like 1 on Unix, 2 on Windows)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
extern unzFile ZEXPORT unzOpen OF((const char *path));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
  Open a Zip file. path contain the full pathname (by example,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
     on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
	 "zlib/zlib111.zip".
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
	 If the zipfile cannot be opened (file don't exist or in not valid), the
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
	   return value is NULL.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
     Else, the return value is a unzFile Handle, usable with other function
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
	   of this unzip package.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
extern int ZEXPORT unzClose OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
  Close a ZipFile opened with unzipOpen.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
  return UNZ_OK if there is no problem. */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
					unz_global_info *pglobal_info));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
  Write info about the ZipFile in the *pglobal_info structure.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
  No preparation of the structure is needed
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
  return UNZ_OK if there is no problem. */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
										   char *szComment,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
					   uLong uSizeBuf));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
  Get the global comment string of the ZipFile, in the szComment buffer.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
  uSizeBuf is the size of the szComment buffer.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
  return the number of byte copied or an error code <0
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
/***************************************************************************/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
/* Unzip package allow you browse the directory of the zipfile */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
  Set the current file of the zipfile to the first file.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
  return UNZ_OK if there is no problem
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
  Set the current file of the zipfile to the next file.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
  return UNZ_OK if there is no problem
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
extern int ZEXPORT unzLocateFile OF((unzFile file, 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
				     const char *szFileName,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
				     int iCaseSensitivity));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
  Try locate the file szFileName in the zipfile.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
  For the iCaseSensitivity signification, see unzStringFileNameCompare
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
  return value :
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
  UNZ_OK if the file is found. It becomes the current file.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
  UNZ_END_OF_LIST_OF_FILE if the file is not found
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
					     unz_file_info *pfile_info,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
					     char *szFileName,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
					     uLong fileNameBufferSize,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
					     void *extraField,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
					     uLong extraFieldBufferSize,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
					     char *szComment,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
					     uLong commentBufferSize));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
  Get Info about the current file
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
  if pfile_info!=NULL, the *pfile_info structure will contain somes info about
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
	    the current file
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
  if szFileName!=NULL, the filemane string will be copied in szFileName
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
			(fileNameBufferSize is the size of the buffer)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
  if extraField!=NULL, the extra field information will be copied in extraField
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
			(extraFieldBufferSize is the size of the buffer).
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
			This is the Central-header version of the extra field
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
  if szComment!=NULL, the comment string of the file will be copied in szComment
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
			(commentBufferSize is the size of the buffer)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
/***************************************************************************/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
/* for reading the content of the current zipfile, you can open it, read data
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
   from it, and close it (you can close it before reading all the file)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
   */
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
  Open for reading data the current file in the zipfile.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
  If there is no error, the return value is UNZ_OK.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
  Close the file in zip opened with unzOpenCurrentFile
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
  Return UNZ_CRCERROR if all the file was read but the CRC is not good
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
												
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
					  voidp buf,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
					  unsigned len));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
  Read bytes from the current file (opened by unzOpenCurrentFile)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
  buf contain buffer where data must be copied
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
  len the size of buf.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   239
  return the number of byte copied if somes bytes are copied
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
  return 0 if the end of file was reached
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   241
  return <0 with error code if there is an error
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   242
    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   244
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
extern z_off_t ZEXPORT unztell OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   246
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   247
  Give the current position in uncompressed data
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   248
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   249
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   250
extern int ZEXPORT unzeof OF((unzFile file));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   251
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   252
  return 1 if the end of file was reached, 0 elsewhere 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   253
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   254
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   255
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   256
											 voidp buf,
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   257
											 unsigned len));
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   258
/*
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   259
  Read extra field from the current file (opened by unzOpenCurrentFile)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   260
  This is the local-header version of the extra field (sometimes, there is
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   261
    more info in the local-header version than in the central-header)
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   262
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   263
  if buf==NULL, it return the size of the local extra field
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   264
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   265
  if buf!=NULL, len is the size of the buffer, the extra header is copied in
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   266
	buf.
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   267
  the return value is the number of bytes copied in buf, or (if <0) 
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   268
	the error code
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   269
*/
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   270
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   271
#ifdef __cplusplus
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
}
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
#endif
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274
fbf5d37147eb Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   275
#endif /* _unz_H */