Mercurial > hg > orthanc
annotate OrthancFramework/Resources/ThirdParty/minizip/unzip.c @ 5161:b6dc4606ab04
release notes for 1.11.3
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 03 Feb 2023 14:24:43 +0100 |
parents | bcfb53d1bc56 |
children | 8174e45f48d8 |
rev | line source |
---|---|
4354
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /* unzip.c -- IO for uncompress .zip files using zlib |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 Version 1.1, February 14h, 2010 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 Modifications of Unzip for Zip64 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 Copyright (C) 2007-2008 Even Rouault |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 Modifications for Zip64 support on both zip and unzip |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 For more info read MiniZip_info.txt |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 ------------------------------------------------------------------------------------ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 compatibility with older software. The following is from the original crypt.c. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 Code woven in by Terry Thorsen 1/2003. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 Copyright (c) 1990-2000 Info-ZIP. All rights reserved. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 See the accompanying file LICENSE, version 2000-Apr-09 or later |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 (the contents of which are also included in zip.h) for terms of use. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 If, for some reason, all these files are missing, the Info-ZIP license |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 The encryption/decryption parts of this source code (as opposed to the |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 non-echoing password parts) were originally written in Europe. The |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 whole source package can be freely distributed, including from the USA. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 (Prior to January 2000, re-export from the US was a violation of US law.) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 This encryption code is a direct transcription of the algorithm from |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 Roger Schlafly, described by Phil Katz in the file appnote.txt. This |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 file (appnote.txt) is distributed with the PKZIP program (even in the |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 version without encryption capabilities). |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 ------------------------------------------------------------------------------------ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 Changes in unzip.c |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 2007-2008 - Even Rouault - Remove old C style function prototypes |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 2007-2008 - Even Rouault - Add unzip support for ZIP64 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 Copyright (C) 2007-2008 Even Rouault |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 should only read the compressed/uncompressed size from the Zip64 format if |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 the size from normal header was 0xFFFFFFFF |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 Patch created by Daniel Borca |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 #include <stdio.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 #include <stdlib.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 #include <string.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 #ifndef NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 #define NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 #include "zlib.h" |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 #include "unzip.h" |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 #ifdef STDC |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 # include <stddef.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 # include <string.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 # include <stdlib.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 #ifdef NO_ERRNO_H |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 extern int errno; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 #else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 # include <errno.h> |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 #ifndef local |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 # define local static |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 /* compile with -Dlocal if your debugger can't find static symbols */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 #ifndef CASESENSITIVITYDEFAULT_NO |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 # if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 # define CASESENSITIVITYDEFAULT_NO |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 # endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 #ifndef UNZ_BUFSIZE |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 #define UNZ_BUFSIZE (16384) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 #ifndef UNZ_MAXFILENAMEINZIP |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 #define UNZ_MAXFILENAMEINZIP (256) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 #ifndef ALLOC |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 # define ALLOC(size) (malloc(size)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 #ifndef TRYFREE |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 # define TRYFREE(p) {if (p) free(p);} |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 #define SIZECENTRALDIRITEM (0x2e) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 #define SIZEZIPLOCALHEADER (0x1e) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 const char unz_copyright[] = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 /* unz_file_info_interntal contain internal info about a file in zipfile*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 typedef struct unz_file_info64_internal_s |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 } unz_file_info64_internal; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 /* file_in_zip_read_info_s contain internal information about a file in zipfile, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 when reading and decompress it */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 typedef struct |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 char *read_buffer; /* internal buffer for compressed data */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 z_stream stream; /* zLib stream structure for inflate */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 #ifdef HAVE_BZIP2 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 bz_stream bstream; /* bzLib stream structure for bziped */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 ZPOS64_T pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 uLong stream_initialised; /* flag set if stream structure is initialised*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 ZPOS64_T offset_local_extrafield;/* offset of the local extra field */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 uInt size_local_extrafield;/* size of the local extra field */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 ZPOS64_T pos_local_extrafield; /* position in the local extra field in read*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 ZPOS64_T total_out_64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 uLong crc32; /* crc32 of all data uncompressed */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 uLong crc32_wait; /* crc32 we must obtain after decompress all */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 zlib_filefunc64_32_def z_filefunc; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 voidpf filestream; /* io structore of the zipfile */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 uLong compression_method; /* compression method (0==store) */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 int raw; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 } file_in_zip64_read_info_s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 /* unz64_s contain internal information about the zipfile |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 typedef struct |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 zlib_filefunc64_32_def z_filefunc; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 int is64bitOpenFunction; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 voidpf filestream; /* io structore of the zipfile */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 unz_global_info64 gi; /* public global information */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 ZPOS64_T num_file; /* number of the current file in the zipfile*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 ZPOS64_T current_file_ok; /* flag about the usability of the current file*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 ZPOS64_T central_pos; /* position of the beginning of the central dir*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 ZPOS64_T size_central_dir; /* size of the central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 ZPOS64_T offset_central_dir; /* offset of start of central directory with |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 respect to the starting disk number */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 unz_file_info64 cur_file_info; /* public info about the current file in zip*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 unz_file_info64_internal cur_file_info_internal; /* private info about it*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 file_in_zip64_read_info_s* pfile_in_zip_read; /* structure about the current |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 file if we are decompressing it */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 int encrypted; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 int isZip64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 # ifndef NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 unsigned long keys[3]; /* keys defining the pseudo-random sequence */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 const z_crc_t* pcrc_32_tab; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 # endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 } unz64_s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 #ifndef NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 #include "crypt.h" |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 /* =========================================================================== |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 Read a byte from a gz_stream; update next_in and avail_in. Return EOF |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 for end of file. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 IN assertion: the stream s has been successfully opened for reading. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 local int unz64local_getByte OF(( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 int *pi)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 unsigned char c; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 if (err==1) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 *pi = (int)c; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 if (ZERROR64(*pzlib_filefunc_def,filestream)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 return UNZ_EOF; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 /* =========================================================================== |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 Reads a long in LSB order from the given gz_stream. Sets |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 local int unz64local_getShort OF(( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 uLong *pX)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 uLong *pX) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 uLong x ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 int i = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 x = (uLong)i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 x |= ((uLong)i)<<8; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 *pX = x; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 *pX = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 local int unz64local_getLong OF(( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 uLong *pX)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 uLong *pX) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 uLong x ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 int i = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 x = (uLong)i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 x |= ((uLong)i)<<8; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 x |= ((uLong)i)<<16; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 x += ((uLong)i)<<24; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 *pX = x; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 *pX = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 local int unz64local_getLong64 OF(( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 ZPOS64_T *pX)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 voidpf filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 ZPOS64_T *pX) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 ZPOS64_T x ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 int i = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 x = (ZPOS64_T)i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 x |= ((ZPOS64_T)i)<<8; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 x |= ((ZPOS64_T)i)<<16; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 x |= ((ZPOS64_T)i)<<24; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 x |= ((ZPOS64_T)i)<<32; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 x |= ((ZPOS64_T)i)<<40; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 x |= ((ZPOS64_T)i)<<48; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 x |= ((ZPOS64_T)i)<<56; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 *pX = x; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 *pX = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 /* My own strcmpi / strcasecmp */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 for (;;) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 char c1=*(fileName1++); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 char c2=*(fileName2++); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 if ((c1>='a') && (c1<='z')) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 c1 -= 0x20; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 if ((c2>='a') && (c2<='z')) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 c2 -= 0x20; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 if (c1=='\0') |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 return ((c2=='\0') ? 0 : -1); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 if (c2=='\0') |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 return 1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 if (c1<c2) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 return -1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 if (c1>c2) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 return 1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 #ifdef CASESENSITIVITYDEFAULT_NO |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 #define CASESENSITIVITYDEFAULTVALUE 2 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 #else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 #define CASESENSITIVITYDEFAULTVALUE 1 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 #ifndef STRCMPCASENOSENTIVEFUNCTION |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 Compare two filename (fileName1,fileName2). |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 or strcasecmp) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 (like 1 on Unix, 2 on Windows) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 const char* fileName2, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 int iCaseSensitivity) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 if (iCaseSensitivity==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 if (iCaseSensitivity==1) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 return strcmp(fileName1,fileName2); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 #ifndef BUFREADCOMMENT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 #define BUFREADCOMMENT (0x400) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 Locate the Central directory of a zipfile (at the end, just before |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 the global comment) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 unsigned char* buf; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 ZPOS64_T uSizeFile; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 ZPOS64_T uBackRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 ZPOS64_T uPosFound=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 if (uMaxBack>uSizeFile) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 uMaxBack = uSizeFile; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 if (buf==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 uBackRead = 4; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 while (uBackRead<uMaxBack) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 uLong uReadSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 ZPOS64_T uReadPos ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 int i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 if (uBackRead+BUFREADCOMMENT>uMaxBack) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 uBackRead = uMaxBack; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 uBackRead+=BUFREADCOMMENT; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 uReadPos = uSizeFile-uBackRead ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
448 if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 for (i=(int)uReadSize-3; (i--)>0;) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 uPosFound = uReadPos+i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
460 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
461 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 if (uPosFound!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
463 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
464 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
465 TRYFREE(buf); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 return uPosFound; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
469 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
470 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
471 Locate the Central directory 64 of a zipfile (at the end, just before |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 the global comment) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 local ZPOS64_T unz64local_SearchCentralDir64 OF(( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 voidpf filestream)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 voidpf filestream) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 unsigned char* buf; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 ZPOS64_T uSizeFile; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 ZPOS64_T uBackRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 ZPOS64_T uPosFound=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 uLong uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 ZPOS64_T relativeOffset; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
493 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
494 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 if (uMaxBack>uSizeFile) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 uMaxBack = uSizeFile; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
499 if (buf==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
500 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
501 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 uBackRead = 4; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
503 while (uBackRead<uMaxBack) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
504 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 uLong uReadSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 ZPOS64_T uReadPos; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 int i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 if (uBackRead+BUFREADCOMMENT>uMaxBack) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 uBackRead = uMaxBack; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 uBackRead+=BUFREADCOMMENT; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 uReadPos = uSizeFile-uBackRead ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
513 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 for (i=(int)uReadSize-3; (i--)>0;) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
523 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
524 ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
525 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 uPosFound = uReadPos+i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
527 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 if (uPosFound!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
533 TRYFREE(buf); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
534 if (uPosFound == 0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 /* Zip64 end of central directory locator */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 /* the signature, already checked */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 /* number of the disk with the start of the zip64 end of central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 if (uL != 0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
549 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 /* relative offset of the zip64 end of central directory record */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 /* total number of disks */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 if (uL != 1) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 /* Goto end of central directory record */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
563 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 /* the signature */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 if (uL != 0x06064b50) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 return relativeOffset; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 Open a Zip file. path contain the full pathname (by example, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 "zlib/zlib114.zip". |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 If the zipfile cannot be opened (file doesn't exist or in not valid), the |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 return value is NULL. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 Else, the return value is a unzFile Handle, usable with other function |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 of this unzip package. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 local unzFile unzOpenInternal (const void *path, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 zlib_filefunc64_32_def* pzlib_filefunc64_32_def, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 int is64bitOpenFunction) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 unz64_s us; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 unz64_s *s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 ZPOS64_T central_pos; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 uLong uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 uLong number_disk; /* number of the current dist, used for |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 spaning ZIP, unsupported, always 0*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 uLong number_disk_with_CD; /* number the the disk with central dir, used |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 for spaning ZIP, unsupported, always 0*/ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 ZPOS64_T number_entry_CD; /* total number of entries in |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
598 the central dir |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 (same than number_entry on nospan) */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 if (unz_copyright[0]!=' ') |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 return NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 us.z_filefunc.zseek32_file = NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 us.z_filefunc.ztell32_file = NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 if (pzlib_filefunc64_32_def==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 us.z_filefunc = *pzlib_filefunc64_32_def; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 us.is64bitOpenFunction = is64bitOpenFunction; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
613 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 us.filestream = ZOPEN64(us.z_filefunc, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
617 path, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 ZLIB_FILEFUNC_MODE_READ | |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 ZLIB_FILEFUNC_MODE_EXISTING); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 if (us.filestream==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 return NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 if (central_pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
625 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
626 uLong uS; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 ZPOS64_T uL64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 us.isZip64 = 1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
631 if (ZSEEK64(us.z_filefunc, us.filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
633 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 /* the signature, already checked */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 /* size of zip64 end of central directory record */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 /* version made by */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
645 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 /* version needed to extract */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
648 if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
649 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 /* number of this disk */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
654 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
655 /* number of the disk with the start of the central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
657 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
659 /* total number of entries in the central directory on this disk */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
660 if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
661 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
662 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
663 /* total number of entries in the central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
664 if (unz64local_getLong64(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
665 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
666 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
667 if ((number_entry_CD!=us.gi.number_entry) || |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
668 (number_disk_with_CD!=0) || |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
669 (number_disk!=0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
670 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
671 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 /* size of the central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
674 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
676 /* offset of start of central directory with respect to the |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
677 starting disk number */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
679 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
680 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 us.gi.size_comment = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
682 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
684 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
685 central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
686 if (central_pos==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
687 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
688 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
689 us.isZip64 = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
690 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
691 if (ZSEEK64(us.z_filefunc, us.filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
693 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
694 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 /* the signature, already checked */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
698 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
699 /* number of this disk */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
700 if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
703 /* number of the disk with the start of the central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
706 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 /* total number of entries in the central dir on this disk */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 us.gi.number_entry = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
711 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
712 /* total number of entries in the central dir */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 number_entry_CD = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
716 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
717 if ((number_entry_CD!=us.gi.number_entry) || |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
718 (number_disk_with_CD!=0) || |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
719 (number_disk!=0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
720 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
721 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
722 /* size of the central directory */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
723 if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
725 us.size_central_dir = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
726 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
727 /* offset of start of central directory with respect to the |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
728 starting disk number */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
730 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
731 us.offset_central_dir = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
732 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 /* zipfile comment length */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 if (unz64local_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
738 if ((central_pos<us.offset_central_dir+us.size_central_dir) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 (err==UNZ_OK)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 if (err!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
744 ZCLOSE64(us.z_filefunc, us.filestream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 return NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
746 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
747 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
748 us.byte_before_the_zipfile = central_pos - |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
749 (us.offset_central_dir+us.size_central_dir); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 us.central_pos = central_pos; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
751 us.pfile_in_zip_read = NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
752 us.encrypted = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
753 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
754 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
755 s=(unz64_s*)ALLOC(sizeof(unz64_s)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
756 if( s != NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
757 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
758 *s=us; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
759 unzGoToFirstFile((unzFile)s); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
760 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
761 return (unzFile)s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
762 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
763 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
764 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
765 extern unzFile ZEXPORT unzOpen2 (const char *path, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
766 zlib_filefunc_def* pzlib_filefunc32_def) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
767 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
768 if (pzlib_filefunc32_def != NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
769 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
770 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
771 fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
772 return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
773 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
774 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
775 return unzOpenInternal(path, NULL, 0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
776 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
777 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
778 extern unzFile ZEXPORT unzOpen2_64 (const void *path, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
779 zlib_filefunc64_def* pzlib_filefunc_def) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
780 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
781 if (pzlib_filefunc_def != NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
782 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
783 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
784 zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
785 zlib_filefunc64_32_def_fill.ztell32_file = NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
786 zlib_filefunc64_32_def_fill.zseek32_file = NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
787 return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
788 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
789 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
790 return unzOpenInternal(path, NULL, 1); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
791 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
792 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
793 extern unzFile ZEXPORT unzOpen (const char *path) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
794 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
795 return unzOpenInternal(path, NULL, 0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
796 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
797 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
798 extern unzFile ZEXPORT unzOpen64 (const void *path) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
799 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
800 return unzOpenInternal(path, NULL, 1); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
801 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
802 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
803 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
804 Close a ZipFile opened with unzOpen. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
805 If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
806 these files MUST be closed with unzCloseCurrentFile before call unzClose. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
807 return UNZ_OK if there is no problem. */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
808 extern int ZEXPORT unzClose (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
809 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
810 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
811 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
812 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
813 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
814 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
815 if (s->pfile_in_zip_read!=NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
816 unzCloseCurrentFile(file); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
817 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
818 ZCLOSE64(s->z_filefunc, s->filestream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
819 TRYFREE(s); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
822 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
823 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
824 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
825 Write info about the ZipFile in the *pglobal_info structure. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
826 No preparation of the structure is needed |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
827 return UNZ_OK if there is no problem. */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
828 extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
829 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
830 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
831 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
832 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
833 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
834 *pglobal_info=s->gi; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
835 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
836 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
837 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
838 extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
839 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
840 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
841 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
842 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
843 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
844 /* to do : check if number_entry is not truncated */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
845 pglobal_info32->number_entry = (uLong)s->gi.number_entry; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
846 pglobal_info32->size_comment = s->gi.size_comment; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
847 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
848 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
849 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
850 Translate date/time from Dos format to tm_unz (readable more easilty) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
851 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
852 local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
853 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
854 ZPOS64_T uDate; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
855 uDate = (ZPOS64_T)(ulDosDate>>16); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
856 ptm->tm_mday = (uInt)(uDate&0x1f) ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
857 ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
858 ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
859 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
860 ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
861 ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
862 ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
863 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
864 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
865 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
866 Get Info about the current file in the zipfile, with internal only info |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
867 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
868 local int unz64local_GetCurrentFileInfoInternal OF((unzFile file, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
869 unz_file_info64 *pfile_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
870 unz_file_info64_internal |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
871 *pfile_info_internal, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
872 char *szFileName, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
873 uLong fileNameBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
874 void *extraField, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
875 uLong extraFieldBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
876 char *szComment, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
877 uLong commentBufferSize)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
878 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
879 local int unz64local_GetCurrentFileInfoInternal (unzFile file, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
880 unz_file_info64 *pfile_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
881 unz_file_info64_internal |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
882 *pfile_info_internal, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
883 char *szFileName, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
884 uLong fileNameBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
885 void *extraField, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
886 uLong extraFieldBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
887 char *szComment, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
888 uLong commentBufferSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
889 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
890 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
891 unz_file_info64 file_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
892 unz_file_info64_internal file_info_internal; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
893 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
894 uLong uMagic; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
895 long lSeek=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
896 uLong uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
897 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
898 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
899 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
900 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
901 if (ZSEEK64(s->z_filefunc, s->filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
902 s->pos_in_central_dir+s->byte_before_the_zipfile, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
903 ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
904 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
905 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
906 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
907 /* we check the magic */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
908 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
909 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
910 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
911 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
912 else if (uMagic!=0x02014b50) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
913 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
914 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
915 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
916 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
917 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
918 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
919 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
920 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
921 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
922 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
923 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
924 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
925 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
926 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
927 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
928 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
929 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
930 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
931 unz64local_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
932 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
933 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
934 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
935 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
936 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
937 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
938 file_info.compressed_size = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
939 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
940 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
941 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
942 file_info.uncompressed_size = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
943 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
944 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
945 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
946 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
947 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
948 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
949 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
950 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
951 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
952 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
953 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
954 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
955 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
956 if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
957 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
958 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
959 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
960 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
961 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
962 // relative offset of local header |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
963 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
964 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
965 file_info_internal.offset_curfile = uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
966 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
967 lSeek+=file_info.size_filename; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
968 if ((err==UNZ_OK) && (szFileName!=NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
969 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
970 uLong uSizeRead ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
971 if (file_info.size_filename<fileNameBufferSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
972 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
973 *(szFileName+file_info.size_filename)='\0'; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
974 uSizeRead = file_info.size_filename; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
975 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
976 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
977 uSizeRead = fileNameBufferSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
978 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
979 if ((file_info.size_filename>0) && (fileNameBufferSize>0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
980 if (ZREAD64(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
981 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
982 lSeek -= uSizeRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
983 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
984 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
985 // Read extrafield |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
986 if ((err==UNZ_OK) && (extraField!=NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
987 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
988 ZPOS64_T uSizeRead ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
989 if (file_info.size_file_extra<extraFieldBufferSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
990 uSizeRead = file_info.size_file_extra; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
991 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
992 uSizeRead = extraFieldBufferSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
993 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
994 if (lSeek!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
995 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
996 if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
997 lSeek=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
998 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
999 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1000 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1001 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1002 if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1003 if (ZREAD64(s->z_filefunc, s->filestream,extraField,(uLong)uSizeRead)!=uSizeRead) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1004 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1005 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1006 lSeek += file_info.size_file_extra - (uLong)uSizeRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1007 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1008 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1009 lSeek += file_info.size_file_extra; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1010 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1011 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1012 if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1013 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1014 uLong acc = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1015 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1016 // since lSeek now points to after the extra field we need to move back |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1017 lSeek -= file_info.size_file_extra; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1018 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1019 if (lSeek!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1020 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1021 if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1022 lSeek=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1023 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1024 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1025 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1026 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1027 while(acc < file_info.size_file_extra) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1028 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1029 uLong headerId; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1030 uLong dataSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1031 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1032 if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1033 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1034 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1035 if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1036 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1037 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1038 /* ZIP64 extra fields */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1039 if (headerId == 0x0001) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1040 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1041 uLong uL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1042 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1043 if(file_info.uncompressed_size == MAXU32) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1044 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1045 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1046 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1047 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1048 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1049 if(file_info.compressed_size == MAXU32) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1050 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1051 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1052 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1053 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1054 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1055 if(file_info_internal.offset_curfile == MAXU32) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1056 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1057 /* Relative Header offset */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1058 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1059 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1060 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1061 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1062 if(file_info.disk_num_start == MAXU32) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1063 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1064 /* Disk Start Number */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1065 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1066 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1067 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1068 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1069 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1070 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1071 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1072 if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1073 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1074 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1075 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1076 acc += 2 + 2 + dataSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1077 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1078 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1079 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1080 if ((err==UNZ_OK) && (szComment!=NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1081 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1082 uLong uSizeRead ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1083 if (file_info.size_file_comment<commentBufferSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1084 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1085 *(szComment+file_info.size_file_comment)='\0'; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1086 uSizeRead = file_info.size_file_comment; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1087 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1088 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1089 uSizeRead = commentBufferSize; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1090 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1091 if (lSeek!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1092 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1093 if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1094 lSeek=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1095 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1096 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1097 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1098 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1099 if ((file_info.size_file_comment>0) && (commentBufferSize>0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1100 if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1101 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1102 lSeek+=file_info.size_file_comment - uSizeRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1103 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1104 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1105 lSeek+=file_info.size_file_comment; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1106 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1107 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1108 if ((err==UNZ_OK) && (pfile_info!=NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1109 *pfile_info=file_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1110 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1111 if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1112 *pfile_info_internal=file_info_internal; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1113 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1114 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1115 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1116 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1117 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1118 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1119 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1120 Write info about the ZipFile in the *pglobal_info structure. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1121 No preparation of the structure is needed |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1122 return UNZ_OK if there is no problem. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1123 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1124 extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1125 unz_file_info64 * pfile_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1126 char * szFileName, uLong fileNameBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1127 void *extraField, uLong extraFieldBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1128 char* szComment, uLong commentBufferSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1129 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1130 return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1131 szFileName,fileNameBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1132 extraField,extraFieldBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1133 szComment,commentBufferSize); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1134 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1135 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1136 extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1137 unz_file_info * pfile_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1138 char * szFileName, uLong fileNameBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1139 void *extraField, uLong extraFieldBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1140 char* szComment, uLong commentBufferSize) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1141 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1142 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1143 unz_file_info64 file_info64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1144 err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1145 szFileName,fileNameBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1146 extraField,extraFieldBufferSize, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1147 szComment,commentBufferSize); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1148 if ((err==UNZ_OK) && (pfile_info != NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1149 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1150 pfile_info->version = file_info64.version; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1151 pfile_info->version_needed = file_info64.version_needed; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1152 pfile_info->flag = file_info64.flag; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1153 pfile_info->compression_method = file_info64.compression_method; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1154 pfile_info->dosDate = file_info64.dosDate; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1155 pfile_info->crc = file_info64.crc; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1156 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1157 pfile_info->size_filename = file_info64.size_filename; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1158 pfile_info->size_file_extra = file_info64.size_file_extra; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1159 pfile_info->size_file_comment = file_info64.size_file_comment; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1160 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1161 pfile_info->disk_num_start = file_info64.disk_num_start; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1162 pfile_info->internal_fa = file_info64.internal_fa; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1163 pfile_info->external_fa = file_info64.external_fa; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1164 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1165 pfile_info->tmu_date = file_info64.tmu_date, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1166 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1167 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1168 pfile_info->compressed_size = (uLong)file_info64.compressed_size; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1169 pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1170 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1171 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1172 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1173 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1174 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1175 Set the current file of the zipfile to the first file. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1176 return UNZ_OK if there is no problem |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1177 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1178 extern int ZEXPORT unzGoToFirstFile (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1179 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1180 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1181 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1182 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1183 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1184 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1185 s->pos_in_central_dir=s->offset_central_dir; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1186 s->num_file=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1187 err=unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1188 &s->cur_file_info_internal, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1189 NULL,0,NULL,0,NULL,0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1190 s->current_file_ok = (err == UNZ_OK); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1191 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1192 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1193 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1194 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1195 Set the current file of the zipfile to the next file. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1196 return UNZ_OK if there is no problem |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1197 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1198 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1199 extern int ZEXPORT unzGoToNextFile (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1200 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1201 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1202 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1203 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1204 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1205 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1206 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1207 if (!s->current_file_ok) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1208 return UNZ_END_OF_LIST_OF_FILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1209 if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1210 if (s->num_file+1==s->gi.number_entry) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1211 return UNZ_END_OF_LIST_OF_FILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1212 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1213 s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1214 s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1215 s->num_file++; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1216 err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1217 &s->cur_file_info_internal, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1218 NULL,0,NULL,0,NULL,0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1219 s->current_file_ok = (err == UNZ_OK); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1220 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1221 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1222 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1223 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1224 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1225 Try locate the file szFileName in the zipfile. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1226 For the iCaseSensitivity signification, see unzStringFileNameCompare |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1227 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1228 return value : |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1229 UNZ_OK if the file is found. It becomes the current file. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1230 UNZ_END_OF_LIST_OF_FILE if the file is not found |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1231 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1232 extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1233 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1234 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1235 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1236 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1237 /* We remember the 'current' position in the file so that we can jump |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1238 * back there if we fail. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1239 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1240 unz_file_info64 cur_file_infoSaved; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1241 unz_file_info64_internal cur_file_info_internalSaved; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1242 ZPOS64_T num_fileSaved; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1243 ZPOS64_T pos_in_central_dirSaved; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1244 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1245 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1246 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1247 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1248 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1249 if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1250 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1251 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1252 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1253 if (!s->current_file_ok) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1254 return UNZ_END_OF_LIST_OF_FILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1255 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1256 /* Save the current state */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1257 num_fileSaved = s->num_file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1258 pos_in_central_dirSaved = s->pos_in_central_dir; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1259 cur_file_infoSaved = s->cur_file_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1260 cur_file_info_internalSaved = s->cur_file_info_internal; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1261 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1262 err = unzGoToFirstFile(file); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1263 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1264 while (err == UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1265 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1266 char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1267 err = unzGetCurrentFileInfo64(file,NULL, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1268 szCurrentFileName,sizeof(szCurrentFileName)-1, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1269 NULL,0,NULL,0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1270 if (err == UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1271 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1272 if (unzStringFileNameCompare(szCurrentFileName, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1273 szFileName,iCaseSensitivity)==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1274 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1275 err = unzGoToNextFile(file); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1276 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1277 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1278 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1279 /* We failed, so restore the state of the 'current file' to where we |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1280 * were. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1281 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1282 s->num_file = num_fileSaved ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1283 s->pos_in_central_dir = pos_in_central_dirSaved ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1284 s->cur_file_info = cur_file_infoSaved; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1285 s->cur_file_info_internal = cur_file_info_internalSaved; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1286 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1287 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1288 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1289 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1290 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1291 /////////////////////////////////////////// |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1292 // Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1293 // I need random access |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1294 // |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1295 // Further optimization could be realized by adding an ability |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1296 // to cache the directory in memory. The goal being a single |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1297 // comprehensive file read to put the file I need in a memory. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1298 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1299 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1300 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1301 typedef struct unz_file_pos_s |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1302 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1303 ZPOS64_T pos_in_zip_directory; // offset in file |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1304 ZPOS64_T num_of_file; // # of file |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1305 } unz_file_pos; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1306 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1307 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1308 extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1309 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1310 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1311 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1312 if (file==NULL || file_pos==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1313 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1314 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1315 if (!s->current_file_ok) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1316 return UNZ_END_OF_LIST_OF_FILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1317 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1318 file_pos->pos_in_zip_directory = s->pos_in_central_dir; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1319 file_pos->num_of_file = s->num_file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1320 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1321 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1322 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1323 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1324 extern int ZEXPORT unzGetFilePos( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1325 unzFile file, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1326 unz_file_pos* file_pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1327 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1328 unz64_file_pos file_pos64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1329 int err = unzGetFilePos64(file,&file_pos64); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1330 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1331 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1332 file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1333 file_pos->num_of_file = (uLong)file_pos64.num_of_file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1334 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1335 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1336 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1337 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1338 extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1339 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1340 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1341 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1342 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1343 if (file==NULL || file_pos==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1344 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1345 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1346 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1347 /* jump to the right spot */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1348 s->pos_in_central_dir = file_pos->pos_in_zip_directory; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1349 s->num_file = file_pos->num_of_file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1350 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1351 /* set the current file */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1352 err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1353 &s->cur_file_info_internal, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1354 NULL,0,NULL,0,NULL,0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1355 /* return results */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1356 s->current_file_ok = (err == UNZ_OK); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1357 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1358 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1359 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1360 extern int ZEXPORT unzGoToFilePos( |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1361 unzFile file, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1362 unz_file_pos* file_pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1363 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1364 unz64_file_pos file_pos64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1365 if (file_pos == NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1366 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1367 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1368 file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1369 file_pos64.num_of_file = file_pos->num_of_file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1370 return unzGoToFilePos64(file,&file_pos64); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1371 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1372 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1373 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1374 // Unzip Helper Functions - should be here? |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1375 /////////////////////////////////////////// |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1376 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1377 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1378 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1379 Read the local header of the current zipfile |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1380 Check the coherency of the local header and info in the end of central |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1381 directory about this file |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1382 store in *piSizeVar the size of extra info in local header |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1383 (filename and size of extra field data) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1384 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1385 local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1386 ZPOS64_T * poffset_local_extrafield, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1387 uInt * psize_local_extrafield) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1388 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1389 uLong uMagic,uData,uFlags; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1390 uLong size_filename; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1391 uLong size_extra_field; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1392 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1393 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1394 *piSizeVar = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1395 *poffset_local_extrafield = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1396 *psize_local_extrafield = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1397 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1398 if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1399 s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1400 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1401 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1402 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1403 if (err==UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1404 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1405 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1406 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1407 else if (uMagic!=0x04034b50) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1408 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1409 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1410 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1411 if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1412 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1413 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1414 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1415 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1416 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1417 if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1418 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1419 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1420 if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1421 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1422 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1423 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1424 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1425 if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1426 /* #ifdef HAVE_BZIP2 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1427 (s->cur_file_info.compression_method!=Z_BZIP2ED) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1428 /* #endif */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1429 (s->cur_file_info.compression_method!=Z_DEFLATED)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1430 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1431 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1432 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1433 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1434 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1435 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1436 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1437 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1438 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1439 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1440 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1441 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1442 else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1443 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1444 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1445 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1446 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1447 else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1448 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1449 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1450 if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1451 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1452 else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1453 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1454 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1455 *piSizeVar += (uInt)size_filename; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1456 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1457 if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1458 err=UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1459 *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1460 SIZEZIPLOCALHEADER + size_filename; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1461 *psize_local_extrafield = (uInt)size_extra_field; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1462 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1463 *piSizeVar += (uInt)size_extra_field; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1464 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1465 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1466 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1467 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1468 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1469 Open for reading data the current file in the zipfile. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1470 If there is no error and the file is opened, the return value is UNZ_OK. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1471 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1472 extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1473 int* level, int raw, const char* password) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1474 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1475 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1476 uInt iSizeVar; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1477 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1478 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1479 ZPOS64_T offset_local_extrafield; /* offset of the local extra field */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1480 uInt size_local_extrafield; /* size of the local extra field */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1481 # ifndef NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1482 char source[12]; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1483 # else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1484 if (password != NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1485 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1486 # endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1487 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1488 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1489 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1490 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1491 if (!s->current_file_ok) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1492 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1493 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1494 if (s->pfile_in_zip_read != NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1495 unzCloseCurrentFile(file); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1496 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1497 if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1498 return UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1499 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1500 pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1501 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1502 return UNZ_INTERNALERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1503 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1504 pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1505 pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1506 pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1507 pfile_in_zip_read_info->pos_local_extrafield=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1508 pfile_in_zip_read_info->raw=raw; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1509 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1510 if (pfile_in_zip_read_info->read_buffer==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1511 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1512 TRYFREE(pfile_in_zip_read_info); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1513 return UNZ_INTERNALERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1514 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1515 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1516 pfile_in_zip_read_info->stream_initialised=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1517 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1518 if (method!=NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1519 *method = (int)s->cur_file_info.compression_method; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1520 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1521 if (level!=NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1522 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1523 *level = 6; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1524 switch (s->cur_file_info.flag & 0x06) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1525 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1526 case 6 : *level = 1; break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1527 case 4 : *level = 2; break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1528 case 2 : *level = 9; break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1529 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1530 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1531 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1532 if ((s->cur_file_info.compression_method!=0) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1533 /* #ifdef HAVE_BZIP2 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1534 (s->cur_file_info.compression_method!=Z_BZIP2ED) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1535 /* #endif */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1536 (s->cur_file_info.compression_method!=Z_DEFLATED)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1537 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1538 err=UNZ_BADZIPFILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1539 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1540 pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1541 pfile_in_zip_read_info->crc32=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1542 pfile_in_zip_read_info->total_out_64=0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1543 pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1544 pfile_in_zip_read_info->filestream=s->filestream; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1545 pfile_in_zip_read_info->z_filefunc=s->z_filefunc; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1546 pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1547 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1548 pfile_in_zip_read_info->stream.total_out = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1549 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1550 if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1551 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1552 #ifdef HAVE_BZIP2 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1553 pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1554 pfile_in_zip_read_info->bstream.bzfree = (free_func)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1555 pfile_in_zip_read_info->bstream.opaque = (voidpf)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1556 pfile_in_zip_read_info->bstream.state = (voidpf)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1557 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1558 pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1559 pfile_in_zip_read_info->stream.zfree = (free_func)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1560 pfile_in_zip_read_info->stream.opaque = (voidpf)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1561 pfile_in_zip_read_info->stream.next_in = (voidpf)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1562 pfile_in_zip_read_info->stream.avail_in = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1563 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1564 err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1565 if (err == Z_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1566 pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1567 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1568 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1569 TRYFREE(pfile_in_zip_read_info); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1570 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1571 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1572 #else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1573 pfile_in_zip_read_info->raw=1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1574 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1575 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1576 else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1577 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1578 pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1579 pfile_in_zip_read_info->stream.zfree = (free_func)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1580 pfile_in_zip_read_info->stream.opaque = (voidpf)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1581 pfile_in_zip_read_info->stream.next_in = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1582 pfile_in_zip_read_info->stream.avail_in = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1583 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1584 err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1585 if (err == Z_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1586 pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1587 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1588 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1589 TRYFREE(pfile_in_zip_read_info); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1590 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1591 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1592 /* windowBits is passed < 0 to tell that there is no zlib header. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1593 * Note that in this case inflate *requires* an extra "dummy" byte |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1594 * after the compressed stream in order to complete decompression and |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1595 * return Z_STREAM_END. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1596 * In unzip, i don't wait absolutely Z_STREAM_END because I known the |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1597 * size of both compressed and uncompressed data |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1598 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1599 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1600 pfile_in_zip_read_info->rest_read_compressed = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1601 s->cur_file_info.compressed_size ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1602 pfile_in_zip_read_info->rest_read_uncompressed = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1603 s->cur_file_info.uncompressed_size ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1604 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1605 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1606 pfile_in_zip_read_info->pos_in_zipfile = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1607 s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1608 iSizeVar; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1609 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1610 pfile_in_zip_read_info->stream.avail_in = (uInt)0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1611 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1612 s->pfile_in_zip_read = pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1613 s->encrypted = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1614 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1615 # ifndef NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1616 if (password != NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1617 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1618 int i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1619 s->pcrc_32_tab = get_crc_table(); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1620 init_keys(password,s->keys,s->pcrc_32_tab); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1621 if (ZSEEK64(s->z_filefunc, s->filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1622 s->pfile_in_zip_read->pos_in_zipfile + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1623 s->pfile_in_zip_read->byte_before_the_zipfile, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1624 SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1625 return UNZ_INTERNALERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1626 if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1627 return UNZ_INTERNALERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1628 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1629 for (i = 0; i<12; i++) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1630 zdecode(s->keys,s->pcrc_32_tab,source[i]); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1631 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1632 s->pfile_in_zip_read->pos_in_zipfile+=12; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1633 s->encrypted=1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1634 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1635 # endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1636 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1637 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1638 return UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1639 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1640 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1641 extern int ZEXPORT unzOpenCurrentFile (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1642 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1643 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1644 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1645 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1646 extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1647 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1648 return unzOpenCurrentFile3(file, NULL, NULL, 0, password); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1649 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1650 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1651 extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1652 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1653 return unzOpenCurrentFile3(file, method, level, raw, NULL); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1654 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1655 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1656 /** Addition for GDAL : START */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1657 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1658 extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1659 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1660 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1661 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1662 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1663 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1664 return 0; //UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1665 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1666 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1667 return 0; //UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1668 return pfile_in_zip_read_info->pos_in_zipfile + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1669 pfile_in_zip_read_info->byte_before_the_zipfile; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1670 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1671 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1672 /** Addition for GDAL : END */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1673 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1674 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1675 Read bytes from the current file. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1676 buf contain buffer where data must be copied |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1677 len the size of buf. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1678 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1679 return the number of byte copied if somes bytes are copied |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1680 return 0 if the end of file was reached |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1681 return <0 with error code if there is an error |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1682 (UNZ_ERRNO for IO error, or zLib error for uncompress error) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1683 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1684 extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1685 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1686 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1687 uInt iRead = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1688 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1689 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1690 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1691 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1692 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1693 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1694 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1695 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1696 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1697 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1698 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1699 if (pfile_in_zip_read_info->read_buffer == NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1700 return UNZ_END_OF_LIST_OF_FILE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1701 if (len==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1702 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1703 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1704 pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1705 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1706 pfile_in_zip_read_info->stream.avail_out = (uInt)len; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1707 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1708 if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1709 (!(pfile_in_zip_read_info->raw))) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1710 pfile_in_zip_read_info->stream.avail_out = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1711 (uInt)pfile_in_zip_read_info->rest_read_uncompressed; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1712 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1713 if ((len>pfile_in_zip_read_info->rest_read_compressed+ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1714 pfile_in_zip_read_info->stream.avail_in) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1715 (pfile_in_zip_read_info->raw)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1716 pfile_in_zip_read_info->stream.avail_out = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1717 (uInt)pfile_in_zip_read_info->rest_read_compressed+ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1718 pfile_in_zip_read_info->stream.avail_in; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1719 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1720 while (pfile_in_zip_read_info->stream.avail_out>0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1721 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1722 if ((pfile_in_zip_read_info->stream.avail_in==0) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1723 (pfile_in_zip_read_info->rest_read_compressed>0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1724 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1725 uInt uReadThis = UNZ_BUFSIZE; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1726 if (pfile_in_zip_read_info->rest_read_compressed<uReadThis) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1727 uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1728 if (uReadThis == 0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1729 return UNZ_EOF; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1730 if (ZSEEK64(pfile_in_zip_read_info->z_filefunc, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1731 pfile_in_zip_read_info->filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1732 pfile_in_zip_read_info->pos_in_zipfile + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1733 pfile_in_zip_read_info->byte_before_the_zipfile, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1734 ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1735 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1736 if (ZREAD64(pfile_in_zip_read_info->z_filefunc, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1737 pfile_in_zip_read_info->filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1738 pfile_in_zip_read_info->read_buffer, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1739 uReadThis)!=uReadThis) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1740 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1741 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1742 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1743 # ifndef NOUNCRYPT |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1744 if(s->encrypted) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1745 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1746 uInt i; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1747 for(i=0;i<uReadThis;i++) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1748 pfile_in_zip_read_info->read_buffer[i] = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1749 zdecode(s->keys,s->pcrc_32_tab, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1750 pfile_in_zip_read_info->read_buffer[i]); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1751 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1752 # endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1753 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1754 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1755 pfile_in_zip_read_info->pos_in_zipfile += uReadThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1756 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1757 pfile_in_zip_read_info->rest_read_compressed-=uReadThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1758 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1759 pfile_in_zip_read_info->stream.next_in = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1760 (Bytef*)pfile_in_zip_read_info->read_buffer; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1761 pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1762 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1763 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1764 if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1765 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1766 uInt uDoCopy,i ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1767 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1768 if ((pfile_in_zip_read_info->stream.avail_in == 0) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1769 (pfile_in_zip_read_info->rest_read_compressed == 0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1770 return (iRead==0) ? UNZ_EOF : iRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1771 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1772 if (pfile_in_zip_read_info->stream.avail_out < |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1773 pfile_in_zip_read_info->stream.avail_in) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1774 uDoCopy = pfile_in_zip_read_info->stream.avail_out ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1775 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1776 uDoCopy = pfile_in_zip_read_info->stream.avail_in ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1777 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1778 for (i=0;i<uDoCopy;i++) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1779 *(pfile_in_zip_read_info->stream.next_out+i) = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1780 *(pfile_in_zip_read_info->stream.next_in+i); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1781 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1782 pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1783 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1784 pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1785 pfile_in_zip_read_info->stream.next_out, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1786 uDoCopy); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1787 pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1788 pfile_in_zip_read_info->stream.avail_in -= uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1789 pfile_in_zip_read_info->stream.avail_out -= uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1790 pfile_in_zip_read_info->stream.next_out += uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1791 pfile_in_zip_read_info->stream.next_in += uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1792 pfile_in_zip_read_info->stream.total_out += uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1793 iRead += uDoCopy; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1794 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1795 else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1796 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1797 #ifdef HAVE_BZIP2 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1798 uLong uTotalOutBefore,uTotalOutAfter; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1799 const Bytef *bufBefore; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1800 uLong uOutThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1801 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1802 pfile_in_zip_read_info->bstream.next_in = (char*)pfile_in_zip_read_info->stream.next_in; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1803 pfile_in_zip_read_info->bstream.avail_in = pfile_in_zip_read_info->stream.avail_in; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1804 pfile_in_zip_read_info->bstream.total_in_lo32 = pfile_in_zip_read_info->stream.total_in; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1805 pfile_in_zip_read_info->bstream.total_in_hi32 = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1806 pfile_in_zip_read_info->bstream.next_out = (char*)pfile_in_zip_read_info->stream.next_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1807 pfile_in_zip_read_info->bstream.avail_out = pfile_in_zip_read_info->stream.avail_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1808 pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1809 pfile_in_zip_read_info->bstream.total_out_hi32 = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1810 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1811 uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1812 bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1813 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1814 err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1815 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1816 uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1817 uOutThis = uTotalOutAfter-uTotalOutBefore; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1818 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1819 pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1820 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1821 pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1822 pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1823 iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1824 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1825 pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->bstream.next_in; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1826 pfile_in_zip_read_info->stream.avail_in = pfile_in_zip_read_info->bstream.avail_in; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1827 pfile_in_zip_read_info->stream.total_in = pfile_in_zip_read_info->bstream.total_in_lo32; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1828 pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1829 pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1830 pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1831 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1832 if (err==BZ_STREAM_END) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1833 return (iRead==0) ? UNZ_EOF : iRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1834 if (err!=BZ_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1835 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1836 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1837 } // end Z_BZIP2ED |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1838 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1839 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1840 ZPOS64_T uTotalOutBefore,uTotalOutAfter; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1841 const Bytef *bufBefore; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1842 ZPOS64_T uOutThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1843 int flush=Z_SYNC_FLUSH; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1844 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1845 uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1846 bufBefore = pfile_in_zip_read_info->stream.next_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1847 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1848 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1849 if ((pfile_in_zip_read_info->rest_read_uncompressed == |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1850 pfile_in_zip_read_info->stream.avail_out) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1851 (pfile_in_zip_read_info->rest_read_compressed == 0)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1852 flush = Z_FINISH; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1853 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1854 err=inflate(&pfile_in_zip_read_info->stream,flush); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1855 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1856 if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1857 err = Z_DATA_ERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1858 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1859 uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1860 uOutThis = uTotalOutAfter-uTotalOutBefore; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1861 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1862 pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1863 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1864 pfile_in_zip_read_info->crc32 = |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1865 crc32(pfile_in_zip_read_info->crc32,bufBefore, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1866 (uInt)(uOutThis)); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1867 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1868 pfile_in_zip_read_info->rest_read_uncompressed -= |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1869 uOutThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1870 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1871 iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1872 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1873 if (err==Z_STREAM_END) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1874 return (iRead==0) ? UNZ_EOF : iRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1875 if (err!=Z_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1876 break; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1877 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1878 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1879 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1880 if (err==Z_OK) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1881 return iRead; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1882 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1883 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1884 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1885 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1886 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1887 Give the current position in uncompressed data |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1888 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1889 extern z_off_t ZEXPORT unztell (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1890 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1891 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1892 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1893 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1894 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1895 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1896 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1897 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1898 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1899 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1900 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1901 return (z_off_t)pfile_in_zip_read_info->stream.total_out; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1902 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1903 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1904 extern ZPOS64_T ZEXPORT unztell64 (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1905 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1906 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1907 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1908 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1909 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1910 return (ZPOS64_T)-1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1911 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1912 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1913 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1914 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1915 return (ZPOS64_T)-1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1916 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1917 return pfile_in_zip_read_info->total_out_64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1918 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1919 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1920 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1921 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1922 return 1 if the end of file was reached, 0 elsewhere |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1923 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1924 extern int ZEXPORT unzeof (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1925 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1926 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1927 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1928 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1929 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1930 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1931 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1932 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1933 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1934 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1935 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1936 if (pfile_in_zip_read_info->rest_read_uncompressed == 0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1937 return 1; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1938 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1939 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1940 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1941 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1942 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1943 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1944 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1945 Read extra field from the current file (opened by unzOpenCurrentFile) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1946 This is the local-header version of the extra field (sometimes, there is |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1947 more info in the local-header version than in the central-header) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1948 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1949 if buf==NULL, it return the size of the local extra field that can be read |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1950 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1951 if buf!=NULL, len is the size of the buffer, the extra header is copied in |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1952 buf. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1953 the return value is the number of bytes copied in buf, or (if <0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1954 the error code |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1955 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1956 extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1957 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1958 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1959 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1960 uInt read_now; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1961 ZPOS64_T size_to_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1962 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1963 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1964 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1965 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1966 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1967 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1968 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1969 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1970 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1971 size_to_read = (pfile_in_zip_read_info->size_local_extrafield - |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1972 pfile_in_zip_read_info->pos_local_extrafield); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1973 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1974 if (buf==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1975 return (int)size_to_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1976 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1977 if (len>size_to_read) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1978 read_now = (uInt)size_to_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1979 else |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1980 read_now = (uInt)len ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1981 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1982 if (read_now==0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1983 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1984 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1985 if (ZSEEK64(pfile_in_zip_read_info->z_filefunc, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1986 pfile_in_zip_read_info->filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1987 pfile_in_zip_read_info->offset_local_extrafield + |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1988 pfile_in_zip_read_info->pos_local_extrafield, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1989 ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1990 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1991 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1992 if (ZREAD64(pfile_in_zip_read_info->z_filefunc, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1993 pfile_in_zip_read_info->filestream, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1994 buf,read_now)!=read_now) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1995 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1996 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1997 return (int)read_now; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1998 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1999 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2000 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2001 Close the file in zip opened with unzOpenCurrentFile |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2002 Return UNZ_CRCERROR if all the file was read but the CRC is not good |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2003 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2004 extern int ZEXPORT unzCloseCurrentFile (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2005 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2006 int err=UNZ_OK; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2007 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2008 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2009 file_in_zip64_read_info_s* pfile_in_zip_read_info; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2010 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2011 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2012 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2013 pfile_in_zip_read_info=s->pfile_in_zip_read; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2014 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2015 if (pfile_in_zip_read_info==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2016 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2017 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2018 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2019 if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2020 (!pfile_in_zip_read_info->raw)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2021 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2022 if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2023 err=UNZ_CRCERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2024 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2025 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2026 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2027 TRYFREE(pfile_in_zip_read_info->read_buffer); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2028 pfile_in_zip_read_info->read_buffer = NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2029 if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2030 inflateEnd(&pfile_in_zip_read_info->stream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2031 #ifdef HAVE_BZIP2 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2032 else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2033 BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2034 #endif |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2035 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2036 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2037 pfile_in_zip_read_info->stream_initialised = 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2038 TRYFREE(pfile_in_zip_read_info); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2039 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2040 s->pfile_in_zip_read=NULL; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2041 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2042 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2043 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2044 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2045 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2046 /* |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2047 Get the global comment string of the ZipFile, in the szComment buffer. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2048 uSizeBuf is the size of the szComment buffer. |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2049 return the number of byte copied or an error code <0 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2050 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2051 extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2052 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2053 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2054 uLong uReadThis ; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2055 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2056 return (int)UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2057 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2058 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2059 uReadThis = uSizeBuf; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2060 if (uReadThis>s->gi.size_comment) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2061 uReadThis = s->gi.size_comment; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2062 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2063 if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2064 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2065 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2066 if (uReadThis>0) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2067 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2068 *szComment='\0'; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2069 if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2070 return UNZ_ERRNO; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2071 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2072 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2073 if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2074 *(szComment+s->gi.size_comment)='\0'; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2075 return (int)uReadThis; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2076 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2077 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2078 /* Additions by RX '2004 */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2079 extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2080 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2081 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2082 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2083 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2084 return 0; //UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2085 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2086 if (!s->current_file_ok) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2087 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2088 if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2089 if (s->num_file==s->gi.number_entry) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2090 return 0; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2091 return s->pos_in_central_dir; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2092 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2093 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2094 extern uLong ZEXPORT unzGetOffset (unzFile file) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2095 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2096 ZPOS64_T offset64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2097 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2098 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2099 return 0; //UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2100 offset64 = unzGetOffset64(file); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2101 return (uLong)offset64; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2102 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2103 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2104 extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2105 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2106 unz64_s* s; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2107 int err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2108 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2109 if (file==NULL) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2110 return UNZ_PARAMERROR; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2111 s=(unz64_s*)file; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2112 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2113 s->pos_in_central_dir = pos; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2114 s->num_file = s->gi.number_entry; /* hack */ |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2115 err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2116 &s->cur_file_info_internal, |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2117 NULL,0,NULL,0,NULL,0); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2118 s->current_file_ok = (err == UNZ_OK); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2119 return err; |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2120 } |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2121 |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2122 extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2123 { |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2124 return unzSetOffset64(file,pos); |
bcfb53d1bc56
trying to uncompress one zip archive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2125 } |