Fossil SCM

Merge trunk into markdown-tagrefs branch.

stephan 2024-03-05 12:53 UTC markdown-tagrefs merge
Commit 0517bd2dd8db5b81457e9c839a307870da213dc20f4d01376538c693d5c0474c
392 files changed +3 -2 +5 +1 -1 +83 -10 +1 -1 +2 -2 +19 -1 +1 -1 +8 -2 +9 -10 +5 -27 +5 -16 +16 -10 +1 -1 +1 -1 +2 -2 +3 -3 +1 -1 +1 -1 +6 -18 +8 -8 +6 -11 +3 -3 +1 -1 +1 -1 +4 -8 +18 -44 +19 -19 +19 -46 +4 -4 +22 -48 +24 -36 +1 -7 +196 -341 +68 -68 +137 -194 +153 -156 +1 -1 +1 -1 +28 -35 +1 -1 +4 -4 +1 -1 +4 -4 +1 -1 +4 -4 +1 -1 +4 -4 +1 -1 +4 -4 +1 -1 +86 -162 +234 -337 +8 -8 +1 -1 +15 -11 +439 -385 +41 -30 +1 -3 +11 -12 +26 -83 +20 -68 +19 -65 +7 -23 +1 -4 +1 -1 +30 -99 +6 -11 +3 -3 +1 -1 +4 -4 +5 -5 +23 -80 +3 -2 +50 -122 +2 -2 +225 -303 +4 -12 +2 -2 +6 -2 +6 -2 +6 -2 +3 -3 +191 -188 -152 +16 -44 +10 -10 +405 -305 +376 -377 +3049 -1330 +14738 -6201 +362 -73 +24 -16 +7 -7 +26 -25 +6 -6 +2 -2 +22 -21 +22 -16 +2 -2 +25 -23 +16 -8 +2 -2 +21 -20 +9 -4 +524 -36 +2 +2 -2 +67 -26 +16 -6 +2 -2 +30 -28 +14 +310 +3 +5 +29 +15 -15 +2 -2 +21 -18 +9 -9 +2 -2 +34 -32 +6 -6 +2 -2 +14 -13 +14 -14 +8 -8 +48 -44 +11 -2 +162 -51 +29 -17 +3 -2 +1 -1 +1 -1 +3 -3 +44 -24 +111 -31 +154 -75 +6 -13 +2 -2 +2 -2 +1 -1 +143 -45 +17 -9 +17 -9 +45 -23 +3 -1 +14 -5 +1 -1 +1 +1 -1 +22 -5 +87 -36 +116 -15 +2 -2 +2 -1 +1 +32 -14 +32 -1 +203 -25 +40 -21 +6 -4 +1 -1 +4 -4 +3 -3 +8 -8 +1 -1 +14 -12 +1 +2 -1 +451 -23 +2 -1 +31 -21 +31 -21 +17 -4 +22 -4 +1 -1 +43 -5 +4 -1 +26 -6 +4 -4 +15 -2 +2 -2 +1 -1 +168 -5 +9 -9 +9 -2 +20 -9 +34 -11 +5 -5 +49 -30 +9 -6 +5 -4 +2 -2 +16 -11 +4 -2 +19 -5 +2 -1 +23 -14 +2 -1 +11 -8 +60 -40 +10 -4 +101 -61 +48 -1 +3 -3 +36 -6 +36 -6 +38 -6 +38 -6 +10 -11 +1 -1 +54 -28 +107 -41 +11 -2 +2 -6 +19 -7 +6 -4 +1 -1 +6 -7 +9 -7 +175 -72 +9 -8 +45 -29 +4 -4 +15 -1 +16 -16 +1 -1 +63 -5 +3 -4 +293 -91 +2 -2 +1 -1 +16 -13 +97 -23 +4 -3 +38 -18 +4 -2 -1 +18 -6 +37 -5 +4 -2 +3 +8 -6 +5 -2 +6 -3 +275 -37 +9 -7 +2 -4 +2 -1 +20 -12 +2 -2 +44 -34 +16 -1 +13 -5 +44 -23 +11 -1 +11 -1 +7 -7 +15 -8 +2 -4 +18 -17 +3 -1 +1 -13 +1 -1 +44 +5 +15 -2 +30 -30 +1 -1 +39 -32 +9 -9 +3 -1 +12 -10 +5 -5 +2 -3 +3 -3 +645 +5 -5 +14 -10 +7 -3 +7 -6 +15 -13 +53 -3 +14 -17 +2 -2 +17 -10 +16 -14 +28 -10 +125 +12 -6 +24 -10 +43 +4 -1 +4 -3 +2 -2 +4 -2 +4 +8 +88 -31 +7 -8 +19 -13 +16 -19 +5 -5 +2 -8 +10 -10 +39 -40 +4 -6 +2 -2 +99 -10 +11 -11 +44 -43 +2 -2 +37 -37 +12 -15 +191 -213 +2 -2 +60 -55 +14 -14 +141 -133 +13 -15 +4 -6 +9 -14 +8 -9 +19 -23 +30 -18 +12 -18 +19 -15 +30 -26 +22 -30 +54 -13 +13 -11 +2 -3 +111 -111 +1 -1 +26 -29 +1 -1 +4 -5 +2 -2 +4 -3 +29 -29 +20 -19 +32 -13 +15 -15 +9 +8 -5 +14 -14 +7 -10 +2 -2 +25 -27 +10 -11 +7 -7 +2 -2 +16 -16 -1 +21 -21 +17 -22 +119 -152 +37 -37 +14 -12 +6 -6 +4 -4 -2 +6 -6 +9 -9 +26 -26 +2 -2 +3 -3 +6 -6 +9 -9 +46 -48 +46 -46 +5 -44 +40 -38 +119 -119 +23 -16 +1 -1 +14 -14 +10 -20 +17 -17 +1 -2 +132 -115 +21 -28 +22 -22 -1 +2 -2 +10 -11 +8 -12 +11 -11
~ Dockerfile ~ Makefile.in ~ VERSION ~ auto.def ~ autosetup/autosetup-find-tclsh ~ compat/zlib/CMakeLists.txt ~ compat/zlib/ChangeLog ~ compat/zlib/FAQ ~ compat/zlib/Makefile.in ~ compat/zlib/README ~ compat/zlib/adler32.c ~ compat/zlib/compress.c ~ compat/zlib/configure ~ compat/zlib/contrib/delphi/ZLib.pas ~ compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs ~ compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs ~ compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs ~ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs ~ compat/zlib/contrib/dotzlib/readme.txt ~ compat/zlib/contrib/infback9/infback9.c ~ compat/zlib/contrib/infback9/infback9.h ~ compat/zlib/contrib/infback9/inftree9.c ~ compat/zlib/contrib/infback9/inftree9.h ~ compat/zlib/contrib/minizip/MiniZip64_Changes.txt ~ compat/zlib/contrib/minizip/configure.ac ~ compat/zlib/contrib/minizip/crypt.h ~ compat/zlib/contrib/minizip/ioapi.c ~ compat/zlib/contrib/minizip/ioapi.h ~ compat/zlib/contrib/minizip/iowin32.c ~ compat/zlib/contrib/minizip/iowin32.h ~ compat/zlib/contrib/minizip/miniunz.c ~ compat/zlib/contrib/minizip/minizip.c ~ compat/zlib/contrib/minizip/mztools.c ~ compat/zlib/contrib/minizip/unzip.c ~ compat/zlib/contrib/minizip/unzip.h ~ compat/zlib/contrib/minizip/zip.c ~ compat/zlib/contrib/minizip/zip.h ~ compat/zlib/contrib/pascal/zlibpas.pas ~ compat/zlib/contrib/testzlib/testzlib.c ~ compat/zlib/contrib/untgz/untgz.c ~ compat/zlib/contrib/vstudio/readme.txt ~ compat/zlib/contrib/vstudio/vc10/zlib.rc ~ compat/zlib/contrib/vstudio/vc10/zlibvc.def ~ compat/zlib/contrib/vstudio/vc11/zlib.rc ~ compat/zlib/contrib/vstudio/vc11/zlibvc.def ~ compat/zlib/contrib/vstudio/vc12/zlib.rc ~ compat/zlib/contrib/vstudio/vc12/zlibvc.def ~ compat/zlib/contrib/vstudio/vc14/zlib.rc ~ compat/zlib/contrib/vstudio/vc14/zlibvc.def ~ compat/zlib/contrib/vstudio/vc9/zlib.rc ~ compat/zlib/contrib/vstudio/vc9/zlibvc.def ~ compat/zlib/crc32.c ~ compat/zlib/deflate.c ~ compat/zlib/deflate.h ~ compat/zlib/examples/fitblk.c ~ compat/zlib/examples/zlib_how.html ~ compat/zlib/examples/zran.c ~ compat/zlib/examples/zran.h ~ compat/zlib/gzclose.c ~ compat/zlib/gzguts.h ~ compat/zlib/gzlib.c ~ compat/zlib/gzread.c ~ compat/zlib/gzwrite.c ~ compat/zlib/infback.c ~ compat/zlib/inffast.c ~ compat/zlib/inffast.h ~ compat/zlib/inflate.c ~ compat/zlib/inftrees.c ~ compat/zlib/inftrees.h ~ compat/zlib/os400/README400 ~ compat/zlib/os400/zlib.inc ~ compat/zlib/qnx/package.qpg ~ compat/zlib/test/example.c ~ compat/zlib/test/infcover.c ~ compat/zlib/test/minigzip.c ~ compat/zlib/treebuild.xml ~ compat/zlib/trees.c ~ compat/zlib/uncompr.c ~ compat/zlib/win32/README-WIN32.txt ~ compat/zlib/zconf.h ~ compat/zlib/zconf.h.cmakein ~ compat/zlib/zconf.h.in ~ compat/zlib/zlib.3 ~ compat/zlib/zlib.3.pdf ~ compat/zlib/zlib.h - compat/zlib/zlib2ansi ~ compat/zlib/zutil.c ~ compat/zlib/zutil.h ~ extsrc/pikchr.c ~ extsrc/pikchr.js ~ extsrc/pikchr.wasm ~ extsrc/shell.c ~ extsrc/sqlite3.c ~ extsrc/sqlite3.h ~ skins/ardoise/css.txt ~ skins/ardoise/footer.txt ~ skins/ardoise/header.txt ~ skins/black_and_white/css.txt ~ skins/black_and_white/footer.txt ~ skins/black_and_white/header.txt ~ skins/blitz/css.txt ~ skins/blitz/footer.txt ~ skins/blitz/header.txt ~ skins/darkmode/css.txt ~ skins/darkmode/footer.txt ~ skins/darkmode/header.txt ~ skins/default/README.md ~ skins/default/css.txt ~ skins/default/details.txt ~ skins/default/footer.txt ~ skins/default/header.txt ~ skins/eagle/css.txt ~ skins/eagle/footer.txt ~ skins/eagle/header.txt ~ skins/etienne/README.md ~ skins/etienne/css.txt ~ skins/etienne/details.txt ~ skins/etienne/footer.txt ~ skins/etienne/header.txt ~ skins/khaki/css.txt ~ skins/khaki/footer.txt ~ skins/khaki/header.txt ~ skins/original/css.txt ~ skins/original/footer.txt ~ skins/original/header.txt ~ skins/plain_gray/css.txt ~ skins/plain_gray/footer.txt ~ skins/plain_gray/header.txt ~ skins/xekri/css.txt ~ skins/xekri/footer.txt ~ skins/xekri/header.txt ~ src/ajax.c ~ src/alerts.c ~ src/allrepo.c ~ src/attach.c ~ src/backlink.c ~ src/backlink.c ~ src/backoffice.c ~ src/blob.c ~ src/branch.c ~ src/browse.c ~ src/builtin.c ~ src/bundle.c ~ src/cache.c ~ src/capabilities.c ~ src/cgi.c ~ src/chat.c ~ src/chat.c ~ src/checkin.c ~ src/clone.c ~ src/color.c ~ src/comformat.c ~ src/configure.c ~ src/content.c ~ src/cookies.c ~ src/db.c ~ src/default.css ~ src/deltacmd.c ~ src/deltafunc.c ~ src/descendants.c ~ src/diff.c ~ src/diff.tcl ~ src/diffcmd.c ~ src/dispatch.c ~ src/doc.c ~ src/encode.c ~ src/etag.c ~ src/event.c ~ src/export.c ~ src/file.c ~ src/fileedit.c ~ src/finfo.c ~ src/foci.c ~ src/forum.c ~ src/fossil.diff.js ~ src/fossil.page.chat.js ~ src/fossil.page.chat.js ~ src/fossil.page.fileedit.js ~ src/fossil.page.forumpost.js ~ src/fossil.page.pikchrshow.js ~ src/fossil.page.pikchrshowasm.js ~ src/fossil.page.whistory.js ~ src/fossil.page.wikiedit.js ~ src/graph.c ~ src/graph.js ~ src/hbmenu.js ~ src/hook.c ~ src/http.c ~ src/http_ssl.c ~ src/http_transport.c ~ src/import.c ~ src/info.c ~ src/interwiki.c ~ src/json.c ~ src/json_artifact.c ~ src/json_branch.c ~ src/json_config.c ~ src/json_finfo.c ~ src/json_login.c ~ src/json_status.c ~ src/json_tag.c ~ src/json_timeline.c ~ src/json_user.c ~ src/json_wiki.c ~ src/login.c ~ src/lookslike.c ~ src/main.c ~ src/main.mk ~ src/manifest.c ~ src/markdown.c ~ src/markdown.c ~ src/markdown_html.c ~ src/markdown_html.c ~ src/merge.c ~ src/merge3.c ~ src/name.c ~ src/patch.c ~ src/pikchrshow.c ~ src/pqueue.c ~ src/printf.c ~ src/rebuild.c ~ src/repolist.c ~ src/report.c ~ src/rss.c ~ src/search.c ~ src/security_audit.c ~ src/setup.c ~ src/setupuser.c ~ src/sha1.c ~ src/sha1hard.c ~ src/sha3.c ~ src/shun.c ~ src/sitemap.c ~ src/skins.c ~ src/smtp.c ~ src/sqlcmd.c ~ src/stash.c ~ src/stat.c ~ src/statrep.c ~ src/style.c ~ src/style.fileedit.css ~ src/style.wikiedit.css ~ src/sync.c ~ src/tag.c ~ src/tar.c ~ src/terminal.c ~ src/th.c ~ src/th_main.c ~ src/th_tcl.c ~ src/timeline.c ~ src/tkt.c ~ src/tktsetup.c ~ src/unicode.c ~ src/unversioned.c ~ src/update.c ~ src/url.c ~ src/user.c ~ src/vfile.c ~ src/wiki.c ~ src/wikiformat.c ~ src/wikiformat.c ~ src/winhttp.c ~ src/xfer.c ~ src/xfersetup.c ~ src/zip.c ~ test/amend.test ~ test/commit-warning.test ~ test/delta1.test ~ test/diff.test ~ test/fake-editor.tcl ~ test/json.test ~ test/merge1.test ~ test/merge2.test ~ test/merge3.test ~ test/merge4.test ~ test/merge5.test ~ test/merge_renames.test ~ test/merge_warn.test ~ test/release-checklist.wiki ~ test/revert.test ~ test/rewrite-test-output.tcl ~ test/set-manifest.test ~ test/settings-repo.test ~ test/settings.test ~ test/stash.test ~ test/symlinks.test ~ test/tester.tcl ~ test/th1-docs.test ~ test/th1-hooks.test ~ test/th1-tcl.test ~ test/th1.test ~ test/unversioned.test ~ test/update.test ~ tools/codecheck1.c ~ tools/makeheaders.c ~ tools/makemake.tcl ~ tools/mkindex.c ~ tools/mkversion.c ~ tools/skintxt2config.c ~ tools/sqlcompattest.c ~ win/Makefile.mingw ~ win/Makefile.msc ~ www/aboutcgi.wiki ~ www/aboutdownload.wiki ~ www/adding_code.wiki ~ www/alerts.md ~ www/backoffice.md ~ www/backup.md ~ www/branching.wiki ~ www/build.wiki ~ www/caps/login-groups.md ~ www/cgi.wiki ~ www/changes.wiki ~ www/chat.md ~ www/checkin_names.wiki ~ www/childprojects.wiki ~ www/ckout-workflows.md ~ www/concepts.wiki ~ www/containers.md ~ www/contribute.wiki ~ www/custom_ticket.wiki ~ www/customgraph.md ~ www/customskin.md ~ www/defcsp.md ~ www/delta-manifests.md ~ www/delta_encoder_algorithm.wiki ~ www/delta_format.wiki ~ www/embeddeddoc.wiki ~ www/encryptedrepos.wiki ~ www/event.wiki ~ www/faq.tcl ~ www/faq.wiki ~ www/fileformat.wiki ~ www/forum.wiki ~ www/fossil-v-git.wiki ~ www/fossil_prompt.wiki ~ www/gitusers.md ~ www/globs.md ~ www/glossary.md ~ www/grep.md ~ www/hashes.md ~ www/hashpolicy.wiki ~ www/hints.wiki ~ www/image-format-vs-repo-size.md ~ www/index.wiki ~ www/inout.wiki ~ www/javascript.md ~ www/json-api/api-checkout.md ~ www/loadmgmt.md ~ www/makefile.wiki ~ www/mirrortogithub.md ~ www/mkindex.tcl ~ www/newrepo.wiki ~ www/password.wiki ~ www/patchcmd.md ~ www/permutedindex.html ~ www/pikchr.md ~ www/pop.wiki ~ www/private.wiki ~ www/qandc.wiki ~ www/quickstart.wiki ~ www/quotes.wiki ~ www/rebaseharm.md ~ www/reviews.wiki ~ www/scgi.wiki ~ www/selfcheck.wiki ~ www/selfhost.wiki ~ www/server/any/cgi.md ~ www/server/any/http-over-ssh.md ~ www/server/any/inetd.md ~ www/server/any/none.md ~ www/server/any/scgi.md ~ www/server/any/xinetd.md ~ www/server/debian/nginx.md ~ www/server/debian/service.md ~ www/server/index.html ~ www/server/macos/service.md ~ www/server/openbsd/fastcgi.md ~ www/server/openbsd/service.wiki ~ www/server/windows/iis.md ~ www/serverext.wiki ~ www/ssl-server.md ~ www/ssl.wiki ~ www/stats.wiki ~ www/sync.wiki ~ www/tech_overview.wiki ~ www/th1.md ~ www/theory1.wiki ~ www/tickets.wiki ~ www/unvers.wiki ~ www/webui.wiki ~ www/whyusefossil.wiki
+3 -2
--- Dockerfile
+++ Dockerfile
@@ -81,10 +81,11 @@
8181
## ---------------------------------------------------------------------
8282
8383
ENV PATH "/bin"
8484
EXPOSE 8080/tcp
8585
USER fossil
86
-ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
86
+ENTRYPOINT [ "fossil", "server" ]
8787
CMD [ \
8888
"--create", \
8989
"--jsmode", "bundled", \
90
- "--user", "admin" ]
90
+ "--user", "admin", \
91
+ "museum/repo.fossil" ]
9192
--- Dockerfile
+++ Dockerfile
@@ -81,10 +81,11 @@
81 ## ---------------------------------------------------------------------
82
83 ENV PATH "/bin"
84 EXPOSE 8080/tcp
85 USER fossil
86 ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87 CMD [ \
88 "--create", \
89 "--jsmode", "bundled", \
90 "--user", "admin" ]
 
91
--- Dockerfile
+++ Dockerfile
@@ -81,10 +81,11 @@
81 ## ---------------------------------------------------------------------
82
83 ENV PATH "/bin"
84 EXPOSE 8080/tcp
85 USER fossil
86 ENTRYPOINT [ "fossil", "server" ]
87 CMD [ \
88 "--create", \
89 "--jsmode", "bundled", \
90 "--user", "admin", \
91 "museum/repo.fossil" ]
92
--- Makefile.in
+++ Makefile.in
@@ -7,10 +7,11 @@
77
#### The toplevel directory of the source tree. Fossil can be built
88
# in a directory that is separate from the source tree. Just change
99
# the following to point from the build directory to the src/ folder.
1010
#
1111
SRCDIR = @srcdir@/src
12
+TOPDIR = @srcdir@
1213
#### Upstream source files included directly in this repository.
1314
#
1415
SRCDIR_extsrc = @srcdir@/extsrc
1516
#### In-tree tools such as code generators and translators:
1617
#
@@ -83,10 +84,14 @@
8384
# https://emscripten.org/docs/getting_started/downloads.html
8485
EMSDK_HOME = @EMSDK_HOME@
8586
EMSDK_ENV = @EMSDK_ENV@
8687
EMCC_OPT = @EMCC_OPT@
8788
EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
89
+
90
+# MAKE_COMPILATION_DB (yes/no) determines whether or not the
91
+# compile_commands.json file will be generated.
92
+MAKE_COMPILATION_DB = @MAKE_COMPILATION_DB@
8893
8994
.PHONY: all tags
9095
9196
include $(SRCDIR)/main.mk
9297
9398
--- Makefile.in
+++ Makefile.in
@@ -7,10 +7,11 @@
7 #### The toplevel directory of the source tree. Fossil can be built
8 # in a directory that is separate from the source tree. Just change
9 # the following to point from the build directory to the src/ folder.
10 #
11 SRCDIR = @srcdir@/src
 
12 #### Upstream source files included directly in this repository.
13 #
14 SRCDIR_extsrc = @srcdir@/extsrc
15 #### In-tree tools such as code generators and translators:
16 #
@@ -83,10 +84,14 @@
83 # https://emscripten.org/docs/getting_started/downloads.html
84 EMSDK_HOME = @EMSDK_HOME@
85 EMSDK_ENV = @EMSDK_ENV@
86 EMCC_OPT = @EMCC_OPT@
87 EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
 
 
 
 
88
89 .PHONY: all tags
90
91 include $(SRCDIR)/main.mk
92
93
--- Makefile.in
+++ Makefile.in
@@ -7,10 +7,11 @@
7 #### The toplevel directory of the source tree. Fossil can be built
8 # in a directory that is separate from the source tree. Just change
9 # the following to point from the build directory to the src/ folder.
10 #
11 SRCDIR = @srcdir@/src
12 TOPDIR = @srcdir@
13 #### Upstream source files included directly in this repository.
14 #
15 SRCDIR_extsrc = @srcdir@/extsrc
16 #### In-tree tools such as code generators and translators:
17 #
@@ -83,10 +84,14 @@
84 # https://emscripten.org/docs/getting_started/downloads.html
85 EMSDK_HOME = @EMSDK_HOME@
86 EMSDK_ENV = @EMSDK_ENV@
87 EMCC_OPT = @EMCC_OPT@
88 EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
89
90 # MAKE_COMPILATION_DB (yes/no) determines whether or not the
91 # compile_commands.json file will be generated.
92 MAKE_COMPILATION_DB = @MAKE_COMPILATION_DB@
93
94 .PHONY: all tags
95
96 include $(SRCDIR)/main.mk
97
98
+1 -1
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1
-2.23
1
+2.24
22
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.23
2
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.24
2
+83 -10
--- auto.def
+++ auto.def
@@ -29,23 +29,31 @@
2929
fusefs=1 => {Disable the Fuse Filesystem}
3030
fossil-debug=0 => {Build with fossil debugging enabled}
3131
no-opt=0 => {Build without optimization}
3232
json=0 => {Build with fossil JSON API enabled}
3333
with-emsdk:path => {Directory containing the Emscripten SDK}
34
+ compile-commands=0 =>
35
+ "Check for compile_commands.json support."
3436
}
3537
3638
# Update the minimum required SQLite version number here, and also
3739
# in src/main.c near the sqlite3_libversion_number() call. Take care
3840
# that both places agree!
39
-define MINIMUM_SQLITE_VERSION "3.38.0"
41
+define MINIMUM_SQLITE_VERSION "3.43.0"
4042
4143
# This is useful for people wanting Fossil to use an external SQLite library
4244
# to compare the one they have against the minimum required
4345
if {[opt-bool print-minimum-sqlite-version]} {
4446
puts [get-define MINIMUM_SQLITE_VERSION]
4547
exit 0
4648
}
49
+
50
+set outOfTreeBuild 0
51
+if {![file exists fossil.1]} {
52
+ puts "This appears to be an out-of-tree build."
53
+ set outOfTreeBuild 1
54
+}
4755
4856
# sqlite wants these types if possible
4957
cc-with {-includes {stdint.h inttypes.h}} {
5058
cc-check-types uint32_t uint16_t int16_t uint8_t
5159
}
@@ -178,13 +186,14 @@
178186
}
179187
180188
find_system_sqlite
181189
182190
proc test_system_sqlite {} {
183
- # Check compatibility of the system SQLite library by running the sqlcompttest.c
184
- # program in the source tree
185
- # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c
191
+ # Check compatibility of the system SQLite library by running the
192
+ # sqlcompttest.c program in the source tree passes
193
+ # MINIMUM_SQLITE_VERSION set at the top of this file to
194
+ # sqlcompttest.c
186195
#
187196
set cmdline {}
188197
lappend cmdline {*}[get-define CCACHE]
189198
lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
190199
lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
@@ -358,18 +367,46 @@
358367
define-append EXTRA_CFLAGS -I$zlibdir
359368
define-append LIBS $zlibdir/libz.a
360369
set ::zlib_lib $zlibdir/libz.a
361370
msg-result "Using zlib in source tree"
362371
} else {
372
+ set cftry {""}
373
+ set ldtry {""}
363374
if {$zlibpath ni {auto ""}} {
364
- cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
365
- define-append EXTRA_CFLAGS -I$zlibpath
366
- define-append EXTRA_LDFLAGS -L$zlibpath
367
- msg-result "Using zlib from $zlibpath"
375
+ lappend cftry "-I$zlibpath"
376
+ lappend cftry "-I$zlibpath/include"
377
+ lappend ldtry "-L$zlibpath"
378
+ lappend ldtry "-L$zlibpath/lib"
379
+ }
380
+
381
+ # Reverse the list of tests so we check most-specific to least, else
382
+ # platform devel files will shadow local --with-zlib overrides.
383
+ foreach c [lreverse $cftry] {
384
+ if {[cc-with [list -cflags $c] {cc-check-includes zlib.h}]} {
385
+ if {$c eq ""} {
386
+ msg-result "Found zlib.h in default include path"
387
+ } else {
388
+ define-append EXTRA_CFLAGS "$c"
389
+ msg-result "Found zlib.h via $c"
390
+ }
391
+ set cfound $c
392
+ break
393
+ }
394
+ }
395
+ if {![info exists cfound]} {
396
+ user-error "zlib.h not found; either install it or specify its location via --with-zlib"
368397
}
369
- if {![cc-check-includes zlib.h] || ![check-function-in-lib inflateEnd z]} {
370
- user-error "zlib not found please install it or specify the location with --with-zlib"
398
+ foreach lcheck [lreverse $ldtry] {
399
+ if {[cc-with [list -cflags "$cfound $lcheck"] {check-function-in-lib inflateEnd z}]} {
400
+ if {$lcheck eq ""} {
401
+ msg-result "Linked to zlib via default library path"
402
+ } else {
403
+ define-append EXTRA_LDFLAGS "$lcheck"
404
+ msg-result "Linked to zlib via $lcheck"
405
+ }
406
+ break
407
+ }
371408
}
372409
set ::zlib_lib -lz
373410
}
374411
375412
set ssldirs [opt-val with-openssl]
@@ -418,10 +455,12 @@
418455
}
419456
if {$found} {
420457
define FOSSIL_ENABLE_SSL
421458
define-append EXTRA_CFLAGS $cflags
422459
define-append EXTRA_LDFLAGS $ldflags
460
+ define-append CFLAGS $cflags
461
+ define-append LDFLAGS $ldflags
423462
if {[info exists ssllibs]} {
424463
define-append LIBS $ssllibs
425464
} else {
426465
define-append LIBS -lssl -lcrypto
427466
}
@@ -618,10 +657,11 @@
618657
msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
619658
if {!$tclprivatestubs} {
620659
define-append LIBS $libs
621660
}
622661
define-append EXTRA_CFLAGS $cflags
662
+ define-append CFLAGS $cflags
623663
if {[info exists zlibpath] && $zlibpath eq "tree"} {
624664
#
625665
# NOTE: When using zlib in the source tree, prevent Tcl from
626666
# pulling in the system one.
627667
#
@@ -728,10 +768,43 @@
728768
define FOSSIL_HAVE_FUSEFS 1
729769
define-append LIBS -lfuse
730770
msg-result "FuseFS support enabled"
731771
}
732772
}
773
+
774
+########################################################################
775
+# Checks the compiler for compile_commands.json support.
776
+#
777
+# Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
778
+# if supported, "no" if not.
779
+proc check-compile-commands {} {
780
+ msg-checking "compile_commands.json support... "
781
+ if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
782
+ # This test reportedly incorrectly succeeds on one of
783
+ # Martin G.'s older systems.
784
+ msg-result "compiler supports compile_commands.json"
785
+ define MAKE_COMPILATION_DB yes
786
+ return 1
787
+ } else {
788
+ msg-result "compiler does not support compile_commands.json"
789
+ define MAKE_COMPILATION_DB no
790
+ return 0
791
+ }
792
+}
793
+
794
+define MAKE_COMPILATION_DB no
795
+if {!$outOfTreeBuild} {
796
+ if {[opt-bool compile-commands]} {
797
+ check-compile-commands
798
+ } else {
799
+ puts "Use --compile-commands to enable check for compile-commands-capable compiler."
800
+ }
801
+} else {
802
+ puts "Disabling compile_commands.json check for out-of-tree build."
803
+ # This is an attempt to resolve the problem reported at
804
+ # https://fossil-scm.org/forum/forumpost/d19061d09a8179d0
805
+}
733806
734807
# Add -fsanitize compile and link options late: we don't want the C
735808
# checks above to run with those sanitizers enabled. It can not only
736809
# be pointless, it can actually break correct tests.
737810
set fsan [opt-val with-sanitizer]
738811
--- auto.def
+++ auto.def
@@ -29,23 +29,31 @@
29 fusefs=1 => {Disable the Fuse Filesystem}
30 fossil-debug=0 => {Build with fossil debugging enabled}
31 no-opt=0 => {Build without optimization}
32 json=0 => {Build with fossil JSON API enabled}
33 with-emsdk:path => {Directory containing the Emscripten SDK}
 
 
34 }
35
36 # Update the minimum required SQLite version number here, and also
37 # in src/main.c near the sqlite3_libversion_number() call. Take care
38 # that both places agree!
39 define MINIMUM_SQLITE_VERSION "3.38.0"
40
41 # This is useful for people wanting Fossil to use an external SQLite library
42 # to compare the one they have against the minimum required
43 if {[opt-bool print-minimum-sqlite-version]} {
44 puts [get-define MINIMUM_SQLITE_VERSION]
45 exit 0
46 }
 
 
 
 
 
 
47
48 # sqlite wants these types if possible
49 cc-with {-includes {stdint.h inttypes.h}} {
50 cc-check-types uint32_t uint16_t int16_t uint8_t
51 }
@@ -178,13 +186,14 @@
178 }
179
180 find_system_sqlite
181
182 proc test_system_sqlite {} {
183 # Check compatibility of the system SQLite library by running the sqlcompttest.c
184 # program in the source tree
185 # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c
 
186 #
187 set cmdline {}
188 lappend cmdline {*}[get-define CCACHE]
189 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
190 lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
@@ -358,18 +367,46 @@
358 define-append EXTRA_CFLAGS -I$zlibdir
359 define-append LIBS $zlibdir/libz.a
360 set ::zlib_lib $zlibdir/libz.a
361 msg-result "Using zlib in source tree"
362 } else {
 
 
363 if {$zlibpath ni {auto ""}} {
364 cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
365 define-append EXTRA_CFLAGS -I$zlibpath
366 define-append EXTRA_LDFLAGS -L$zlibpath
367 msg-result "Using zlib from $zlibpath"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368 }
369 if {![cc-check-includes zlib.h] || ![check-function-in-lib inflateEnd z]} {
370 user-error "zlib not found please install it or specify the location with --with-zlib"
 
 
 
 
 
 
 
 
371 }
372 set ::zlib_lib -lz
373 }
374
375 set ssldirs [opt-val with-openssl]
@@ -418,10 +455,12 @@
418 }
419 if {$found} {
420 define FOSSIL_ENABLE_SSL
421 define-append EXTRA_CFLAGS $cflags
422 define-append EXTRA_LDFLAGS $ldflags
 
 
423 if {[info exists ssllibs]} {
424 define-append LIBS $ssllibs
425 } else {
426 define-append LIBS -lssl -lcrypto
427 }
@@ -618,10 +657,11 @@
618 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
619 if {!$tclprivatestubs} {
620 define-append LIBS $libs
621 }
622 define-append EXTRA_CFLAGS $cflags
 
623 if {[info exists zlibpath] && $zlibpath eq "tree"} {
624 #
625 # NOTE: When using zlib in the source tree, prevent Tcl from
626 # pulling in the system one.
627 #
@@ -728,10 +768,43 @@
728 define FOSSIL_HAVE_FUSEFS 1
729 define-append LIBS -lfuse
730 msg-result "FuseFS support enabled"
731 }
732 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
734 # Add -fsanitize compile and link options late: we don't want the C
735 # checks above to run with those sanitizers enabled. It can not only
736 # be pointless, it can actually break correct tests.
737 set fsan [opt-val with-sanitizer]
738
--- auto.def
+++ auto.def
@@ -29,23 +29,31 @@
29 fusefs=1 => {Disable the Fuse Filesystem}
30 fossil-debug=0 => {Build with fossil debugging enabled}
31 no-opt=0 => {Build without optimization}
32 json=0 => {Build with fossil JSON API enabled}
33 with-emsdk:path => {Directory containing the Emscripten SDK}
34 compile-commands=0 =>
35 "Check for compile_commands.json support."
36 }
37
38 # Update the minimum required SQLite version number here, and also
39 # in src/main.c near the sqlite3_libversion_number() call. Take care
40 # that both places agree!
41 define MINIMUM_SQLITE_VERSION "3.43.0"
42
43 # This is useful for people wanting Fossil to use an external SQLite library
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47 exit 0
48 }
49
50 set outOfTreeBuild 0
51 if {![file exists fossil.1]} {
52 puts "This appears to be an out-of-tree build."
53 set outOfTreeBuild 1
54 }
55
56 # sqlite wants these types if possible
57 cc-with {-includes {stdint.h inttypes.h}} {
58 cc-check-types uint32_t uint16_t int16_t uint8_t
59 }
@@ -178,13 +186,14 @@
186 }
187
188 find_system_sqlite
189
190 proc test_system_sqlite {} {
191 # Check compatibility of the system SQLite library by running the
192 # sqlcompttest.c program in the source tree passes
193 # MINIMUM_SQLITE_VERSION set at the top of this file to
194 # sqlcompttest.c
195 #
196 set cmdline {}
197 lappend cmdline {*}[get-define CCACHE]
198 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
199 lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
@@ -358,18 +367,46 @@
367 define-append EXTRA_CFLAGS -I$zlibdir
368 define-append LIBS $zlibdir/libz.a
369 set ::zlib_lib $zlibdir/libz.a
370 msg-result "Using zlib in source tree"
371 } else {
372 set cftry {""}
373 set ldtry {""}
374 if {$zlibpath ni {auto ""}} {
375 lappend cftry "-I$zlibpath"
376 lappend cftry "-I$zlibpath/include"
377 lappend ldtry "-L$zlibpath"
378 lappend ldtry "-L$zlibpath/lib"
379 }
380
381 # Reverse the list of tests so we check most-specific to least, else
382 # platform devel files will shadow local --with-zlib overrides.
383 foreach c [lreverse $cftry] {
384 if {[cc-with [list -cflags $c] {cc-check-includes zlib.h}]} {
385 if {$c eq ""} {
386 msg-result "Found zlib.h in default include path"
387 } else {
388 define-append EXTRA_CFLAGS "$c"
389 msg-result "Found zlib.h via $c"
390 }
391 set cfound $c
392 break
393 }
394 }
395 if {![info exists cfound]} {
396 user-error "zlib.h not found; either install it or specify its location via --with-zlib"
397 }
398 foreach lcheck [lreverse $ldtry] {
399 if {[cc-with [list -cflags "$cfound $lcheck"] {check-function-in-lib inflateEnd z}]} {
400 if {$lcheck eq ""} {
401 msg-result "Linked to zlib via default library path"
402 } else {
403 define-append EXTRA_LDFLAGS "$lcheck"
404 msg-result "Linked to zlib via $lcheck"
405 }
406 break
407 }
408 }
409 set ::zlib_lib -lz
410 }
411
412 set ssldirs [opt-val with-openssl]
@@ -418,10 +455,12 @@
455 }
456 if {$found} {
457 define FOSSIL_ENABLE_SSL
458 define-append EXTRA_CFLAGS $cflags
459 define-append EXTRA_LDFLAGS $ldflags
460 define-append CFLAGS $cflags
461 define-append LDFLAGS $ldflags
462 if {[info exists ssllibs]} {
463 define-append LIBS $ssllibs
464 } else {
465 define-append LIBS -lssl -lcrypto
466 }
@@ -618,10 +657,11 @@
657 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
658 if {!$tclprivatestubs} {
659 define-append LIBS $libs
660 }
661 define-append EXTRA_CFLAGS $cflags
662 define-append CFLAGS $cflags
663 if {[info exists zlibpath] && $zlibpath eq "tree"} {
664 #
665 # NOTE: When using zlib in the source tree, prevent Tcl from
666 # pulling in the system one.
667 #
@@ -728,10 +768,43 @@
768 define FOSSIL_HAVE_FUSEFS 1
769 define-append LIBS -lfuse
770 msg-result "FuseFS support enabled"
771 }
772 }
773
774 ########################################################################
775 # Checks the compiler for compile_commands.json support.
776 #
777 # Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
778 # if supported, "no" if not.
779 proc check-compile-commands {} {
780 msg-checking "compile_commands.json support... "
781 if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
782 # This test reportedly incorrectly succeeds on one of
783 # Martin G.'s older systems.
784 msg-result "compiler supports compile_commands.json"
785 define MAKE_COMPILATION_DB yes
786 return 1
787 } else {
788 msg-result "compiler does not support compile_commands.json"
789 define MAKE_COMPILATION_DB no
790 return 0
791 }
792 }
793
794 define MAKE_COMPILATION_DB no
795 if {!$outOfTreeBuild} {
796 if {[opt-bool compile-commands]} {
797 check-compile-commands
798 } else {
799 puts "Use --compile-commands to enable check for compile-commands-capable compiler."
800 }
801 } else {
802 puts "Disabling compile_commands.json check for out-of-tree build."
803 # This is an attempt to resolve the problem reported at
804 # https://fossil-scm.org/forum/forumpost/d19061d09a8179d0
805 }
806
807 # Add -fsanitize compile and link options late: we don't want the C
808 # checks above to run with those sanitizers enabled. It can not only
809 # be pointless, it can actually break correct tests.
810 set fsan [opt-val with-sanitizer]
811
--- autosetup/autosetup-find-tclsh
+++ autosetup/autosetup-find-tclsh
@@ -8,10 +8,10 @@
88
for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
99
{ $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
1010
done
1111
echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
1212
for cc in ${CC_FOR_BUILD:-cc} gcc; do
13
- { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
13
+ { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } >/dev/null 2>&1 || continue
1414
"$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
1515
done
1616
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
1717
echo false
1818
--- autosetup/autosetup-find-tclsh
+++ autosetup/autosetup-find-tclsh
@@ -8,10 +8,10 @@
8 for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
9 { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
10 done
11 echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
12 for cc in ${CC_FOR_BUILD:-cc} gcc; do
13 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
14 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
15 done
16 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
17 echo false
18
--- autosetup/autosetup-find-tclsh
+++ autosetup/autosetup-find-tclsh
@@ -8,10 +8,10 @@
8 for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
9 { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
10 done
11 echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
12 for cc in ${CC_FOR_BUILD:-cc} gcc; do
13 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } >/dev/null 2>&1 || continue
14 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
15 done
16 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
17 echo false
18
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,11 +1,11 @@
1
-cmake_minimum_required(VERSION 2.4.4)
1
+cmake_minimum_required(VERSION 2.4.4...3.15.0)
22
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
33
44
project(zlib C)
55
6
-set(VERSION "1.2.13")
6
+set(VERSION "1.3")
77
88
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
99
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
1010
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
1111
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
1212
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,11 +1,11 @@
1 cmake_minimum_required(VERSION 2.4.4)
2 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
3
4 project(zlib C)
5
6 set(VERSION "1.2.13")
7
8 set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
9 set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
10 set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
11 set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
12
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,11 +1,11 @@
1 cmake_minimum_required(VERSION 2.4.4...3.15.0)
2 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
3
4 project(zlib C)
5
6 set(VERSION "1.3")
7
8 set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
9 set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
10 set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
11 set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
12
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,26 @@
11
22
ChangeLog file for zlib
33
4
+Changes in 1.3 (18 Aug 2023)
5
+- Remove K&R function definitions and zlib2ansi
6
+- Fix bug in deflateBound() for level 0 and memLevel 9
7
+- Fix bug when gzungetc() is used immediately after gzopen()
8
+- Fix bug when using gzflush() with a very small buffer
9
+- Fix crash when gzsetparams() attempted for transparent write
10
+- Fix test/example.c to work with FORCE_STORED
11
+- Rewrite of zran in examples (see zran.c version history)
12
+- Fix minizip to allow it to open an empty zip file
13
+- Fix reading disk number start on zip64 files in minizip
14
+- Fix logic error in minizip argument processing
15
+- Add minizip testing to Makefile
16
+- Read multiple bytes instead of byte-by-byte in minizip unzip.c
17
+- Add memory sanitizer to configure (--memory)
18
+- Various portability improvements
19
+- Various documentation improvements
20
+- Various spelling and typo corrections
21
+
422
Changes in 1.2.13 (13 Oct 2022)
523
- Fix configure issue that discarded provided CC definition
624
- Correct incorrect inputs provided to the CRC functions
725
- Repair prototypes and exporting of new CRC functions
826
- Fix inflateBack to detect invalid input with distances too far
@@ -1443,11 +1461,11 @@
14431461
- fixed typo in zconf.h (_GNUC__ => __GNUC__)
14441462
- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
14451463
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
14461464
- in fcalloc, normalize pointer if size > 65520 bytes
14471465
- don't use special fcalloc for 32 bit Borland C++
1448
-- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
1466
+- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
14491467
- use Z_BINARY instead of BINARY
14501468
- document that gzclose after gzdopen will close the file
14511469
- allow "a" as mode in gzopen
14521470
- fix error checking in gzread
14531471
- allow skipping .gz extra-field on pipes
14541472
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,26 @@
1
2 ChangeLog file for zlib
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4 Changes in 1.2.13 (13 Oct 2022)
5 - Fix configure issue that discarded provided CC definition
6 - Correct incorrect inputs provided to the CRC functions
7 - Repair prototypes and exporting of new CRC functions
8 - Fix inflateBack to detect invalid input with distances too far
@@ -1443,11 +1461,11 @@
1443 - fixed typo in zconf.h (_GNUC__ => __GNUC__)
1444 - check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
1445 - fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
1446 - in fcalloc, normalize pointer if size > 65520 bytes
1447 - don't use special fcalloc for 32 bit Borland C++
1448 - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
1449 - use Z_BINARY instead of BINARY
1450 - document that gzclose after gzdopen will close the file
1451 - allow "a" as mode in gzopen
1452 - fix error checking in gzread
1453 - allow skipping .gz extra-field on pipes
1454
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,26 @@
1
2 ChangeLog file for zlib
3
4 Changes in 1.3 (18 Aug 2023)
5 - Remove K&R function definitions and zlib2ansi
6 - Fix bug in deflateBound() for level 0 and memLevel 9
7 - Fix bug when gzungetc() is used immediately after gzopen()
8 - Fix bug when using gzflush() with a very small buffer
9 - Fix crash when gzsetparams() attempted for transparent write
10 - Fix test/example.c to work with FORCE_STORED
11 - Rewrite of zran in examples (see zran.c version history)
12 - Fix minizip to allow it to open an empty zip file
13 - Fix reading disk number start on zip64 files in minizip
14 - Fix logic error in minizip argument processing
15 - Add minizip testing to Makefile
16 - Read multiple bytes instead of byte-by-byte in minizip unzip.c
17 - Add memory sanitizer to configure (--memory)
18 - Various portability improvements
19 - Various documentation improvements
20 - Various spelling and typo corrections
21
22 Changes in 1.2.13 (13 Oct 2022)
23 - Fix configure issue that discarded provided CC definition
24 - Correct incorrect inputs provided to the CRC functions
25 - Repair prototypes and exporting of new CRC functions
26 - Fix inflateBack to detect invalid input with distances too far
@@ -1443,11 +1461,11 @@
1461 - fixed typo in zconf.h (_GNUC__ => __GNUC__)
1462 - check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
1463 - fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
1464 - in fcalloc, normalize pointer if size > 65520 bytes
1465 - don't use special fcalloc for 32 bit Borland C++
1466 - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
1467 - use Z_BINARY instead of BINARY
1468 - document that gzclose after gzdopen will close the file
1469 - allow "a" as mode in gzopen
1470 - fix error checking in gzread
1471 - allow skipping .gz extra-field on pipes
1472
+1 -1
--- compat/zlib/FAQ
+++ compat/zlib/FAQ
@@ -2,11 +2,11 @@
22
Frequently Asked Questions about zlib
33
44
55
If your question is not there, please check the zlib home page
66
http://zlib.net/ which may have more recent information.
7
-The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
7
+The latest zlib FAQ is at http://zlib.net/zlib_faq.html
88
99
1010
1. Is zlib Y2K-compliant?
1111
1212
Yes. zlib doesn't handle dates.
1313
--- compat/zlib/FAQ
+++ compat/zlib/FAQ
@@ -2,11 +2,11 @@
2 Frequently Asked Questions about zlib
3
4
5 If your question is not there, please check the zlib home page
6 http://zlib.net/ which may have more recent information.
7 The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
8
9
10 1. Is zlib Y2K-compliant?
11
12 Yes. zlib doesn't handle dates.
13
--- compat/zlib/FAQ
+++ compat/zlib/FAQ
@@ -2,11 +2,11 @@
2 Frequently Asked Questions about zlib
3
4
5 If your question is not there, please check the zlib home page
6 http://zlib.net/ which may have more recent information.
7 The latest zlib FAQ is at http://zlib.net/zlib_faq.html
8
9
10 1. Is zlib Y2K-compliant?
11
12 Yes. zlib doesn't handle dates.
13
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -26,11 +26,11 @@
2626
LDSHARED=$(CC)
2727
CPP=$(CC) -E
2828
2929
STATICLIB=libz.a
3030
SHAREDLIB=libz.so
31
-SHAREDLIBV=libz.so.1.2.13
31
+SHAREDLIBV=libz.so.1.3
3232
SHAREDLIBM=libz.so.1
3333
LIBS=$(STATICLIB) $(SHAREDLIBV)
3434
3535
AR=ar
3636
ARFLAGS=rc
@@ -357,12 +357,18 @@
357357
rm $$TEMPFILE
358358
359359
zconf: $(SRCDIR)zconf.h.in
360360
cp -p $(SRCDIR)zconf.h.in zconf.h
361361
362
+minizip-test: static
363
+ cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
364
+
365
+minizip-clean:
366
+ cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
367
+
362368
mostlyclean: clean
363
-clean:
369
+clean: minizip-clean
364370
rm -f *.o *.lo *~ \
365371
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
366372
example64$(EXE) minigzip64$(EXE) \
367373
infcover \
368374
libz.* foo.gz so_locations \
369375
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -26,11 +26,11 @@
26 LDSHARED=$(CC)
27 CPP=$(CC) -E
28
29 STATICLIB=libz.a
30 SHAREDLIB=libz.so
31 SHAREDLIBV=libz.so.1.2.13
32 SHAREDLIBM=libz.so.1
33 LIBS=$(STATICLIB) $(SHAREDLIBV)
34
35 AR=ar
36 ARFLAGS=rc
@@ -357,12 +357,18 @@
357 rm $$TEMPFILE
358
359 zconf: $(SRCDIR)zconf.h.in
360 cp -p $(SRCDIR)zconf.h.in zconf.h
361
 
 
 
 
 
 
362 mostlyclean: clean
363 clean:
364 rm -f *.o *.lo *~ \
365 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
366 example64$(EXE) minigzip64$(EXE) \
367 infcover \
368 libz.* foo.gz so_locations \
369
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -26,11 +26,11 @@
26 LDSHARED=$(CC)
27 CPP=$(CC) -E
28
29 STATICLIB=libz.a
30 SHAREDLIB=libz.so
31 SHAREDLIBV=libz.so.1.3
32 SHAREDLIBM=libz.so.1
33 LIBS=$(STATICLIB) $(SHAREDLIBV)
34
35 AR=ar
36 ARFLAGS=rc
@@ -357,12 +357,18 @@
357 rm $$TEMPFILE
358
359 zconf: $(SRCDIR)zconf.h.in
360 cp -p $(SRCDIR)zconf.h.in zconf.h
361
362 minizip-test: static
363 cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
364
365 minizip-clean:
366 cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
367
368 mostlyclean: clean
369 clean: minizip-clean
370 rm -f *.o *.lo *~ \
371 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
372 example64$(EXE) minigzip64$(EXE) \
373 infcover \
374 libz.* foo.gz so_locations \
375
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
11
ZLIB DATA COMPRESSION LIBRARY
22
3
-zlib 1.2.13 is a general purpose data compression library. All the code is
3
+zlib 1.3 is a general purpose data compression library. All the code is
44
thread safe. The data format used by the zlib library is described by RFCs
55
(Request for Comments) 1950 to 1952 in the files
66
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
77
rfc1952 (gzip format).
88
@@ -27,22 +27,21 @@
2727
2828
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
2929
3030
Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
3131
issue of Dr. Dobb's Journal; a copy of the article is available at
32
-http://marknelson.us/1997/01/01/zlib-engine/ .
32
+https://marknelson.us/posts/1997/01/01/zlib-engine.html .
3333
34
-The changes made in version 1.2.13 are documented in the file ChangeLog.
34
+The changes made in version 1.3 are documented in the file ChangeLog.
3535
3636
Unsupported third party contributions are provided in directory contrib/ .
3737
38
-zlib is available in Java using the java.util.zip package, documented at
39
-http://java.sun.com/developer/technicalArticles/Programming/compression/ .
38
+zlib is available in Java using the java.util.zip package. Follow the API
39
+Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
4040
41
-A Perl interface to zlib written by Paul Marquess <[email protected]> is available
42
-at CPAN (Comprehensive Perl Archive Network) sites, including
43
-http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
41
+A Perl interface to zlib and bzip2 written by Paul Marquess <[email protected]>
42
+can be found at https://github.com/pmqs/IO-Compress .
4443
4544
A Python interface to zlib written by A.M. Kuchling <[email protected]> is
4645
available in Python 1.5 and later versions, see
4746
http://docs.python.org/library/zlib.html .
4847
@@ -62,11 +61,11 @@
6261
compiler flag). The compiler bug has been reported to SGI.
6362
6463
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
6564
when compiled with cc.
6665
67
-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
66
+- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
6867
necessary to get gzprintf working correctly. This is done by configure.
6968
7069
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
7170
other compilers. Use "make test" to check your compiler.
7271
@@ -82,11 +81,11 @@
8281
people who reported problems and suggested various improvements in zlib; they
8382
are too numerous to cite here.
8483
8584
Copyright notice:
8685
87
- (C) 1995-2022 Jean-loup Gailly and Mark Adler
86
+ (C) 1995-2023 Jean-loup Gailly and Mark Adler
8887
8988
This software is provided 'as-is', without any express or implied
9089
warranty. In no event will the authors be held liable for any damages
9190
arising from the use of this software.
9291
9392
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.2.13 is a general purpose data compression library. All the code is
4 thread safe. The data format used by the zlib library is described by RFCs
5 (Request for Comments) 1950 to 1952 in the files
6 http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
7 rfc1952 (gzip format).
8
@@ -27,22 +27,21 @@
27
28 PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
29
30 Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
31 issue of Dr. Dobb's Journal; a copy of the article is available at
32 http://marknelson.us/1997/01/01/zlib-engine/ .
33
34 The changes made in version 1.2.13 are documented in the file ChangeLog.
35
36 Unsupported third party contributions are provided in directory contrib/ .
37
38 zlib is available in Java using the java.util.zip package, documented at
39 http://java.sun.com/developer/technicalArticles/Programming/compression/ .
40
41 A Perl interface to zlib written by Paul Marquess <[email protected]> is available
42 at CPAN (Comprehensive Perl Archive Network) sites, including
43 http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
44
45 A Python interface to zlib written by A.M. Kuchling <[email protected]> is
46 available in Python 1.5 and later versions, see
47 http://docs.python.org/library/zlib.html .
48
@@ -62,11 +61,11 @@
62 compiler flag). The compiler bug has been reported to SGI.
63
64 - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
65 when compiled with cc.
66
67 - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
68 necessary to get gzprintf working correctly. This is done by configure.
69
70 - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
71 other compilers. Use "make test" to check your compiler.
72
@@ -82,11 +81,11 @@
82 people who reported problems and suggested various improvements in zlib; they
83 are too numerous to cite here.
84
85 Copyright notice:
86
87 (C) 1995-2022 Jean-loup Gailly and Mark Adler
88
89 This software is provided 'as-is', without any express or implied
90 warranty. In no event will the authors be held liable for any damages
91 arising from the use of this software.
92
93
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.3 is a general purpose data compression library. All the code is
4 thread safe. The data format used by the zlib library is described by RFCs
5 (Request for Comments) 1950 to 1952 in the files
6 http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
7 rfc1952 (gzip format).
8
@@ -27,22 +27,21 @@
27
28 PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
29
30 Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
31 issue of Dr. Dobb's Journal; a copy of the article is available at
32 https://marknelson.us/posts/1997/01/01/zlib-engine.html .
33
34 The changes made in version 1.3 are documented in the file ChangeLog.
35
36 Unsupported third party contributions are provided in directory contrib/ .
37
38 zlib is available in Java using the java.util.zip package. Follow the API
39 Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
40
41 A Perl interface to zlib and bzip2 written by Paul Marquess <[email protected]>
42 can be found at https://github.com/pmqs/IO-Compress .
 
43
44 A Python interface to zlib written by A.M. Kuchling <[email protected]> is
45 available in Python 1.5 and later versions, see
46 http://docs.python.org/library/zlib.html .
47
@@ -62,11 +61,11 @@
61 compiler flag). The compiler bug has been reported to SGI.
62
63 - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
64 when compiled with cc.
65
66 - On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
67 necessary to get gzprintf working correctly. This is done by configure.
68
69 - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
70 other compilers. Use "make test" to check your compiler.
71
@@ -82,11 +81,11 @@
81 people who reported problems and suggested various improvements in zlib; they
82 are too numerous to cite here.
83
84 Copyright notice:
85
86 (C) 1995-2023 Jean-loup Gailly and Mark Adler
87
88 This software is provided 'as-is', without any express or implied
89 warranty. In no event will the authors be held liable for any damages
90 arising from the use of this software.
91
92
--- compat/zlib/adler32.c
+++ compat/zlib/adler32.c
@@ -5,12 +5,10 @@
55
66
/* @(#) $Id$ */
77
88
#include "zutil.h"
99
10
-local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11
-
1210
#define BASE 65521U /* largest prime smaller than 65536 */
1311
#define NMAX 5552
1412
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
1513
1614
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
@@ -58,15 +56,11 @@
5856
# define MOD28(a) a %= BASE
5957
# define MOD63(a) a %= BASE
6058
#endif
6159
6260
/* ========================================================================= */
63
-uLong ZEXPORT adler32_z(adler, buf, len)
64
- uLong adler;
65
- const Bytef *buf;
66
- z_size_t len;
67
-{
61
+uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
6862
unsigned long sum2;
6963
unsigned n;
7064
7165
/* split Adler-32 into component sums */
7266
sum2 = (adler >> 16) & 0xffff;
@@ -129,24 +123,16 @@
129123
/* return recombined sums */
130124
return adler | (sum2 << 16);
131125
}
132126
133127
/* ========================================================================= */
134
-uLong ZEXPORT adler32(adler, buf, len)
135
- uLong adler;
136
- const Bytef *buf;
137
- uInt len;
138
-{
128
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
139129
return adler32_z(adler, buf, len);
140130
}
141131
142132
/* ========================================================================= */
143
-local uLong adler32_combine_(adler1, adler2, len2)
144
- uLong adler1;
145
- uLong adler2;
146
- z_off64_t len2;
147
-{
133
+local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
148134
unsigned long sum1;
149135
unsigned long sum2;
150136
unsigned rem;
151137
152138
/* for negative len, return invalid adler32 as a clue for debugging */
@@ -167,20 +153,12 @@
167153
if (sum2 >= BASE) sum2 -= BASE;
168154
return sum1 | (sum2 << 16);
169155
}
170156
171157
/* ========================================================================= */
172
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
173
- uLong adler1;
174
- uLong adler2;
175
- z_off_t len2;
176
-{
158
+uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
177159
return adler32_combine_(adler1, adler2, len2);
178160
}
179161
180
-uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181
- uLong adler1;
182
- uLong adler2;
183
- z_off64_t len2;
184
-{
162
+uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
185163
return adler32_combine_(adler1, adler2, len2);
186164
}
187165
--- compat/zlib/adler32.c
+++ compat/zlib/adler32.c
@@ -5,12 +5,10 @@
5
6 /* @(#) $Id$ */
7
8 #include "zutil.h"
9
10 local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11
12 #define BASE 65521U /* largest prime smaller than 65536 */
13 #define NMAX 5552
14 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
15
16 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
@@ -58,15 +56,11 @@
58 # define MOD28(a) a %= BASE
59 # define MOD63(a) a %= BASE
60 #endif
61
62 /* ========================================================================= */
63 uLong ZEXPORT adler32_z(adler, buf, len)
64 uLong adler;
65 const Bytef *buf;
66 z_size_t len;
67 {
68 unsigned long sum2;
69 unsigned n;
70
71 /* split Adler-32 into component sums */
72 sum2 = (adler >> 16) & 0xffff;
@@ -129,24 +123,16 @@
129 /* return recombined sums */
130 return adler | (sum2 << 16);
131 }
132
133 /* ========================================================================= */
134 uLong ZEXPORT adler32(adler, buf, len)
135 uLong adler;
136 const Bytef *buf;
137 uInt len;
138 {
139 return adler32_z(adler, buf, len);
140 }
141
142 /* ========================================================================= */
143 local uLong adler32_combine_(adler1, adler2, len2)
144 uLong adler1;
145 uLong adler2;
146 z_off64_t len2;
147 {
148 unsigned long sum1;
149 unsigned long sum2;
150 unsigned rem;
151
152 /* for negative len, return invalid adler32 as a clue for debugging */
@@ -167,20 +153,12 @@
167 if (sum2 >= BASE) sum2 -= BASE;
168 return sum1 | (sum2 << 16);
169 }
170
171 /* ========================================================================= */
172 uLong ZEXPORT adler32_combine(adler1, adler2, len2)
173 uLong adler1;
174 uLong adler2;
175 z_off_t len2;
176 {
177 return adler32_combine_(adler1, adler2, len2);
178 }
179
180 uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181 uLong adler1;
182 uLong adler2;
183 z_off64_t len2;
184 {
185 return adler32_combine_(adler1, adler2, len2);
186 }
187
--- compat/zlib/adler32.c
+++ compat/zlib/adler32.c
@@ -5,12 +5,10 @@
5
6 /* @(#) $Id$ */
7
8 #include "zutil.h"
9
 
 
10 #define BASE 65521U /* largest prime smaller than 65536 */
11 #define NMAX 5552
12 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
13
14 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
@@ -58,15 +56,11 @@
56 # define MOD28(a) a %= BASE
57 # define MOD63(a) a %= BASE
58 #endif
59
60 /* ========================================================================= */
61 uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
 
 
 
 
62 unsigned long sum2;
63 unsigned n;
64
65 /* split Adler-32 into component sums */
66 sum2 = (adler >> 16) & 0xffff;
@@ -129,24 +123,16 @@
123 /* return recombined sums */
124 return adler | (sum2 << 16);
125 }
126
127 /* ========================================================================= */
128 uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
 
 
 
 
129 return adler32_z(adler, buf, len);
130 }
131
132 /* ========================================================================= */
133 local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
 
 
 
 
134 unsigned long sum1;
135 unsigned long sum2;
136 unsigned rem;
137
138 /* for negative len, return invalid adler32 as a clue for debugging */
@@ -167,20 +153,12 @@
153 if (sum2 >= BASE) sum2 -= BASE;
154 return sum1 | (sum2 << 16);
155 }
156
157 /* ========================================================================= */
158 uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
 
 
 
 
159 return adler32_combine_(adler1, adler2, len2);
160 }
161
162 uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
 
 
 
 
163 return adler32_combine_(adler1, adler2, len2);
164 }
165
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -17,17 +17,12 @@
1717
1818
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1919
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
2020
Z_STREAM_ERROR if the level parameter is invalid.
2121
*/
22
-int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
23
- Bytef *dest;
24
- uLongf *destLen;
25
- const Bytef *source;
26
- uLong sourceLen;
27
- int level;
28
-{
22
+int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
23
+ uLong sourceLen, int level) {
2924
z_stream stream;
3025
int err;
3126
const uInt max = (uInt)-1;
3227
uLong left;
3328
@@ -63,24 +58,18 @@
6358
return err == Z_STREAM_END ? Z_OK : err;
6459
}
6560
6661
/* ===========================================================================
6762
*/
68
-int ZEXPORT compress(dest, destLen, source, sourceLen)
69
- Bytef *dest;
70
- uLongf *destLen;
71
- const Bytef *source;
72
- uLong sourceLen;
73
-{
63
+int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
64
+ uLong sourceLen) {
7465
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
7566
}
7667
7768
/* ===========================================================================
7869
If the default memLevel or windowBits for deflateInit() is changed, then
7970
this function needs to be updated.
8071
*/
81
-uLong ZEXPORT compressBound(sourceLen)
82
- uLong sourceLen;
83
-{
72
+uLong ZEXPORT compressBound(uLong sourceLen) {
8473
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
8574
(sourceLen >> 25) + 13;
8675
}
8776
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -17,17 +17,12 @@
17
18 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
19 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
20 Z_STREAM_ERROR if the level parameter is invalid.
21 */
22 int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
23 Bytef *dest;
24 uLongf *destLen;
25 const Bytef *source;
26 uLong sourceLen;
27 int level;
28 {
29 z_stream stream;
30 int err;
31 const uInt max = (uInt)-1;
32 uLong left;
33
@@ -63,24 +58,18 @@
63 return err == Z_STREAM_END ? Z_OK : err;
64 }
65
66 /* ===========================================================================
67 */
68 int ZEXPORT compress(dest, destLen, source, sourceLen)
69 Bytef *dest;
70 uLongf *destLen;
71 const Bytef *source;
72 uLong sourceLen;
73 {
74 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
75 }
76
77 /* ===========================================================================
78 If the default memLevel or windowBits for deflateInit() is changed, then
79 this function needs to be updated.
80 */
81 uLong ZEXPORT compressBound(sourceLen)
82 uLong sourceLen;
83 {
84 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
85 (sourceLen >> 25) + 13;
86 }
87
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -17,17 +17,12 @@
17
18 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
19 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
20 Z_STREAM_ERROR if the level parameter is invalid.
21 */
22 int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
23 uLong sourceLen, int level) {
 
 
 
 
 
24 z_stream stream;
25 int err;
26 const uInt max = (uInt)-1;
27 uLong left;
28
@@ -63,24 +58,18 @@
58 return err == Z_STREAM_END ? Z_OK : err;
59 }
60
61 /* ===========================================================================
62 */
63 int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
64 uLong sourceLen) {
 
 
 
 
65 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
66 }
67
68 /* ===========================================================================
69 If the default memLevel or windowBits for deflateInit() is changed, then
70 this function needs to be updated.
71 */
72 uLong ZEXPORT compressBound(uLong sourceLen) {
 
 
73 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
74 (sourceLen >> 25) + 13;
75 }
76
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -42,12 +42,10 @@
4242
# destination name for static library
4343
STATICLIB=libz.a
4444
4545
# extract zlib version numbers from zlib.h
4646
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
47
-VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
48
-VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
4947
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
5048
5149
# establish commands for library building
5250
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
5351
AR=${AR-"${CROSS_PREFIX}ar"}
@@ -88,11 +86,12 @@
8886
zconst=0
8987
build64=0
9088
gcc=0
9189
warn=0
9290
debug=0
93
-sanitize=0
91
+address=0
92
+memory=0
9493
old_cc="$CC"
9594
old_cflags="$CFLAGS"
9695
OBJC='$(OBJZ) $(OBJG)'
9796
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
9897
@@ -100,11 +99,11 @@
10099
leave()
101100
{
102101
if test "$*" != "0"; then
103102
echo "** $0 aborting." | tee -a configure.log
104103
fi
105
- rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
104
+ rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
106105
echo -------------------- >> configure.log
107106
echo >> configure.log
108107
echo >> configure.log
109108
exit $1
110109
}
@@ -139,11 +138,13 @@
139138
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
140139
--localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
141140
-c* | --const) zconst=1; shift ;;
142141
-w* | --warn) warn=1; shift ;;
143142
-d* | --debug) debug=1; shift ;;
144
- --sanitize) sanitize=1; shift ;;
143
+ --sanitize) address=1; shift ;;
144
+ --address) address=1; shift ;;
145
+ --memory) memory=1; shift ;;
145146
*)
146147
echo "unknown option: $1" | tee -a configure.log
147148
echo "$0 --help for help" | tee -a configure.log
148149
leave 1;;
149150
esac
@@ -209,12 +210,15 @@
209210
CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST"
210211
else
211212
CFLAGS="${CFLAGS} -Wall -Wextra"
212213
fi
213214
fi
214
- if test $sanitize -eq 1; then
215
- CFLAGS="${CFLAGS} -g -fsanitize=address"
215
+ if test $address -eq 1; then
216
+ CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
217
+ fi
218
+ if test $memory -eq 1; then
219
+ CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
216220
fi
217221
if test $debug -eq 1; then
218222
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
219223
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
220224
fi
@@ -257,12 +261,14 @@
257261
Darwin* | darwin* | *-darwin*)
258262
shared_ext='.dylib'
259263
SHAREDLIB=libz$shared_ext
260264
SHAREDLIBV=libz.$VER$shared_ext
261265
SHAREDLIBM=libz.$VER1$shared_ext
262
- LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
263
- if libtool -V 2>&1 | grep Apple > /dev/null; then
266
+ LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"}
267
+ if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
268
+ AR="${CROSS_PREFIX}libtool"
269
+ elif libtool -V 2>&1 | grep Apple > /dev/null; then
264270
AR="libtool"
265271
else
266272
AR="/usr/bin/libtool"
267273
fi
268274
ARFLAGS="-o" ;;
@@ -858,11 +864,11 @@
858864
echo mandir = $mandir >> configure.log
859865
echo prefix = $prefix >> configure.log
860866
echo sharedlibdir = $sharedlibdir >> configure.log
861867
echo uname = $uname >> configure.log
862868
863
-# udpate Makefile with the configure results
869
+# update Makefile with the configure results
864870
sed < ${SRCDIR}Makefile.in "
865871
/^CC *=/s#=.*#=$CC#
866872
/^CFLAGS *=/s#=.*#=$CFLAGS#
867873
/^SFLAGS *=/s#=.*#=$SFLAGS#
868874
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
869875
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -42,12 +42,10 @@
42 # destination name for static library
43 STATICLIB=libz.a
44
45 # extract zlib version numbers from zlib.h
46 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
47 VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
48 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
49 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
50
51 # establish commands for library building
52 if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
53 AR=${AR-"${CROSS_PREFIX}ar"}
@@ -88,11 +86,12 @@
88 zconst=0
89 build64=0
90 gcc=0
91 warn=0
92 debug=0
93 sanitize=0
 
94 old_cc="$CC"
95 old_cflags="$CFLAGS"
96 OBJC='$(OBJZ) $(OBJG)'
97 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
98
@@ -100,11 +99,11 @@
100 leave()
101 {
102 if test "$*" != "0"; then
103 echo "** $0 aborting." | tee -a configure.log
104 fi
105 rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
106 echo -------------------- >> configure.log
107 echo >> configure.log
108 echo >> configure.log
109 exit $1
110 }
@@ -139,11 +138,13 @@
139 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
140 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
141 -c* | --const) zconst=1; shift ;;
142 -w* | --warn) warn=1; shift ;;
143 -d* | --debug) debug=1; shift ;;
144 --sanitize) sanitize=1; shift ;;
 
 
145 *)
146 echo "unknown option: $1" | tee -a configure.log
147 echo "$0 --help for help" | tee -a configure.log
148 leave 1;;
149 esac
@@ -209,12 +210,15 @@
209 CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST"
210 else
211 CFLAGS="${CFLAGS} -Wall -Wextra"
212 fi
213 fi
214 if test $sanitize -eq 1; then
215 CFLAGS="${CFLAGS} -g -fsanitize=address"
 
 
 
216 fi
217 if test $debug -eq 1; then
218 CFLAGS="${CFLAGS} -DZLIB_DEBUG"
219 SFLAGS="${SFLAGS} -DZLIB_DEBUG"
220 fi
@@ -257,12 +261,14 @@
257 Darwin* | darwin* | *-darwin*)
258 shared_ext='.dylib'
259 SHAREDLIB=libz$shared_ext
260 SHAREDLIBV=libz.$VER$shared_ext
261 SHAREDLIBM=libz.$VER1$shared_ext
262 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
263 if libtool -V 2>&1 | grep Apple > /dev/null; then
 
 
264 AR="libtool"
265 else
266 AR="/usr/bin/libtool"
267 fi
268 ARFLAGS="-o" ;;
@@ -858,11 +864,11 @@
858 echo mandir = $mandir >> configure.log
859 echo prefix = $prefix >> configure.log
860 echo sharedlibdir = $sharedlibdir >> configure.log
861 echo uname = $uname >> configure.log
862
863 # udpate Makefile with the configure results
864 sed < ${SRCDIR}Makefile.in "
865 /^CC *=/s#=.*#=$CC#
866 /^CFLAGS *=/s#=.*#=$CFLAGS#
867 /^SFLAGS *=/s#=.*#=$SFLAGS#
868 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
869
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -42,12 +42,10 @@
42 # destination name for static library
43 STATICLIB=libz.a
44
45 # extract zlib version numbers from zlib.h
46 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
 
 
47 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
48
49 # establish commands for library building
50 if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
51 AR=${AR-"${CROSS_PREFIX}ar"}
@@ -88,11 +86,12 @@
86 zconst=0
87 build64=0
88 gcc=0
89 warn=0
90 debug=0
91 address=0
92 memory=0
93 old_cc="$CC"
94 old_cflags="$CFLAGS"
95 OBJC='$(OBJZ) $(OBJG)'
96 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
97
@@ -100,11 +99,11 @@
99 leave()
100 {
101 if test "$*" != "0"; then
102 echo "** $0 aborting." | tee -a configure.log
103 fi
104 rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
105 echo -------------------- >> configure.log
106 echo >> configure.log
107 echo >> configure.log
108 exit $1
109 }
@@ -139,11 +138,13 @@
138 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
139 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
140 -c* | --const) zconst=1; shift ;;
141 -w* | --warn) warn=1; shift ;;
142 -d* | --debug) debug=1; shift ;;
143 --sanitize) address=1; shift ;;
144 --address) address=1; shift ;;
145 --memory) memory=1; shift ;;
146 *)
147 echo "unknown option: $1" | tee -a configure.log
148 echo "$0 --help for help" | tee -a configure.log
149 leave 1;;
150 esac
@@ -209,12 +210,15 @@
210 CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST"
211 else
212 CFLAGS="${CFLAGS} -Wall -Wextra"
213 fi
214 fi
215 if test $address -eq 1; then
216 CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
217 fi
218 if test $memory -eq 1; then
219 CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
220 fi
221 if test $debug -eq 1; then
222 CFLAGS="${CFLAGS} -DZLIB_DEBUG"
223 SFLAGS="${SFLAGS} -DZLIB_DEBUG"
224 fi
@@ -257,12 +261,14 @@
261 Darwin* | darwin* | *-darwin*)
262 shared_ext='.dylib'
263 SHAREDLIB=libz$shared_ext
264 SHAREDLIBV=libz.$VER$shared_ext
265 SHAREDLIBM=libz.$VER1$shared_ext
266 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"}
267 if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
268 AR="${CROSS_PREFIX}libtool"
269 elif libtool -V 2>&1 | grep Apple > /dev/null; then
270 AR="libtool"
271 else
272 AR="/usr/bin/libtool"
273 fi
274 ARFLAGS="-o" ;;
@@ -858,11 +864,11 @@
864 echo mandir = $mandir >> configure.log
865 echo prefix = $prefix >> configure.log
866 echo sharedlibdir = $sharedlibdir >> configure.log
867 echo uname = $uname >> configure.log
868
869 # update Makefile with the configure results
870 sed < ${SRCDIR}Makefile.in "
871 /^CC *=/s#=.*#=$CC#
872 /^CFLAGS *=/s#=.*#=$CFLAGS#
873 /^SFLAGS *=/s#=.*#=$SFLAGS#
874 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
875
--- compat/zlib/contrib/delphi/ZLib.pas
+++ compat/zlib/contrib/delphi/ZLib.pas
@@ -150,11 +150,11 @@
150150
BufSize = number of bytes in OutBuf }
151151
procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152152
const OutBuf: Pointer; BufSize: Integer);
153153
154154
const
155
- zlib_version = '1.2.13';
155
+ zlib_version = '1.3.0';
156156
157157
type
158158
EZlibError = class(Exception);
159159
ECompressionError = class(EZlibError);
160160
EDecompressionError = class(EZlibError);
161161
--- compat/zlib/contrib/delphi/ZLib.pas
+++ compat/zlib/contrib/delphi/ZLib.pas
@@ -150,11 +150,11 @@
150 BufSize = number of bytes in OutBuf }
151 procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer);
153
154 const
155 zlib_version = '1.2.13';
156
157 type
158 EZlibError = class(Exception);
159 ECompressionError = class(EZlibError);
160 EDecompressionError = class(EZlibError);
161
--- compat/zlib/contrib/delphi/ZLib.pas
+++ compat/zlib/contrib/delphi/ZLib.pas
@@ -150,11 +150,11 @@
150 BufSize = number of bytes in OutBuf }
151 procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer);
153
154 const
155 zlib_version = '1.3.0';
156
157 type
158 EZlibError = class(Exception);
159 ECompressionError = class(EZlibError);
160 EDecompressionError = class(EZlibError);
161
--- compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
@@ -59,11 +59,11 @@
5959
/// <param name="offset">Where in <c>data</c> to start updating</param>
6060
/// <param name="count">The number of bytes from <c>data</c> to use</param>
6161
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
6262
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
6363
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
64
- /// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
64
+ /// <remarks>All the other <c>Update</c> methods are implemented in terms of this one.
6565
/// This is therefore the only method a derived class has to implement</remarks>
6666
public abstract void Update(byte[] data, int offset, int count);
6767
6868
/// <summary>
6969
/// Updates the current checksum with an array of bytes.
7070
--- compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
@@ -59,11 +59,11 @@
59 /// <param name="offset">Where in <c>data</c> to start updating</param>
60 /// <param name="count">The number of bytes from <c>data</c> to use</param>
61 /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
62 /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
63 /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
64 /// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
65 /// This is therefore the only method a derived class has to implement</remarks>
66 public abstract void Update(byte[] data, int offset, int count);
67
68 /// <summary>
69 /// Updates the current checksum with an array of bytes.
70
--- compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
@@ -59,11 +59,11 @@
59 /// <param name="offset">Where in <c>data</c> to start updating</param>
60 /// <param name="count">The number of bytes from <c>data</c> to use</param>
61 /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
62 /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
63 /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
64 /// <remarks>All the other <c>Update</c> methods are implemented in terms of this one.
65 /// This is therefore the only method a derived class has to implement</remarks>
66 public abstract void Update(byte[] data, int offset, int count);
67
68 /// <summary>
69 /// Updates the current checksum with an array of bytes.
70
--- compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
@@ -137,11 +137,11 @@
137137
/// Performs any codec specific cleanup
138138
/// </summary>
139139
/// <remarks>This must be implemented by a derived class</remarks>
140140
protected abstract void CleanUp();
141141
142
- // performs the release of the handles and calls the dereived CleanUp()
142
+ // performs the release of the handles and calls the derived CleanUp()
143143
private void CleanUp(bool isDisposing)
144144
{
145145
if (!_isDisposed)
146146
{
147147
CleanUp();
@@ -158,11 +158,11 @@
158158
#endregion
159159
160160
#region Helper methods
161161
162162
/// <summary>
163
- /// Copies a number of bytes to the internal codec buffer - ready for proccesing
163
+ /// Copies a number of bytes to the internal codec buffer - ready for processing
164164
/// </summary>
165165
/// <param name="data">The byte array that contains the data to copy</param>
166166
/// <param name="startIndex">The index of the first byte to copy</param>
167167
/// <param name="count">The number of bytes to copy from <c>data</c></param>
168168
protected void copyInput(byte[] data, int startIndex, int count)
169169
--- compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
@@ -137,11 +137,11 @@
137 /// Performs any codec specific cleanup
138 /// </summary>
139 /// <remarks>This must be implemented by a derived class</remarks>
140 protected abstract void CleanUp();
141
142 // performs the release of the handles and calls the dereived CleanUp()
143 private void CleanUp(bool isDisposing)
144 {
145 if (!_isDisposed)
146 {
147 CleanUp();
@@ -158,11 +158,11 @@
158 #endregion
159
160 #region Helper methods
161
162 /// <summary>
163 /// Copies a number of bytes to the internal codec buffer - ready for proccesing
164 /// </summary>
165 /// <param name="data">The byte array that contains the data to copy</param>
166 /// <param name="startIndex">The index of the first byte to copy</param>
167 /// <param name="count">The number of bytes to copy from <c>data</c></param>
168 protected void copyInput(byte[] data, int startIndex, int count)
169
--- compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
@@ -137,11 +137,11 @@
137 /// Performs any codec specific cleanup
138 /// </summary>
139 /// <remarks>This must be implemented by a derived class</remarks>
140 protected abstract void CleanUp();
141
142 // performs the release of the handles and calls the derived CleanUp()
143 private void CleanUp(bool isDisposing)
144 {
145 if (!_isDisposed)
146 {
147 CleanUp();
@@ -158,11 +158,11 @@
158 #endregion
159
160 #region Helper methods
161
162 /// <summary>
163 /// Copies a number of bytes to the internal codec buffer - ready for processing
164 /// </summary>
165 /// <param name="data">The byte array that contains the data to copy</param>
166 /// <param name="startIndex">The index of the first byte to copy</param>
167 /// <param name="count">The number of bytes to copy from <c>data</c></param>
168 protected void copyInput(byte[] data, int startIndex, int count)
169
--- compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
@@ -244,11 +244,11 @@
244244
{
245245
throw new NotSupportedException();
246246
}
247247
248248
/// <summary>
249
- /// Not suppported.
249
+ /// Not supported.
250250
/// </summary>
251251
/// <param name="offset"></param>
252252
/// <param name="origin"></param>
253253
/// <returns></returns>
254254
/// <exception cref="NotSupportedException">Always thrown</exception>
@@ -266,11 +266,11 @@
266266
{
267267
// left empty on purpose
268268
}
269269
270270
/// <summary>
271
- /// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
271
+ /// Gets/sets the current position in the <c>GZipStream</c>. Not supported.
272272
/// </summary>
273273
/// <remarks>In this implementation this property is not supported</remarks>
274274
/// <exception cref="NotSupportedException">Always thrown</exception>
275275
public override long Position
276276
{
@@ -283,11 +283,11 @@
283283
throw new NotSupportedException();
284284
}
285285
}
286286
287287
/// <summary>
288
- /// Gets the size of the stream. Not suppported.
288
+ /// Gets the size of the stream. Not supported.
289289
/// </summary>
290290
/// <remarks>In this implementation this property is not supported</remarks>
291291
/// <exception cref="NotSupportedException">Always thrown</exception>
292292
public override long Length
293293
{
294294
--- compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
@@ -244,11 +244,11 @@
244 {
245 throw new NotSupportedException();
246 }
247
248 /// <summary>
249 /// Not suppported.
250 /// </summary>
251 /// <param name="offset"></param>
252 /// <param name="origin"></param>
253 /// <returns></returns>
254 /// <exception cref="NotSupportedException">Always thrown</exception>
@@ -266,11 +266,11 @@
266 {
267 // left empty on purpose
268 }
269
270 /// <summary>
271 /// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
272 /// </summary>
273 /// <remarks>In this implementation this property is not supported</remarks>
274 /// <exception cref="NotSupportedException">Always thrown</exception>
275 public override long Position
276 {
@@ -283,11 +283,11 @@
283 throw new NotSupportedException();
284 }
285 }
286
287 /// <summary>
288 /// Gets the size of the stream. Not suppported.
289 /// </summary>
290 /// <remarks>In this implementation this property is not supported</remarks>
291 /// <exception cref="NotSupportedException">Always thrown</exception>
292 public override long Length
293 {
294
--- compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
@@ -244,11 +244,11 @@
244 {
245 throw new NotSupportedException();
246 }
247
248 /// <summary>
249 /// Not supported.
250 /// </summary>
251 /// <param name="offset"></param>
252 /// <param name="origin"></param>
253 /// <returns></returns>
254 /// <exception cref="NotSupportedException">Always thrown</exception>
@@ -266,11 +266,11 @@
266 {
267 // left empty on purpose
268 }
269
270 /// <summary>
271 /// Gets/sets the current position in the <c>GZipStream</c>. Not supported.
272 /// </summary>
273 /// <remarks>In this implementation this property is not supported</remarks>
274 /// <exception cref="NotSupportedException">Always thrown</exception>
275 public override long Position
276 {
@@ -283,11 +283,11 @@
283 throw new NotSupportedException();
284 }
285 }
286
287 /// <summary>
288 /// Gets the size of the stream. Not supported.
289 /// </summary>
290 /// <remarks>In this implementation this property is not supported</remarks>
291 /// <exception cref="NotSupportedException">Always thrown</exception>
292 public override long Length
293 {
294
--- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -154,11 +154,11 @@
154154
#region Info tests
155155
[Test]
156156
public void Info_Version()
157157
{
158158
Info info = new Info();
159
- Assert.AreEqual("1.2.13", Info.Version);
159
+ Assert.AreEqual("1.3.0", Info.Version);
160160
Assert.AreEqual(32, info.SizeOfUInt);
161161
Assert.AreEqual(32, info.SizeOfULong);
162162
Assert.AreEqual(32, info.SizeOfPointer);
163163
Assert.AreEqual(32, info.SizeOfOffset);
164164
}
165165
--- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -154,11 +154,11 @@
154 #region Info tests
155 [Test]
156 public void Info_Version()
157 {
158 Info info = new Info();
159 Assert.AreEqual("1.2.13", Info.Version);
160 Assert.AreEqual(32, info.SizeOfUInt);
161 Assert.AreEqual(32, info.SizeOfULong);
162 Assert.AreEqual(32, info.SizeOfPointer);
163 Assert.AreEqual(32, info.SizeOfOffset);
164 }
165
--- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -154,11 +154,11 @@
154 #region Info tests
155 [Test]
156 public void Info_Version()
157 {
158 Info info = new Info();
159 Assert.AreEqual("1.3.0", Info.Version);
160 Assert.AreEqual(32, info.SizeOfUInt);
161 Assert.AreEqual(32, info.SizeOfULong);
162 Assert.AreEqual(32, info.SizeOfPointer);
163 Assert.AreEqual(32, info.SizeOfOffset);
164 }
165
--- compat/zlib/contrib/dotzlib/readme.txt
+++ compat/zlib/contrib/dotzlib/readme.txt
@@ -34,11 +34,11 @@
3434
2. Using NAnt:
3535
Open a command prompt with access to the build environment and run nant
3636
in the same directory as the DotZLib.build file.
3737
You can define 2 properties on the nant command-line to control the build:
3838
debug={true|false} to toggle between release/debug builds (default=true).
39
- nunit={true|false} to include or esclude unit tests (default=true).
39
+ nunit={true|false} to include or exclude unit tests (default=true).
4040
Also the target clean will remove binaries.
4141
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
4242
or ./DotZLib/bin/debug, depending on whether you are building the release
4343
or debug version of the library.
4444
4545
--- compat/zlib/contrib/dotzlib/readme.txt
+++ compat/zlib/contrib/dotzlib/readme.txt
@@ -34,11 +34,11 @@
34 2. Using NAnt:
35 Open a command prompt with access to the build environment and run nant
36 in the same directory as the DotZLib.build file.
37 You can define 2 properties on the nant command-line to control the build:
38 debug={true|false} to toggle between release/debug builds (default=true).
39 nunit={true|false} to include or esclude unit tests (default=true).
40 Also the target clean will remove binaries.
41 Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
42 or ./DotZLib/bin/debug, depending on whether you are building the release
43 or debug version of the library.
44
45
--- compat/zlib/contrib/dotzlib/readme.txt
+++ compat/zlib/contrib/dotzlib/readme.txt
@@ -34,11 +34,11 @@
34 2. Using NAnt:
35 Open a command prompt with access to the build environment and run nant
36 in the same directory as the DotZLib.build file.
37 You can define 2 properties on the nant command-line to control the build:
38 debug={true|false} to toggle between release/debug builds (default=true).
39 nunit={true|false} to include or exclude unit tests (default=true).
40 Also the target clean will remove binaries.
41 Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
42 or ./DotZLib/bin/debug, depending on whether you are building the release
43 or debug version of the library.
44
45
--- compat/zlib/contrib/infback9/infback9.c
+++ compat/zlib/contrib/infback9/infback9.c
@@ -14,16 +14,12 @@
1414
strm provides memory allocation functions in zalloc and zfree, or
1515
Z_NULL to use the library memory allocation functions.
1616
1717
window is a user-supplied window and output buffer that is 64K bytes.
1818
*/
19
-int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
20
-z_stream FAR *strm;
21
-unsigned char FAR *window;
22
-const char *version;
23
-int stream_size;
24
-{
19
+int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window,
20
+ const char *version, int stream_size) {
2521
struct inflate_state FAR *state;
2622
2723
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
2824
stream_size != (int)(sizeof(z_stream)))
2925
return Z_VERSION_ERROR;
@@ -49,12 +45,11 @@
4945
decoding.
5046
*/
5147
#ifdef MAKEFIXED
5248
#include <stdio.h>
5349
54
-void makefixed9(void)
55
-{
50
+void makefixed9(void) {
5651
unsigned sym, bits, low, size;
5752
code *next, *lenfix, *distfix;
5853
struct inflate_state state;
5954
code fixed[544];
6055
@@ -212,17 +207,12 @@
212207
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
213208
error, or Z_MEM_ERROR if it could not allocate memory for the state.
214209
inflateBack() can also return Z_STREAM_ERROR if the input parameters
215210
are not correct, i.e. strm is Z_NULL or the state was not initialized.
216211
*/
217
-int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
218
-z_stream FAR *strm;
219
-in_func in;
220
-void FAR *in_desc;
221
-out_func out;
222
-void FAR *out_desc;
223
-{
212
+int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc,
213
+ out_func out, void FAR *out_desc) {
224214
struct inflate_state FAR *state;
225215
z_const unsigned char FAR *next; /* next input */
226216
unsigned char FAR *put; /* next output */
227217
unsigned have; /* available input */
228218
unsigned long left; /* available output */
@@ -601,15 +591,13 @@
601591
strm->next_in = next;
602592
strm->avail_in = have;
603593
return ret;
604594
}
605595
606
-int ZEXPORT inflateBack9End(strm)
607
-z_stream FAR *strm;
608
-{
596
+int ZEXPORT inflateBack9End(z_stream FAR *strm) {
609597
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
610598
return Z_STREAM_ERROR;
611599
ZFREE(strm, strm->state);
612600
strm->state = Z_NULL;
613601
Tracev((stderr, "inflate: end\n"));
614602
return Z_OK;
615603
}
616604
--- compat/zlib/contrib/infback9/infback9.c
+++ compat/zlib/contrib/infback9/infback9.c
@@ -14,16 +14,12 @@
14 strm provides memory allocation functions in zalloc and zfree, or
15 Z_NULL to use the library memory allocation functions.
16
17 window is a user-supplied window and output buffer that is 64K bytes.
18 */
19 int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
20 z_stream FAR *strm;
21 unsigned char FAR *window;
22 const char *version;
23 int stream_size;
24 {
25 struct inflate_state FAR *state;
26
27 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
28 stream_size != (int)(sizeof(z_stream)))
29 return Z_VERSION_ERROR;
@@ -49,12 +45,11 @@
49 decoding.
50 */
51 #ifdef MAKEFIXED
52 #include <stdio.h>
53
54 void makefixed9(void)
55 {
56 unsigned sym, bits, low, size;
57 code *next, *lenfix, *distfix;
58 struct inflate_state state;
59 code fixed[544];
60
@@ -212,17 +207,12 @@
212 returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
213 error, or Z_MEM_ERROR if it could not allocate memory for the state.
214 inflateBack() can also return Z_STREAM_ERROR if the input parameters
215 are not correct, i.e. strm is Z_NULL or the state was not initialized.
216 */
217 int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
218 z_stream FAR *strm;
219 in_func in;
220 void FAR *in_desc;
221 out_func out;
222 void FAR *out_desc;
223 {
224 struct inflate_state FAR *state;
225 z_const unsigned char FAR *next; /* next input */
226 unsigned char FAR *put; /* next output */
227 unsigned have; /* available input */
228 unsigned long left; /* available output */
@@ -601,15 +591,13 @@
601 strm->next_in = next;
602 strm->avail_in = have;
603 return ret;
604 }
605
606 int ZEXPORT inflateBack9End(strm)
607 z_stream FAR *strm;
608 {
609 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
610 return Z_STREAM_ERROR;
611 ZFREE(strm, strm->state);
612 strm->state = Z_NULL;
613 Tracev((stderr, "inflate: end\n"));
614 return Z_OK;
615 }
616
--- compat/zlib/contrib/infback9/infback9.c
+++ compat/zlib/contrib/infback9/infback9.c
@@ -14,16 +14,12 @@
14 strm provides memory allocation functions in zalloc and zfree, or
15 Z_NULL to use the library memory allocation functions.
16
17 window is a user-supplied window and output buffer that is 64K bytes.
18 */
19 int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window,
20 const char *version, int stream_size) {
 
 
 
 
21 struct inflate_state FAR *state;
22
23 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
24 stream_size != (int)(sizeof(z_stream)))
25 return Z_VERSION_ERROR;
@@ -49,12 +45,11 @@
45 decoding.
46 */
47 #ifdef MAKEFIXED
48 #include <stdio.h>
49
50 void makefixed9(void) {
 
51 unsigned sym, bits, low, size;
52 code *next, *lenfix, *distfix;
53 struct inflate_state state;
54 code fixed[544];
55
@@ -212,17 +207,12 @@
207 returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
208 error, or Z_MEM_ERROR if it could not allocate memory for the state.
209 inflateBack() can also return Z_STREAM_ERROR if the input parameters
210 are not correct, i.e. strm is Z_NULL or the state was not initialized.
211 */
212 int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc,
213 out_func out, void FAR *out_desc) {
 
 
 
 
 
214 struct inflate_state FAR *state;
215 z_const unsigned char FAR *next; /* next input */
216 unsigned char FAR *put; /* next output */
217 unsigned have; /* available input */
218 unsigned long left; /* available output */
@@ -601,15 +591,13 @@
591 strm->next_in = next;
592 strm->avail_in = have;
593 return ret;
594 }
595
596 int ZEXPORT inflateBack9End(z_stream FAR *strm) {
 
 
597 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
598 return Z_STREAM_ERROR;
599 ZFREE(strm, strm->state);
600 strm->state = Z_NULL;
601 Tracev((stderr, "inflate: end\n"));
602 return Z_OK;
603 }
604
--- compat/zlib/contrib/infback9/infback9.h
+++ compat/zlib/contrib/infback9/infback9.h
@@ -18,18 +18,18 @@
1818
1919
#ifdef __cplusplus
2020
extern "C" {
2121
#endif
2222
23
-ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
24
- in_func in, void FAR *in_desc,
25
- out_func out, void FAR *out_desc));
26
-ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm));
27
-ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm,
28
- unsigned char FAR *window,
29
- const char *version,
30
- int stream_size));
23
+ZEXTERN int ZEXPORT inflateBack9(z_stream FAR *strm,
24
+ in_func in, void FAR *in_desc,
25
+ out_func out, void FAR *out_desc);
26
+ZEXTERN int ZEXPORT inflateBack9End(z_stream FAR *strm);
27
+ZEXTERN int ZEXPORT inflateBack9Init_(z_stream FAR *strm,
28
+ unsigned char FAR *window,
29
+ const char *version,
30
+ int stream_size);
3131
#define inflateBack9Init(strm, window) \
3232
inflateBack9Init_((strm), (window), \
3333
ZLIB_VERSION, sizeof(z_stream))
3434
3535
#ifdef __cplusplus
3636
--- compat/zlib/contrib/infback9/infback9.h
+++ compat/zlib/contrib/infback9/infback9.h
@@ -18,18 +18,18 @@
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
24 in_func in, void FAR *in_desc,
25 out_func out, void FAR *out_desc));
26 ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm));
27 ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm,
28 unsigned char FAR *window,
29 const char *version,
30 int stream_size));
31 #define inflateBack9Init(strm, window) \
32 inflateBack9Init_((strm), (window), \
33 ZLIB_VERSION, sizeof(z_stream))
34
35 #ifdef __cplusplus
36
--- compat/zlib/contrib/infback9/infback9.h
+++ compat/zlib/contrib/infback9/infback9.h
@@ -18,18 +18,18 @@
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 ZEXTERN int ZEXPORT inflateBack9(z_stream FAR *strm,
24 in_func in, void FAR *in_desc,
25 out_func out, void FAR *out_desc);
26 ZEXTERN int ZEXPORT inflateBack9End(z_stream FAR *strm);
27 ZEXTERN int ZEXPORT inflateBack9Init_(z_stream FAR *strm,
28 unsigned char FAR *window,
29 const char *version,
30 int stream_size);
31 #define inflateBack9Init(strm, window) \
32 inflateBack9Init_((strm), (window), \
33 ZLIB_VERSION, sizeof(z_stream))
34
35 #ifdef __cplusplus
36
--- compat/zlib/contrib/infback9/inftree9.c
+++ compat/zlib/contrib/infback9/inftree9.c
@@ -1,17 +1,17 @@
11
/* inftree9.c -- generate Huffman trees for efficient decoding
2
- * Copyright (C) 1995-2022 Mark Adler
2
+ * Copyright (C) 1995-2023 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55
66
#include "zutil.h"
77
#include "inftree9.h"
88
99
#define MAXBITS 15
1010
1111
const char inflate9_copyright[] =
12
- " inflate9 1.2.13 Copyright 1995-2022 Mark Adler ";
12
+ " inflate9 1.3 Copyright 1995-2023 Mark Adler ";
1313
/*
1414
If you use the zlib library in a product, an acknowledgment is welcome
1515
in the documentation of your product. If for some reason you cannot
1616
include such an acknowledgment, I would appreciate that you keep this
1717
copyright string in the executable of your product.
@@ -27,18 +27,13 @@
2727
on return points to the next available entry's address. bits is the
2828
requested root table index bits, and on return it is the actual root
2929
table index bits. It will differ if the request is greater than the
3030
longest code or if it is less than the shortest code.
3131
*/
32
-int inflate_table9(type, lens, codes, table, bits, work)
33
-codetype type;
34
-unsigned short FAR *lens;
35
-unsigned codes;
36
-code FAR * FAR *table;
37
-unsigned FAR *bits;
38
-unsigned short FAR *work;
39
-{
32
+int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes,
33
+ code FAR * FAR *table, unsigned FAR *bits,
34
+ unsigned short FAR *work) {
4035
unsigned len; /* a code's length in bits */
4136
unsigned sym; /* index of code symbols */
4237
unsigned min, max; /* minimum and maximum code lengths */
4338
unsigned root; /* number of index bits for root table */
4439
unsigned curr; /* number of index bits for current table */
@@ -62,11 +57,11 @@
6257
19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
6358
131, 163, 195, 227, 3, 0, 0};
6459
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
6560
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
6661
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
67
- 133, 133, 133, 133, 144, 194, 65};
62
+ 133, 133, 133, 133, 144, 198, 203};
6863
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
6964
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
7065
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
7166
4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
7267
static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
7368
--- compat/zlib/contrib/infback9/inftree9.c
+++ compat/zlib/contrib/infback9/inftree9.c
@@ -1,17 +1,17 @@
1 /* inftree9.c -- generate Huffman trees for efficient decoding
2 * Copyright (C) 1995-2022 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6 #include "zutil.h"
7 #include "inftree9.h"
8
9 #define MAXBITS 15
10
11 const char inflate9_copyright[] =
12 " inflate9 1.2.13 Copyright 1995-2022 Mark Adler ";
13 /*
14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot
16 include such an acknowledgment, I would appreciate that you keep this
17 copyright string in the executable of your product.
@@ -27,18 +27,13 @@
27 on return points to the next available entry's address. bits is the
28 requested root table index bits, and on return it is the actual root
29 table index bits. It will differ if the request is greater than the
30 longest code or if it is less than the shortest code.
31 */
32 int inflate_table9(type, lens, codes, table, bits, work)
33 codetype type;
34 unsigned short FAR *lens;
35 unsigned codes;
36 code FAR * FAR *table;
37 unsigned FAR *bits;
38 unsigned short FAR *work;
39 {
40 unsigned len; /* a code's length in bits */
41 unsigned sym; /* index of code symbols */
42 unsigned min, max; /* minimum and maximum code lengths */
43 unsigned root; /* number of index bits for root table */
44 unsigned curr; /* number of index bits for current table */
@@ -62,11 +57,11 @@
62 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
63 131, 163, 195, 227, 3, 0, 0};
64 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
65 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
67 133, 133, 133, 133, 144, 194, 65};
68 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
69 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
71 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
72 static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
73
--- compat/zlib/contrib/infback9/inftree9.c
+++ compat/zlib/contrib/infback9/inftree9.c
@@ -1,17 +1,17 @@
1 /* inftree9.c -- generate Huffman trees for efficient decoding
2 * Copyright (C) 1995-2023 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6 #include "zutil.h"
7 #include "inftree9.h"
8
9 #define MAXBITS 15
10
11 const char inflate9_copyright[] =
12 " inflate9 1.3 Copyright 1995-2023 Mark Adler ";
13 /*
14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot
16 include such an acknowledgment, I would appreciate that you keep this
17 copyright string in the executable of your product.
@@ -27,18 +27,13 @@
27 on return points to the next available entry's address. bits is the
28 requested root table index bits, and on return it is the actual root
29 table index bits. It will differ if the request is greater than the
30 longest code or if it is less than the shortest code.
31 */
32 int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes,
33 code FAR * FAR *table, unsigned FAR *bits,
34 unsigned short FAR *work) {
 
 
 
 
 
35 unsigned len; /* a code's length in bits */
36 unsigned sym; /* index of code symbols */
37 unsigned min, max; /* minimum and maximum code lengths */
38 unsigned root; /* number of index bits for root table */
39 unsigned curr; /* number of index bits for current table */
@@ -62,11 +57,11 @@
57 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
58 131, 163, 195, 227, 3, 0, 0};
59 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
60 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
61 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
62 133, 133, 133, 133, 144, 198, 203};
63 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
64 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
65 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
66 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
67 static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
68
--- compat/zlib/contrib/infback9/inftree9.h
+++ compat/zlib/contrib/infback9/inftree9.h
@@ -54,8 +54,8 @@
5454
CODES,
5555
LENS,
5656
DISTS
5757
} codetype;
5858
59
-extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
60
- unsigned codes, code FAR * FAR *table,
61
- unsigned FAR *bits, unsigned short FAR *work));
59
+extern int inflate_table9(codetype type, unsigned short FAR *lens,
60
+ unsigned codes, code FAR * FAR *table,
61
+ unsigned FAR *bits, unsigned short FAR *work);
6262
--- compat/zlib/contrib/infback9/inftree9.h
+++ compat/zlib/contrib/infback9/inftree9.h
@@ -54,8 +54,8 @@
54 CODES,
55 LENS,
56 DISTS
57 } codetype;
58
59 extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
60 unsigned codes, code FAR * FAR *table,
61 unsigned FAR *bits, unsigned short FAR *work));
62
--- compat/zlib/contrib/infback9/inftree9.h
+++ compat/zlib/contrib/infback9/inftree9.h
@@ -54,8 +54,8 @@
54 CODES,
55 LENS,
56 DISTS
57 } codetype;
58
59 extern int inflate_table9(codetype type, unsigned short FAR *lens,
60 unsigned codes, code FAR * FAR *table,
61 unsigned FAR *bits, unsigned short FAR *work);
62
--- compat/zlib/contrib/minizip/MiniZip64_Changes.txt
+++ compat/zlib/contrib/minizip/MiniZip64_Changes.txt
@@ -1,6 +1,6 @@
11
2
-MiniZip 1.1 was derrived from MiniZip at version 1.01f
2
+MiniZip 1.1 was derived from MiniZip at version 1.01f
33
44
Change in 1.0 (Okt 2009)
55
- **TODO - Add history**
66
77
--- compat/zlib/contrib/minizip/MiniZip64_Changes.txt
+++ compat/zlib/contrib/minizip/MiniZip64_Changes.txt
@@ -1,6 +1,6 @@
1
2 MiniZip 1.1 was derrived from MiniZip at version 1.01f
3
4 Change in 1.0 (Okt 2009)
5 - **TODO - Add history**
6
7
--- compat/zlib/contrib/minizip/MiniZip64_Changes.txt
+++ compat/zlib/contrib/minizip/MiniZip64_Changes.txt
@@ -1,6 +1,6 @@
1
2 MiniZip 1.1 was derived from MiniZip at version 1.01f
3
4 Change in 1.0 (Okt 2009)
5 - **TODO - Add history**
6
7
--- compat/zlib/contrib/minizip/configure.ac
+++ compat/zlib/contrib/minizip/configure.ac
@@ -1,9 +1,9 @@
11
# -*- Autoconf -*-
22
# Process this file with autoconf to produce a configure script.
33
4
-AC_INIT([minizip], [1.2.13], [bugzilla.redhat.com])
4
+AC_INIT([minizip], [1.3.0], [bugzilla.redhat.com])
55
AC_CONFIG_SRCDIR([minizip.c])
66
AM_INIT_AUTOMAKE([foreign])
77
LT_INIT
88
99
AC_MSG_CHECKING([whether to build example programs])
1010
--- compat/zlib/contrib/minizip/configure.ac
+++ compat/zlib/contrib/minizip/configure.ac
@@ -1,9 +1,9 @@
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([minizip], [1.2.13], [bugzilla.redhat.com])
5 AC_CONFIG_SRCDIR([minizip.c])
6 AM_INIT_AUTOMAKE([foreign])
7 LT_INIT
8
9 AC_MSG_CHECKING([whether to build example programs])
10
--- compat/zlib/contrib/minizip/configure.ac
+++ compat/zlib/contrib/minizip/configure.ac
@@ -1,9 +1,9 @@
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([minizip], [1.3.0], [bugzilla.redhat.com])
5 AC_CONFIG_SRCDIR([minizip.c])
6 AM_INIT_AUTOMAKE([foreign])
7 LT_INIT
8
9 AC_MSG_CHECKING([whether to build example programs])
10
--- compat/zlib/contrib/minizip/crypt.h
+++ compat/zlib/contrib/minizip/crypt.h
@@ -30,12 +30,11 @@
3030
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
3131
3232
/***********************************************************************
3333
* Return the next byte in the pseudo-random sequence
3434
*/
35
-static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
36
-{
35
+static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
3736
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
3837
* unpredictable manner on 16-bit systems; not a problem
3938
* with any known compiler so far, though */
4039
4140
(void)pcrc_32_tab;
@@ -44,12 +43,11 @@
4443
}
4544
4645
/***********************************************************************
4746
* Update the encryption keys with the next byte of plain text
4847
*/
49
-static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
50
-{
48
+static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
5149
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
5250
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
5351
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
5452
{
5553
register int keyshift = (int)((*(pkeys+1)) >> 24);
@@ -61,12 +59,11 @@
6159
6260
/***********************************************************************
6361
* Initialize the encryption keys and the random header according to
6462
* the given password.
6563
*/
66
-static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
67
-{
64
+static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
6865
*(pkeys+0) = 305419896L;
6966
*(pkeys+1) = 591751049L;
7067
*(pkeys+2) = 878082192L;
7168
while (*passwd != '\0') {
7269
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
@@ -91,12 +88,11 @@
9188
static unsigned crypthead(const char* passwd, /* password string */
9289
unsigned char* buf, /* where to write header */
9390
int bufSize,
9491
unsigned long* pkeys,
9592
const z_crc_t* pcrc_32_tab,
96
- unsigned long crcForCrypting)
97
-{
93
+ unsigned long crcForCrypting) {
9894
unsigned n; /* index in random header */
9995
int t; /* temporary */
10096
int c; /* random byte */
10197
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
10298
static unsigned calls = 0; /* ensure different random header each time */
10399
--- compat/zlib/contrib/minizip/crypt.h
+++ compat/zlib/contrib/minizip/crypt.h
@@ -30,12 +30,11 @@
30 #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
31
32 /***********************************************************************
33 * Return the next byte in the pseudo-random sequence
34 */
35 static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
36 {
37 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
38 * unpredictable manner on 16-bit systems; not a problem
39 * with any known compiler so far, though */
40
41 (void)pcrc_32_tab;
@@ -44,12 +43,11 @@
44 }
45
46 /***********************************************************************
47 * Update the encryption keys with the next byte of plain text
48 */
49 static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
50 {
51 (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
52 (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
53 (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
54 {
55 register int keyshift = (int)((*(pkeys+1)) >> 24);
@@ -61,12 +59,11 @@
61
62 /***********************************************************************
63 * Initialize the encryption keys and the random header according to
64 * the given password.
65 */
66 static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
67 {
68 *(pkeys+0) = 305419896L;
69 *(pkeys+1) = 591751049L;
70 *(pkeys+2) = 878082192L;
71 while (*passwd != '\0') {
72 update_keys(pkeys,pcrc_32_tab,(int)*passwd);
@@ -91,12 +88,11 @@
91 static unsigned crypthead(const char* passwd, /* password string */
92 unsigned char* buf, /* where to write header */
93 int bufSize,
94 unsigned long* pkeys,
95 const z_crc_t* pcrc_32_tab,
96 unsigned long crcForCrypting)
97 {
98 unsigned n; /* index in random header */
99 int t; /* temporary */
100 int c; /* random byte */
101 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
102 static unsigned calls = 0; /* ensure different random header each time */
103
--- compat/zlib/contrib/minizip/crypt.h
+++ compat/zlib/contrib/minizip/crypt.h
@@ -30,12 +30,11 @@
30 #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
31
32 /***********************************************************************
33 * Return the next byte in the pseudo-random sequence
34 */
35 static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
 
36 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
37 * unpredictable manner on 16-bit systems; not a problem
38 * with any known compiler so far, though */
39
40 (void)pcrc_32_tab;
@@ -44,12 +43,11 @@
43 }
44
45 /***********************************************************************
46 * Update the encryption keys with the next byte of plain text
47 */
48 static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
 
49 (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
50 (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
51 (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
52 {
53 register int keyshift = (int)((*(pkeys+1)) >> 24);
@@ -61,12 +59,11 @@
59
60 /***********************************************************************
61 * Initialize the encryption keys and the random header according to
62 * the given password.
63 */
64 static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
 
65 *(pkeys+0) = 305419896L;
66 *(pkeys+1) = 591751049L;
67 *(pkeys+2) = 878082192L;
68 while (*passwd != '\0') {
69 update_keys(pkeys,pcrc_32_tab,(int)*passwd);
@@ -91,12 +88,11 @@
88 static unsigned crypthead(const char* passwd, /* password string */
89 unsigned char* buf, /* where to write header */
90 int bufSize,
91 unsigned long* pkeys,
92 const z_crc_t* pcrc_32_tab,
93 unsigned long crcForCrypting) {
 
94 unsigned n; /* index in random header */
95 int t; /* temporary */
96 int c; /* random byte */
97 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
98 static unsigned calls = 0; /* ensure different random header each time */
99
--- compat/zlib/contrib/minizip/ioapi.c
+++ compat/zlib/contrib/minizip/ioapi.c
@@ -12,11 +12,11 @@
1212
1313
#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
1414
#define _CRT_SECURE_NO_WARNINGS
1515
#endif
1616
17
-#if defined(__APPLE__) || defined(IOAPI_NO_64)
17
+#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
1818
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
1919
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
2020
#define FTELLO_FUNC(stream) ftello(stream)
2121
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
2222
#else
@@ -26,22 +26,20 @@
2626
#endif
2727
2828
2929
#include "ioapi.h"
3030
31
-voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
32
-{
31
+voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc, const void*filename, int mode) {
3332
if (pfilefunc->zfile_func64.zopen64_file != NULL)
3433
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
3534
else
3635
{
3736
return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
3837
}
3938
}
4039
41
-long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
42
-{
40
+long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) {
4341
if (pfilefunc->zfile_func64.zseek64_file != NULL)
4442
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
4543
else
4644
{
4745
uLong offsetTruncated = (uLong)offset;
@@ -50,12 +48,11 @@
5048
else
5149
return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
5250
}
5351
}
5452
55
-ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
56
-{
53
+ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) {
5754
if (pfilefunc->zfile_func64.zseek64_file != NULL)
5855
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
5956
else
6057
{
6158
uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
@@ -64,15 +61,13 @@
6461
else
6562
return tell_uLong;
6663
}
6764
}
6865
69
-void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
70
-{
66
+void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) {
7167
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
7268
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
73
- p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
7469
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
7570
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
7671
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
7772
p_filefunc64_32->zfile_func64.zseek64_file = NULL;
7873
p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
@@ -82,20 +77,11 @@
8277
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
8378
}
8479
8580
8681
87
-static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
88
-static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
89
-static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
90
-static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
91
-static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
92
-static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
93
-static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
94
-
95
-static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
96
-{
82
+static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
9783
FILE* file = NULL;
9884
const char* mode_fopen = NULL;
9985
(void)opaque;
10086
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
10187
mode_fopen = "rb";
@@ -109,12 +95,11 @@
10995
if ((filename!=NULL) && (mode_fopen != NULL))
11096
file = fopen(filename, mode_fopen);
11197
return file;
11298
}
11399
114
-static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
115
-{
100
+static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
116101
FILE* file = NULL;
117102
const char* mode_fopen = NULL;
118103
(void)opaque;
119104
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
120105
mode_fopen = "rb";
@@ -129,45 +114,40 @@
129114
file = FOPEN_FUNC((const char*)filename, mode_fopen);
130115
return file;
131116
}
132117
133118
134
-static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
135
-{
119
+static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
136120
uLong ret;
137121
(void)opaque;
138122
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
139123
return ret;
140124
}
141125
142
-static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
143
-{
126
+static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
144127
uLong ret;
145128
(void)opaque;
146129
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
147130
return ret;
148131
}
149132
150
-static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
151
-{
133
+static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
152134
long ret;
153135
(void)opaque;
154136
ret = ftell((FILE *)stream);
155137
return ret;
156138
}
157139
158140
159
-static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
160
-{
141
+static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
161142
ZPOS64_T ret;
162143
(void)opaque;
163144
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
164145
return ret;
165146
}
166147
167
-static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
168
-{
148
+static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
169149
int fseek_origin=0;
170150
long ret;
171151
(void)opaque;
172152
switch (origin)
173153
{
@@ -186,12 +166,11 @@
186166
if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
187167
ret = -1;
188168
return ret;
189169
}
190170
191
-static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
192
-{
171
+static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
193172
int fseek_origin=0;
194173
long ret;
195174
(void)opaque;
196175
switch (origin)
197176
{
@@ -206,36 +185,32 @@
206185
break;
207186
default: return -1;
208187
}
209188
ret = 0;
210189
211
- if(FSEEKO_FUNC((FILE *)stream, (z_off_t)offset, fseek_origin) != 0)
190
+ if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0)
212191
ret = -1;
213192
214193
return ret;
215194
}
216195
217196
218
-static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
219
-{
197
+static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
220198
int ret;
221199
(void)opaque;
222200
ret = fclose((FILE *)stream);
223201
return ret;
224202
}
225203
226
-static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
227
-{
204
+static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
228205
int ret;
229206
(void)opaque;
230207
ret = ferror((FILE *)stream);
231208
return ret;
232209
}
233210
234
-void fill_fopen_filefunc (pzlib_filefunc_def)
235
- zlib_filefunc_def* pzlib_filefunc_def;
236
-{
211
+void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
237212
pzlib_filefunc_def->zopen_file = fopen_file_func;
238213
pzlib_filefunc_def->zread_file = fread_file_func;
239214
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
240215
pzlib_filefunc_def->ztell_file = ftell_file_func;
241216
pzlib_filefunc_def->zseek_file = fseek_file_func;
@@ -242,16 +217,15 @@
242217
pzlib_filefunc_def->zclose_file = fclose_file_func;
243218
pzlib_filefunc_def->zerror_file = ferror_file_func;
244219
pzlib_filefunc_def->opaque = NULL;
245220
}
246221
247
-void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
248
-{
222
+void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
249223
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
250224
pzlib_filefunc_def->zread_file = fread_file_func;
251225
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
252226
pzlib_filefunc_def->ztell64_file = ftell64_file_func;
253227
pzlib_filefunc_def->zseek64_file = fseek64_file_func;
254228
pzlib_filefunc_def->zclose_file = fclose_file_func;
255229
pzlib_filefunc_def->zerror_file = ferror_file_func;
256230
pzlib_filefunc_def->opaque = NULL;
257231
}
258232
--- compat/zlib/contrib/minizip/ioapi.c
+++ compat/zlib/contrib/minizip/ioapi.c
@@ -12,11 +12,11 @@
12
13 #if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
14 #define _CRT_SECURE_NO_WARNINGS
15 #endif
16
17 #if defined(__APPLE__) || defined(IOAPI_NO_64)
18 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
19 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
20 #define FTELLO_FUNC(stream) ftello(stream)
21 #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
22 #else
@@ -26,22 +26,20 @@
26 #endif
27
28
29 #include "ioapi.h"
30
31 voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
32 {
33 if (pfilefunc->zfile_func64.zopen64_file != NULL)
34 return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
35 else
36 {
37 return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
38 }
39 }
40
41 long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
42 {
43 if (pfilefunc->zfile_func64.zseek64_file != NULL)
44 return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
45 else
46 {
47 uLong offsetTruncated = (uLong)offset;
@@ -50,12 +48,11 @@
50 else
51 return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
52 }
53 }
54
55 ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
56 {
57 if (pfilefunc->zfile_func64.zseek64_file != NULL)
58 return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
59 else
60 {
61 uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
@@ -64,15 +61,13 @@
64 else
65 return tell_uLong;
66 }
67 }
68
69 void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
70 {
71 p_filefunc64_32->zfile_func64.zopen64_file = NULL;
72 p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
73 p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
74 p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
75 p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
76 p_filefunc64_32->zfile_func64.ztell64_file = NULL;
77 p_filefunc64_32->zfile_func64.zseek64_file = NULL;
78 p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
@@ -82,20 +77,11 @@
82 p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
83 }
84
85
86
87 static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
88 static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
89 static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
90 static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
91 static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
92 static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
93 static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
94
95 static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
96 {
97 FILE* file = NULL;
98 const char* mode_fopen = NULL;
99 (void)opaque;
100 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
101 mode_fopen = "rb";
@@ -109,12 +95,11 @@
109 if ((filename!=NULL) && (mode_fopen != NULL))
110 file = fopen(filename, mode_fopen);
111 return file;
112 }
113
114 static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
115 {
116 FILE* file = NULL;
117 const char* mode_fopen = NULL;
118 (void)opaque;
119 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
120 mode_fopen = "rb";
@@ -129,45 +114,40 @@
129 file = FOPEN_FUNC((const char*)filename, mode_fopen);
130 return file;
131 }
132
133
134 static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
135 {
136 uLong ret;
137 (void)opaque;
138 ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
139 return ret;
140 }
141
142 static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
143 {
144 uLong ret;
145 (void)opaque;
146 ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
147 return ret;
148 }
149
150 static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
151 {
152 long ret;
153 (void)opaque;
154 ret = ftell((FILE *)stream);
155 return ret;
156 }
157
158
159 static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
160 {
161 ZPOS64_T ret;
162 (void)opaque;
163 ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
164 return ret;
165 }
166
167 static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
168 {
169 int fseek_origin=0;
170 long ret;
171 (void)opaque;
172 switch (origin)
173 {
@@ -186,12 +166,11 @@
186 if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
187 ret = -1;
188 return ret;
189 }
190
191 static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
192 {
193 int fseek_origin=0;
194 long ret;
195 (void)opaque;
196 switch (origin)
197 {
@@ -206,36 +185,32 @@
206 break;
207 default: return -1;
208 }
209 ret = 0;
210
211 if(FSEEKO_FUNC((FILE *)stream, (z_off_t)offset, fseek_origin) != 0)
212 ret = -1;
213
214 return ret;
215 }
216
217
218 static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
219 {
220 int ret;
221 (void)opaque;
222 ret = fclose((FILE *)stream);
223 return ret;
224 }
225
226 static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
227 {
228 int ret;
229 (void)opaque;
230 ret = ferror((FILE *)stream);
231 return ret;
232 }
233
234 void fill_fopen_filefunc (pzlib_filefunc_def)
235 zlib_filefunc_def* pzlib_filefunc_def;
236 {
237 pzlib_filefunc_def->zopen_file = fopen_file_func;
238 pzlib_filefunc_def->zread_file = fread_file_func;
239 pzlib_filefunc_def->zwrite_file = fwrite_file_func;
240 pzlib_filefunc_def->ztell_file = ftell_file_func;
241 pzlib_filefunc_def->zseek_file = fseek_file_func;
@@ -242,16 +217,15 @@
242 pzlib_filefunc_def->zclose_file = fclose_file_func;
243 pzlib_filefunc_def->zerror_file = ferror_file_func;
244 pzlib_filefunc_def->opaque = NULL;
245 }
246
247 void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
248 {
249 pzlib_filefunc_def->zopen64_file = fopen64_file_func;
250 pzlib_filefunc_def->zread_file = fread_file_func;
251 pzlib_filefunc_def->zwrite_file = fwrite_file_func;
252 pzlib_filefunc_def->ztell64_file = ftell64_file_func;
253 pzlib_filefunc_def->zseek64_file = fseek64_file_func;
254 pzlib_filefunc_def->zclose_file = fclose_file_func;
255 pzlib_filefunc_def->zerror_file = ferror_file_func;
256 pzlib_filefunc_def->opaque = NULL;
257 }
258
--- compat/zlib/contrib/minizip/ioapi.c
+++ compat/zlib/contrib/minizip/ioapi.c
@@ -12,11 +12,11 @@
12
13 #if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
14 #define _CRT_SECURE_NO_WARNINGS
15 #endif
16
17 #if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
18 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
19 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
20 #define FTELLO_FUNC(stream) ftello(stream)
21 #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
22 #else
@@ -26,22 +26,20 @@
26 #endif
27
28
29 #include "ioapi.h"
30
31 voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc, const void*filename, int mode) {
 
32 if (pfilefunc->zfile_func64.zopen64_file != NULL)
33 return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
34 else
35 {
36 return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
37 }
38 }
39
40 long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) {
 
41 if (pfilefunc->zfile_func64.zseek64_file != NULL)
42 return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
43 else
44 {
45 uLong offsetTruncated = (uLong)offset;
@@ -50,12 +48,11 @@
48 else
49 return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
50 }
51 }
52
53 ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) {
 
54 if (pfilefunc->zfile_func64.zseek64_file != NULL)
55 return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
56 else
57 {
58 uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
@@ -64,15 +61,13 @@
61 else
62 return tell_uLong;
63 }
64 }
65
66 void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) {
 
67 p_filefunc64_32->zfile_func64.zopen64_file = NULL;
68 p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
 
69 p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
70 p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
71 p_filefunc64_32->zfile_func64.ztell64_file = NULL;
72 p_filefunc64_32->zfile_func64.zseek64_file = NULL;
73 p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
@@ -82,20 +77,11 @@
77 p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
78 }
79
80
81
82 static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
 
 
 
 
 
 
 
 
 
83 FILE* file = NULL;
84 const char* mode_fopen = NULL;
85 (void)opaque;
86 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
87 mode_fopen = "rb";
@@ -109,12 +95,11 @@
95 if ((filename!=NULL) && (mode_fopen != NULL))
96 file = fopen(filename, mode_fopen);
97 return file;
98 }
99
100 static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
 
101 FILE* file = NULL;
102 const char* mode_fopen = NULL;
103 (void)opaque;
104 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
105 mode_fopen = "rb";
@@ -129,45 +114,40 @@
114 file = FOPEN_FUNC((const char*)filename, mode_fopen);
115 return file;
116 }
117
118
119 static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
 
120 uLong ret;
121 (void)opaque;
122 ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
123 return ret;
124 }
125
126 static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
 
127 uLong ret;
128 (void)opaque;
129 ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
130 return ret;
131 }
132
133 static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
 
134 long ret;
135 (void)opaque;
136 ret = ftell((FILE *)stream);
137 return ret;
138 }
139
140
141 static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
 
142 ZPOS64_T ret;
143 (void)opaque;
144 ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
145 return ret;
146 }
147
148 static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
 
149 int fseek_origin=0;
150 long ret;
151 (void)opaque;
152 switch (origin)
153 {
@@ -186,12 +166,11 @@
166 if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
167 ret = -1;
168 return ret;
169 }
170
171 static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
 
172 int fseek_origin=0;
173 long ret;
174 (void)opaque;
175 switch (origin)
176 {
@@ -206,36 +185,32 @@
185 break;
186 default: return -1;
187 }
188 ret = 0;
189
190 if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0)
191 ret = -1;
192
193 return ret;
194 }
195
196
197 static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
 
198 int ret;
199 (void)opaque;
200 ret = fclose((FILE *)stream);
201 return ret;
202 }
203
204 static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
 
205 int ret;
206 (void)opaque;
207 ret = ferror((FILE *)stream);
208 return ret;
209 }
210
211 void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
 
 
212 pzlib_filefunc_def->zopen_file = fopen_file_func;
213 pzlib_filefunc_def->zread_file = fread_file_func;
214 pzlib_filefunc_def->zwrite_file = fwrite_file_func;
215 pzlib_filefunc_def->ztell_file = ftell_file_func;
216 pzlib_filefunc_def->zseek_file = fseek_file_func;
@@ -242,16 +217,15 @@
217 pzlib_filefunc_def->zclose_file = fclose_file_func;
218 pzlib_filefunc_def->zerror_file = ferror_file_func;
219 pzlib_filefunc_def->opaque = NULL;
220 }
221
222 void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
 
223 pzlib_filefunc_def->zopen64_file = fopen64_file_func;
224 pzlib_filefunc_def->zread_file = fread_file_func;
225 pzlib_filefunc_def->zwrite_file = fwrite_file_func;
226 pzlib_filefunc_def->ztell64_file = ftell64_file_func;
227 pzlib_filefunc_def->zseek64_file = fseek64_file_func;
228 pzlib_filefunc_def->zclose_file = fclose_file_func;
229 pzlib_filefunc_def->zerror_file = ferror_file_func;
230 pzlib_filefunc_def->opaque = NULL;
231 }
232
--- compat/zlib/contrib/minizip/ioapi.h
+++ compat/zlib/contrib/minizip/ioapi.h
@@ -48,11 +48,11 @@
4848
#if defined(USE_FILE32API)
4949
#define fopen64 fopen
5050
#define ftello64 ftell
5151
#define fseeko64 fseek
5252
#else
53
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
53
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
5454
#define fopen64 fopen
5555
#define ftello64 ftello
5656
#define fseeko64 fseeko
5757
#endif
5858
#ifdef _MSC_VER
@@ -80,11 +80,11 @@
8080
8181
#ifdef HAVE_MINIZIP64_CONF_H
8282
#include "mz64conf.h"
8383
#endif
8484
85
-/* a type choosen by DEFINE */
85
+/* a type chosen by DEFINE */
8686
#ifdef HAVE_64BIT_INT_CUSTOM
8787
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
8888
#else
8989
#ifdef HAS_STDINT_H
9090
#include "stdint.h"
@@ -132,18 +132,18 @@
132132
#endif
133133
134134
135135
136136
137
-typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
138
-typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
139
-typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
140
-typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
141
-typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
142
-
143
-typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
144
-typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
137
+typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
138
+typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
139
+typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
140
+typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
141
+typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
142
+
143
+typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
144
+typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
145145
146146
147147
/* here is the "old" 32 bits structure structure */
148148
typedef struct zlib_filefunc_def_s
149149
{
@@ -155,13 +155,13 @@
155155
close_file_func zclose_file;
156156
testerror_file_func zerror_file;
157157
voidpf opaque;
158158
} zlib_filefunc_def;
159159
160
-typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
161
-typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
162
-typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
160
+typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
161
+typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
162
+typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
163163
164164
typedef struct zlib_filefunc64_def_s
165165
{
166166
open64_file_func zopen64_file;
167167
read_file_func zread_file;
@@ -171,12 +171,12 @@
171171
close_file_func zclose_file;
172172
testerror_file_func zerror_file;
173173
voidpf opaque;
174174
} zlib_filefunc64_def;
175175
176
-void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
177
-void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
176
+void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
177
+void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
178178
179179
/* now internal definition, only for zip.c and unzip.h */
180180
typedef struct zlib_filefunc64_32_def_s
181181
{
182182
zlib_filefunc64_def zfile_func64;
@@ -191,15 +191,15 @@
191191
//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
192192
//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
193193
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
194194
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
195195
196
-voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
197
-long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
198
-ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
196
+voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
197
+long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
198
+ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
199199
200
-void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
200
+void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
201201
202202
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
203203
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
204204
#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
205205
206206
--- compat/zlib/contrib/minizip/ioapi.h
+++ compat/zlib/contrib/minizip/ioapi.h
@@ -48,11 +48,11 @@
48 #if defined(USE_FILE32API)
49 #define fopen64 fopen
50 #define ftello64 ftell
51 #define fseeko64 fseek
52 #else
53 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
54 #define fopen64 fopen
55 #define ftello64 ftello
56 #define fseeko64 fseeko
57 #endif
58 #ifdef _MSC_VER
@@ -80,11 +80,11 @@
80
81 #ifdef HAVE_MINIZIP64_CONF_H
82 #include "mz64conf.h"
83 #endif
84
85 /* a type choosen by DEFINE */
86 #ifdef HAVE_64BIT_INT_CUSTOM
87 typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
88 #else
89 #ifdef HAS_STDINT_H
90 #include "stdint.h"
@@ -132,18 +132,18 @@
132 #endif
133
134
135
136
137 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
138 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
139 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
140 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
141 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
142
143 typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
144 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
145
146
147 /* here is the "old" 32 bits structure structure */
148 typedef struct zlib_filefunc_def_s
149 {
@@ -155,13 +155,13 @@
155 close_file_func zclose_file;
156 testerror_file_func zerror_file;
157 voidpf opaque;
158 } zlib_filefunc_def;
159
160 typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
161 typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
162 typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
163
164 typedef struct zlib_filefunc64_def_s
165 {
166 open64_file_func zopen64_file;
167 read_file_func zread_file;
@@ -171,12 +171,12 @@
171 close_file_func zclose_file;
172 testerror_file_func zerror_file;
173 voidpf opaque;
174 } zlib_filefunc64_def;
175
176 void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
177 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
178
179 /* now internal definition, only for zip.c and unzip.h */
180 typedef struct zlib_filefunc64_32_def_s
181 {
182 zlib_filefunc64_def zfile_func64;
@@ -191,15 +191,15 @@
191 //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
192 //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
193 #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
194 #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
195
196 voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
197 long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
198 ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
199
200 void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
201
202 #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
203 #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
204 #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
205
206
--- compat/zlib/contrib/minizip/ioapi.h
+++ compat/zlib/contrib/minizip/ioapi.h
@@ -48,11 +48,11 @@
48 #if defined(USE_FILE32API)
49 #define fopen64 fopen
50 #define ftello64 ftell
51 #define fseeko64 fseek
52 #else
53 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
54 #define fopen64 fopen
55 #define ftello64 ftello
56 #define fseeko64 fseeko
57 #endif
58 #ifdef _MSC_VER
@@ -80,11 +80,11 @@
80
81 #ifdef HAVE_MINIZIP64_CONF_H
82 #include "mz64conf.h"
83 #endif
84
85 /* a type chosen by DEFINE */
86 #ifdef HAVE_64BIT_INT_CUSTOM
87 typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
88 #else
89 #ifdef HAS_STDINT_H
90 #include "stdint.h"
@@ -132,18 +132,18 @@
132 #endif
133
134
135
136
137 typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
138 typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
139 typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
140 typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
141 typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
142
143 typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
144 typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
145
146
147 /* here is the "old" 32 bits structure structure */
148 typedef struct zlib_filefunc_def_s
149 {
@@ -155,13 +155,13 @@
155 close_file_func zclose_file;
156 testerror_file_func zerror_file;
157 voidpf opaque;
158 } zlib_filefunc_def;
159
160 typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
161 typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
162 typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
163
164 typedef struct zlib_filefunc64_def_s
165 {
166 open64_file_func zopen64_file;
167 read_file_func zread_file;
@@ -171,12 +171,12 @@
171 close_file_func zclose_file;
172 testerror_file_func zerror_file;
173 voidpf opaque;
174 } zlib_filefunc64_def;
175
176 void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
177 void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
178
179 /* now internal definition, only for zip.c and unzip.h */
180 typedef struct zlib_filefunc64_32_def_s
181 {
182 zlib_filefunc64_def zfile_func64;
@@ -191,15 +191,15 @@
191 //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
192 //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
193 #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
194 #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
195
196 voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
197 long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
198 ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
199
200 void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
201
202 #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
203 #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
204 #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
205
206
--- compat/zlib/contrib/minizip/iowin32.c
+++ compat/zlib/contrib/minizip/iowin32.c
@@ -36,18 +36,10 @@
3636
#if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP)
3737
#define IOWIN32_USING_WINRT_API 1
3838
#endif
3939
#endif
4040
41
-voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode));
42
-uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
43
-uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
44
-ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream));
45
-long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
46
-int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream));
47
-int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream));
48
-
4941
typedef struct
5042
{
5143
HANDLE hf;
5244
int error;
5345
} WIN32FILE_IOWIN;
@@ -55,12 +47,11 @@
5547
5648
static void win32_translate_open_mode(int mode,
5749
DWORD* lpdwDesiredAccess,
5850
DWORD* lpdwCreationDisposition,
5951
DWORD* lpdwShareMode,
60
- DWORD* lpdwFlagsAndAttributes)
61
-{
52
+ DWORD* lpdwFlagsAndAttributes) {
6253
*lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
6354
6455
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
6556
{
6657
*lpdwDesiredAccess = GENERIC_READ;
@@ -77,12 +68,11 @@
7768
*lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
7869
*lpdwCreationDisposition = CREATE_ALWAYS;
7970
}
8071
}
8172
82
-static voidpf win32_build_iowin(HANDLE hFile)
83
-{
73
+static voidpf win32_build_iowin(HANDLE hFile) {
8474
voidpf ret=NULL;
8575
8676
if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
8777
{
8878
WIN32FILE_IOWIN w32fiow;
@@ -96,12 +86,11 @@
9686
*((WIN32FILE_IOWIN*)ret) = w32fiow;
9787
}
9888
return ret;
9989
}
10090
101
-voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode)
102
-{
91
+voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
10392
const char* mode_fopen = NULL;
10493
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
10594
HANDLE hFile = NULL;
10695
10796
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -125,12 +114,11 @@
125114
126115
return win32_build_iowin(hFile);
127116
}
128117
129118
130
-voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode)
131
-{
119
+voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
132120
const char* mode_fopen = NULL;
133121
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
134122
HANDLE hFile = NULL;
135123
136124
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -149,12 +137,11 @@
149137
150138
return win32_build_iowin(hFile);
151139
}
152140
153141
154
-voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode)
155
-{
142
+voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
156143
const char* mode_fopen = NULL;
157144
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
158145
HANDLE hFile = NULL;
159146
160147
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -169,12 +156,11 @@
169156
170157
return win32_build_iowin(hFile);
171158
}
172159
173160
174
-voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode)
175
-{
161
+voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
176162
const char* mode_fopen = NULL;
177163
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
178164
HANDLE hFile = NULL;
179165
180166
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -198,12 +184,11 @@
198184
199185
return win32_build_iowin(hFile);
200186
}
201187
202188
203
-uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size)
204
-{
189
+uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
205190
uLong ret=0;
206191
HANDLE hFile = NULL;
207192
if (stream!=NULL)
208193
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
209194
@@ -220,12 +205,11 @@
220205
221206
return ret;
222207
}
223208
224209
225
-uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size)
226
-{
210
+uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
227211
uLong ret=0;
228212
HANDLE hFile = NULL;
229213
if (stream!=NULL)
230214
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
231215
@@ -241,12 +225,11 @@
241225
}
242226
243227
return ret;
244228
}
245229
246
-static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
247
-{
230
+static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) {
248231
#ifdef IOWIN32_USING_WINRT_API
249232
return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
250233
#else
251234
LONG lHigh = pos.HighPart;
252235
DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod);
@@ -261,12 +244,11 @@
261244
}
262245
return fOk;
263246
#endif
264247
}
265248
266
-long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
267
-{
249
+long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
268250
long ret=-1;
269251
HANDLE hFile = NULL;
270252
if (stream!=NULL)
271253
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
272254
if (hFile != NULL)
@@ -284,12 +266,11 @@
284266
ret=(long)pos.LowPart;
285267
}
286268
return ret;
287269
}
288270
289
-ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
290
-{
271
+ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
291272
ZPOS64_T ret= (ZPOS64_T)-1;
292273
HANDLE hFile = NULL;
293274
if (stream!=NULL)
294275
hFile = ((WIN32FILE_IOWIN*)stream)->hf;
295276
@@ -309,12 +290,11 @@
309290
}
310291
return ret;
311292
}
312293
313294
314
-long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin)
315
-{
295
+long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
316296
DWORD dwMoveMethod=0xFFFFFFFF;
317297
HANDLE hFile = NULL;
318298
319299
long ret=-1;
320300
if (stream!=NULL)
@@ -347,12 +327,11 @@
347327
ret=0;
348328
}
349329
return ret;
350330
}
351331
352
-long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin)
353
-{
332
+long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
354333
DWORD dwMoveMethod=0xFFFFFFFF;
355334
HANDLE hFile = NULL;
356335
long ret=-1;
357336
358337
if (stream!=NULL)
@@ -386,12 +365,11 @@
386365
ret=0;
387366
}
388367
return ret;
389368
}
390369
391
-int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
392
-{
370
+int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
393371
int ret=-1;
394372
395373
if (stream!=NULL)
396374
{
397375
HANDLE hFile;
@@ -404,22 +382,20 @@
404382
free(stream);
405383
}
406384
return ret;
407385
}
408386
409
-int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
410
-{
387
+int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
411388
int ret=-1;
412389
if (stream!=NULL)
413390
{
414391
ret = ((WIN32FILE_IOWIN*)stream) -> error;
415392
}
416393
return ret;
417394
}
418395
419
-void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
420
-{
396
+void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
421397
pzlib_filefunc_def->zopen_file = win32_open_file_func;
422398
pzlib_filefunc_def->zread_file = win32_read_file_func;
423399
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
424400
pzlib_filefunc_def->ztell_file = win32_tell_file_func;
425401
pzlib_filefunc_def->zseek_file = win32_seek_file_func;
@@ -426,12 +402,11 @@
426402
pzlib_filefunc_def->zclose_file = win32_close_file_func;
427403
pzlib_filefunc_def->zerror_file = win32_error_file_func;
428404
pzlib_filefunc_def->opaque = NULL;
429405
}
430406
431
-void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
432
-{
407
+void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) {
433408
pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
434409
pzlib_filefunc_def->zread_file = win32_read_file_func;
435410
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
436411
pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
437412
pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
@@ -439,12 +414,11 @@
439414
pzlib_filefunc_def->zerror_file = win32_error_file_func;
440415
pzlib_filefunc_def->opaque = NULL;
441416
}
442417
443418
444
-void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
445
-{
419
+void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) {
446420
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
447421
pzlib_filefunc_def->zread_file = win32_read_file_func;
448422
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
449423
pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
450424
pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
@@ -452,16 +426,15 @@
452426
pzlib_filefunc_def->zerror_file = win32_error_file_func;
453427
pzlib_filefunc_def->opaque = NULL;
454428
}
455429
456430
457
-void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def)
458
-{
431
+void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) {
459432
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
460433
pzlib_filefunc_def->zread_file = win32_read_file_func;
461434
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
462435
pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
463436
pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
464437
pzlib_filefunc_def->zclose_file = win32_close_file_func;
465438
pzlib_filefunc_def->zerror_file = win32_error_file_func;
466439
pzlib_filefunc_def->opaque = NULL;
467440
}
468441
--- compat/zlib/contrib/minizip/iowin32.c
+++ compat/zlib/contrib/minizip/iowin32.c
@@ -36,18 +36,10 @@
36 #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP)
37 #define IOWIN32_USING_WINRT_API 1
38 #endif
39 #endif
40
41 voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode));
42 uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
43 uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
44 ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream));
45 long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
46 int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream));
47 int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream));
48
49 typedef struct
50 {
51 HANDLE hf;
52 int error;
53 } WIN32FILE_IOWIN;
@@ -55,12 +47,11 @@
55
56 static void win32_translate_open_mode(int mode,
57 DWORD* lpdwDesiredAccess,
58 DWORD* lpdwCreationDisposition,
59 DWORD* lpdwShareMode,
60 DWORD* lpdwFlagsAndAttributes)
61 {
62 *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
63
64 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
65 {
66 *lpdwDesiredAccess = GENERIC_READ;
@@ -77,12 +68,11 @@
77 *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
78 *lpdwCreationDisposition = CREATE_ALWAYS;
79 }
80 }
81
82 static voidpf win32_build_iowin(HANDLE hFile)
83 {
84 voidpf ret=NULL;
85
86 if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
87 {
88 WIN32FILE_IOWIN w32fiow;
@@ -96,12 +86,11 @@
96 *((WIN32FILE_IOWIN*)ret) = w32fiow;
97 }
98 return ret;
99 }
100
101 voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode)
102 {
103 const char* mode_fopen = NULL;
104 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
105 HANDLE hFile = NULL;
106
107 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -125,12 +114,11 @@
125
126 return win32_build_iowin(hFile);
127 }
128
129
130 voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode)
131 {
132 const char* mode_fopen = NULL;
133 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
134 HANDLE hFile = NULL;
135
136 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -149,12 +137,11 @@
149
150 return win32_build_iowin(hFile);
151 }
152
153
154 voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode)
155 {
156 const char* mode_fopen = NULL;
157 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
158 HANDLE hFile = NULL;
159
160 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -169,12 +156,11 @@
169
170 return win32_build_iowin(hFile);
171 }
172
173
174 voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode)
175 {
176 const char* mode_fopen = NULL;
177 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
178 HANDLE hFile = NULL;
179
180 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -198,12 +184,11 @@
198
199 return win32_build_iowin(hFile);
200 }
201
202
203 uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size)
204 {
205 uLong ret=0;
206 HANDLE hFile = NULL;
207 if (stream!=NULL)
208 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
209
@@ -220,12 +205,11 @@
220
221 return ret;
222 }
223
224
225 uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size)
226 {
227 uLong ret=0;
228 HANDLE hFile = NULL;
229 if (stream!=NULL)
230 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
231
@@ -241,12 +225,11 @@
241 }
242
243 return ret;
244 }
245
246 static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
247 {
248 #ifdef IOWIN32_USING_WINRT_API
249 return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
250 #else
251 LONG lHigh = pos.HighPart;
252 DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod);
@@ -261,12 +244,11 @@
261 }
262 return fOk;
263 #endif
264 }
265
266 long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
267 {
268 long ret=-1;
269 HANDLE hFile = NULL;
270 if (stream!=NULL)
271 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
272 if (hFile != NULL)
@@ -284,12 +266,11 @@
284 ret=(long)pos.LowPart;
285 }
286 return ret;
287 }
288
289 ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
290 {
291 ZPOS64_T ret= (ZPOS64_T)-1;
292 HANDLE hFile = NULL;
293 if (stream!=NULL)
294 hFile = ((WIN32FILE_IOWIN*)stream)->hf;
295
@@ -309,12 +290,11 @@
309 }
310 return ret;
311 }
312
313
314 long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin)
315 {
316 DWORD dwMoveMethod=0xFFFFFFFF;
317 HANDLE hFile = NULL;
318
319 long ret=-1;
320 if (stream!=NULL)
@@ -347,12 +327,11 @@
347 ret=0;
348 }
349 return ret;
350 }
351
352 long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin)
353 {
354 DWORD dwMoveMethod=0xFFFFFFFF;
355 HANDLE hFile = NULL;
356 long ret=-1;
357
358 if (stream!=NULL)
@@ -386,12 +365,11 @@
386 ret=0;
387 }
388 return ret;
389 }
390
391 int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
392 {
393 int ret=-1;
394
395 if (stream!=NULL)
396 {
397 HANDLE hFile;
@@ -404,22 +382,20 @@
404 free(stream);
405 }
406 return ret;
407 }
408
409 int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
410 {
411 int ret=-1;
412 if (stream!=NULL)
413 {
414 ret = ((WIN32FILE_IOWIN*)stream) -> error;
415 }
416 return ret;
417 }
418
419 void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
420 {
421 pzlib_filefunc_def->zopen_file = win32_open_file_func;
422 pzlib_filefunc_def->zread_file = win32_read_file_func;
423 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
424 pzlib_filefunc_def->ztell_file = win32_tell_file_func;
425 pzlib_filefunc_def->zseek_file = win32_seek_file_func;
@@ -426,12 +402,11 @@
426 pzlib_filefunc_def->zclose_file = win32_close_file_func;
427 pzlib_filefunc_def->zerror_file = win32_error_file_func;
428 pzlib_filefunc_def->opaque = NULL;
429 }
430
431 void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
432 {
433 pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
434 pzlib_filefunc_def->zread_file = win32_read_file_func;
435 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
436 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
437 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
@@ -439,12 +414,11 @@
439 pzlib_filefunc_def->zerror_file = win32_error_file_func;
440 pzlib_filefunc_def->opaque = NULL;
441 }
442
443
444 void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
445 {
446 pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
447 pzlib_filefunc_def->zread_file = win32_read_file_func;
448 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
449 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
450 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
@@ -452,16 +426,15 @@
452 pzlib_filefunc_def->zerror_file = win32_error_file_func;
453 pzlib_filefunc_def->opaque = NULL;
454 }
455
456
457 void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def)
458 {
459 pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
460 pzlib_filefunc_def->zread_file = win32_read_file_func;
461 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
462 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
463 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
464 pzlib_filefunc_def->zclose_file = win32_close_file_func;
465 pzlib_filefunc_def->zerror_file = win32_error_file_func;
466 pzlib_filefunc_def->opaque = NULL;
467 }
468
--- compat/zlib/contrib/minizip/iowin32.c
+++ compat/zlib/contrib/minizip/iowin32.c
@@ -36,18 +36,10 @@
36 #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP)
37 #define IOWIN32_USING_WINRT_API 1
38 #endif
39 #endif
40
 
 
 
 
 
 
 
 
41 typedef struct
42 {
43 HANDLE hf;
44 int error;
45 } WIN32FILE_IOWIN;
@@ -55,12 +47,11 @@
47
48 static void win32_translate_open_mode(int mode,
49 DWORD* lpdwDesiredAccess,
50 DWORD* lpdwCreationDisposition,
51 DWORD* lpdwShareMode,
52 DWORD* lpdwFlagsAndAttributes) {
 
53 *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
54
55 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
56 {
57 *lpdwDesiredAccess = GENERIC_READ;
@@ -77,12 +68,11 @@
68 *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
69 *lpdwCreationDisposition = CREATE_ALWAYS;
70 }
71 }
72
73 static voidpf win32_build_iowin(HANDLE hFile) {
 
74 voidpf ret=NULL;
75
76 if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
77 {
78 WIN32FILE_IOWIN w32fiow;
@@ -96,12 +86,11 @@
86 *((WIN32FILE_IOWIN*)ret) = w32fiow;
87 }
88 return ret;
89 }
90
91 voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
 
92 const char* mode_fopen = NULL;
93 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
94 HANDLE hFile = NULL;
95
96 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -125,12 +114,11 @@
114
115 return win32_build_iowin(hFile);
116 }
117
118
119 voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
 
120 const char* mode_fopen = NULL;
121 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
122 HANDLE hFile = NULL;
123
124 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -149,12 +137,11 @@
137
138 return win32_build_iowin(hFile);
139 }
140
141
142 voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
 
143 const char* mode_fopen = NULL;
144 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
145 HANDLE hFile = NULL;
146
147 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -169,12 +156,11 @@
156
157 return win32_build_iowin(hFile);
158 }
159
160
161 voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
 
162 const char* mode_fopen = NULL;
163 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
164 HANDLE hFile = NULL;
165
166 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
@@ -198,12 +184,11 @@
184
185 return win32_build_iowin(hFile);
186 }
187
188
189 uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
 
190 uLong ret=0;
191 HANDLE hFile = NULL;
192 if (stream!=NULL)
193 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
194
@@ -220,12 +205,11 @@
205
206 return ret;
207 }
208
209
210 uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
 
211 uLong ret=0;
212 HANDLE hFile = NULL;
213 if (stream!=NULL)
214 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
215
@@ -241,12 +225,11 @@
225 }
226
227 return ret;
228 }
229
230 static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) {
 
231 #ifdef IOWIN32_USING_WINRT_API
232 return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
233 #else
234 LONG lHigh = pos.HighPart;
235 DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod);
@@ -261,12 +244,11 @@
244 }
245 return fOk;
246 #endif
247 }
248
249 long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
 
250 long ret=-1;
251 HANDLE hFile = NULL;
252 if (stream!=NULL)
253 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
254 if (hFile != NULL)
@@ -284,12 +266,11 @@
266 ret=(long)pos.LowPart;
267 }
268 return ret;
269 }
270
271 ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
 
272 ZPOS64_T ret= (ZPOS64_T)-1;
273 HANDLE hFile = NULL;
274 if (stream!=NULL)
275 hFile = ((WIN32FILE_IOWIN*)stream)->hf;
276
@@ -309,12 +290,11 @@
290 }
291 return ret;
292 }
293
294
295 long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
 
296 DWORD dwMoveMethod=0xFFFFFFFF;
297 HANDLE hFile = NULL;
298
299 long ret=-1;
300 if (stream!=NULL)
@@ -347,12 +327,11 @@
327 ret=0;
328 }
329 return ret;
330 }
331
332 long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
 
333 DWORD dwMoveMethod=0xFFFFFFFF;
334 HANDLE hFile = NULL;
335 long ret=-1;
336
337 if (stream!=NULL)
@@ -386,12 +365,11 @@
365 ret=0;
366 }
367 return ret;
368 }
369
370 int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
 
371 int ret=-1;
372
373 if (stream!=NULL)
374 {
375 HANDLE hFile;
@@ -404,22 +382,20 @@
382 free(stream);
383 }
384 return ret;
385 }
386
387 int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
 
388 int ret=-1;
389 if (stream!=NULL)
390 {
391 ret = ((WIN32FILE_IOWIN*)stream) -> error;
392 }
393 return ret;
394 }
395
396 void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
 
397 pzlib_filefunc_def->zopen_file = win32_open_file_func;
398 pzlib_filefunc_def->zread_file = win32_read_file_func;
399 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
400 pzlib_filefunc_def->ztell_file = win32_tell_file_func;
401 pzlib_filefunc_def->zseek_file = win32_seek_file_func;
@@ -426,12 +402,11 @@
402 pzlib_filefunc_def->zclose_file = win32_close_file_func;
403 pzlib_filefunc_def->zerror_file = win32_error_file_func;
404 pzlib_filefunc_def->opaque = NULL;
405 }
406
407 void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) {
 
408 pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
409 pzlib_filefunc_def->zread_file = win32_read_file_func;
410 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
411 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
412 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
@@ -439,12 +414,11 @@
414 pzlib_filefunc_def->zerror_file = win32_error_file_func;
415 pzlib_filefunc_def->opaque = NULL;
416 }
417
418
419 void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) {
 
420 pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
421 pzlib_filefunc_def->zread_file = win32_read_file_func;
422 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
423 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
424 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
@@ -452,16 +426,15 @@
426 pzlib_filefunc_def->zerror_file = win32_error_file_func;
427 pzlib_filefunc_def->opaque = NULL;
428 }
429
430
431 void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) {
 
432 pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
433 pzlib_filefunc_def->zread_file = win32_read_file_func;
434 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
435 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
436 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
437 pzlib_filefunc_def->zclose_file = win32_close_file_func;
438 pzlib_filefunc_def->zerror_file = win32_error_file_func;
439 pzlib_filefunc_def->opaque = NULL;
440 }
441
--- compat/zlib/contrib/minizip/iowin32.h
+++ compat/zlib/contrib/minizip/iowin32.h
@@ -16,13 +16,13 @@
1616
1717
#ifdef __cplusplus
1818
extern "C" {
1919
#endif
2020
21
-void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
22
-void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def));
23
-void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def));
24
-void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def));
21
+void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
22
+void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def);
23
+void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def);
24
+void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def);
2525
2626
#ifdef __cplusplus
2727
}
2828
#endif
2929
--- compat/zlib/contrib/minizip/iowin32.h
+++ compat/zlib/contrib/minizip/iowin32.h
@@ -16,13 +16,13 @@
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
22 void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def));
23 void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def));
24 void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def));
25
26 #ifdef __cplusplus
27 }
28 #endif
29
--- compat/zlib/contrib/minizip/iowin32.h
+++ compat/zlib/contrib/minizip/iowin32.h
@@ -16,13 +16,13 @@
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
22 void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def);
23 void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def);
24 void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def);
25
26 #ifdef __cplusplus
27 }
28 #endif
29
--- compat/zlib/contrib/minizip/miniunz.c
+++ compat/zlib/contrib/minizip/miniunz.c
@@ -25,11 +25,11 @@
2525
#ifndef _FILE_OFFSET_BIT
2626
#define _FILE_OFFSET_BIT 64
2727
#endif
2828
#endif
2929
30
-#ifdef __APPLE__
30
+#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
3131
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
3232
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
3333
#define FTELLO_FUNC(stream) ftello(stream)
3434
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
3535
#else
@@ -79,15 +79,11 @@
7979
8080
/* change_file_date : change the date/time of a file
8181
filename : the filename of the file where date/time must be modified
8282
dosdate : the new date at the MSDos format (4 bytes)
8383
tmu_date : the SAME new date at the tm_unz format */
84
-static void change_file_date(filename,dosdate,tmu_date)
85
- const char *filename;
86
- uLong dosdate;
87
- tm_unz tmu_date;
88
-{
84
+static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
8985
#ifdef _WIN32
9086
HANDLE hFile;
9187
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
9288
9389
hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE,
@@ -113,35 +109,37 @@
113109
newdate.tm_year=tmu_date.tm_year ;
114110
newdate.tm_isdst=-1;
115111
116112
ut.actime=ut.modtime=mktime(&newdate);
117113
utime(filename,&ut);
114
+#else
115
+ (void)filename;
116
+ (void)dosdate;
117
+ (void)tmu_date;
118118
#endif
119119
#endif
120120
}
121121
122122
123123
/* mymkdir and change_file_date are not 100 % portable
124124
As I don't know well Unix, I wait feedback for the unix portion */
125125
126
-static int mymkdir(dirname)
127
- const char* dirname;
128
-{
126
+static int mymkdir(const char* dirname) {
129127
int ret=0;
130128
#ifdef _WIN32
131129
ret = _mkdir(dirname);
132130
#elif unix
133131
ret = mkdir (dirname,0775);
134132
#elif __APPLE__
135133
ret = mkdir (dirname,0775);
134
+#else
135
+ (void)dirname;
136136
#endif
137137
return ret;
138138
}
139139
140
-static int makedir (newdir)
141
- const char *newdir;
142
-{
140
+static int makedir(const char *newdir) {
143141
char *buffer ;
144142
char *p;
145143
size_t len = strlen(newdir);
146144
147145
if (len == 0)
@@ -185,30 +183,27 @@
185183
}
186184
free(buffer);
187185
return 1;
188186
}
189187
190
-static void do_banner()
191
-{
188
+static void do_banner(void) {
192189
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
193190
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
194191
}
195192
196
-static void do_help()
197
-{
193
+static void do_help(void) {
198194
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
199195
" -e Extract without pathname (junk paths)\n" \
200196
" -x Extract with pathname\n" \
201197
" -v list files\n" \
202198
" -l list files\n" \
203199
" -d directory to extract into\n" \
204200
" -o overwrite files without prompting\n" \
205
- " -p extract crypted file using password\n\n");
201
+ " -p extract encrypted file using password\n\n");
206202
}
207203
208
-static void Display64BitsSize(ZPOS64_T n, int size_char)
209
-{
204
+static void Display64BitsSize(ZPOS64_T n, int size_char) {
210205
/* to avoid compatibility problem , we do here the conversion */
211206
char number[21];
212207
int offset=19;
213208
int pos_string = 19;
214209
number[20]=0;
@@ -231,13 +226,11 @@
231226
}
232227
233228
printf("%s",&number[pos_string]);
234229
}
235230
236
-static int do_list(uf)
237
- unzFile uf;
238
-{
231
+static int do_list(unzFile uf) {
239232
uLong i;
240233
unz_global_info64 gi;
241234
int err;
242235
243236
err = unzGetGlobalInfo64(uf,&gi);
@@ -248,11 +241,11 @@
248241
for (i=0;i<gi.number_entry;i++)
249242
{
250243
char filename_inzip[256];
251244
unz_file_info64 file_info;
252245
uLong ratio=0;
253
- const char *string_method;
246
+ const char *string_method = "";
254247
char charCrypt=' ';
255248
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
256249
if (err!=UNZ_OK)
257250
{
258251
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
@@ -259,11 +252,11 @@
259252
break;
260253
}
261254
if (file_info.uncompressed_size>0)
262255
ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size);
263256
264
- /* display a '*' if the file is crypted */
257
+ /* display a '*' if the file is encrypted */
265258
if ((file_info.flag & 1) != 0)
266259
charCrypt='*';
267260
268261
if (file_info.compression_method==0)
269262
string_method="Stored";
@@ -309,16 +302,11 @@
309302
310303
return 0;
311304
}
312305
313306
314
-static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
315
- unzFile uf;
316
- const int* popt_extract_without_path;
317
- int* popt_overwrite;
318
- const char* password;
319
-{
307
+static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
320308
char filename_inzip[256];
321309
char* filename_withoutpath;
322310
char* p;
323311
int err=UNZ_OK;
324312
FILE *fout=NULL;
@@ -471,16 +459,11 @@
471459
free(buf);
472460
return err;
473461
}
474462
475463
476
-static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
477
- unzFile uf;
478
- int opt_extract_without_path;
479
- int opt_overwrite;
480
- const char* password;
481
-{
464
+static int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password) {
482465
uLong i;
483466
unz_global_info64 gi;
484467
int err;
485468
486469
err = unzGetGlobalInfo64(uf,&gi);
@@ -506,17 +489,11 @@
506489
}
507490
508491
return 0;
509492
}
510493
511
-static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
512
- unzFile uf;
513
- const char* filename;
514
- int opt_extract_without_path;
515
- int opt_overwrite;
516
- const char* password;
517
-{
494
+static int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) {
518495
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
519496
{
520497
printf("file %s not found in the zipfile\n",filename);
521498
return 2;
522499
}
@@ -528,14 +505,11 @@
528505
else
529506
return 1;
530507
}
531508
532509
533
-int main(argc,argv)
534
- int argc;
535
- char *argv[];
536
-{
510
+int main(int argc, char *argv[]) {
537511
const char *zipfilename=NULL;
538512
const char *filename_to_extract=NULL;
539513
const char *password=NULL;
540514
char filename_try[MAXFILENAME+16] = "";
541515
int i;
@@ -604,11 +578,11 @@
604578
# ifdef USEWIN32IOAPI
605579
zlib_filefunc64_def ffunc;
606580
# endif
607581
608582
strncpy(filename_try, zipfilename,MAXFILENAME-1);
609
- /* strncpy doesnt append the trailing NULL, of the string is too long. */
583
+ /* strncpy doesn't append the trailing NULL, of the string is too long. */
610584
filename_try[ MAXFILENAME ] = '\0';
611585
612586
# ifdef USEWIN32IOAPI
613587
fill_win32_filefunc64A(&ffunc);
614588
uf = unzOpen2_64(zipfilename,&ffunc);
615589
--- compat/zlib/contrib/minizip/miniunz.c
+++ compat/zlib/contrib/minizip/miniunz.c
@@ -25,11 +25,11 @@
25 #ifndef _FILE_OFFSET_BIT
26 #define _FILE_OFFSET_BIT 64
27 #endif
28 #endif
29
30 #ifdef __APPLE__
31 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
32 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
33 #define FTELLO_FUNC(stream) ftello(stream)
34 #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
35 #else
@@ -79,15 +79,11 @@
79
80 /* change_file_date : change the date/time of a file
81 filename : the filename of the file where date/time must be modified
82 dosdate : the new date at the MSDos format (4 bytes)
83 tmu_date : the SAME new date at the tm_unz format */
84 static void change_file_date(filename,dosdate,tmu_date)
85 const char *filename;
86 uLong dosdate;
87 tm_unz tmu_date;
88 {
89 #ifdef _WIN32
90 HANDLE hFile;
91 FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
92
93 hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE,
@@ -113,35 +109,37 @@
113 newdate.tm_year=tmu_date.tm_year ;
114 newdate.tm_isdst=-1;
115
116 ut.actime=ut.modtime=mktime(&newdate);
117 utime(filename,&ut);
 
 
 
 
118 #endif
119 #endif
120 }
121
122
123 /* mymkdir and change_file_date are not 100 % portable
124 As I don't know well Unix, I wait feedback for the unix portion */
125
126 static int mymkdir(dirname)
127 const char* dirname;
128 {
129 int ret=0;
130 #ifdef _WIN32
131 ret = _mkdir(dirname);
132 #elif unix
133 ret = mkdir (dirname,0775);
134 #elif __APPLE__
135 ret = mkdir (dirname,0775);
 
 
136 #endif
137 return ret;
138 }
139
140 static int makedir (newdir)
141 const char *newdir;
142 {
143 char *buffer ;
144 char *p;
145 size_t len = strlen(newdir);
146
147 if (len == 0)
@@ -185,30 +183,27 @@
185 }
186 free(buffer);
187 return 1;
188 }
189
190 static void do_banner()
191 {
192 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
193 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
194 }
195
196 static void do_help()
197 {
198 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
199 " -e Extract without pathname (junk paths)\n" \
200 " -x Extract with pathname\n" \
201 " -v list files\n" \
202 " -l list files\n" \
203 " -d directory to extract into\n" \
204 " -o overwrite files without prompting\n" \
205 " -p extract crypted file using password\n\n");
206 }
207
208 static void Display64BitsSize(ZPOS64_T n, int size_char)
209 {
210 /* to avoid compatibility problem , we do here the conversion */
211 char number[21];
212 int offset=19;
213 int pos_string = 19;
214 number[20]=0;
@@ -231,13 +226,11 @@
231 }
232
233 printf("%s",&number[pos_string]);
234 }
235
236 static int do_list(uf)
237 unzFile uf;
238 {
239 uLong i;
240 unz_global_info64 gi;
241 int err;
242
243 err = unzGetGlobalInfo64(uf,&gi);
@@ -248,11 +241,11 @@
248 for (i=0;i<gi.number_entry;i++)
249 {
250 char filename_inzip[256];
251 unz_file_info64 file_info;
252 uLong ratio=0;
253 const char *string_method;
254 char charCrypt=' ';
255 err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
256 if (err!=UNZ_OK)
257 {
258 printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
@@ -259,11 +252,11 @@
259 break;
260 }
261 if (file_info.uncompressed_size>0)
262 ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size);
263
264 /* display a '*' if the file is crypted */
265 if ((file_info.flag & 1) != 0)
266 charCrypt='*';
267
268 if (file_info.compression_method==0)
269 string_method="Stored";
@@ -309,16 +302,11 @@
309
310 return 0;
311 }
312
313
314 static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
315 unzFile uf;
316 const int* popt_extract_without_path;
317 int* popt_overwrite;
318 const char* password;
319 {
320 char filename_inzip[256];
321 char* filename_withoutpath;
322 char* p;
323 int err=UNZ_OK;
324 FILE *fout=NULL;
@@ -471,16 +459,11 @@
471 free(buf);
472 return err;
473 }
474
475
476 static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
477 unzFile uf;
478 int opt_extract_without_path;
479 int opt_overwrite;
480 const char* password;
481 {
482 uLong i;
483 unz_global_info64 gi;
484 int err;
485
486 err = unzGetGlobalInfo64(uf,&gi);
@@ -506,17 +489,11 @@
506 }
507
508 return 0;
509 }
510
511 static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
512 unzFile uf;
513 const char* filename;
514 int opt_extract_without_path;
515 int opt_overwrite;
516 const char* password;
517 {
518 if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
519 {
520 printf("file %s not found in the zipfile\n",filename);
521 return 2;
522 }
@@ -528,14 +505,11 @@
528 else
529 return 1;
530 }
531
532
533 int main(argc,argv)
534 int argc;
535 char *argv[];
536 {
537 const char *zipfilename=NULL;
538 const char *filename_to_extract=NULL;
539 const char *password=NULL;
540 char filename_try[MAXFILENAME+16] = "";
541 int i;
@@ -604,11 +578,11 @@
604 # ifdef USEWIN32IOAPI
605 zlib_filefunc64_def ffunc;
606 # endif
607
608 strncpy(filename_try, zipfilename,MAXFILENAME-1);
609 /* strncpy doesnt append the trailing NULL, of the string is too long. */
610 filename_try[ MAXFILENAME ] = '\0';
611
612 # ifdef USEWIN32IOAPI
613 fill_win32_filefunc64A(&ffunc);
614 uf = unzOpen2_64(zipfilename,&ffunc);
615
--- compat/zlib/contrib/minizip/miniunz.c
+++ compat/zlib/contrib/minizip/miniunz.c
@@ -25,11 +25,11 @@
25 #ifndef _FILE_OFFSET_BIT
26 #define _FILE_OFFSET_BIT 64
27 #endif
28 #endif
29
30 #if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
31 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
32 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
33 #define FTELLO_FUNC(stream) ftello(stream)
34 #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
35 #else
@@ -79,15 +79,11 @@
79
80 /* change_file_date : change the date/time of a file
81 filename : the filename of the file where date/time must be modified
82 dosdate : the new date at the MSDos format (4 bytes)
83 tmu_date : the SAME new date at the tm_unz format */
84 static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
 
 
 
 
85 #ifdef _WIN32
86 HANDLE hFile;
87 FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
88
89 hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE,
@@ -113,35 +109,37 @@
109 newdate.tm_year=tmu_date.tm_year ;
110 newdate.tm_isdst=-1;
111
112 ut.actime=ut.modtime=mktime(&newdate);
113 utime(filename,&ut);
114 #else
115 (void)filename;
116 (void)dosdate;
117 (void)tmu_date;
118 #endif
119 #endif
120 }
121
122
123 /* mymkdir and change_file_date are not 100 % portable
124 As I don't know well Unix, I wait feedback for the unix portion */
125
126 static int mymkdir(const char* dirname) {
 
 
127 int ret=0;
128 #ifdef _WIN32
129 ret = _mkdir(dirname);
130 #elif unix
131 ret = mkdir (dirname,0775);
132 #elif __APPLE__
133 ret = mkdir (dirname,0775);
134 #else
135 (void)dirname;
136 #endif
137 return ret;
138 }
139
140 static int makedir(const char *newdir) {
 
 
141 char *buffer ;
142 char *p;
143 size_t len = strlen(newdir);
144
145 if (len == 0)
@@ -185,30 +183,27 @@
183 }
184 free(buffer);
185 return 1;
186 }
187
188 static void do_banner(void) {
 
189 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
190 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
191 }
192
193 static void do_help(void) {
 
194 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
195 " -e Extract without pathname (junk paths)\n" \
196 " -x Extract with pathname\n" \
197 " -v list files\n" \
198 " -l list files\n" \
199 " -d directory to extract into\n" \
200 " -o overwrite files without prompting\n" \
201 " -p extract encrypted file using password\n\n");
202 }
203
204 static void Display64BitsSize(ZPOS64_T n, int size_char) {
 
205 /* to avoid compatibility problem , we do here the conversion */
206 char number[21];
207 int offset=19;
208 int pos_string = 19;
209 number[20]=0;
@@ -231,13 +226,11 @@
226 }
227
228 printf("%s",&number[pos_string]);
229 }
230
231 static int do_list(unzFile uf) {
 
 
232 uLong i;
233 unz_global_info64 gi;
234 int err;
235
236 err = unzGetGlobalInfo64(uf,&gi);
@@ -248,11 +241,11 @@
241 for (i=0;i<gi.number_entry;i++)
242 {
243 char filename_inzip[256];
244 unz_file_info64 file_info;
245 uLong ratio=0;
246 const char *string_method = "";
247 char charCrypt=' ';
248 err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
249 if (err!=UNZ_OK)
250 {
251 printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
@@ -259,11 +252,11 @@
252 break;
253 }
254 if (file_info.uncompressed_size>0)
255 ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size);
256
257 /* display a '*' if the file is encrypted */
258 if ((file_info.flag & 1) != 0)
259 charCrypt='*';
260
261 if (file_info.compression_method==0)
262 string_method="Stored";
@@ -309,16 +302,11 @@
302
303 return 0;
304 }
305
306
307 static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
 
 
 
 
 
308 char filename_inzip[256];
309 char* filename_withoutpath;
310 char* p;
311 int err=UNZ_OK;
312 FILE *fout=NULL;
@@ -471,16 +459,11 @@
459 free(buf);
460 return err;
461 }
462
463
464 static int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password) {
 
 
 
 
 
465 uLong i;
466 unz_global_info64 gi;
467 int err;
468
469 err = unzGetGlobalInfo64(uf,&gi);
@@ -506,17 +489,11 @@
489 }
490
491 return 0;
492 }
493
494 static int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) {
 
 
 
 
 
 
495 if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
496 {
497 printf("file %s not found in the zipfile\n",filename);
498 return 2;
499 }
@@ -528,14 +505,11 @@
505 else
506 return 1;
507 }
508
509
510 int main(int argc, char *argv[]) {
 
 
 
511 const char *zipfilename=NULL;
512 const char *filename_to_extract=NULL;
513 const char *password=NULL;
514 char filename_try[MAXFILENAME+16] = "";
515 int i;
@@ -604,11 +578,11 @@
578 # ifdef USEWIN32IOAPI
579 zlib_filefunc64_def ffunc;
580 # endif
581
582 strncpy(filename_try, zipfilename,MAXFILENAME-1);
583 /* strncpy doesn't append the trailing NULL, of the string is too long. */
584 filename_try[ MAXFILENAME ] = '\0';
585
586 # ifdef USEWIN32IOAPI
587 fill_win32_filefunc64A(&ffunc);
588 uf = unzOpen2_64(zipfilename,&ffunc);
589
--- compat/zlib/contrib/minizip/minizip.c
+++ compat/zlib/contrib/minizip/minizip.c
@@ -26,11 +26,11 @@
2626
#ifndef _FILE_OFFSET_BIT
2727
#define _FILE_OFFSET_BIT 64
2828
#endif
2929
#endif
3030
31
-#ifdef __APPLE__
31
+#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
3232
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
3333
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
3434
#define FTELLO_FUNC(stream) ftello(stream)
3535
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
3636
#else
@@ -69,15 +69,13 @@
6969
7070
#define WRITEBUFFERSIZE (16384)
7171
#define MAXFILENAME (256)
7272
7373
#ifdef _WIN32
74
-static int filetime(f, tmzip, dt)
75
- const char *f; /* name of file to get info on */
76
- tm_zip *tmzip; /* return value: access, modific. and creation times */
77
- uLong *dt; /* dostime */
78
-{
74
+/* f: name of file to get info on, tmzip: return value: access,
75
+ modification and creation times, dt: dostime */
76
+static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
7977
int ret = 0;
8078
{
8179
FILETIME ftLocal;
8280
HANDLE hFind;
8381
WIN32_FIND_DATAA ff32;
@@ -93,15 +91,13 @@
9391
}
9492
return ret;
9593
}
9694
#else
9795
#if defined(unix) || defined(__APPLE__)
98
-static int filetime(f, tmzip, dt)
99
- const char *f; /* name of file to get info on */
100
- tm_zip *tmzip; /* return value: access, modific. and creation times */
101
- uLong *dt; /* dostime */
102
-{
96
+/* f: name of file to get info on, tmzip: return value: access,
97
+ modification and creation times, dt: dostime */
98
+static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
10399
(void)dt;
104100
int ret=0;
105101
struct stat s; /* results of stat() */
106102
struct tm* filedate;
107103
time_t tm_t=0;
@@ -112,11 +108,11 @@
112108
size_t len = strlen(f);
113109
if (len > MAXFILENAME)
114110
len = MAXFILENAME;
115111
116112
strncpy(name, f,MAXFILENAME-1);
117
- /* strncpy doesnt append the trailing NULL, of the string is too long. */
113
+ /* strncpy doesn't append the trailing NULL, of the string is too long. */
118114
name[ MAXFILENAME ] = '\0';
119115
120116
if (name[len - 1] == '/')
121117
name[len - 1] = '\0';
122118
/* not all systems allow stat'ing a file with / appended */
@@ -136,26 +132,25 @@
136132
tmzip->tm_year = filedate->tm_year;
137133
138134
return ret;
139135
}
140136
#else
141
-uLong filetime(f, tmzip, dt)
142
- const char *f; /* name of file to get info on */
143
- tm_zip *tmzip; /* return value: access, modific. and creation times */
144
- uLong *dt; /* dostime */
145
-{
137
+/* f: name of file to get info on, tmzip: return value: access,
138
+ modification and creation times, dt: dostime */
139
+static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
140
+ (void)f;
141
+ (void)tmzip;
142
+ (void)dt;
146143
return 0;
147144
}
148145
#endif
149146
#endif
150147
151148
152149
153150
154
-static int check_exist_file(filename)
155
- const char* filename;
156
-{
151
+static int check_exist_file(const char* filename) {
157152
FILE* ftestexist;
158153
int ret = 1;
159154
ftestexist = FOPEN_FUNC(filename,"rb");
160155
if (ftestexist==NULL)
161156
ret = 0;
@@ -162,18 +157,16 @@
162157
else
163158
fclose(ftestexist);
164159
return ret;
165160
}
166161
167
-static void do_banner()
168
-{
162
+static void do_banner(void) {
169163
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
170164
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
171165
}
172166
173
-static void do_help()
174
-{
167
+static void do_help(void) {
175168
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
176169
" -o Overwrite existing file.zip\n" \
177170
" -a Append to existing file.zip\n" \
178171
" -0 Store only\n" \
179172
" -1 Compress faster\n" \
@@ -181,12 +174,11 @@
181174
" -j exclude path. store only the file name.\n\n");
182175
}
183176
184177
/* calculate the CRC32 of a file,
185178
because to encrypt a file, we need known the CRC32 of the file before */
186
-static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
187
-{
179
+static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_buf, unsigned long* result_crc) {
188180
unsigned long calculate_crc=0;
189181
int err=ZIP_OK;
190182
FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
191183
192184
unsigned long size_read = 0;
@@ -220,22 +212,21 @@
220212
*result_crc=calculate_crc;
221213
printf("file %s crc %lx\n", filenameinzip, calculate_crc);
222214
return err;
223215
}
224216
225
-static int isLargeFile(const char* filename)
226
-{
217
+static int isLargeFile(const char* filename) {
227218
int largeFile = 0;
228219
ZPOS64_T pos = 0;
229220
FILE* pFile = FOPEN_FUNC(filename, "rb");
230221
231222
if(pFile != NULL)
232223
{
233224
FSEEKO_FUNC(pFile, 0, SEEK_END);
234225
pos = (ZPOS64_T)FTELLO_FUNC(pFile);
235226
236
- printf("File : %s is %lld bytes\n", filename, pos);
227
+ printf("File : %s is %llu bytes\n", filename, pos);
237228
238229
if(pos >= 0xffffffff)
239230
largeFile = 1;
240231
241232
fclose(pFile);
@@ -242,14 +233,11 @@
242233
}
243234
244235
return largeFile;
245236
}
246237
247
-int main(argc,argv)
248
- int argc;
249
- char *argv[];
250
-{
238
+int main(int argc, char *argv[]) {
251239
int i;
252240
int opt_overwrite=0;
253241
int opt_compress_level=Z_DEFAULT_COMPRESSION;
254242
int opt_exclude_path=0;
255243
int zipfilenamearg = 0;
@@ -321,11 +309,11 @@
321309
int i,len;
322310
int dot_found=0;
323311
324312
zipok = 1 ;
325313
strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
326
- /* strncpy doesnt append the trailing NULL, of the string is too long. */
314
+ /* strncpy doesn't append the trailing NULL, of the string is too long. */
327315
filename_try[ MAXFILENAME ] = '\0';
328316
329317
len=(int)strlen(filename_try);
330318
for (i=0;i<len;i++)
331319
if (filename_try[i]=='.')
@@ -391,14 +379,14 @@
391379
{
392380
if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
393381
((argv[i][1]=='o') || (argv[i][1]=='O') ||
394382
(argv[i][1]=='a') || (argv[i][1]=='A') ||
395383
(argv[i][1]=='p') || (argv[i][1]=='P') ||
396
- ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
384
+ ((argv[i][1]>='0') && (argv[i][1]<='9'))) &&
397385
(strlen(argv[i]) == 2)))
398386
{
399
- FILE * fin;
387
+ FILE * fin = NULL;
400388
size_t size_read;
401389
const char* filenameinzip = argv[i];
402390
const char *savefilenameinzip;
403391
zip_fileinfo zi;
404392
unsigned long crcFile=0;
405393
--- compat/zlib/contrib/minizip/minizip.c
+++ compat/zlib/contrib/minizip/minizip.c
@@ -26,11 +26,11 @@
26 #ifndef _FILE_OFFSET_BIT
27 #define _FILE_OFFSET_BIT 64
28 #endif
29 #endif
30
31 #ifdef __APPLE__
32 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
33 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
34 #define FTELLO_FUNC(stream) ftello(stream)
35 #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
36 #else
@@ -69,15 +69,13 @@
69
70 #define WRITEBUFFERSIZE (16384)
71 #define MAXFILENAME (256)
72
73 #ifdef _WIN32
74 static int filetime(f, tmzip, dt)
75 const char *f; /* name of file to get info on */
76 tm_zip *tmzip; /* return value: access, modific. and creation times */
77 uLong *dt; /* dostime */
78 {
79 int ret = 0;
80 {
81 FILETIME ftLocal;
82 HANDLE hFind;
83 WIN32_FIND_DATAA ff32;
@@ -93,15 +91,13 @@
93 }
94 return ret;
95 }
96 #else
97 #if defined(unix) || defined(__APPLE__)
98 static int filetime(f, tmzip, dt)
99 const char *f; /* name of file to get info on */
100 tm_zip *tmzip; /* return value: access, modific. and creation times */
101 uLong *dt; /* dostime */
102 {
103 (void)dt;
104 int ret=0;
105 struct stat s; /* results of stat() */
106 struct tm* filedate;
107 time_t tm_t=0;
@@ -112,11 +108,11 @@
112 size_t len = strlen(f);
113 if (len > MAXFILENAME)
114 len = MAXFILENAME;
115
116 strncpy(name, f,MAXFILENAME-1);
117 /* strncpy doesnt append the trailing NULL, of the string is too long. */
118 name[ MAXFILENAME ] = '\0';
119
120 if (name[len - 1] == '/')
121 name[len - 1] = '\0';
122 /* not all systems allow stat'ing a file with / appended */
@@ -136,26 +132,25 @@
136 tmzip->tm_year = filedate->tm_year;
137
138 return ret;
139 }
140 #else
141 uLong filetime(f, tmzip, dt)
142 const char *f; /* name of file to get info on */
143 tm_zip *tmzip; /* return value: access, modific. and creation times */
144 uLong *dt; /* dostime */
145 {
 
146 return 0;
147 }
148 #endif
149 #endif
150
151
152
153
154 static int check_exist_file(filename)
155 const char* filename;
156 {
157 FILE* ftestexist;
158 int ret = 1;
159 ftestexist = FOPEN_FUNC(filename,"rb");
160 if (ftestexist==NULL)
161 ret = 0;
@@ -162,18 +157,16 @@
162 else
163 fclose(ftestexist);
164 return ret;
165 }
166
167 static void do_banner()
168 {
169 printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
170 printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
171 }
172
173 static void do_help()
174 {
175 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
176 " -o Overwrite existing file.zip\n" \
177 " -a Append to existing file.zip\n" \
178 " -0 Store only\n" \
179 " -1 Compress faster\n" \
@@ -181,12 +174,11 @@
181 " -j exclude path. store only the file name.\n\n");
182 }
183
184 /* calculate the CRC32 of a file,
185 because to encrypt a file, we need known the CRC32 of the file before */
186 static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
187 {
188 unsigned long calculate_crc=0;
189 int err=ZIP_OK;
190 FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
191
192 unsigned long size_read = 0;
@@ -220,22 +212,21 @@
220 *result_crc=calculate_crc;
221 printf("file %s crc %lx\n", filenameinzip, calculate_crc);
222 return err;
223 }
224
225 static int isLargeFile(const char* filename)
226 {
227 int largeFile = 0;
228 ZPOS64_T pos = 0;
229 FILE* pFile = FOPEN_FUNC(filename, "rb");
230
231 if(pFile != NULL)
232 {
233 FSEEKO_FUNC(pFile, 0, SEEK_END);
234 pos = (ZPOS64_T)FTELLO_FUNC(pFile);
235
236 printf("File : %s is %lld bytes\n", filename, pos);
237
238 if(pos >= 0xffffffff)
239 largeFile = 1;
240
241 fclose(pFile);
@@ -242,14 +233,11 @@
242 }
243
244 return largeFile;
245 }
246
247 int main(argc,argv)
248 int argc;
249 char *argv[];
250 {
251 int i;
252 int opt_overwrite=0;
253 int opt_compress_level=Z_DEFAULT_COMPRESSION;
254 int opt_exclude_path=0;
255 int zipfilenamearg = 0;
@@ -321,11 +309,11 @@
321 int i,len;
322 int dot_found=0;
323
324 zipok = 1 ;
325 strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
326 /* strncpy doesnt append the trailing NULL, of the string is too long. */
327 filename_try[ MAXFILENAME ] = '\0';
328
329 len=(int)strlen(filename_try);
330 for (i=0;i<len;i++)
331 if (filename_try[i]=='.')
@@ -391,14 +379,14 @@
391 {
392 if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
393 ((argv[i][1]=='o') || (argv[i][1]=='O') ||
394 (argv[i][1]=='a') || (argv[i][1]=='A') ||
395 (argv[i][1]=='p') || (argv[i][1]=='P') ||
396 ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
397 (strlen(argv[i]) == 2)))
398 {
399 FILE * fin;
400 size_t size_read;
401 const char* filenameinzip = argv[i];
402 const char *savefilenameinzip;
403 zip_fileinfo zi;
404 unsigned long crcFile=0;
405
--- compat/zlib/contrib/minizip/minizip.c
+++ compat/zlib/contrib/minizip/minizip.c
@@ -26,11 +26,11 @@
26 #ifndef _FILE_OFFSET_BIT
27 #define _FILE_OFFSET_BIT 64
28 #endif
29 #endif
30
31 #if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
32 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
33 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
34 #define FTELLO_FUNC(stream) ftello(stream)
35 #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
36 #else
@@ -69,15 +69,13 @@
69
70 #define WRITEBUFFERSIZE (16384)
71 #define MAXFILENAME (256)
72
73 #ifdef _WIN32
74 /* f: name of file to get info on, tmzip: return value: access,
75 modification and creation times, dt: dostime */
76 static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
 
 
77 int ret = 0;
78 {
79 FILETIME ftLocal;
80 HANDLE hFind;
81 WIN32_FIND_DATAA ff32;
@@ -93,15 +91,13 @@
91 }
92 return ret;
93 }
94 #else
95 #if defined(unix) || defined(__APPLE__)
96 /* f: name of file to get info on, tmzip: return value: access,
97 modification and creation times, dt: dostime */
98 static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
 
 
99 (void)dt;
100 int ret=0;
101 struct stat s; /* results of stat() */
102 struct tm* filedate;
103 time_t tm_t=0;
@@ -112,11 +108,11 @@
108 size_t len = strlen(f);
109 if (len > MAXFILENAME)
110 len = MAXFILENAME;
111
112 strncpy(name, f,MAXFILENAME-1);
113 /* strncpy doesn't append the trailing NULL, of the string is too long. */
114 name[ MAXFILENAME ] = '\0';
115
116 if (name[len - 1] == '/')
117 name[len - 1] = '\0';
118 /* not all systems allow stat'ing a file with / appended */
@@ -136,26 +132,25 @@
132 tmzip->tm_year = filedate->tm_year;
133
134 return ret;
135 }
136 #else
137 /* f: name of file to get info on, tmzip: return value: access,
138 modification and creation times, dt: dostime */
139 static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
140 (void)f;
141 (void)tmzip;
142 (void)dt;
143 return 0;
144 }
145 #endif
146 #endif
147
148
149
150
151 static int check_exist_file(const char* filename) {
 
 
152 FILE* ftestexist;
153 int ret = 1;
154 ftestexist = FOPEN_FUNC(filename,"rb");
155 if (ftestexist==NULL)
156 ret = 0;
@@ -162,18 +157,16 @@
157 else
158 fclose(ftestexist);
159 return ret;
160 }
161
162 static void do_banner(void) {
 
163 printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
164 printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
165 }
166
167 static void do_help(void) {
 
168 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
169 " -o Overwrite existing file.zip\n" \
170 " -a Append to existing file.zip\n" \
171 " -0 Store only\n" \
172 " -1 Compress faster\n" \
@@ -181,12 +174,11 @@
174 " -j exclude path. store only the file name.\n\n");
175 }
176
177 /* calculate the CRC32 of a file,
178 because to encrypt a file, we need known the CRC32 of the file before */
179 static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_buf, unsigned long* result_crc) {
 
180 unsigned long calculate_crc=0;
181 int err=ZIP_OK;
182 FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
183
184 unsigned long size_read = 0;
@@ -220,22 +212,21 @@
212 *result_crc=calculate_crc;
213 printf("file %s crc %lx\n", filenameinzip, calculate_crc);
214 return err;
215 }
216
217 static int isLargeFile(const char* filename) {
 
218 int largeFile = 0;
219 ZPOS64_T pos = 0;
220 FILE* pFile = FOPEN_FUNC(filename, "rb");
221
222 if(pFile != NULL)
223 {
224 FSEEKO_FUNC(pFile, 0, SEEK_END);
225 pos = (ZPOS64_T)FTELLO_FUNC(pFile);
226
227 printf("File : %s is %llu bytes\n", filename, pos);
228
229 if(pos >= 0xffffffff)
230 largeFile = 1;
231
232 fclose(pFile);
@@ -242,14 +233,11 @@
233 }
234
235 return largeFile;
236 }
237
238 int main(int argc, char *argv[]) {
 
 
 
239 int i;
240 int opt_overwrite=0;
241 int opt_compress_level=Z_DEFAULT_COMPRESSION;
242 int opt_exclude_path=0;
243 int zipfilenamearg = 0;
@@ -321,11 +309,11 @@
309 int i,len;
310 int dot_found=0;
311
312 zipok = 1 ;
313 strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
314 /* strncpy doesn't append the trailing NULL, of the string is too long. */
315 filename_try[ MAXFILENAME ] = '\0';
316
317 len=(int)strlen(filename_try);
318 for (i=0;i<len;i++)
319 if (filename_try[i]=='.')
@@ -391,14 +379,14 @@
379 {
380 if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
381 ((argv[i][1]=='o') || (argv[i][1]=='O') ||
382 (argv[i][1]=='a') || (argv[i][1]=='A') ||
383 (argv[i][1]=='p') || (argv[i][1]=='P') ||
384 ((argv[i][1]>='0') && (argv[i][1]<='9'))) &&
385 (strlen(argv[i]) == 2)))
386 {
387 FILE * fin = NULL;
388 size_t size_read;
389 const char* filenameinzip = argv[i];
390 const char *savefilenameinzip;
391 zip_fileinfo zi;
392 unsigned long crcFile=0;
393
--- compat/zlib/contrib/minizip/mztools.c
+++ compat/zlib/contrib/minizip/mztools.c
@@ -25,17 +25,11 @@
2525
#define WRITE_32(buff, n) do { \
2626
WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
2727
WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
2828
} while(0)
2929
30
-extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
31
-const char* file;
32
-const char* fileOut;
33
-const char* fileOutTmp;
34
-uLong* nRecovered;
35
-uLong* bytesRecovered;
36
-{
30
+extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) {
3731
int err = Z_OK;
3832
FILE* fpZip = fopen(file, "rb");
3933
FILE* fpOut = fopen(fileOut, "wb");
4034
FILE* fpOutCD = fopen(fileOutTmp, "wb");
4135
if (fpZip != NULL && fpOut != NULL) {
4236
--- compat/zlib/contrib/minizip/mztools.c
+++ compat/zlib/contrib/minizip/mztools.c
@@ -25,17 +25,11 @@
25 #define WRITE_32(buff, n) do { \
26 WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
27 WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
28 } while(0)
29
30 extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
31 const char* file;
32 const char* fileOut;
33 const char* fileOutTmp;
34 uLong* nRecovered;
35 uLong* bytesRecovered;
36 {
37 int err = Z_OK;
38 FILE* fpZip = fopen(file, "rb");
39 FILE* fpOut = fopen(fileOut, "wb");
40 FILE* fpOutCD = fopen(fileOutTmp, "wb");
41 if (fpZip != NULL && fpOut != NULL) {
42
--- compat/zlib/contrib/minizip/mztools.c
+++ compat/zlib/contrib/minizip/mztools.c
@@ -25,17 +25,11 @@
25 #define WRITE_32(buff, n) do { \
26 WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
27 WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
28 } while(0)
29
30 extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) {
 
 
 
 
 
 
31 int err = Z_OK;
32 FILE* fpZip = fopen(file, "rb");
33 FILE* fpOut = fopen(fileOut, "wb");
34 FILE* fpOutCD = fopen(fileOutTmp, "wb");
35 if (fpZip != NULL && fpOut != NULL) {
36
--- compat/zlib/contrib/minizip/unzip.c
+++ compat/zlib/contrib/minizip/unzip.c
@@ -47,16 +47,16 @@
4747
2007-2008 - Even Rouault - Add unzip support for ZIP64
4848
4949
Copyright (C) 2007-2008 Even Rouault
5050
5151
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).
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).
5353
Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
5454
should only read the compressed/uncompressed size from the Zip64 format if
5555
the size from normal header was 0xFFFFFFFF
56
- Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant
57
- Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
56
+ Oct-2009 - Mathias Svensson - Applied some bug fixes from patches received from Gilles Vollant
57
+ Oct-2009 - Mathias Svensson - Applied support to unzip files with compression method BZIP2 (bzip2 lib is required)
5858
Patch created by Daniel Borca
5959
6060
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
6161
6262
Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson
@@ -75,12 +75,10 @@
7575
#include "zlib.h"
7676
#include "unzip.h"
7777
7878
#ifdef STDC
7979
# include <stddef.h>
80
-# include <string.h>
81
-# include <stdlib.h>
8280
#endif
8381
#ifdef NO_ERRNO_H
8482
extern int errno;
8583
#else
8684
# include <errno.h>
@@ -109,13 +107,10 @@
109107
#endif
110108
111109
#ifndef ALLOC
112110
# define ALLOC(size) (malloc(size))
113111
#endif
114
-#ifndef TRYFREE
115
-# define TRYFREE(p) { free(p);}
116
-#endif
117112
118113
#define SIZECENTRALDIRITEM (0x2e)
119114
#define SIZEZIPLOCALHEADER (0x1e)
120115
121116
@@ -151,11 +146,11 @@
151146
uLong crc32; /* crc32 of all data uncompressed */
152147
uLong crc32_wait; /* crc32 we must obtain after decompress all */
153148
ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
154149
ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
155150
zlib_filefunc64_32_def z_filefunc;
156
- voidpf filestream; /* io structore of the zipfile */
151
+ voidpf filestream; /* io structure of the zipfile */
157152
uLong compression_method; /* compression method (0==store) */
158153
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
159154
int raw;
160155
} file_in_zip64_read_info_s;
161156
@@ -164,11 +159,11 @@
164159
*/
165160
typedef struct
166161
{
167162
zlib_filefunc64_32_def z_filefunc;
168163
int is64bitOpenFunction;
169
- voidpf filestream; /* io structore of the zipfile */
164
+ voidpf filestream; /* io structure of the zipfile */
170165
unz_global_info64 gi; /* public global information */
171166
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
172167
ZPOS64_T num_file; /* number of the current file in the zipfile*/
173168
ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/
174169
ZPOS64_T current_file_ok; /* flag about the usability of the current file*/
@@ -194,162 +189,80 @@
194189
195190
196191
#ifndef NOUNCRYPT
197192
#include "crypt.h"
198193
#endif
194
+
199195
200196
/* ===========================================================================
201
- Read a byte from a gz_stream; update next_in and avail_in. Return EOF
202
- for end of file.
203
- IN assertion: the stream s has been successfully opened for reading.
197
+ Reads a long in LSB order from the given gz_stream. Sets
204198
*/
205199
206
-
207
-local int unz64local_getByte OF((
208
- const zlib_filefunc64_32_def* pzlib_filefunc_def,
209
- voidpf filestream,
210
- int *pi));
211
-
212
-local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
213
-{
214
- unsigned char c;
215
- int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
216
- if (err==1)
217
- {
218
- *pi = (int)c;
200
+local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def,
201
+ voidpf filestream,
202
+ uLong *pX) {
203
+ unsigned char c[2];
204
+ int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,2);
205
+ if (err==2)
206
+ {
207
+ *pX = c[0] | ((uLong)c[1] << 8);
208
+ return UNZ_OK;
209
+ }
210
+ else
211
+ {
212
+ *pX = 0;
213
+ if (ZERROR64(*pzlib_filefunc_def,filestream))
214
+ return UNZ_ERRNO;
215
+ else
216
+ return UNZ_EOF;
217
+ }
218
+}
219
+
220
+local int unz64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def,
221
+ voidpf filestream,
222
+ uLong *pX) {
223
+ unsigned char c[4];
224
+ int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,4);
225
+ if (err==4)
226
+ {
227
+ *pX = c[0] | ((uLong)c[1] << 8) | ((uLong)c[2] << 16) | ((uLong)c[3] << 24);
228
+ return UNZ_OK;
229
+ }
230
+ else
231
+ {
232
+ *pX = 0;
233
+ if (ZERROR64(*pzlib_filefunc_def,filestream))
234
+ return UNZ_ERRNO;
235
+ else
236
+ return UNZ_EOF;
237
+ }
238
+}
239
+
240
+
241
+local int unz64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
242
+ voidpf filestream,
243
+ ZPOS64_T *pX) {
244
+ unsigned char c[8];
245
+ int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,8);
246
+ if (err==8)
247
+ {
248
+ *pX = c[0] | ((ZPOS64_T)c[1] << 8) | ((ZPOS64_T)c[2] << 16) | ((ZPOS64_T)c[3] << 24)
249
+ | ((ZPOS64_T)c[4] << 32) | ((ZPOS64_T)c[5] << 40) | ((ZPOS64_T)c[6] << 48) | ((ZPOS64_T)c[7] << 56);
219250
return UNZ_OK;
220251
}
221252
else
222253
{
254
+ *pX = 0;
223255
if (ZERROR64(*pzlib_filefunc_def,filestream))
224256
return UNZ_ERRNO;
225257
else
226258
return UNZ_EOF;
227259
}
228260
}
229261
230
-
231
-/* ===========================================================================
232
- Reads a long in LSB order from the given gz_stream. Sets
233
-*/
234
-local int unz64local_getShort OF((
235
- const zlib_filefunc64_32_def* pzlib_filefunc_def,
236
- voidpf filestream,
237
- uLong *pX));
238
-
239
-local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
240
- voidpf filestream,
241
- uLong *pX)
242
-{
243
- uLong x ;
244
- int i = 0;
245
- int err;
246
-
247
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
248
- x = (uLong)i;
249
-
250
- if (err==UNZ_OK)
251
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
252
- x |= ((uLong)i)<<8;
253
-
254
- if (err==UNZ_OK)
255
- *pX = x;
256
- else
257
- *pX = 0;
258
- return err;
259
-}
260
-
261
-local int unz64local_getLong OF((
262
- const zlib_filefunc64_32_def* pzlib_filefunc_def,
263
- voidpf filestream,
264
- uLong *pX));
265
-
266
-local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
267
- voidpf filestream,
268
- uLong *pX)
269
-{
270
- uLong x ;
271
- int i = 0;
272
- int err;
273
-
274
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
275
- x = (uLong)i;
276
-
277
- if (err==UNZ_OK)
278
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
279
- x |= ((uLong)i)<<8;
280
-
281
- if (err==UNZ_OK)
282
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
283
- x |= ((uLong)i)<<16;
284
-
285
- if (err==UNZ_OK)
286
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
287
- x += ((uLong)i)<<24;
288
-
289
- if (err==UNZ_OK)
290
- *pX = x;
291
- else
292
- *pX = 0;
293
- return err;
294
-}
295
-
296
-local int unz64local_getLong64 OF((
297
- const zlib_filefunc64_32_def* pzlib_filefunc_def,
298
- voidpf filestream,
299
- ZPOS64_T *pX));
300
-
301
-
302
-local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,
303
- voidpf filestream,
304
- ZPOS64_T *pX)
305
-{
306
- ZPOS64_T x ;
307
- int i = 0;
308
- int err;
309
-
310
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
311
- x = (ZPOS64_T)i;
312
-
313
- if (err==UNZ_OK)
314
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
315
- x |= ((ZPOS64_T)i)<<8;
316
-
317
- if (err==UNZ_OK)
318
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
319
- x |= ((ZPOS64_T)i)<<16;
320
-
321
- if (err==UNZ_OK)
322
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
323
- x |= ((ZPOS64_T)i)<<24;
324
-
325
- if (err==UNZ_OK)
326
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
327
- x |= ((ZPOS64_T)i)<<32;
328
-
329
- if (err==UNZ_OK)
330
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
331
- x |= ((ZPOS64_T)i)<<40;
332
-
333
- if (err==UNZ_OK)
334
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
335
- x |= ((ZPOS64_T)i)<<48;
336
-
337
- if (err==UNZ_OK)
338
- err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
339
- x |= ((ZPOS64_T)i)<<56;
340
-
341
- if (err==UNZ_OK)
342
- *pX = x;
343
- else
344
- *pX = 0;
345
- return err;
346
-}
347
-
348262
/* My own strcmpi / strcasecmp */
349
-local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
350
-{
263
+local int strcmpcasenosensitive_internal(const char* fileName1, const char* fileName2) {
351264
for (;;)
352265
{
353266
char c1=*(fileName1++);
354267
char c2=*(fileName2++);
355268
if ((c1>='a') && (c1<='z'))
@@ -377,23 +290,21 @@
377290
#ifndef STRCMPCASENOSENTIVEFUNCTION
378291
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
379292
#endif
380293
381294
/*
382
- Compare two filename (fileName1,fileName2).
383
- If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
384
- If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
295
+ Compare two filenames (fileName1,fileName2).
296
+ If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
297
+ If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
385298
or strcasecmp)
386
- If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
299
+ If iCaseSensitivity = 0, case sensitivity is default of your operating system
387300
(like 1 on Unix, 2 on Windows)
388301
389302
*/
390303
extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
391
- const char* fileName2,
392
- int iCaseSensitivity)
393
-
394
-{
304
+ const char* fileName2,
305
+ int iCaseSensitivity) {
395306
if (iCaseSensitivity==0)
396307
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
397308
398309
if (iCaseSensitivity==1)
399310
return strcmp(fileName1,fileName2);
@@ -403,35 +314,37 @@
403314
404315
#ifndef BUFREADCOMMENT
405316
#define BUFREADCOMMENT (0x400)
406317
#endif
407318
319
+#ifndef CENTRALDIRINVALID
320
+#define CENTRALDIRINVALID ((ZPOS64_T)(-1))
321
+#endif
322
+
408323
/*
409324
Locate the Central directory of a zipfile (at the end, just before
410325
the global comment)
411326
*/
412
-local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
413
-local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
414
-{
327
+local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
415328
unsigned char* buf;
416329
ZPOS64_T uSizeFile;
417330
ZPOS64_T uBackRead;
418331
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
419
- ZPOS64_T uPosFound=0;
332
+ ZPOS64_T uPosFound=CENTRALDIRINVALID;
420333
421334
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
422
- return 0;
335
+ return CENTRALDIRINVALID;
423336
424337
425338
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
426339
427340
if (uMaxBack>uSizeFile)
428341
uMaxBack = uSizeFile;
429342
430343
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
431344
if (buf==NULL)
432
- return 0;
345
+ return CENTRALDIRINVALID;
433346
434347
uBackRead = 4;
435348
while (uBackRead<uMaxBack)
436349
{
437350
uLong uReadSize;
@@ -457,49 +370,44 @@
457370
{
458371
uPosFound = uReadPos+(unsigned)i;
459372
break;
460373
}
461374
462
- if (uPosFound!=0)
375
+ if (uPosFound!=CENTRALDIRINVALID)
463376
break;
464377
}
465
- TRYFREE(buf);
378
+ free(buf);
466379
return uPosFound;
467380
}
468381
469382
470383
/*
471384
Locate the Central directory 64 of a zipfile (at the end, just before
472385
the global comment)
473386
*/
474
-local ZPOS64_T unz64local_SearchCentralDir64 OF((
475
- const zlib_filefunc64_32_def* pzlib_filefunc_def,
476
- voidpf filestream));
477
-
478387
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
479
- voidpf filestream)
480
-{
388
+ voidpf filestream) {
481389
unsigned char* buf;
482390
ZPOS64_T uSizeFile;
483391
ZPOS64_T uBackRead;
484392
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
485
- ZPOS64_T uPosFound=0;
393
+ ZPOS64_T uPosFound=CENTRALDIRINVALID;
486394
uLong uL;
487395
ZPOS64_T relativeOffset;
488396
489397
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
490
- return 0;
398
+ return CENTRALDIRINVALID;
491399
492400
493401
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
494402
495403
if (uMaxBack>uSizeFile)
496404
uMaxBack = uSizeFile;
497405
498406
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
499407
if (buf==NULL)
500
- return 0;
408
+ return CENTRALDIRINVALID;
501409
502410
uBackRead = 4;
503411
while (uBackRead<uMaxBack)
504412
{
505413
uLong uReadSize;
@@ -525,51 +433,51 @@
525433
{
526434
uPosFound = uReadPos+(unsigned)i;
527435
break;
528436
}
529437
530
- if (uPosFound!=0)
438
+ if (uPosFound!=CENTRALDIRINVALID)
531439
break;
532440
}
533
- TRYFREE(buf);
534
- if (uPosFound == 0)
535
- return 0;
441
+ free(buf);
442
+ if (uPosFound == CENTRALDIRINVALID)
443
+ return CENTRALDIRINVALID;
536444
537445
/* Zip64 end of central directory locator */
538446
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
539
- return 0;
447
+ return CENTRALDIRINVALID;
540448
541449
/* the signature, already checked */
542450
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
543
- return 0;
451
+ return CENTRALDIRINVALID;
544452
545453
/* number of the disk with the start of the zip64 end of central directory */
546454
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
547
- return 0;
455
+ return CENTRALDIRINVALID;
548456
if (uL != 0)
549
- return 0;
457
+ return CENTRALDIRINVALID;
550458
551459
/* relative offset of the zip64 end of central directory record */
552460
if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
553
- return 0;
461
+ return CENTRALDIRINVALID;
554462
555463
/* total number of disks */
556464
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
557
- return 0;
465
+ return CENTRALDIRINVALID;
558466
if (uL != 1)
559
- return 0;
467
+ return CENTRALDIRINVALID;
560468
561469
/* Goto end of central directory record */
562470
if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
563
- return 0;
471
+ return CENTRALDIRINVALID;
564472
565473
/* the signature */
566474
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
567
- return 0;
475
+ return CENTRALDIRINVALID;
568476
569477
if (uL != 0x06064b50)
570
- return 0;
478
+ return CENTRALDIRINVALID;
571479
572480
return relativeOffset;
573481
}
574482
575483
/*
@@ -579,23 +487,22 @@
579487
If the zipfile cannot be opened (file doesn't exist or in not valid), the
580488
return value is NULL.
581489
Else, the return value is a unzFile Handle, usable with other function
582490
of this unzip package.
583491
*/
584
-local unzFile unzOpenInternal (const void *path,
585
- zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
586
- int is64bitOpenFunction)
587
-{
492
+local unzFile unzOpenInternal(const void *path,
493
+ zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
494
+ int is64bitOpenFunction) {
588495
unz64_s us;
589496
unz64_s *s;
590497
ZPOS64_T central_pos;
591498
uLong uL;
592499
593500
uLong number_disk; /* number of the current dist, used for
594
- spaning ZIP, unsupported, always 0*/
501
+ spanning ZIP, unsupported, always 0*/
595502
uLong number_disk_with_CD; /* number the the disk with central dir, used
596
- for spaning ZIP, unsupported, always 0*/
503
+ for spanning ZIP, unsupported, always 0*/
597504
ZPOS64_T number_entry_CD; /* total number of entries in
598505
the central dir
599506
(same than number_entry on nospan) */
600507
601508
int err=UNZ_OK;
@@ -619,11 +526,11 @@
619526
ZLIB_FILEFUNC_MODE_EXISTING);
620527
if (us.filestream==NULL)
621528
return NULL;
622529
623530
central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
624
- if (central_pos)
531
+ if (central_pos!=CENTRALDIRINVALID)
625532
{
626533
uLong uS;
627534
ZPOS64_T uL64;
628535
629536
us.isZip64 = 1;
@@ -681,11 +588,11 @@
681588
us.gi.size_comment = 0;
682589
}
683590
else
684591
{
685592
central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
686
- if (central_pos==0)
593
+ if (central_pos==CENTRALDIRINVALID)
687594
err=UNZ_ERRNO;
688595
689596
us.isZip64 = 0;
690597
691598
if (ZSEEK64(us.z_filefunc, us.filestream,
@@ -760,13 +667,12 @@
760667
}
761668
return (unzFile)s;
762669
}
763670
764671
765
-extern unzFile ZEXPORT unzOpen2 (const char *path,
766
- zlib_filefunc_def* pzlib_filefunc32_def)
767
-{
672
+extern unzFile ZEXPORT unzOpen2(const char *path,
673
+ zlib_filefunc_def* pzlib_filefunc32_def) {
768674
if (pzlib_filefunc32_def != NULL)
769675
{
770676
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
771677
fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
772678
return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);
@@ -773,13 +679,12 @@
773679
}
774680
else
775681
return unzOpenInternal(path, NULL, 0);
776682
}
777683
778
-extern unzFile ZEXPORT unzOpen2_64 (const void *path,
779
- zlib_filefunc64_def* pzlib_filefunc_def)
780
-{
684
+extern unzFile ZEXPORT unzOpen2_64(const void *path,
685
+ zlib_filefunc64_def* pzlib_filefunc_def) {
781686
if (pzlib_filefunc_def != NULL)
782687
{
783688
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
784689
zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
785690
zlib_filefunc64_32_def_fill.ztell32_file = NULL;
@@ -788,57 +693,52 @@
788693
}
789694
else
790695
return unzOpenInternal(path, NULL, 1);
791696
}
792697
793
-extern unzFile ZEXPORT unzOpen (const char *path)
794
-{
698
+extern unzFile ZEXPORT unzOpen(const char *path) {
795699
return unzOpenInternal(path, NULL, 0);
796700
}
797701
798
-extern unzFile ZEXPORT unzOpen64 (const void *path)
799
-{
702
+extern unzFile ZEXPORT unzOpen64(const void *path) {
800703
return unzOpenInternal(path, NULL, 1);
801704
}
802705
803706
/*
804707
Close a ZipFile opened with unzOpen.
805708
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
806709
these files MUST be closed with unzCloseCurrentFile before call unzClose.
807710
return UNZ_OK if there is no problem. */
808
-extern int ZEXPORT unzClose (unzFile file)
809
-{
711
+extern int ZEXPORT unzClose(unzFile file) {
810712
unz64_s* s;
811713
if (file==NULL)
812714
return UNZ_PARAMERROR;
813715
s=(unz64_s*)file;
814716
815717
if (s->pfile_in_zip_read!=NULL)
816718
unzCloseCurrentFile(file);
817719
818720
ZCLOSE64(s->z_filefunc, s->filestream);
819
- TRYFREE(s);
721
+ free(s);
820722
return UNZ_OK;
821723
}
822724
823725
824726
/*
825727
Write info about the ZipFile in the *pglobal_info structure.
826728
No preparation of the structure is needed
827729
return UNZ_OK if there is no problem. */
828
-extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info)
829
-{
730
+extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) {
830731
unz64_s* s;
831732
if (file==NULL)
832733
return UNZ_PARAMERROR;
833734
s=(unz64_s*)file;
834735
*pglobal_info=s->gi;
835736
return UNZ_OK;
836737
}
837738
838
-extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32)
839
-{
739
+extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) {
840740
unz64_s* s;
841741
if (file==NULL)
842742
return UNZ_PARAMERROR;
843743
s=(unz64_s*)file;
844744
/* to do : check if number_entry is not truncated */
@@ -845,14 +745,13 @@
845745
pglobal_info32->number_entry = (uLong)s->gi.number_entry;
846746
pglobal_info32->size_comment = s->gi.size_comment;
847747
return UNZ_OK;
848748
}
849749
/*
850
- Translate date/time from Dos format to tm_unz (readable more easilty)
750
+ Translate date/time from Dos format to tm_unz (readable more easily)
851751
*/
852
-local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
853
-{
752
+local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) {
854753
ZPOS64_T uDate;
855754
uDate = (ZPOS64_T)(ulDosDate>>16);
856755
ptm->tm_mday = (int)(uDate&0x1f) ;
857756
ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
858757
ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
@@ -863,32 +762,20 @@
863762
}
864763
865764
/*
866765
Get Info about the current file in the zipfile, with internal only info
867766
*/
868
-local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
869
- unz_file_info64 *pfile_info,
870
- unz_file_info64_internal
871
- *pfile_info_internal,
872
- char *szFileName,
873
- uLong fileNameBufferSize,
874
- void *extraField,
875
- uLong extraFieldBufferSize,
876
- char *szComment,
877
- uLong commentBufferSize));
878
-
879
-local int unz64local_GetCurrentFileInfoInternal (unzFile file,
880
- unz_file_info64 *pfile_info,
881
- unz_file_info64_internal
882
- *pfile_info_internal,
883
- char *szFileName,
884
- uLong fileNameBufferSize,
885
- void *extraField,
886
- uLong extraFieldBufferSize,
887
- char *szComment,
888
- uLong commentBufferSize)
889
-{
767
+local int unz64local_GetCurrentFileInfoInternal(unzFile file,
768
+ unz_file_info64 *pfile_info,
769
+ unz_file_info64_internal
770
+ *pfile_info_internal,
771
+ char *szFileName,
772
+ uLong fileNameBufferSize,
773
+ void *extraField,
774
+ uLong extraFieldBufferSize,
775
+ char *szComment,
776
+ uLong commentBufferSize) {
890777
unz64_s* s;
891778
unz_file_info64 file_info;
892779
unz_file_info64_internal file_info_internal;
893780
int err=UNZ_OK;
894781
uLong uMagic;
@@ -1036,37 +923,35 @@
1036923
err=UNZ_ERRNO;
1037924
1038925
/* ZIP64 extra fields */
1039926
if (headerId == 0x0001)
1040927
{
1041
- uLong uL;
1042
-
1043
- if(file_info.uncompressed_size == MAXU32)
1044
- {
1045
- if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
1046
- err=UNZ_ERRNO;
1047
- }
1048
-
1049
- if(file_info.compressed_size == MAXU32)
1050
- {
1051
- if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
1052
- err=UNZ_ERRNO;
1053
- }
1054
-
1055
- if(file_info_internal.offset_curfile == MAXU32)
1056
- {
1057
- /* Relative Header offset */
1058
- if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
1059
- err=UNZ_ERRNO;
1060
- }
1061
-
1062
- if(file_info.disk_num_start == MAXU32)
1063
- {
1064
- /* Disk Start Number */
1065
- if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
1066
- err=UNZ_ERRNO;
1067
- }
928
+ if(file_info.uncompressed_size == MAXU32)
929
+ {
930
+ if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
931
+ err=UNZ_ERRNO;
932
+ }
933
+
934
+ if(file_info.compressed_size == MAXU32)
935
+ {
936
+ if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
937
+ err=UNZ_ERRNO;
938
+ }
939
+
940
+ if(file_info_internal.offset_curfile == MAXU32)
941
+ {
942
+ /* Relative Header offset */
943
+ if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
944
+ err=UNZ_ERRNO;
945
+ }
946
+
947
+ if(file_info.disk_num_start == 0xffff)
948
+ {
949
+ /* Disk Start Number */
950
+ if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
951
+ err=UNZ_ERRNO;
952
+ }
1068953
1069954
}
1070955
else
1071956
{
1072957
if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
@@ -1119,28 +1004,26 @@
11191004
/*
11201005
Write info about the ZipFile in the *pglobal_info structure.
11211006
No preparation of the structure is needed
11221007
return UNZ_OK if there is no problem.
11231008
*/
1124
-extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
1125
- unz_file_info64 * pfile_info,
1126
- char * szFileName, uLong fileNameBufferSize,
1127
- void *extraField, uLong extraFieldBufferSize,
1128
- char* szComment, uLong commentBufferSize)
1129
-{
1009
+extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
1010
+ unz_file_info64 * pfile_info,
1011
+ char * szFileName, uLong fileNameBufferSize,
1012
+ void *extraField, uLong extraFieldBufferSize,
1013
+ char* szComment, uLong commentBufferSize) {
11301014
return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
1131
- szFileName,fileNameBufferSize,
1132
- extraField,extraFieldBufferSize,
1133
- szComment,commentBufferSize);
1015
+ szFileName,fileNameBufferSize,
1016
+ extraField,extraFieldBufferSize,
1017
+ szComment,commentBufferSize);
11341018
}
11351019
1136
-extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
1137
- unz_file_info * pfile_info,
1138
- char * szFileName, uLong fileNameBufferSize,
1139
- void *extraField, uLong extraFieldBufferSize,
1140
- char* szComment, uLong commentBufferSize)
1141
-{
1020
+extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
1021
+ unz_file_info * pfile_info,
1022
+ char * szFileName, uLong fileNameBufferSize,
1023
+ void *extraField, uLong extraFieldBufferSize,
1024
+ char* szComment, uLong commentBufferSize) {
11421025
int err;
11431026
unz_file_info64 file_info64;
11441027
err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
11451028
szFileName,fileNameBufferSize,
11461029
extraField,extraFieldBufferSize,
@@ -1160,11 +1043,11 @@
11601043
11611044
pfile_info->disk_num_start = file_info64.disk_num_start;
11621045
pfile_info->internal_fa = file_info64.internal_fa;
11631046
pfile_info->external_fa = file_info64.external_fa;
11641047
1165
- pfile_info->tmu_date = file_info64.tmu_date,
1048
+ pfile_info->tmu_date = file_info64.tmu_date;
11661049
11671050
11681051
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
11691052
pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
11701053
@@ -1173,12 +1056,11 @@
11731056
}
11741057
/*
11751058
Set the current file of the zipfile to the first file.
11761059
return UNZ_OK if there is no problem
11771060
*/
1178
-extern int ZEXPORT unzGoToFirstFile (unzFile file)
1179
-{
1061
+extern int ZEXPORT unzGoToFirstFile(unzFile file) {
11801062
int err=UNZ_OK;
11811063
unz64_s* s;
11821064
if (file==NULL)
11831065
return UNZ_PARAMERROR;
11841066
s=(unz64_s*)file;
@@ -1194,12 +1076,11 @@
11941076
/*
11951077
Set the current file of the zipfile to the next file.
11961078
return UNZ_OK if there is no problem
11971079
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
11981080
*/
1199
-extern int ZEXPORT unzGoToNextFile (unzFile file)
1200
-{
1081
+extern int ZEXPORT unzGoToNextFile(unzFile file) {
12011082
unz64_s* s;
12021083
int err;
12031084
12041085
if (file==NULL)
12051086
return UNZ_PARAMERROR;
@@ -1227,12 +1108,11 @@
12271108
12281109
return value :
12291110
UNZ_OK if the file is found. It becomes the current file.
12301111
UNZ_END_OF_LIST_OF_FILE if the file is not found
12311112
*/
1232
-extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
1233
-{
1113
+extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity) {
12341114
unz64_s* s;
12351115
int err;
12361116
12371117
/* We remember the 'current' position in the file so that we can jump
12381118
* back there if we fail.
@@ -1303,12 +1183,11 @@
13031183
ZPOS64_T pos_in_zip_directory; // offset in file
13041184
ZPOS64_T num_of_file; // # of file
13051185
} unz_file_pos;
13061186
*/
13071187
1308
-extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
1309
-{
1188
+extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) {
13101189
unz64_s* s;
13111190
13121191
if (file==NULL || file_pos==NULL)
13131192
return UNZ_PARAMERROR;
13141193
s=(unz64_s*)file;
@@ -1319,14 +1198,11 @@
13191198
file_pos->num_of_file = s->num_file;
13201199
13211200
return UNZ_OK;
13221201
}
13231202
1324
-extern int ZEXPORT unzGetFilePos(
1325
- unzFile file,
1326
- unz_file_pos* file_pos)
1327
-{
1203
+extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) {
13281204
unz64_file_pos file_pos64;
13291205
int err = unzGetFilePos64(file,&file_pos64);
13301206
if (err==UNZ_OK)
13311207
{
13321208
file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
@@ -1333,12 +1209,11 @@
13331209
file_pos->num_of_file = (uLong)file_pos64.num_of_file;
13341210
}
13351211
return err;
13361212
}
13371213
1338
-extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos)
1339
-{
1214
+extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) {
13401215
unz64_s* s;
13411216
int err;
13421217
13431218
if (file==NULL || file_pos==NULL)
13441219
return UNZ_PARAMERROR;
@@ -1355,14 +1230,11 @@
13551230
/* return results */
13561231
s->current_file_ok = (err == UNZ_OK);
13571232
return err;
13581233
}
13591234
1360
-extern int ZEXPORT unzGoToFilePos(
1361
- unzFile file,
1362
- unz_file_pos* file_pos)
1363
-{
1235
+extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) {
13641236
unz64_file_pos file_pos64;
13651237
if (file_pos == NULL)
13661238
return UNZ_PARAMERROR;
13671239
13681240
file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
@@ -1380,14 +1252,13 @@
13801252
Check the coherency of the local header and info in the end of central
13811253
directory about this file
13821254
store in *piSizeVar the size of extra info in local header
13831255
(filename and size of extra field data)
13841256
*/
1385
-local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
1386
- ZPOS64_T * poffset_local_extrafield,
1387
- uInt * psize_local_extrafield)
1388
-{
1257
+local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar,
1258
+ ZPOS64_T * poffset_local_extrafield,
1259
+ uInt * psize_local_extrafield) {
13891260
uLong uMagic,uData,uFlags;
13901261
uLong size_filename;
13911262
uLong size_extra_field;
13921263
int err=UNZ_OK;
13931264
@@ -1467,13 +1338,12 @@
14671338
14681339
/*
14691340
Open for reading data the current file in the zipfile.
14701341
If there is no error and the file is opened, the return value is UNZ_OK.
14711342
*/
1472
-extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
1473
- int* level, int raw, const char* password)
1474
-{
1343
+extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
1344
+ int* level, int raw, const char* password) {
14751345
int err=UNZ_OK;
14761346
uInt iSizeVar;
14771347
unz64_s* s;
14781348
file_in_zip64_read_info_s* pfile_in_zip_read_info;
14791349
ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
@@ -1507,11 +1377,11 @@
15071377
pfile_in_zip_read_info->pos_local_extrafield=0;
15081378
pfile_in_zip_read_info->raw=raw;
15091379
15101380
if (pfile_in_zip_read_info->read_buffer==NULL)
15111381
{
1512
- TRYFREE(pfile_in_zip_read_info);
1382
+ free(pfile_in_zip_read_info);
15131383
return UNZ_INTERNALERROR;
15141384
}
15151385
15161386
pfile_in_zip_read_info->stream_initialised=0;
15171387
@@ -1564,12 +1434,12 @@
15641434
err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
15651435
if (err == Z_OK)
15661436
pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
15671437
else
15681438
{
1569
- TRYFREE(pfile_in_zip_read_info->read_buffer);
1570
- TRYFREE(pfile_in_zip_read_info);
1439
+ free(pfile_in_zip_read_info->read_buffer);
1440
+ free(pfile_in_zip_read_info);
15711441
return err;
15721442
}
15731443
#else
15741444
pfile_in_zip_read_info->raw=1;
15751445
#endif
@@ -1585,12 +1455,12 @@
15851455
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
15861456
if (err == Z_OK)
15871457
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
15881458
else
15891459
{
1590
- TRYFREE(pfile_in_zip_read_info->read_buffer);
1591
- TRYFREE(pfile_in_zip_read_info);
1460
+ free(pfile_in_zip_read_info->read_buffer);
1461
+ free(pfile_in_zip_read_info);
15921462
return err;
15931463
}
15941464
/* windowBits is passed < 0 to tell that there is no zlib header.
15951465
* Note that in this case inflate *requires* an extra "dummy" byte
15961466
* after the compressed stream in order to complete decompression and
@@ -1638,29 +1508,25 @@
16381508
16391509
16401510
return UNZ_OK;
16411511
}
16421512
1643
-extern int ZEXPORT unzOpenCurrentFile (unzFile file)
1644
-{
1513
+extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
16451514
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
16461515
}
16471516
1648
-extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password)
1649
-{
1517
+extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) {
16501518
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
16511519
}
16521520
1653
-extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw)
1654
-{
1521
+extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) {
16551522
return unzOpenCurrentFile3(file, method, level, raw, NULL);
16561523
}
16571524
16581525
/** Addition for GDAL : START */
16591526
1660
-extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
1661
-{
1527
+extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) {
16621528
unz64_s* s;
16631529
file_in_zip64_read_info_s* pfile_in_zip_read_info;
16641530
s=(unz64_s*)file;
16651531
if (file==NULL)
16661532
return 0; //UNZ_PARAMERROR;
@@ -1676,17 +1542,16 @@
16761542
/*
16771543
Read bytes from the current file.
16781544
buf contain buffer where data must be copied
16791545
len the size of buf.
16801546
1681
- return the number of byte copied if somes bytes are copied
1547
+ return the number of byte copied if some bytes are copied
16821548
return 0 if the end of file was reached
16831549
return <0 with error code if there is an error
16841550
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
16851551
*/
1686
-extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
1687
-{
1552
+extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
16881553
int err=UNZ_OK;
16891554
uInt iRead = 0;
16901555
unz64_s* s;
16911556
file_in_zip64_read_info_s* pfile_in_zip_read_info;
16921557
if (file==NULL)
@@ -1889,12 +1754,11 @@
18891754
18901755
18911756
/*
18921757
Give the current position in uncompressed data
18931758
*/
1894
-extern z_off_t ZEXPORT unztell (unzFile file)
1895
-{
1759
+extern z_off_t ZEXPORT unztell(unzFile file) {
18961760
unz64_s* s;
18971761
file_in_zip64_read_info_s* pfile_in_zip_read_info;
18981762
if (file==NULL)
18991763
return UNZ_PARAMERROR;
19001764
s=(unz64_s*)file;
@@ -1904,12 +1768,11 @@
19041768
return UNZ_PARAMERROR;
19051769
19061770
return (z_off_t)pfile_in_zip_read_info->stream.total_out;
19071771
}
19081772
1909
-extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
1910
-{
1773
+extern ZPOS64_T ZEXPORT unztell64(unzFile file) {
19111774
19121775
unz64_s* s;
19131776
file_in_zip64_read_info_s* pfile_in_zip_read_info;
19141777
if (file==NULL)
19151778
return (ZPOS64_T)-1;
@@ -1924,12 +1787,11 @@
19241787
19251788
19261789
/*
19271790
return 1 if the end of file was reached, 0 elsewhere
19281791
*/
1929
-extern int ZEXPORT unzeof (unzFile file)
1930
-{
1792
+extern int ZEXPORT unzeof(unzFile file) {
19311793
unz64_s* s;
19321794
file_in_zip64_read_info_s* pfile_in_zip_read_info;
19331795
if (file==NULL)
19341796
return UNZ_PARAMERROR;
19351797
s=(unz64_s*)file;
@@ -1956,12 +1818,11 @@
19561818
if buf!=NULL, len is the size of the buffer, the extra header is copied in
19571819
buf.
19581820
the return value is the number of bytes copied in buf, or (if <0)
19591821
the error code
19601822
*/
1961
-extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
1962
-{
1823
+extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) {
19631824
unz64_s* s;
19641825
file_in_zip64_read_info_s* pfile_in_zip_read_info;
19651826
uInt read_now;
19661827
ZPOS64_T size_to_read;
19671828
@@ -2004,12 +1865,11 @@
20041865
20051866
/*
20061867
Close the file in zip opened with unzOpenCurrentFile
20071868
Return UNZ_CRCERROR if all the file was read but the CRC is not good
20081869
*/
2009
-extern int ZEXPORT unzCloseCurrentFile (unzFile file)
2010
-{
1870
+extern int ZEXPORT unzCloseCurrentFile(unzFile file) {
20111871
int err=UNZ_OK;
20121872
20131873
unz64_s* s;
20141874
file_in_zip64_read_info_s* pfile_in_zip_read_info;
20151875
if (file==NULL)
@@ -2027,11 +1887,11 @@
20271887
if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
20281888
err=UNZ_CRCERROR;
20291889
}
20301890
20311891
2032
- TRYFREE(pfile_in_zip_read_info->read_buffer);
1892
+ free(pfile_in_zip_read_info->read_buffer);
20331893
pfile_in_zip_read_info->read_buffer = NULL;
20341894
if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
20351895
inflateEnd(&pfile_in_zip_read_info->stream);
20361896
#ifdef HAVE_BZIP2
20371897
else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
@@ -2038,11 +1898,11 @@
20381898
BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
20391899
#endif
20401900
20411901
20421902
pfile_in_zip_read_info->stream_initialised = 0;
2043
- TRYFREE(pfile_in_zip_read_info);
1903
+ free(pfile_in_zip_read_info);
20441904
20451905
s->pfile_in_zip_read=NULL;
20461906
20471907
return err;
20481908
}
@@ -2051,12 +1911,11 @@
20511911
/*
20521912
Get the global comment string of the ZipFile, in the szComment buffer.
20531913
uSizeBuf is the size of the szComment buffer.
20541914
return the number of byte copied or an error code <0
20551915
*/
2056
-extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)
2057
-{
1916
+extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) {
20581917
unz64_s* s;
20591918
uLong uReadThis ;
20601919
if (file==NULL)
20611920
return (int)UNZ_PARAMERROR;
20621921
s=(unz64_s*)file;
@@ -2079,12 +1938,11 @@
20791938
*(szComment+s->gi.size_comment)='\0';
20801939
return (int)uReadThis;
20811940
}
20821941
20831942
/* Additions by RX '2004 */
2084
-extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
2085
-{
1943
+extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) {
20861944
unz64_s* s;
20871945
20881946
if (file==NULL)
20891947
return 0; //UNZ_PARAMERROR;
20901948
s=(unz64_s*)file;
@@ -2094,22 +1952,20 @@
20941952
if (s->num_file==s->gi.number_entry)
20951953
return 0;
20961954
return s->pos_in_central_dir;
20971955
}
20981956
2099
-extern uLong ZEXPORT unzGetOffset (unzFile file)
2100
-{
1957
+extern uLong ZEXPORT unzGetOffset(unzFile file) {
21011958
ZPOS64_T offset64;
21021959
21031960
if (file==NULL)
21041961
return 0; //UNZ_PARAMERROR;
21051962
offset64 = unzGetOffset64(file);
21061963
return (uLong)offset64;
21071964
}
21081965
2109
-extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
2110
-{
1966
+extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) {
21111967
unz64_s* s;
21121968
int err;
21131969
21141970
if (file==NULL)
21151971
return UNZ_PARAMERROR;
@@ -2122,9 +1978,8 @@
21221978
NULL,0,NULL,0,NULL,0);
21231979
s->current_file_ok = (err == UNZ_OK);
21241980
return err;
21251981
}
21261982
2127
-extern int ZEXPORT unzSetOffset (unzFile file, uLong pos)
2128
-{
1983
+extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) {
21291984
return unzSetOffset64(file,pos);
21301985
}
21311986
--- compat/zlib/contrib/minizip/unzip.c
+++ compat/zlib/contrib/minizip/unzip.c
@@ -47,16 +47,16 @@
47 2007-2008 - Even Rouault - Add unzip support for ZIP64
48
49 Copyright (C) 2007-2008 Even Rouault
50
51
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).
53 Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
54 should only read the compressed/uncompressed size from the Zip64 format if
55 the size from normal header was 0xFFFFFFFF
56 Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant
57 Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
58 Patch created by Daniel Borca
59
60 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
61
62 Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson
@@ -75,12 +75,10 @@
75 #include "zlib.h"
76 #include "unzip.h"
77
78 #ifdef STDC
79 # include <stddef.h>
80 # include <string.h>
81 # include <stdlib.h>
82 #endif
83 #ifdef NO_ERRNO_H
84 extern int errno;
85 #else
86 # include <errno.h>
@@ -109,13 +107,10 @@
109 #endif
110
111 #ifndef ALLOC
112 # define ALLOC(size) (malloc(size))
113 #endif
114 #ifndef TRYFREE
115 # define TRYFREE(p) { free(p);}
116 #endif
117
118 #define SIZECENTRALDIRITEM (0x2e)
119 #define SIZEZIPLOCALHEADER (0x1e)
120
121
@@ -151,11 +146,11 @@
151 uLong crc32; /* crc32 of all data uncompressed */
152 uLong crc32_wait; /* crc32 we must obtain after decompress all */
153 ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
154 ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
155 zlib_filefunc64_32_def z_filefunc;
156 voidpf filestream; /* io structore of the zipfile */
157 uLong compression_method; /* compression method (0==store) */
158 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
159 int raw;
160 } file_in_zip64_read_info_s;
161
@@ -164,11 +159,11 @@
164 */
165 typedef struct
166 {
167 zlib_filefunc64_32_def z_filefunc;
168 int is64bitOpenFunction;
169 voidpf filestream; /* io structore of the zipfile */
170 unz_global_info64 gi; /* public global information */
171 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
172 ZPOS64_T num_file; /* number of the current file in the zipfile*/
173 ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/
174 ZPOS64_T current_file_ok; /* flag about the usability of the current file*/
@@ -194,162 +189,80 @@
194
195
196 #ifndef NOUNCRYPT
197 #include "crypt.h"
198 #endif
 
199
200 /* ===========================================================================
201 Read a byte from a gz_stream; update next_in and avail_in. Return EOF
202 for end of file.
203 IN assertion: the stream s has been successfully opened for reading.
204 */
205
206
207 local int unz64local_getByte OF((
208 const zlib_filefunc64_32_def* pzlib_filefunc_def,
209 voidpf filestream,
210 int *pi));
211
212 local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
213 {
214 unsigned char c;
215 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
216 if (err==1)
217 {
218 *pi = (int)c;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219 return UNZ_OK;
220 }
221 else
222 {
 
223 if (ZERROR64(*pzlib_filefunc_def,filestream))
224 return UNZ_ERRNO;
225 else
226 return UNZ_EOF;
227 }
228 }
229
230
231 /* ===========================================================================
232 Reads a long in LSB order from the given gz_stream. Sets
233 */
234 local int unz64local_getShort OF((
235 const zlib_filefunc64_32_def* pzlib_filefunc_def,
236 voidpf filestream,
237 uLong *pX));
238
239 local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
240 voidpf filestream,
241 uLong *pX)
242 {
243 uLong x ;
244 int i = 0;
245 int err;
246
247 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
248 x = (uLong)i;
249
250 if (err==UNZ_OK)
251 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
252 x |= ((uLong)i)<<8;
253
254 if (err==UNZ_OK)
255 *pX = x;
256 else
257 *pX = 0;
258 return err;
259 }
260
261 local int unz64local_getLong OF((
262 const zlib_filefunc64_32_def* pzlib_filefunc_def,
263 voidpf filestream,
264 uLong *pX));
265
266 local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
267 voidpf filestream,
268 uLong *pX)
269 {
270 uLong x ;
271 int i = 0;
272 int err;
273
274 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
275 x = (uLong)i;
276
277 if (err==UNZ_OK)
278 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
279 x |= ((uLong)i)<<8;
280
281 if (err==UNZ_OK)
282 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
283 x |= ((uLong)i)<<16;
284
285 if (err==UNZ_OK)
286 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
287 x += ((uLong)i)<<24;
288
289 if (err==UNZ_OK)
290 *pX = x;
291 else
292 *pX = 0;
293 return err;
294 }
295
296 local int unz64local_getLong64 OF((
297 const zlib_filefunc64_32_def* pzlib_filefunc_def,
298 voidpf filestream,
299 ZPOS64_T *pX));
300
301
302 local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,
303 voidpf filestream,
304 ZPOS64_T *pX)
305 {
306 ZPOS64_T x ;
307 int i = 0;
308 int err;
309
310 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
311 x = (ZPOS64_T)i;
312
313 if (err==UNZ_OK)
314 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
315 x |= ((ZPOS64_T)i)<<8;
316
317 if (err==UNZ_OK)
318 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
319 x |= ((ZPOS64_T)i)<<16;
320
321 if (err==UNZ_OK)
322 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
323 x |= ((ZPOS64_T)i)<<24;
324
325 if (err==UNZ_OK)
326 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
327 x |= ((ZPOS64_T)i)<<32;
328
329 if (err==UNZ_OK)
330 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
331 x |= ((ZPOS64_T)i)<<40;
332
333 if (err==UNZ_OK)
334 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
335 x |= ((ZPOS64_T)i)<<48;
336
337 if (err==UNZ_OK)
338 err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
339 x |= ((ZPOS64_T)i)<<56;
340
341 if (err==UNZ_OK)
342 *pX = x;
343 else
344 *pX = 0;
345 return err;
346 }
347
348 /* My own strcmpi / strcasecmp */
349 local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
350 {
351 for (;;)
352 {
353 char c1=*(fileName1++);
354 char c2=*(fileName2++);
355 if ((c1>='a') && (c1<='z'))
@@ -377,23 +290,21 @@
377 #ifndef STRCMPCASENOSENTIVEFUNCTION
378 #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
379 #endif
380
381 /*
382 Compare two filename (fileName1,fileName2).
383 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
384 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
385 or strcasecmp)
386 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
387 (like 1 on Unix, 2 on Windows)
388
389 */
390 extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
391 const char* fileName2,
392 int iCaseSensitivity)
393
394 {
395 if (iCaseSensitivity==0)
396 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
397
398 if (iCaseSensitivity==1)
399 return strcmp(fileName1,fileName2);
@@ -403,35 +314,37 @@
403
404 #ifndef BUFREADCOMMENT
405 #define BUFREADCOMMENT (0x400)
406 #endif
407
 
 
 
 
408 /*
409 Locate the Central directory of a zipfile (at the end, just before
410 the global comment)
411 */
412 local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
413 local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
414 {
415 unsigned char* buf;
416 ZPOS64_T uSizeFile;
417 ZPOS64_T uBackRead;
418 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
419 ZPOS64_T uPosFound=0;
420
421 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
422 return 0;
423
424
425 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
426
427 if (uMaxBack>uSizeFile)
428 uMaxBack = uSizeFile;
429
430 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
431 if (buf==NULL)
432 return 0;
433
434 uBackRead = 4;
435 while (uBackRead<uMaxBack)
436 {
437 uLong uReadSize;
@@ -457,49 +370,44 @@
457 {
458 uPosFound = uReadPos+(unsigned)i;
459 break;
460 }
461
462 if (uPosFound!=0)
463 break;
464 }
465 TRYFREE(buf);
466 return uPosFound;
467 }
468
469
470 /*
471 Locate the Central directory 64 of a zipfile (at the end, just before
472 the global comment)
473 */
474 local ZPOS64_T unz64local_SearchCentralDir64 OF((
475 const zlib_filefunc64_32_def* pzlib_filefunc_def,
476 voidpf filestream));
477
478 local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
479 voidpf filestream)
480 {
481 unsigned char* buf;
482 ZPOS64_T uSizeFile;
483 ZPOS64_T uBackRead;
484 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
485 ZPOS64_T uPosFound=0;
486 uLong uL;
487 ZPOS64_T relativeOffset;
488
489 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
490 return 0;
491
492
493 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
494
495 if (uMaxBack>uSizeFile)
496 uMaxBack = uSizeFile;
497
498 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
499 if (buf==NULL)
500 return 0;
501
502 uBackRead = 4;
503 while (uBackRead<uMaxBack)
504 {
505 uLong uReadSize;
@@ -525,51 +433,51 @@
525 {
526 uPosFound = uReadPos+(unsigned)i;
527 break;
528 }
529
530 if (uPosFound!=0)
531 break;
532 }
533 TRYFREE(buf);
534 if (uPosFound == 0)
535 return 0;
536
537 /* Zip64 end of central directory locator */
538 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
539 return 0;
540
541 /* the signature, already checked */
542 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
543 return 0;
544
545 /* number of the disk with the start of the zip64 end of central directory */
546 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
547 return 0;
548 if (uL != 0)
549 return 0;
550
551 /* relative offset of the zip64 end of central directory record */
552 if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
553 return 0;
554
555 /* total number of disks */
556 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
557 return 0;
558 if (uL != 1)
559 return 0;
560
561 /* Goto end of central directory record */
562 if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
563 return 0;
564
565 /* the signature */
566 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
567 return 0;
568
569 if (uL != 0x06064b50)
570 return 0;
571
572 return relativeOffset;
573 }
574
575 /*
@@ -579,23 +487,22 @@
579 If the zipfile cannot be opened (file doesn't exist or in not valid), the
580 return value is NULL.
581 Else, the return value is a unzFile Handle, usable with other function
582 of this unzip package.
583 */
584 local unzFile unzOpenInternal (const void *path,
585 zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
586 int is64bitOpenFunction)
587 {
588 unz64_s us;
589 unz64_s *s;
590 ZPOS64_T central_pos;
591 uLong uL;
592
593 uLong number_disk; /* number of the current dist, used for
594 spaning ZIP, unsupported, always 0*/
595 uLong number_disk_with_CD; /* number the the disk with central dir, used
596 for spaning ZIP, unsupported, always 0*/
597 ZPOS64_T number_entry_CD; /* total number of entries in
598 the central dir
599 (same than number_entry on nospan) */
600
601 int err=UNZ_OK;
@@ -619,11 +526,11 @@
619 ZLIB_FILEFUNC_MODE_EXISTING);
620 if (us.filestream==NULL)
621 return NULL;
622
623 central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
624 if (central_pos)
625 {
626 uLong uS;
627 ZPOS64_T uL64;
628
629 us.isZip64 = 1;
@@ -681,11 +588,11 @@
681 us.gi.size_comment = 0;
682 }
683 else
684 {
685 central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
686 if (central_pos==0)
687 err=UNZ_ERRNO;
688
689 us.isZip64 = 0;
690
691 if (ZSEEK64(us.z_filefunc, us.filestream,
@@ -760,13 +667,12 @@
760 }
761 return (unzFile)s;
762 }
763
764
765 extern unzFile ZEXPORT unzOpen2 (const char *path,
766 zlib_filefunc_def* pzlib_filefunc32_def)
767 {
768 if (pzlib_filefunc32_def != NULL)
769 {
770 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
771 fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
772 return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);
@@ -773,13 +679,12 @@
773 }
774 else
775 return unzOpenInternal(path, NULL, 0);
776 }
777
778 extern unzFile ZEXPORT unzOpen2_64 (const void *path,
779 zlib_filefunc64_def* pzlib_filefunc_def)
780 {
781 if (pzlib_filefunc_def != NULL)
782 {
783 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
784 zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
785 zlib_filefunc64_32_def_fill.ztell32_file = NULL;
@@ -788,57 +693,52 @@
788 }
789 else
790 return unzOpenInternal(path, NULL, 1);
791 }
792
793 extern unzFile ZEXPORT unzOpen (const char *path)
794 {
795 return unzOpenInternal(path, NULL, 0);
796 }
797
798 extern unzFile ZEXPORT unzOpen64 (const void *path)
799 {
800 return unzOpenInternal(path, NULL, 1);
801 }
802
803 /*
804 Close a ZipFile opened with unzOpen.
805 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
806 these files MUST be closed with unzCloseCurrentFile before call unzClose.
807 return UNZ_OK if there is no problem. */
808 extern int ZEXPORT unzClose (unzFile file)
809 {
810 unz64_s* s;
811 if (file==NULL)
812 return UNZ_PARAMERROR;
813 s=(unz64_s*)file;
814
815 if (s->pfile_in_zip_read!=NULL)
816 unzCloseCurrentFile(file);
817
818 ZCLOSE64(s->z_filefunc, s->filestream);
819 TRYFREE(s);
820 return UNZ_OK;
821 }
822
823
824 /*
825 Write info about the ZipFile in the *pglobal_info structure.
826 No preparation of the structure is needed
827 return UNZ_OK if there is no problem. */
828 extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info)
829 {
830 unz64_s* s;
831 if (file==NULL)
832 return UNZ_PARAMERROR;
833 s=(unz64_s*)file;
834 *pglobal_info=s->gi;
835 return UNZ_OK;
836 }
837
838 extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32)
839 {
840 unz64_s* s;
841 if (file==NULL)
842 return UNZ_PARAMERROR;
843 s=(unz64_s*)file;
844 /* to do : check if number_entry is not truncated */
@@ -845,14 +745,13 @@
845 pglobal_info32->number_entry = (uLong)s->gi.number_entry;
846 pglobal_info32->size_comment = s->gi.size_comment;
847 return UNZ_OK;
848 }
849 /*
850 Translate date/time from Dos format to tm_unz (readable more easilty)
851 */
852 local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
853 {
854 ZPOS64_T uDate;
855 uDate = (ZPOS64_T)(ulDosDate>>16);
856 ptm->tm_mday = (int)(uDate&0x1f) ;
857 ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
858 ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
@@ -863,32 +762,20 @@
863 }
864
865 /*
866 Get Info about the current file in the zipfile, with internal only info
867 */
868 local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
869 unz_file_info64 *pfile_info,
870 unz_file_info64_internal
871 *pfile_info_internal,
872 char *szFileName,
873 uLong fileNameBufferSize,
874 void *extraField,
875 uLong extraFieldBufferSize,
876 char *szComment,
877 uLong commentBufferSize));
878
879 local int unz64local_GetCurrentFileInfoInternal (unzFile file,
880 unz_file_info64 *pfile_info,
881 unz_file_info64_internal
882 *pfile_info_internal,
883 char *szFileName,
884 uLong fileNameBufferSize,
885 void *extraField,
886 uLong extraFieldBufferSize,
887 char *szComment,
888 uLong commentBufferSize)
889 {
890 unz64_s* s;
891 unz_file_info64 file_info;
892 unz_file_info64_internal file_info_internal;
893 int err=UNZ_OK;
894 uLong uMagic;
@@ -1036,37 +923,35 @@
1036 err=UNZ_ERRNO;
1037
1038 /* ZIP64 extra fields */
1039 if (headerId == 0x0001)
1040 {
1041 uLong uL;
1042
1043 if(file_info.uncompressed_size == MAXU32)
1044 {
1045 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
1046 err=UNZ_ERRNO;
1047 }
1048
1049 if(file_info.compressed_size == MAXU32)
1050 {
1051 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
1052 err=UNZ_ERRNO;
1053 }
1054
1055 if(file_info_internal.offset_curfile == MAXU32)
1056 {
1057 /* Relative Header offset */
1058 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
1059 err=UNZ_ERRNO;
1060 }
1061
1062 if(file_info.disk_num_start == MAXU32)
1063 {
1064 /* Disk Start Number */
1065 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
1066 err=UNZ_ERRNO;
1067 }
1068
1069 }
1070 else
1071 {
1072 if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
@@ -1119,28 +1004,26 @@
1119 /*
1120 Write info about the ZipFile in the *pglobal_info structure.
1121 No preparation of the structure is needed
1122 return UNZ_OK if there is no problem.
1123 */
1124 extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
1125 unz_file_info64 * pfile_info,
1126 char * szFileName, uLong fileNameBufferSize,
1127 void *extraField, uLong extraFieldBufferSize,
1128 char* szComment, uLong commentBufferSize)
1129 {
1130 return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
1131 szFileName,fileNameBufferSize,
1132 extraField,extraFieldBufferSize,
1133 szComment,commentBufferSize);
1134 }
1135
1136 extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
1137 unz_file_info * pfile_info,
1138 char * szFileName, uLong fileNameBufferSize,
1139 void *extraField, uLong extraFieldBufferSize,
1140 char* szComment, uLong commentBufferSize)
1141 {
1142 int err;
1143 unz_file_info64 file_info64;
1144 err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
1145 szFileName,fileNameBufferSize,
1146 extraField,extraFieldBufferSize,
@@ -1160,11 +1043,11 @@
1160
1161 pfile_info->disk_num_start = file_info64.disk_num_start;
1162 pfile_info->internal_fa = file_info64.internal_fa;
1163 pfile_info->external_fa = file_info64.external_fa;
1164
1165 pfile_info->tmu_date = file_info64.tmu_date,
1166
1167
1168 pfile_info->compressed_size = (uLong)file_info64.compressed_size;
1169 pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
1170
@@ -1173,12 +1056,11 @@
1173 }
1174 /*
1175 Set the current file of the zipfile to the first file.
1176 return UNZ_OK if there is no problem
1177 */
1178 extern int ZEXPORT unzGoToFirstFile (unzFile file)
1179 {
1180 int err=UNZ_OK;
1181 unz64_s* s;
1182 if (file==NULL)
1183 return UNZ_PARAMERROR;
1184 s=(unz64_s*)file;
@@ -1194,12 +1076,11 @@
1194 /*
1195 Set the current file of the zipfile to the next file.
1196 return UNZ_OK if there is no problem
1197 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
1198 */
1199 extern int ZEXPORT unzGoToNextFile (unzFile file)
1200 {
1201 unz64_s* s;
1202 int err;
1203
1204 if (file==NULL)
1205 return UNZ_PARAMERROR;
@@ -1227,12 +1108,11 @@
1227
1228 return value :
1229 UNZ_OK if the file is found. It becomes the current file.
1230 UNZ_END_OF_LIST_OF_FILE if the file is not found
1231 */
1232 extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
1233 {
1234 unz64_s* s;
1235 int err;
1236
1237 /* We remember the 'current' position in the file so that we can jump
1238 * back there if we fail.
@@ -1303,12 +1183,11 @@
1303 ZPOS64_T pos_in_zip_directory; // offset in file
1304 ZPOS64_T num_of_file; // # of file
1305 } unz_file_pos;
1306 */
1307
1308 extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
1309 {
1310 unz64_s* s;
1311
1312 if (file==NULL || file_pos==NULL)
1313 return UNZ_PARAMERROR;
1314 s=(unz64_s*)file;
@@ -1319,14 +1198,11 @@
1319 file_pos->num_of_file = s->num_file;
1320
1321 return UNZ_OK;
1322 }
1323
1324 extern int ZEXPORT unzGetFilePos(
1325 unzFile file,
1326 unz_file_pos* file_pos)
1327 {
1328 unz64_file_pos file_pos64;
1329 int err = unzGetFilePos64(file,&file_pos64);
1330 if (err==UNZ_OK)
1331 {
1332 file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
@@ -1333,12 +1209,11 @@
1333 file_pos->num_of_file = (uLong)file_pos64.num_of_file;
1334 }
1335 return err;
1336 }
1337
1338 extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos)
1339 {
1340 unz64_s* s;
1341 int err;
1342
1343 if (file==NULL || file_pos==NULL)
1344 return UNZ_PARAMERROR;
@@ -1355,14 +1230,11 @@
1355 /* return results */
1356 s->current_file_ok = (err == UNZ_OK);
1357 return err;
1358 }
1359
1360 extern int ZEXPORT unzGoToFilePos(
1361 unzFile file,
1362 unz_file_pos* file_pos)
1363 {
1364 unz64_file_pos file_pos64;
1365 if (file_pos == NULL)
1366 return UNZ_PARAMERROR;
1367
1368 file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
@@ -1380,14 +1252,13 @@
1380 Check the coherency of the local header and info in the end of central
1381 directory about this file
1382 store in *piSizeVar the size of extra info in local header
1383 (filename and size of extra field data)
1384 */
1385 local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
1386 ZPOS64_T * poffset_local_extrafield,
1387 uInt * psize_local_extrafield)
1388 {
1389 uLong uMagic,uData,uFlags;
1390 uLong size_filename;
1391 uLong size_extra_field;
1392 int err=UNZ_OK;
1393
@@ -1467,13 +1338,12 @@
1467
1468 /*
1469 Open for reading data the current file in the zipfile.
1470 If there is no error and the file is opened, the return value is UNZ_OK.
1471 */
1472 extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
1473 int* level, int raw, const char* password)
1474 {
1475 int err=UNZ_OK;
1476 uInt iSizeVar;
1477 unz64_s* s;
1478 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1479 ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
@@ -1507,11 +1377,11 @@
1507 pfile_in_zip_read_info->pos_local_extrafield=0;
1508 pfile_in_zip_read_info->raw=raw;
1509
1510 if (pfile_in_zip_read_info->read_buffer==NULL)
1511 {
1512 TRYFREE(pfile_in_zip_read_info);
1513 return UNZ_INTERNALERROR;
1514 }
1515
1516 pfile_in_zip_read_info->stream_initialised=0;
1517
@@ -1564,12 +1434,12 @@
1564 err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
1565 if (err == Z_OK)
1566 pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
1567 else
1568 {
1569 TRYFREE(pfile_in_zip_read_info->read_buffer);
1570 TRYFREE(pfile_in_zip_read_info);
1571 return err;
1572 }
1573 #else
1574 pfile_in_zip_read_info->raw=1;
1575 #endif
@@ -1585,12 +1455,12 @@
1585 err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
1586 if (err == Z_OK)
1587 pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
1588 else
1589 {
1590 TRYFREE(pfile_in_zip_read_info->read_buffer);
1591 TRYFREE(pfile_in_zip_read_info);
1592 return err;
1593 }
1594 /* windowBits is passed < 0 to tell that there is no zlib header.
1595 * Note that in this case inflate *requires* an extra "dummy" byte
1596 * after the compressed stream in order to complete decompression and
@@ -1638,29 +1508,25 @@
1638
1639
1640 return UNZ_OK;
1641 }
1642
1643 extern int ZEXPORT unzOpenCurrentFile (unzFile file)
1644 {
1645 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
1646 }
1647
1648 extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password)
1649 {
1650 return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
1651 }
1652
1653 extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw)
1654 {
1655 return unzOpenCurrentFile3(file, method, level, raw, NULL);
1656 }
1657
1658 /** Addition for GDAL : START */
1659
1660 extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
1661 {
1662 unz64_s* s;
1663 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1664 s=(unz64_s*)file;
1665 if (file==NULL)
1666 return 0; //UNZ_PARAMERROR;
@@ -1676,17 +1542,16 @@
1676 /*
1677 Read bytes from the current file.
1678 buf contain buffer where data must be copied
1679 len the size of buf.
1680
1681 return the number of byte copied if somes bytes are copied
1682 return 0 if the end of file was reached
1683 return <0 with error code if there is an error
1684 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
1685 */
1686 extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
1687 {
1688 int err=UNZ_OK;
1689 uInt iRead = 0;
1690 unz64_s* s;
1691 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1692 if (file==NULL)
@@ -1889,12 +1754,11 @@
1889
1890
1891 /*
1892 Give the current position in uncompressed data
1893 */
1894 extern z_off_t ZEXPORT unztell (unzFile file)
1895 {
1896 unz64_s* s;
1897 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1898 if (file==NULL)
1899 return UNZ_PARAMERROR;
1900 s=(unz64_s*)file;
@@ -1904,12 +1768,11 @@
1904 return UNZ_PARAMERROR;
1905
1906 return (z_off_t)pfile_in_zip_read_info->stream.total_out;
1907 }
1908
1909 extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
1910 {
1911
1912 unz64_s* s;
1913 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1914 if (file==NULL)
1915 return (ZPOS64_T)-1;
@@ -1924,12 +1787,11 @@
1924
1925
1926 /*
1927 return 1 if the end of file was reached, 0 elsewhere
1928 */
1929 extern int ZEXPORT unzeof (unzFile file)
1930 {
1931 unz64_s* s;
1932 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1933 if (file==NULL)
1934 return UNZ_PARAMERROR;
1935 s=(unz64_s*)file;
@@ -1956,12 +1818,11 @@
1956 if buf!=NULL, len is the size of the buffer, the extra header is copied in
1957 buf.
1958 the return value is the number of bytes copied in buf, or (if <0)
1959 the error code
1960 */
1961 extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
1962 {
1963 unz64_s* s;
1964 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1965 uInt read_now;
1966 ZPOS64_T size_to_read;
1967
@@ -2004,12 +1865,11 @@
2004
2005 /*
2006 Close the file in zip opened with unzOpenCurrentFile
2007 Return UNZ_CRCERROR if all the file was read but the CRC is not good
2008 */
2009 extern int ZEXPORT unzCloseCurrentFile (unzFile file)
2010 {
2011 int err=UNZ_OK;
2012
2013 unz64_s* s;
2014 file_in_zip64_read_info_s* pfile_in_zip_read_info;
2015 if (file==NULL)
@@ -2027,11 +1887,11 @@
2027 if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
2028 err=UNZ_CRCERROR;
2029 }
2030
2031
2032 TRYFREE(pfile_in_zip_read_info->read_buffer);
2033 pfile_in_zip_read_info->read_buffer = NULL;
2034 if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
2035 inflateEnd(&pfile_in_zip_read_info->stream);
2036 #ifdef HAVE_BZIP2
2037 else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
@@ -2038,11 +1898,11 @@
2038 BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
2039 #endif
2040
2041
2042 pfile_in_zip_read_info->stream_initialised = 0;
2043 TRYFREE(pfile_in_zip_read_info);
2044
2045 s->pfile_in_zip_read=NULL;
2046
2047 return err;
2048 }
@@ -2051,12 +1911,11 @@
2051 /*
2052 Get the global comment string of the ZipFile, in the szComment buffer.
2053 uSizeBuf is the size of the szComment buffer.
2054 return the number of byte copied or an error code <0
2055 */
2056 extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)
2057 {
2058 unz64_s* s;
2059 uLong uReadThis ;
2060 if (file==NULL)
2061 return (int)UNZ_PARAMERROR;
2062 s=(unz64_s*)file;
@@ -2079,12 +1938,11 @@
2079 *(szComment+s->gi.size_comment)='\0';
2080 return (int)uReadThis;
2081 }
2082
2083 /* Additions by RX '2004 */
2084 extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
2085 {
2086 unz64_s* s;
2087
2088 if (file==NULL)
2089 return 0; //UNZ_PARAMERROR;
2090 s=(unz64_s*)file;
@@ -2094,22 +1952,20 @@
2094 if (s->num_file==s->gi.number_entry)
2095 return 0;
2096 return s->pos_in_central_dir;
2097 }
2098
2099 extern uLong ZEXPORT unzGetOffset (unzFile file)
2100 {
2101 ZPOS64_T offset64;
2102
2103 if (file==NULL)
2104 return 0; //UNZ_PARAMERROR;
2105 offset64 = unzGetOffset64(file);
2106 return (uLong)offset64;
2107 }
2108
2109 extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
2110 {
2111 unz64_s* s;
2112 int err;
2113
2114 if (file==NULL)
2115 return UNZ_PARAMERROR;
@@ -2122,9 +1978,8 @@
2122 NULL,0,NULL,0,NULL,0);
2123 s->current_file_ok = (err == UNZ_OK);
2124 return err;
2125 }
2126
2127 extern int ZEXPORT unzSetOffset (unzFile file, uLong pos)
2128 {
2129 return unzSetOffset64(file,pos);
2130 }
2131
--- compat/zlib/contrib/minizip/unzip.c
+++ compat/zlib/contrib/minizip/unzip.c
@@ -47,16 +47,16 @@
47 2007-2008 - Even Rouault - Add unzip support for ZIP64
48
49 Copyright (C) 2007-2008 Even Rouault
50
51
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).
53 Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
54 should only read the compressed/uncompressed size from the Zip64 format if
55 the size from normal header was 0xFFFFFFFF
56 Oct-2009 - Mathias Svensson - Applied some bug fixes from patches received from Gilles Vollant
57 Oct-2009 - Mathias Svensson - Applied support to unzip files with compression method BZIP2 (bzip2 lib is required)
58 Patch created by Daniel Borca
59
60 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
61
62 Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson
@@ -75,12 +75,10 @@
75 #include "zlib.h"
76 #include "unzip.h"
77
78 #ifdef STDC
79 # include <stddef.h>
 
 
80 #endif
81 #ifdef NO_ERRNO_H
82 extern int errno;
83 #else
84 # include <errno.h>
@@ -109,13 +107,10 @@
107 #endif
108
109 #ifndef ALLOC
110 # define ALLOC(size) (malloc(size))
111 #endif
 
 
 
112
113 #define SIZECENTRALDIRITEM (0x2e)
114 #define SIZEZIPLOCALHEADER (0x1e)
115
116
@@ -151,11 +146,11 @@
146 uLong crc32; /* crc32 of all data uncompressed */
147 uLong crc32_wait; /* crc32 we must obtain after decompress all */
148 ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
149 ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
150 zlib_filefunc64_32_def z_filefunc;
151 voidpf filestream; /* io structure of the zipfile */
152 uLong compression_method; /* compression method (0==store) */
153 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
154 int raw;
155 } file_in_zip64_read_info_s;
156
@@ -164,11 +159,11 @@
159 */
160 typedef struct
161 {
162 zlib_filefunc64_32_def z_filefunc;
163 int is64bitOpenFunction;
164 voidpf filestream; /* io structure of the zipfile */
165 unz_global_info64 gi; /* public global information */
166 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
167 ZPOS64_T num_file; /* number of the current file in the zipfile*/
168 ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/
169 ZPOS64_T current_file_ok; /* flag about the usability of the current file*/
@@ -194,162 +189,80 @@
189
190
191 #ifndef NOUNCRYPT
192 #include "crypt.h"
193 #endif
194
195
196 /* ===========================================================================
197 Reads a long in LSB order from the given gz_stream. Sets
 
 
198 */
199
200 local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def,
201 voidpf filestream,
202 uLong *pX) {
203 unsigned char c[2];
204 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,2);
205 if (err==2)
206 {
207 *pX = c[0] | ((uLong)c[1] << 8);
208 return UNZ_OK;
209 }
210 else
211 {
212 *pX = 0;
213 if (ZERROR64(*pzlib_filefunc_def,filestream))
214 return UNZ_ERRNO;
215 else
216 return UNZ_EOF;
217 }
218 }
219
220 local int unz64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def,
221 voidpf filestream,
222 uLong *pX) {
223 unsigned char c[4];
224 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,4);
225 if (err==4)
226 {
227 *pX = c[0] | ((uLong)c[1] << 8) | ((uLong)c[2] << 16) | ((uLong)c[3] << 24);
228 return UNZ_OK;
229 }
230 else
231 {
232 *pX = 0;
233 if (ZERROR64(*pzlib_filefunc_def,filestream))
234 return UNZ_ERRNO;
235 else
236 return UNZ_EOF;
237 }
238 }
239
240
241 local int unz64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
242 voidpf filestream,
243 ZPOS64_T *pX) {
244 unsigned char c[8];
245 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,8);
246 if (err==8)
247 {
248 *pX = c[0] | ((ZPOS64_T)c[1] << 8) | ((ZPOS64_T)c[2] << 16) | ((ZPOS64_T)c[3] << 24)
249 | ((ZPOS64_T)c[4] << 32) | ((ZPOS64_T)c[5] << 40) | ((ZPOS64_T)c[6] << 48) | ((ZPOS64_T)c[7] << 56);
250 return UNZ_OK;
251 }
252 else
253 {
254 *pX = 0;
255 if (ZERROR64(*pzlib_filefunc_def,filestream))
256 return UNZ_ERRNO;
257 else
258 return UNZ_EOF;
259 }
260 }
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262 /* My own strcmpi / strcasecmp */
263 local int strcmpcasenosensitive_internal(const char* fileName1, const char* fileName2) {
 
264 for (;;)
265 {
266 char c1=*(fileName1++);
267 char c2=*(fileName2++);
268 if ((c1>='a') && (c1<='z'))
@@ -377,23 +290,21 @@
290 #ifndef STRCMPCASENOSENTIVEFUNCTION
291 #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
292 #endif
293
294 /*
295 Compare two filenames (fileName1,fileName2).
296 If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
297 If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
298 or strcasecmp)
299 If iCaseSensitivity = 0, case sensitivity is default of your operating system
300 (like 1 on Unix, 2 on Windows)
301
302 */
303 extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
304 const char* fileName2,
305 int iCaseSensitivity) {
 
 
306 if (iCaseSensitivity==0)
307 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
308
309 if (iCaseSensitivity==1)
310 return strcmp(fileName1,fileName2);
@@ -403,35 +314,37 @@
314
315 #ifndef BUFREADCOMMENT
316 #define BUFREADCOMMENT (0x400)
317 #endif
318
319 #ifndef CENTRALDIRINVALID
320 #define CENTRALDIRINVALID ((ZPOS64_T)(-1))
321 #endif
322
323 /*
324 Locate the Central directory of a zipfile (at the end, just before
325 the global comment)
326 */
327 local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
 
 
328 unsigned char* buf;
329 ZPOS64_T uSizeFile;
330 ZPOS64_T uBackRead;
331 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
332 ZPOS64_T uPosFound=CENTRALDIRINVALID;
333
334 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
335 return CENTRALDIRINVALID;
336
337
338 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
339
340 if (uMaxBack>uSizeFile)
341 uMaxBack = uSizeFile;
342
343 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
344 if (buf==NULL)
345 return CENTRALDIRINVALID;
346
347 uBackRead = 4;
348 while (uBackRead<uMaxBack)
349 {
350 uLong uReadSize;
@@ -457,49 +370,44 @@
370 {
371 uPosFound = uReadPos+(unsigned)i;
372 break;
373 }
374
375 if (uPosFound!=CENTRALDIRINVALID)
376 break;
377 }
378 free(buf);
379 return uPosFound;
380 }
381
382
383 /*
384 Locate the Central directory 64 of a zipfile (at the end, just before
385 the global comment)
386 */
 
 
 
 
387 local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
388 voidpf filestream) {
 
389 unsigned char* buf;
390 ZPOS64_T uSizeFile;
391 ZPOS64_T uBackRead;
392 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
393 ZPOS64_T uPosFound=CENTRALDIRINVALID;
394 uLong uL;
395 ZPOS64_T relativeOffset;
396
397 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
398 return CENTRALDIRINVALID;
399
400
401 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
402
403 if (uMaxBack>uSizeFile)
404 uMaxBack = uSizeFile;
405
406 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
407 if (buf==NULL)
408 return CENTRALDIRINVALID;
409
410 uBackRead = 4;
411 while (uBackRead<uMaxBack)
412 {
413 uLong uReadSize;
@@ -525,51 +433,51 @@
433 {
434 uPosFound = uReadPos+(unsigned)i;
435 break;
436 }
437
438 if (uPosFound!=CENTRALDIRINVALID)
439 break;
440 }
441 free(buf);
442 if (uPosFound == CENTRALDIRINVALID)
443 return CENTRALDIRINVALID;
444
445 /* Zip64 end of central directory locator */
446 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
447 return CENTRALDIRINVALID;
448
449 /* the signature, already checked */
450 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
451 return CENTRALDIRINVALID;
452
453 /* number of the disk with the start of the zip64 end of central directory */
454 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
455 return CENTRALDIRINVALID;
456 if (uL != 0)
457 return CENTRALDIRINVALID;
458
459 /* relative offset of the zip64 end of central directory record */
460 if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
461 return CENTRALDIRINVALID;
462
463 /* total number of disks */
464 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
465 return CENTRALDIRINVALID;
466 if (uL != 1)
467 return CENTRALDIRINVALID;
468
469 /* Goto end of central directory record */
470 if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
471 return CENTRALDIRINVALID;
472
473 /* the signature */
474 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
475 return CENTRALDIRINVALID;
476
477 if (uL != 0x06064b50)
478 return CENTRALDIRINVALID;
479
480 return relativeOffset;
481 }
482
483 /*
@@ -579,23 +487,22 @@
487 If the zipfile cannot be opened (file doesn't exist or in not valid), the
488 return value is NULL.
489 Else, the return value is a unzFile Handle, usable with other function
490 of this unzip package.
491 */
492 local unzFile unzOpenInternal(const void *path,
493 zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
494 int is64bitOpenFunction) {
 
495 unz64_s us;
496 unz64_s *s;
497 ZPOS64_T central_pos;
498 uLong uL;
499
500 uLong number_disk; /* number of the current dist, used for
501 spanning ZIP, unsupported, always 0*/
502 uLong number_disk_with_CD; /* number the the disk with central dir, used
503 for spanning ZIP, unsupported, always 0*/
504 ZPOS64_T number_entry_CD; /* total number of entries in
505 the central dir
506 (same than number_entry on nospan) */
507
508 int err=UNZ_OK;
@@ -619,11 +526,11 @@
526 ZLIB_FILEFUNC_MODE_EXISTING);
527 if (us.filestream==NULL)
528 return NULL;
529
530 central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
531 if (central_pos!=CENTRALDIRINVALID)
532 {
533 uLong uS;
534 ZPOS64_T uL64;
535
536 us.isZip64 = 1;
@@ -681,11 +588,11 @@
588 us.gi.size_comment = 0;
589 }
590 else
591 {
592 central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
593 if (central_pos==CENTRALDIRINVALID)
594 err=UNZ_ERRNO;
595
596 us.isZip64 = 0;
597
598 if (ZSEEK64(us.z_filefunc, us.filestream,
@@ -760,13 +667,12 @@
667 }
668 return (unzFile)s;
669 }
670
671
672 extern unzFile ZEXPORT unzOpen2(const char *path,
673 zlib_filefunc_def* pzlib_filefunc32_def) {
 
674 if (pzlib_filefunc32_def != NULL)
675 {
676 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
677 fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
678 return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0);
@@ -773,13 +679,12 @@
679 }
680 else
681 return unzOpenInternal(path, NULL, 0);
682 }
683
684 extern unzFile ZEXPORT unzOpen2_64(const void *path,
685 zlib_filefunc64_def* pzlib_filefunc_def) {
 
686 if (pzlib_filefunc_def != NULL)
687 {
688 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
689 zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
690 zlib_filefunc64_32_def_fill.ztell32_file = NULL;
@@ -788,57 +693,52 @@
693 }
694 else
695 return unzOpenInternal(path, NULL, 1);
696 }
697
698 extern unzFile ZEXPORT unzOpen(const char *path) {
 
699 return unzOpenInternal(path, NULL, 0);
700 }
701
702 extern unzFile ZEXPORT unzOpen64(const void *path) {
 
703 return unzOpenInternal(path, NULL, 1);
704 }
705
706 /*
707 Close a ZipFile opened with unzOpen.
708 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
709 these files MUST be closed with unzCloseCurrentFile before call unzClose.
710 return UNZ_OK if there is no problem. */
711 extern int ZEXPORT unzClose(unzFile file) {
 
712 unz64_s* s;
713 if (file==NULL)
714 return UNZ_PARAMERROR;
715 s=(unz64_s*)file;
716
717 if (s->pfile_in_zip_read!=NULL)
718 unzCloseCurrentFile(file);
719
720 ZCLOSE64(s->z_filefunc, s->filestream);
721 free(s);
722 return UNZ_OK;
723 }
724
725
726 /*
727 Write info about the ZipFile in the *pglobal_info structure.
728 No preparation of the structure is needed
729 return UNZ_OK if there is no problem. */
730 extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) {
 
731 unz64_s* s;
732 if (file==NULL)
733 return UNZ_PARAMERROR;
734 s=(unz64_s*)file;
735 *pglobal_info=s->gi;
736 return UNZ_OK;
737 }
738
739 extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) {
 
740 unz64_s* s;
741 if (file==NULL)
742 return UNZ_PARAMERROR;
743 s=(unz64_s*)file;
744 /* to do : check if number_entry is not truncated */
@@ -845,14 +745,13 @@
745 pglobal_info32->number_entry = (uLong)s->gi.number_entry;
746 pglobal_info32->size_comment = s->gi.size_comment;
747 return UNZ_OK;
748 }
749 /*
750 Translate date/time from Dos format to tm_unz (readable more easily)
751 */
752 local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) {
 
753 ZPOS64_T uDate;
754 uDate = (ZPOS64_T)(ulDosDate>>16);
755 ptm->tm_mday = (int)(uDate&0x1f) ;
756 ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
757 ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
@@ -863,32 +762,20 @@
762 }
763
764 /*
765 Get Info about the current file in the zipfile, with internal only info
766 */
767 local int unz64local_GetCurrentFileInfoInternal(unzFile file,
768 unz_file_info64 *pfile_info,
769 unz_file_info64_internal
770 *pfile_info_internal,
771 char *szFileName,
772 uLong fileNameBufferSize,
773 void *extraField,
774 uLong extraFieldBufferSize,
775 char *szComment,
776 uLong commentBufferSize) {
 
 
 
 
 
 
 
 
 
 
 
 
777 unz64_s* s;
778 unz_file_info64 file_info;
779 unz_file_info64_internal file_info_internal;
780 int err=UNZ_OK;
781 uLong uMagic;
@@ -1036,37 +923,35 @@
923 err=UNZ_ERRNO;
924
925 /* ZIP64 extra fields */
926 if (headerId == 0x0001)
927 {
928 if(file_info.uncompressed_size == MAXU32)
929 {
930 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
931 err=UNZ_ERRNO;
932 }
933
934 if(file_info.compressed_size == MAXU32)
935 {
936 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
937 err=UNZ_ERRNO;
938 }
939
940 if(file_info_internal.offset_curfile == MAXU32)
941 {
942 /* Relative Header offset */
943 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
944 err=UNZ_ERRNO;
945 }
946
947 if(file_info.disk_num_start == 0xffff)
948 {
949 /* Disk Start Number */
950 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
951 err=UNZ_ERRNO;
952 }
 
 
953
954 }
955 else
956 {
957 if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
@@ -1119,28 +1004,26 @@
1004 /*
1005 Write info about the ZipFile in the *pglobal_info structure.
1006 No preparation of the structure is needed
1007 return UNZ_OK if there is no problem.
1008 */
1009 extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
1010 unz_file_info64 * pfile_info,
1011 char * szFileName, uLong fileNameBufferSize,
1012 void *extraField, uLong extraFieldBufferSize,
1013 char* szComment, uLong commentBufferSize) {
 
1014 return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
1015 szFileName,fileNameBufferSize,
1016 extraField,extraFieldBufferSize,
1017 szComment,commentBufferSize);
1018 }
1019
1020 extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
1021 unz_file_info * pfile_info,
1022 char * szFileName, uLong fileNameBufferSize,
1023 void *extraField, uLong extraFieldBufferSize,
1024 char* szComment, uLong commentBufferSize) {
 
1025 int err;
1026 unz_file_info64 file_info64;
1027 err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
1028 szFileName,fileNameBufferSize,
1029 extraField,extraFieldBufferSize,
@@ -1160,11 +1043,11 @@
1043
1044 pfile_info->disk_num_start = file_info64.disk_num_start;
1045 pfile_info->internal_fa = file_info64.internal_fa;
1046 pfile_info->external_fa = file_info64.external_fa;
1047
1048 pfile_info->tmu_date = file_info64.tmu_date;
1049
1050
1051 pfile_info->compressed_size = (uLong)file_info64.compressed_size;
1052 pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
1053
@@ -1173,12 +1056,11 @@
1056 }
1057 /*
1058 Set the current file of the zipfile to the first file.
1059 return UNZ_OK if there is no problem
1060 */
1061 extern int ZEXPORT unzGoToFirstFile(unzFile file) {
 
1062 int err=UNZ_OK;
1063 unz64_s* s;
1064 if (file==NULL)
1065 return UNZ_PARAMERROR;
1066 s=(unz64_s*)file;
@@ -1194,12 +1076,11 @@
1076 /*
1077 Set the current file of the zipfile to the next file.
1078 return UNZ_OK if there is no problem
1079 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
1080 */
1081 extern int ZEXPORT unzGoToNextFile(unzFile file) {
 
1082 unz64_s* s;
1083 int err;
1084
1085 if (file==NULL)
1086 return UNZ_PARAMERROR;
@@ -1227,12 +1108,11 @@
1108
1109 return value :
1110 UNZ_OK if the file is found. It becomes the current file.
1111 UNZ_END_OF_LIST_OF_FILE if the file is not found
1112 */
1113 extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity) {
 
1114 unz64_s* s;
1115 int err;
1116
1117 /* We remember the 'current' position in the file so that we can jump
1118 * back there if we fail.
@@ -1303,12 +1183,11 @@
1183 ZPOS64_T pos_in_zip_directory; // offset in file
1184 ZPOS64_T num_of_file; // # of file
1185 } unz_file_pos;
1186 */
1187
1188 extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) {
 
1189 unz64_s* s;
1190
1191 if (file==NULL || file_pos==NULL)
1192 return UNZ_PARAMERROR;
1193 s=(unz64_s*)file;
@@ -1319,14 +1198,11 @@
1198 file_pos->num_of_file = s->num_file;
1199
1200 return UNZ_OK;
1201 }
1202
1203 extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) {
 
 
 
1204 unz64_file_pos file_pos64;
1205 int err = unzGetFilePos64(file,&file_pos64);
1206 if (err==UNZ_OK)
1207 {
1208 file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory;
@@ -1333,12 +1209,11 @@
1209 file_pos->num_of_file = (uLong)file_pos64.num_of_file;
1210 }
1211 return err;
1212 }
1213
1214 extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) {
 
1215 unz64_s* s;
1216 int err;
1217
1218 if (file==NULL || file_pos==NULL)
1219 return UNZ_PARAMERROR;
@@ -1355,14 +1230,11 @@
1230 /* return results */
1231 s->current_file_ok = (err == UNZ_OK);
1232 return err;
1233 }
1234
1235 extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) {
 
 
 
1236 unz64_file_pos file_pos64;
1237 if (file_pos == NULL)
1238 return UNZ_PARAMERROR;
1239
1240 file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory;
@@ -1380,14 +1252,13 @@
1252 Check the coherency of the local header and info in the end of central
1253 directory about this file
1254 store in *piSizeVar the size of extra info in local header
1255 (filename and size of extra field data)
1256 */
1257 local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar,
1258 ZPOS64_T * poffset_local_extrafield,
1259 uInt * psize_local_extrafield) {
 
1260 uLong uMagic,uData,uFlags;
1261 uLong size_filename;
1262 uLong size_extra_field;
1263 int err=UNZ_OK;
1264
@@ -1467,13 +1338,12 @@
1338
1339 /*
1340 Open for reading data the current file in the zipfile.
1341 If there is no error and the file is opened, the return value is UNZ_OK.
1342 */
1343 extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
1344 int* level, int raw, const char* password) {
 
1345 int err=UNZ_OK;
1346 uInt iSizeVar;
1347 unz64_s* s;
1348 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1349 ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
@@ -1507,11 +1377,11 @@
1377 pfile_in_zip_read_info->pos_local_extrafield=0;
1378 pfile_in_zip_read_info->raw=raw;
1379
1380 if (pfile_in_zip_read_info->read_buffer==NULL)
1381 {
1382 free(pfile_in_zip_read_info);
1383 return UNZ_INTERNALERROR;
1384 }
1385
1386 pfile_in_zip_read_info->stream_initialised=0;
1387
@@ -1564,12 +1434,12 @@
1434 err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
1435 if (err == Z_OK)
1436 pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
1437 else
1438 {
1439 free(pfile_in_zip_read_info->read_buffer);
1440 free(pfile_in_zip_read_info);
1441 return err;
1442 }
1443 #else
1444 pfile_in_zip_read_info->raw=1;
1445 #endif
@@ -1585,12 +1455,12 @@
1455 err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
1456 if (err == Z_OK)
1457 pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
1458 else
1459 {
1460 free(pfile_in_zip_read_info->read_buffer);
1461 free(pfile_in_zip_read_info);
1462 return err;
1463 }
1464 /* windowBits is passed < 0 to tell that there is no zlib header.
1465 * Note that in this case inflate *requires* an extra "dummy" byte
1466 * after the compressed stream in order to complete decompression and
@@ -1638,29 +1508,25 @@
1508
1509
1510 return UNZ_OK;
1511 }
1512
1513 extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
 
1514 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
1515 }
1516
1517 extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) {
 
1518 return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
1519 }
1520
1521 extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) {
 
1522 return unzOpenCurrentFile3(file, method, level, raw, NULL);
1523 }
1524
1525 /** Addition for GDAL : START */
1526
1527 extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) {
 
1528 unz64_s* s;
1529 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1530 s=(unz64_s*)file;
1531 if (file==NULL)
1532 return 0; //UNZ_PARAMERROR;
@@ -1676,17 +1542,16 @@
1542 /*
1543 Read bytes from the current file.
1544 buf contain buffer where data must be copied
1545 len the size of buf.
1546
1547 return the number of byte copied if some bytes are copied
1548 return 0 if the end of file was reached
1549 return <0 with error code if there is an error
1550 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
1551 */
1552 extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
 
1553 int err=UNZ_OK;
1554 uInt iRead = 0;
1555 unz64_s* s;
1556 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1557 if (file==NULL)
@@ -1889,12 +1754,11 @@
1754
1755
1756 /*
1757 Give the current position in uncompressed data
1758 */
1759 extern z_off_t ZEXPORT unztell(unzFile file) {
 
1760 unz64_s* s;
1761 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1762 if (file==NULL)
1763 return UNZ_PARAMERROR;
1764 s=(unz64_s*)file;
@@ -1904,12 +1768,11 @@
1768 return UNZ_PARAMERROR;
1769
1770 return (z_off_t)pfile_in_zip_read_info->stream.total_out;
1771 }
1772
1773 extern ZPOS64_T ZEXPORT unztell64(unzFile file) {
 
1774
1775 unz64_s* s;
1776 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1777 if (file==NULL)
1778 return (ZPOS64_T)-1;
@@ -1924,12 +1787,11 @@
1787
1788
1789 /*
1790 return 1 if the end of file was reached, 0 elsewhere
1791 */
1792 extern int ZEXPORT unzeof(unzFile file) {
 
1793 unz64_s* s;
1794 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1795 if (file==NULL)
1796 return UNZ_PARAMERROR;
1797 s=(unz64_s*)file;
@@ -1956,12 +1818,11 @@
1818 if buf!=NULL, len is the size of the buffer, the extra header is copied in
1819 buf.
1820 the return value is the number of bytes copied in buf, or (if <0)
1821 the error code
1822 */
1823 extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) {
 
1824 unz64_s* s;
1825 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1826 uInt read_now;
1827 ZPOS64_T size_to_read;
1828
@@ -2004,12 +1865,11 @@
1865
1866 /*
1867 Close the file in zip opened with unzOpenCurrentFile
1868 Return UNZ_CRCERROR if all the file was read but the CRC is not good
1869 */
1870 extern int ZEXPORT unzCloseCurrentFile(unzFile file) {
 
1871 int err=UNZ_OK;
1872
1873 unz64_s* s;
1874 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1875 if (file==NULL)
@@ -2027,11 +1887,11 @@
1887 if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
1888 err=UNZ_CRCERROR;
1889 }
1890
1891
1892 free(pfile_in_zip_read_info->read_buffer);
1893 pfile_in_zip_read_info->read_buffer = NULL;
1894 if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
1895 inflateEnd(&pfile_in_zip_read_info->stream);
1896 #ifdef HAVE_BZIP2
1897 else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED)
@@ -2038,11 +1898,11 @@
1898 BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream);
1899 #endif
1900
1901
1902 pfile_in_zip_read_info->stream_initialised = 0;
1903 free(pfile_in_zip_read_info);
1904
1905 s->pfile_in_zip_read=NULL;
1906
1907 return err;
1908 }
@@ -2051,12 +1911,11 @@
1911 /*
1912 Get the global comment string of the ZipFile, in the szComment buffer.
1913 uSizeBuf is the size of the szComment buffer.
1914 return the number of byte copied or an error code <0
1915 */
1916 extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) {
 
1917 unz64_s* s;
1918 uLong uReadThis ;
1919 if (file==NULL)
1920 return (int)UNZ_PARAMERROR;
1921 s=(unz64_s*)file;
@@ -2079,12 +1938,11 @@
1938 *(szComment+s->gi.size_comment)='\0';
1939 return (int)uReadThis;
1940 }
1941
1942 /* Additions by RX '2004 */
1943 extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) {
 
1944 unz64_s* s;
1945
1946 if (file==NULL)
1947 return 0; //UNZ_PARAMERROR;
1948 s=(unz64_s*)file;
@@ -2094,22 +1952,20 @@
1952 if (s->num_file==s->gi.number_entry)
1953 return 0;
1954 return s->pos_in_central_dir;
1955 }
1956
1957 extern uLong ZEXPORT unzGetOffset(unzFile file) {
 
1958 ZPOS64_T offset64;
1959
1960 if (file==NULL)
1961 return 0; //UNZ_PARAMERROR;
1962 offset64 = unzGetOffset64(file);
1963 return (uLong)offset64;
1964 }
1965
1966 extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) {
 
1967 unz64_s* s;
1968 int err;
1969
1970 if (file==NULL)
1971 return UNZ_PARAMERROR;
@@ -2122,9 +1978,8 @@
1978 NULL,0,NULL,0,NULL,0);
1979 s->current_file_ok = (err == UNZ_OK);
1980 return err;
1981 }
1982
1983 extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) {
 
1984 return unzSetOffset64(file,pos);
1985 }
1986
--- compat/zlib/contrib/minizip/unzip.h
+++ compat/zlib/contrib/minizip/unzip.h
@@ -148,25 +148,25 @@
148148
uLong external_fa; /* external file attributes 4 bytes */
149149
150150
tm_unz tmu_date;
151151
} unz_file_info;
152152
153
-extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
154
- const char* fileName2,
155
- int iCaseSensitivity));
153
+extern int ZEXPORT unzStringFileNameCompare(const char* fileName1,
154
+ const char* fileName2,
155
+ int iCaseSensitivity);
156156
/*
157
- Compare two filename (fileName1,fileName2).
158
- If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
159
- If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
157
+ Compare two filenames (fileName1,fileName2).
158
+ If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
159
+ If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
160160
or strcasecmp)
161
- If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
161
+ If iCaseSensitivity = 0, case sensitivity is default of your operating system
162162
(like 1 on Unix, 2 on Windows)
163163
*/
164164
165165
166
-extern unzFile ZEXPORT unzOpen OF((const char *path));
167
-extern unzFile ZEXPORT unzOpen64 OF((const void *path));
166
+extern unzFile ZEXPORT unzOpen(const char *path);
167
+extern unzFile ZEXPORT unzOpen64(const void *path);
168168
/*
169169
Open a Zip file. path contain the full pathname (by example,
170170
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
171171
"zlib/zlib113.zip".
172172
If the zipfile cannot be opened (file don't exist or in not valid), the
@@ -179,45 +179,45 @@
179179
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
180180
does not describe the reality
181181
*/
182182
183183
184
-extern unzFile ZEXPORT unzOpen2 OF((const char *path,
185
- zlib_filefunc_def* pzlib_filefunc_def));
184
+extern unzFile ZEXPORT unzOpen2(const char *path,
185
+ zlib_filefunc_def* pzlib_filefunc_def);
186186
/*
187187
Open a Zip file, like unzOpen, but provide a set of file low level API
188188
for read/write the zip file (see ioapi.h)
189189
*/
190190
191
-extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
192
- zlib_filefunc64_def* pzlib_filefunc_def));
191
+extern unzFile ZEXPORT unzOpen2_64(const void *path,
192
+ zlib_filefunc64_def* pzlib_filefunc_def);
193193
/*
194194
Open a Zip file, like unz64Open, but provide a set of file low level API
195195
for read/write the zip file (see ioapi.h)
196196
*/
197197
198
-extern int ZEXPORT unzClose OF((unzFile file));
198
+extern int ZEXPORT unzClose(unzFile file);
199199
/*
200200
Close a ZipFile opened with unzOpen.
201201
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
202202
these files MUST be closed with unzCloseCurrentFile before call unzClose.
203203
return UNZ_OK if there is no problem. */
204204
205
-extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
206
- unz_global_info *pglobal_info));
205
+extern int ZEXPORT unzGetGlobalInfo(unzFile file,
206
+ unz_global_info *pglobal_info);
207207
208
-extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
209
- unz_global_info64 *pglobal_info));
208
+extern int ZEXPORT unzGetGlobalInfo64(unzFile file,
209
+ unz_global_info64 *pglobal_info);
210210
/*
211211
Write info about the ZipFile in the *pglobal_info structure.
212212
No preparation of the structure is needed
213213
return UNZ_OK if there is no problem. */
214214
215215
216
-extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
217
- char *szComment,
218
- uLong uSizeBuf));
216
+extern int ZEXPORT unzGetGlobalComment(unzFile file,
217
+ char *szComment,
218
+ uLong uSizeBuf);
219219
/*
220220
Get the global comment string of the ZipFile, in the szComment buffer.
221221
uSizeBuf is the size of the szComment buffer.
222222
return the number of byte copied or an error code <0
223223
*/
@@ -224,26 +224,26 @@
224224
225225
226226
/***************************************************************************/
227227
/* Unzip package allow you browse the directory of the zipfile */
228228
229
-extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
229
+extern int ZEXPORT unzGoToFirstFile(unzFile file);
230230
/*
231231
Set the current file of the zipfile to the first file.
232232
return UNZ_OK if there is no problem
233233
*/
234234
235
-extern int ZEXPORT unzGoToNextFile OF((unzFile file));
235
+extern int ZEXPORT unzGoToNextFile(unzFile file);
236236
/*
237237
Set the current file of the zipfile to the next file.
238238
return UNZ_OK if there is no problem
239239
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
240240
*/
241241
242
-extern int ZEXPORT unzLocateFile OF((unzFile file,
243
- const char *szFileName,
244
- int iCaseSensitivity));
242
+extern int ZEXPORT unzLocateFile(unzFile file,
243
+ const char *szFileName,
244
+ int iCaseSensitivity);
245245
/*
246246
Try locate the file szFileName in the zipfile.
247247
For the iCaseSensitivity signification, see unzStringFileNameCompare
248248
249249
return value :
@@ -283,30 +283,30 @@
283283
unzFile file,
284284
const unz64_file_pos* file_pos);
285285
286286
/* ****************************************** */
287287
288
-extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
289
- unz_file_info64 *pfile_info,
290
- char *szFileName,
291
- uLong fileNameBufferSize,
292
- void *extraField,
293
- uLong extraFieldBufferSize,
294
- char *szComment,
295
- uLong commentBufferSize));
296
-
297
-extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
298
- unz_file_info *pfile_info,
299
- char *szFileName,
300
- uLong fileNameBufferSize,
301
- void *extraField,
302
- uLong extraFieldBufferSize,
303
- char *szComment,
304
- uLong commentBufferSize));
288
+extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
289
+ unz_file_info64 *pfile_info,
290
+ char *szFileName,
291
+ uLong fileNameBufferSize,
292
+ void *extraField,
293
+ uLong extraFieldBufferSize,
294
+ char *szComment,
295
+ uLong commentBufferSize);
296
+
297
+extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
298
+ unz_file_info *pfile_info,
299
+ char *szFileName,
300
+ uLong fileNameBufferSize,
301
+ void *extraField,
302
+ uLong extraFieldBufferSize,
303
+ char *szComment,
304
+ uLong commentBufferSize);
305305
/*
306306
Get Info about the current file
307
- if pfile_info!=NULL, the *pfile_info structure will contain somes info about
307
+ if pfile_info!=NULL, the *pfile_info structure will contain some info about
308308
the current file
309309
if szFileName!=NULL, the filemane string will be copied in szFileName
310310
(fileNameBufferSize is the size of the buffer)
311311
if extraField!=NULL, the extra field information will be copied in extraField
312312
(extraFieldBufferSize is the size of the buffer).
@@ -316,52 +316,52 @@
316316
*/
317317
318318
319319
/** Addition for GDAL : START */
320320
321
-extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
321
+extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file);
322322
323323
/** Addition for GDAL : END */
324324
325325
326326
/***************************************************************************/
327327
/* for reading the content of the current zipfile, you can open it, read data
328328
from it, and close it (you can close it before reading all the file)
329329
*/
330330
331
-extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
331
+extern int ZEXPORT unzOpenCurrentFile(unzFile file);
332332
/*
333333
Open for reading data the current file in the zipfile.
334334
If there is no error, the return value is UNZ_OK.
335335
*/
336336
337
-extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
338
- const char* password));
337
+extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file,
338
+ const char* password);
339339
/*
340340
Open for reading data the current file in the zipfile.
341341
password is a crypting password
342342
If there is no error, the return value is UNZ_OK.
343343
*/
344344
345
-extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
346
- int* method,
347
- int* level,
348
- int raw));
345
+extern int ZEXPORT unzOpenCurrentFile2(unzFile file,
346
+ int* method,
347
+ int* level,
348
+ int raw);
349349
/*
350350
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
351351
if raw==1
352352
*method will receive method of compression, *level will receive level of
353353
compression
354354
note : you can set level parameter as NULL (if you did not want known level,
355355
but you CANNOT set method parameter as NULL
356356
*/
357357
358
-extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
359
- int* method,
360
- int* level,
361
- int raw,
362
- const char* password));
358
+extern int ZEXPORT unzOpenCurrentFile3(unzFile file,
359
+ int* method,
360
+ int* level,
361
+ int raw,
362
+ const char* password);
363363
/*
364364
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
365365
if raw==1
366366
*method will receive method of compression, *level will receive level of
367367
compression
@@ -368,45 +368,45 @@
368368
note : you can set level parameter as NULL (if you did not want known level,
369369
but you CANNOT set method parameter as NULL
370370
*/
371371
372372
373
-extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
373
+extern int ZEXPORT unzCloseCurrentFile(unzFile file);
374374
/*
375375
Close the file in zip opened with unzOpenCurrentFile
376376
Return UNZ_CRCERROR if all the file was read but the CRC is not good
377377
*/
378378
379
-extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
380
- voidp buf,
381
- unsigned len));
379
+extern int ZEXPORT unzReadCurrentFile(unzFile file,
380
+ voidp buf,
381
+ unsigned len);
382382
/*
383383
Read bytes from the current file (opened by unzOpenCurrentFile)
384384
buf contain buffer where data must be copied
385385
len the size of buf.
386386
387
- return the number of byte copied if somes bytes are copied
387
+ return the number of byte copied if some bytes are copied
388388
return 0 if the end of file was reached
389389
return <0 with error code if there is an error
390390
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
391391
*/
392392
393
-extern z_off_t ZEXPORT unztell OF((unzFile file));
393
+extern z_off_t ZEXPORT unztell(unzFile file);
394394
395
-extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
395
+extern ZPOS64_T ZEXPORT unztell64(unzFile file);
396396
/*
397397
Give the current position in uncompressed data
398398
*/
399399
400
-extern int ZEXPORT unzeof OF((unzFile file));
400
+extern int ZEXPORT unzeof(unzFile file);
401401
/*
402402
return 1 if the end of file was reached, 0 elsewhere
403403
*/
404404
405
-extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
406
- voidp buf,
407
- unsigned len));
405
+extern int ZEXPORT unzGetLocalExtrafield(unzFile file,
406
+ voidp buf,
407
+ unsigned len);
408408
/*
409409
Read extra field from the current file (opened by unzOpenCurrentFile)
410410
This is the local-header version of the extra field (sometimes, there is
411411
more info in the local-header version than in the central-header)
412412
413413
--- compat/zlib/contrib/minizip/unzip.h
+++ compat/zlib/contrib/minizip/unzip.h
@@ -148,25 +148,25 @@
148 uLong external_fa; /* external file attributes 4 bytes */
149
150 tm_unz tmu_date;
151 } unz_file_info;
152
153 extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
154 const char* fileName2,
155 int iCaseSensitivity));
156 /*
157 Compare two filename (fileName1,fileName2).
158 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
159 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
160 or strcasecmp)
161 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
162 (like 1 on Unix, 2 on Windows)
163 */
164
165
166 extern unzFile ZEXPORT unzOpen OF((const char *path));
167 extern unzFile ZEXPORT unzOpen64 OF((const void *path));
168 /*
169 Open a Zip file. path contain the full pathname (by example,
170 on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
171 "zlib/zlib113.zip".
172 If the zipfile cannot be opened (file don't exist or in not valid), the
@@ -179,45 +179,45 @@
179 is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
180 does not describe the reality
181 */
182
183
184 extern unzFile ZEXPORT unzOpen2 OF((const char *path,
185 zlib_filefunc_def* pzlib_filefunc_def));
186 /*
187 Open a Zip file, like unzOpen, but provide a set of file low level API
188 for read/write the zip file (see ioapi.h)
189 */
190
191 extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
192 zlib_filefunc64_def* pzlib_filefunc_def));
193 /*
194 Open a Zip file, like unz64Open, but provide a set of file low level API
195 for read/write the zip file (see ioapi.h)
196 */
197
198 extern int ZEXPORT unzClose OF((unzFile file));
199 /*
200 Close a ZipFile opened with unzOpen.
201 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
202 these files MUST be closed with unzCloseCurrentFile before call unzClose.
203 return UNZ_OK if there is no problem. */
204
205 extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
206 unz_global_info *pglobal_info));
207
208 extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
209 unz_global_info64 *pglobal_info));
210 /*
211 Write info about the ZipFile in the *pglobal_info structure.
212 No preparation of the structure is needed
213 return UNZ_OK if there is no problem. */
214
215
216 extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
217 char *szComment,
218 uLong uSizeBuf));
219 /*
220 Get the global comment string of the ZipFile, in the szComment buffer.
221 uSizeBuf is the size of the szComment buffer.
222 return the number of byte copied or an error code <0
223 */
@@ -224,26 +224,26 @@
224
225
226 /***************************************************************************/
227 /* Unzip package allow you browse the directory of the zipfile */
228
229 extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
230 /*
231 Set the current file of the zipfile to the first file.
232 return UNZ_OK if there is no problem
233 */
234
235 extern int ZEXPORT unzGoToNextFile OF((unzFile file));
236 /*
237 Set the current file of the zipfile to the next file.
238 return UNZ_OK if there is no problem
239 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
240 */
241
242 extern int ZEXPORT unzLocateFile OF((unzFile file,
243 const char *szFileName,
244 int iCaseSensitivity));
245 /*
246 Try locate the file szFileName in the zipfile.
247 For the iCaseSensitivity signification, see unzStringFileNameCompare
248
249 return value :
@@ -283,30 +283,30 @@
283 unzFile file,
284 const unz64_file_pos* file_pos);
285
286 /* ****************************************** */
287
288 extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
289 unz_file_info64 *pfile_info,
290 char *szFileName,
291 uLong fileNameBufferSize,
292 void *extraField,
293 uLong extraFieldBufferSize,
294 char *szComment,
295 uLong commentBufferSize));
296
297 extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
298 unz_file_info *pfile_info,
299 char *szFileName,
300 uLong fileNameBufferSize,
301 void *extraField,
302 uLong extraFieldBufferSize,
303 char *szComment,
304 uLong commentBufferSize));
305 /*
306 Get Info about the current file
307 if pfile_info!=NULL, the *pfile_info structure will contain somes info about
308 the current file
309 if szFileName!=NULL, the filemane string will be copied in szFileName
310 (fileNameBufferSize is the size of the buffer)
311 if extraField!=NULL, the extra field information will be copied in extraField
312 (extraFieldBufferSize is the size of the buffer).
@@ -316,52 +316,52 @@
316 */
317
318
319 /** Addition for GDAL : START */
320
321 extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
322
323 /** Addition for GDAL : END */
324
325
326 /***************************************************************************/
327 /* for reading the content of the current zipfile, you can open it, read data
328 from it, and close it (you can close it before reading all the file)
329 */
330
331 extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
332 /*
333 Open for reading data the current file in the zipfile.
334 If there is no error, the return value is UNZ_OK.
335 */
336
337 extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
338 const char* password));
339 /*
340 Open for reading data the current file in the zipfile.
341 password is a crypting password
342 If there is no error, the return value is UNZ_OK.
343 */
344
345 extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
346 int* method,
347 int* level,
348 int raw));
349 /*
350 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
351 if raw==1
352 *method will receive method of compression, *level will receive level of
353 compression
354 note : you can set level parameter as NULL (if you did not want known level,
355 but you CANNOT set method parameter as NULL
356 */
357
358 extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
359 int* method,
360 int* level,
361 int raw,
362 const char* password));
363 /*
364 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
365 if raw==1
366 *method will receive method of compression, *level will receive level of
367 compression
@@ -368,45 +368,45 @@
368 note : you can set level parameter as NULL (if you did not want known level,
369 but you CANNOT set method parameter as NULL
370 */
371
372
373 extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
374 /*
375 Close the file in zip opened with unzOpenCurrentFile
376 Return UNZ_CRCERROR if all the file was read but the CRC is not good
377 */
378
379 extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
380 voidp buf,
381 unsigned len));
382 /*
383 Read bytes from the current file (opened by unzOpenCurrentFile)
384 buf contain buffer where data must be copied
385 len the size of buf.
386
387 return the number of byte copied if somes bytes are copied
388 return 0 if the end of file was reached
389 return <0 with error code if there is an error
390 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
391 */
392
393 extern z_off_t ZEXPORT unztell OF((unzFile file));
394
395 extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
396 /*
397 Give the current position in uncompressed data
398 */
399
400 extern int ZEXPORT unzeof OF((unzFile file));
401 /*
402 return 1 if the end of file was reached, 0 elsewhere
403 */
404
405 extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
406 voidp buf,
407 unsigned len));
408 /*
409 Read extra field from the current file (opened by unzOpenCurrentFile)
410 This is the local-header version of the extra field (sometimes, there is
411 more info in the local-header version than in the central-header)
412
413
--- compat/zlib/contrib/minizip/unzip.h
+++ compat/zlib/contrib/minizip/unzip.h
@@ -148,25 +148,25 @@
148 uLong external_fa; /* external file attributes 4 bytes */
149
150 tm_unz tmu_date;
151 } unz_file_info;
152
153 extern int ZEXPORT unzStringFileNameCompare(const char* fileName1,
154 const char* fileName2,
155 int iCaseSensitivity);
156 /*
157 Compare two filenames (fileName1,fileName2).
158 If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
159 If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
160 or strcasecmp)
161 If iCaseSensitivity = 0, case sensitivity is default of your operating system
162 (like 1 on Unix, 2 on Windows)
163 */
164
165
166 extern unzFile ZEXPORT unzOpen(const char *path);
167 extern unzFile ZEXPORT unzOpen64(const void *path);
168 /*
169 Open a Zip file. path contain the full pathname (by example,
170 on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
171 "zlib/zlib113.zip".
172 If the zipfile cannot be opened (file don't exist or in not valid), the
@@ -179,45 +179,45 @@
179 is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
180 does not describe the reality
181 */
182
183
184 extern unzFile ZEXPORT unzOpen2(const char *path,
185 zlib_filefunc_def* pzlib_filefunc_def);
186 /*
187 Open a Zip file, like unzOpen, but provide a set of file low level API
188 for read/write the zip file (see ioapi.h)
189 */
190
191 extern unzFile ZEXPORT unzOpen2_64(const void *path,
192 zlib_filefunc64_def* pzlib_filefunc_def);
193 /*
194 Open a Zip file, like unz64Open, but provide a set of file low level API
195 for read/write the zip file (see ioapi.h)
196 */
197
198 extern int ZEXPORT unzClose(unzFile file);
199 /*
200 Close a ZipFile opened with unzOpen.
201 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
202 these files MUST be closed with unzCloseCurrentFile before call unzClose.
203 return UNZ_OK if there is no problem. */
204
205 extern int ZEXPORT unzGetGlobalInfo(unzFile file,
206 unz_global_info *pglobal_info);
207
208 extern int ZEXPORT unzGetGlobalInfo64(unzFile file,
209 unz_global_info64 *pglobal_info);
210 /*
211 Write info about the ZipFile in the *pglobal_info structure.
212 No preparation of the structure is needed
213 return UNZ_OK if there is no problem. */
214
215
216 extern int ZEXPORT unzGetGlobalComment(unzFile file,
217 char *szComment,
218 uLong uSizeBuf);
219 /*
220 Get the global comment string of the ZipFile, in the szComment buffer.
221 uSizeBuf is the size of the szComment buffer.
222 return the number of byte copied or an error code <0
223 */
@@ -224,26 +224,26 @@
224
225
226 /***************************************************************************/
227 /* Unzip package allow you browse the directory of the zipfile */
228
229 extern int ZEXPORT unzGoToFirstFile(unzFile file);
230 /*
231 Set the current file of the zipfile to the first file.
232 return UNZ_OK if there is no problem
233 */
234
235 extern int ZEXPORT unzGoToNextFile(unzFile file);
236 /*
237 Set the current file of the zipfile to the next file.
238 return UNZ_OK if there is no problem
239 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
240 */
241
242 extern int ZEXPORT unzLocateFile(unzFile file,
243 const char *szFileName,
244 int iCaseSensitivity);
245 /*
246 Try locate the file szFileName in the zipfile.
247 For the iCaseSensitivity signification, see unzStringFileNameCompare
248
249 return value :
@@ -283,30 +283,30 @@
283 unzFile file,
284 const unz64_file_pos* file_pos);
285
286 /* ****************************************** */
287
288 extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
289 unz_file_info64 *pfile_info,
290 char *szFileName,
291 uLong fileNameBufferSize,
292 void *extraField,
293 uLong extraFieldBufferSize,
294 char *szComment,
295 uLong commentBufferSize);
296
297 extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
298 unz_file_info *pfile_info,
299 char *szFileName,
300 uLong fileNameBufferSize,
301 void *extraField,
302 uLong extraFieldBufferSize,
303 char *szComment,
304 uLong commentBufferSize);
305 /*
306 Get Info about the current file
307 if pfile_info!=NULL, the *pfile_info structure will contain some info about
308 the current file
309 if szFileName!=NULL, the filemane string will be copied in szFileName
310 (fileNameBufferSize is the size of the buffer)
311 if extraField!=NULL, the extra field information will be copied in extraField
312 (extraFieldBufferSize is the size of the buffer).
@@ -316,52 +316,52 @@
316 */
317
318
319 /** Addition for GDAL : START */
320
321 extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file);
322
323 /** Addition for GDAL : END */
324
325
326 /***************************************************************************/
327 /* for reading the content of the current zipfile, you can open it, read data
328 from it, and close it (you can close it before reading all the file)
329 */
330
331 extern int ZEXPORT unzOpenCurrentFile(unzFile file);
332 /*
333 Open for reading data the current file in the zipfile.
334 If there is no error, the return value is UNZ_OK.
335 */
336
337 extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file,
338 const char* password);
339 /*
340 Open for reading data the current file in the zipfile.
341 password is a crypting password
342 If there is no error, the return value is UNZ_OK.
343 */
344
345 extern int ZEXPORT unzOpenCurrentFile2(unzFile file,
346 int* method,
347 int* level,
348 int raw);
349 /*
350 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
351 if raw==1
352 *method will receive method of compression, *level will receive level of
353 compression
354 note : you can set level parameter as NULL (if you did not want known level,
355 but you CANNOT set method parameter as NULL
356 */
357
358 extern int ZEXPORT unzOpenCurrentFile3(unzFile file,
359 int* method,
360 int* level,
361 int raw,
362 const char* password);
363 /*
364 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
365 if raw==1
366 *method will receive method of compression, *level will receive level of
367 compression
@@ -368,45 +368,45 @@
368 note : you can set level parameter as NULL (if you did not want known level,
369 but you CANNOT set method parameter as NULL
370 */
371
372
373 extern int ZEXPORT unzCloseCurrentFile(unzFile file);
374 /*
375 Close the file in zip opened with unzOpenCurrentFile
376 Return UNZ_CRCERROR if all the file was read but the CRC is not good
377 */
378
379 extern int ZEXPORT unzReadCurrentFile(unzFile file,
380 voidp buf,
381 unsigned len);
382 /*
383 Read bytes from the current file (opened by unzOpenCurrentFile)
384 buf contain buffer where data must be copied
385 len the size of buf.
386
387 return the number of byte copied if some bytes are copied
388 return 0 if the end of file was reached
389 return <0 with error code if there is an error
390 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
391 */
392
393 extern z_off_t ZEXPORT unztell(unzFile file);
394
395 extern ZPOS64_T ZEXPORT unztell64(unzFile file);
396 /*
397 Give the current position in uncompressed data
398 */
399
400 extern int ZEXPORT unzeof(unzFile file);
401 /*
402 return 1 if the end of file was reached, 0 elsewhere
403 */
404
405 extern int ZEXPORT unzGetLocalExtrafield(unzFile file,
406 voidp buf,
407 unsigned len);
408 /*
409 Read extra field from the current file (opened by unzOpenCurrentFile)
410 This is the local-header version of the extra field (sometimes, there is
411 more info in the local-header version than in the central-header)
412
413
--- compat/zlib/contrib/minizip/zip.c
+++ compat/zlib/contrib/minizip/zip.c
@@ -12,11 +12,11 @@
1212
Changes
1313
Oct-2009 - Mathias Svensson - Remove old C style function prototypes
1414
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
1515
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
1616
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
17
- It is used when recreting zip archive with RAW when deleting items from a zip.
17
+ It is used when recreating zip archive with RAW when deleting items from a zip.
1818
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
1919
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
2020
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
2121
2222
*/
@@ -23,18 +23,17 @@
2323
2424
2525
#include <stdio.h>
2626
#include <stdlib.h>
2727
#include <string.h>
28
+#include <stdint.h>
2829
#include <time.h>
2930
#include "zlib.h"
3031
#include "zip.h"
3132
3233
#ifdef STDC
3334
# include <stddef.h>
34
-# include <string.h>
35
-# include <stdlib.h>
3635
#endif
3736
#ifdef NO_ERRNO_H
3837
extern int errno;
3938
#else
4039
# include <errno.h>
@@ -45,11 +44,11 @@
4544
# define local static
4645
#endif
4746
/* compile with -Dlocal if your debugger can't find static symbols */
4847
4948
#ifndef VERSIONMADEBY
50
-# define VERSIONMADEBY (0x0) /* platform depedent */
49
+# define VERSIONMADEBY (0x0) /* platform dependent */
5150
#endif
5251
5352
#ifndef Z_BUFSIZE
5453
#define Z_BUFSIZE (64*1024) //(16384)
5554
#endif
@@ -59,13 +58,10 @@
5958
#endif
6059
6160
#ifndef ALLOC
6261
# define ALLOC(size) (malloc(size))
6362
#endif
64
-#ifndef TRYFREE
65
-# define TRYFREE(p) {if (p) free(p);}
66
-#endif
6763
6864
/*
6965
#define SIZECENTRALDIRITEM (0x2e)
7066
#define SIZEZIPLOCALHEADER (0x1e)
7167
*/
@@ -136,24 +132,24 @@
136132
137133
int stream_initialised; /* 1 is stream is initialised */
138134
uInt pos_in_buffered_data; /* last written byte in buffered_data */
139135
140136
ZPOS64_T pos_local_header; /* offset of the local header of the file
141
- currenty writing */
137
+ currently writing */
142138
char* central_header; /* central header data for the current file */
143139
uLong size_centralExtra;
144140
uLong size_centralheader; /* size of the central header for cur file */
145141
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
146142
uLong flag; /* flag of the file currently writing */
147143
148
- int method; /* compression method of file currenty wr.*/
144
+ int method; /* compression method of file currently wr.*/
149145
int raw; /* 1 for directly writing raw data */
150146
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
151147
uLong dosDate;
152148
uLong crc32;
153149
int encrypt;
154
- int zip64; /* Add ZIP64 extened information in the extra field */
150
+ int zip64; /* Add ZIP64 extended information in the extra field */
155151
ZPOS64_T pos_zip64extrainfo;
156152
ZPOS64_T totalCompressedData;
157153
ZPOS64_T totalUncompressedData;
158154
#ifndef NOCRYPT
159155
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
@@ -163,14 +159,14 @@
163159
} curfile64_info;
164160
165161
typedef struct
166162
{
167163
zlib_filefunc64_32_def z_filefunc;
168
- voidpf filestream; /* io structore of the zipfile */
164
+ voidpf filestream; /* io structure of the zipfile */
169165
linkedlist_data central_dir;/* datablock with central dir in construction*/
170166
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
171
- curfile64_info ci; /* info on the file curretly writing */
167
+ curfile64_info ci; /* info on the file currently writing */
172168
173169
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
174170
ZPOS64_T add_position_when_writing_offset;
175171
ZPOS64_T number_entry;
176172
@@ -184,12 +180,11 @@
184180
#ifndef NOCRYPT
185181
#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
186182
#include "crypt.h"
187183
#endif
188184
189
-local linkedlist_datablock_internal* allocate_new_datablock()
190
-{
185
+local linkedlist_datablock_internal* allocate_new_datablock(void) {
191186
linkedlist_datablock_internal* ldi;
192187
ldi = (linkedlist_datablock_internal*)
193188
ALLOC(sizeof(linkedlist_datablock_internal));
194189
if (ldi!=NULL)
195190
{
@@ -198,34 +193,30 @@
198193
ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
199194
}
200195
return ldi;
201196
}
202197
203
-local void free_datablock(linkedlist_datablock_internal* ldi)
204
-{
198
+local void free_datablock(linkedlist_datablock_internal* ldi) {
205199
while (ldi!=NULL)
206200
{
207201
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
208
- TRYFREE(ldi);
202
+ free(ldi);
209203
ldi = ldinext;
210204
}
211205
}
212206
213
-local void init_linkedlist(linkedlist_data* ll)
214
-{
207
+local void init_linkedlist(linkedlist_data* ll) {
215208
ll->first_block = ll->last_block = NULL;
216209
}
217210
218
-local void free_linkedlist(linkedlist_data* ll)
219
-{
211
+local void free_linkedlist(linkedlist_data* ll) {
220212
free_datablock(ll->first_block);
221213
ll->first_block = ll->last_block = NULL;
222214
}
223215
224216
225
-local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
226
-{
217
+local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
227218
linkedlist_datablock_internal* ldi;
228219
const unsigned char* from_copy;
229220
230221
if (ll==NULL)
231222
return ZIP_INTERNALERROR;
@@ -236,11 +227,11 @@
236227
if (ll->first_block == NULL)
237228
return ZIP_INTERNALERROR;
238229
}
239230
240231
ldi = ll->last_block;
241
- from_copy = (unsigned char*)buf;
232
+ from_copy = (const unsigned char*)buf;
242233
243234
while (len>0)
244235
{
245236
uInt copy_this;
246237
uInt i;
@@ -281,13 +272,11 @@
281272
/* ===========================================================================
282273
Inputs a long in LSB order to the given file
283274
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
284275
*/
285276
286
-local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
287
-local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
288
-{
277
+local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
289278
unsigned char buf[8];
290279
int n;
291280
for (n = 0; n < nbByte; n++)
292281
{
293282
buf[n] = (unsigned char)(x & 0xff);
@@ -305,13 +294,11 @@
305294
return ZIP_ERRNO;
306295
else
307296
return ZIP_OK;
308297
}
309298
310
-local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
311
-local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
312
-{
299
+local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
313300
unsigned char* buf=(unsigned char*)dest;
314301
int n;
315302
for (n = 0; n < nbByte; n++) {
316303
buf[n] = (unsigned char)(x & 0xff);
317304
x >>= 8;
@@ -327,12 +314,11 @@
327314
}
328315
329316
/****************************************************************************/
330317
331318
332
-local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
333
-{
319
+local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
334320
uLong year = (uLong)ptm->tm_year;
335321
if (year>=1980)
336322
year-=1980;
337323
else if (year>=80)
338324
year-=80;
@@ -342,14 +328,11 @@
342328
}
343329
344330
345331
/****************************************************************************/
346332
347
-local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
348
-
349
-local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
350
-{
333
+local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
351334
unsigned char c;
352335
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
353336
if (err==1)
354337
{
355338
*pi = (int)c;
@@ -366,14 +349,11 @@
366349
367350
368351
/* ===========================================================================
369352
Reads a long in LSB order from the given gz_stream. Sets
370353
*/
371
-local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
372
-
373
-local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
374
-{
354
+local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
375355
uLong x ;
376356
int i = 0;
377357
int err;
378358
379359
err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -388,14 +368,11 @@
388368
else
389369
*pX = 0;
390370
return err;
391371
}
392372
393
-local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
394
-
395
-local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
396
-{
373
+local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
397374
uLong x ;
398375
int i = 0;
399376
int err;
400377
401378
err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -418,15 +395,12 @@
418395
else
419396
*pX = 0;
420397
return err;
421398
}
422399
423
-local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
424400
425
-
426
-local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
427
-{
401
+local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
428402
ZPOS64_T x;
429403
int i = 0;
430404
int err;
431405
432406
err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -473,14 +447,11 @@
473447
#endif
474448
/*
475449
Locate the Central directory of a zipfile (at the end, just before
476450
the global comment)
477451
*/
478
-local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
479
-
480
-local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
481
-{
452
+local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
482453
unsigned char* buf;
483454
ZPOS64_T uSizeFile;
484455
ZPOS64_T uBackRead;
485456
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
486457
ZPOS64_T uPosFound=0;
@@ -527,22 +498,19 @@
527498
}
528499
529500
if (uPosFound!=0)
530501
break;
531502
}
532
- TRYFREE(buf);
503
+ free(buf);
533504
return uPosFound;
534505
}
535506
536507
/*
537508
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
538509
the global comment)
539510
*/
540
-local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
541
-
542
-local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
543
-{
511
+local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
544512
unsigned char* buf;
545513
ZPOS64_T uSizeFile;
546514
ZPOS64_T uBackRead;
547515
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
548516
ZPOS64_T uPosFound=0;
@@ -593,11 +561,11 @@
593561
594562
if (uPosFound!=0)
595563
break;
596564
}
597565
598
- TRYFREE(buf);
566
+ free(buf);
599567
if (uPosFound == 0)
600568
return 0;
601569
602570
/* Zip64 end of central directory locator */
603571
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
@@ -635,24 +603,23 @@
635603
return 0;
636604
637605
return relativeOffset;
638606
}
639607
640
-local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
641
-{
608
+local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
642609
int err=ZIP_OK;
643610
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
644611
645612
ZPOS64_T size_central_dir; /* size of the central directory */
646613
ZPOS64_T offset_central_dir; /* offset of start of central directory */
647614
ZPOS64_T central_pos;
648615
uLong uL;
649616
650617
uLong number_disk; /* number of the current dist, used for
651
- spaning ZIP, unsupported, always 0*/
618
+ spanning ZIP, unsupported, always 0*/
652619
uLong number_disk_with_CD; /* number the the disk with central dir, used
653
- for spaning ZIP, unsupported, always 0*/
620
+ for spanning ZIP, unsupported, always 0*/
654621
ZPOS64_T number_entry;
655622
ZPOS64_T number_entry_CD; /* total number of entries in
656623
the central dir
657624
(same than number_entry on nospan) */
658625
uLong VersionMadeBy;
@@ -828,11 +795,11 @@
828795
if (err==ZIP_OK)
829796
err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this);
830797
831798
size_central_dir_to_read-=read_this;
832799
}
833
- TRYFREE(buf_read);
800
+ free(buf_read);
834801
}
835802
pziinit->begin_pos = byte_before_the_zipfile;
836803
pziinit->number_entry = number_entry_CD;
837804
838805
if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
@@ -844,12 +811,11 @@
844811
845812
#endif /* !NO_ADDFILEINEXISTINGZIP*/
846813
847814
848815
/************************************************************/
849
-extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
850
-{
816
+extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
851817
zip64_internal ziinit;
852818
zip64_internal* zi;
853819
int err=ZIP_OK;
854820
855821
ziinit.z_filefunc.zseek32_file = NULL;
@@ -903,24 +869,23 @@
903869
# endif /* !NO_ADDFILEINEXISTINGZIP*/
904870
905871
if (err != ZIP_OK)
906872
{
907873
# ifndef NO_ADDFILEINEXISTINGZIP
908
- TRYFREE(ziinit.globalcomment);
874
+ free(ziinit.globalcomment);
909875
# endif /* !NO_ADDFILEINEXISTINGZIP*/
910
- TRYFREE(zi);
876
+ free(zi);
911877
return NULL;
912878
}
913879
else
914880
{
915881
*zi = ziinit;
916882
return (zipFile)zi;
917883
}
918884
}
919885
920
-extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
921
-{
886
+extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
922887
if (pzlib_filefunc32_def != NULL)
923888
{
924889
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
925890
fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
926891
return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
@@ -927,12 +892,11 @@
927892
}
928893
else
929894
return zipOpen3(pathname, append, globalcomment, NULL);
930895
}
931896
932
-extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
933
-{
897
+extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
934898
if (pzlib_filefunc_def != NULL)
935899
{
936900
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
937901
zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
938902
zlib_filefunc64_32_def_fill.ztell32_file = NULL;
@@ -943,22 +907,19 @@
943907
return zipOpen3(pathname, append, globalcomment, NULL);
944908
}
945909
946910
947911
948
-extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
949
-{
912
+extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
950913
return zipOpen3((const void*)pathname,append,NULL,NULL);
951914
}
952915
953
-extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
954
-{
916
+extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
955917
return zipOpen3(pathname,append,NULL,NULL);
956918
}
957919
958
-local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
959
-{
920
+local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
960921
/* write the local header */
961922
int err;
962923
uInt size_filename = (uInt)strlen(filename);
963924
uInt size_extrafield = size_extrafield_local;
964925
@@ -1050,18 +1011,17 @@
10501011
before calling this function it can be done with zipRemoveExtraInfoBlock
10511012
10521013
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
10531014
unnecessary allocations.
10541015
*/
1055
-extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1056
- const void* extrafield_local, uInt size_extrafield_local,
1057
- const void* extrafield_global, uInt size_extrafield_global,
1058
- const char* comment, int method, int level, int raw,
1059
- int windowBits,int memLevel, int strategy,
1060
- const char* password, uLong crcForCrypting,
1061
- uLong versionMadeBy, uLong flagBase, int zip64)
1062
-{
1016
+extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1017
+ const void* extrafield_local, uInt size_extrafield_local,
1018
+ const void* extrafield_global, uInt size_extrafield_global,
1019
+ const char* comment, int method, int level, int raw,
1020
+ int windowBits,int memLevel, int strategy,
1021
+ const char* password, uLong crcForCrypting,
1022
+ uLong versionMadeBy, uLong flagBase, int zip64) {
10631023
zip64_internal* zi;
10641024
uInt size_filename;
10651025
uInt size_comment;
10661026
uInt i;
10671027
int err = ZIP_OK;
@@ -1260,110 +1220,102 @@
12601220
if (err==Z_OK)
12611221
zi->in_opened_file_inzip = 1;
12621222
return err;
12631223
}
12641224
1265
-extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1266
- const void* extrafield_local, uInt size_extrafield_local,
1267
- const void* extrafield_global, uInt size_extrafield_global,
1268
- const char* comment, int method, int level, int raw,
1269
- int windowBits,int memLevel, int strategy,
1270
- const char* password, uLong crcForCrypting,
1271
- uLong versionMadeBy, uLong flagBase)
1272
-{
1273
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1274
- extrafield_local, size_extrafield_local,
1275
- extrafield_global, size_extrafield_global,
1276
- comment, method, level, raw,
1277
- windowBits, memLevel, strategy,
1278
- password, crcForCrypting, versionMadeBy, flagBase, 0);
1279
-}
1280
-
1281
-extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1282
- const void* extrafield_local, uInt size_extrafield_local,
1283
- const void* extrafield_global, uInt size_extrafield_global,
1284
- const char* comment, int method, int level, int raw,
1285
- int windowBits,int memLevel, int strategy,
1286
- const char* password, uLong crcForCrypting)
1287
-{
1288
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1289
- extrafield_local, size_extrafield_local,
1290
- extrafield_global, size_extrafield_global,
1291
- comment, method, level, raw,
1292
- windowBits, memLevel, strategy,
1293
- password, crcForCrypting, VERSIONMADEBY, 0, 0);
1225
+extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1226
+ const void* extrafield_local, uInt size_extrafield_local,
1227
+ const void* extrafield_global, uInt size_extrafield_global,
1228
+ const char* comment, int method, int level, int raw,
1229
+ int windowBits,int memLevel, int strategy,
1230
+ const char* password, uLong crcForCrypting,
1231
+ uLong versionMadeBy, uLong flagBase) {
1232
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1233
+ extrafield_local, size_extrafield_local,
1234
+ extrafield_global, size_extrafield_global,
1235
+ comment, method, level, raw,
1236
+ windowBits, memLevel, strategy,
1237
+ password, crcForCrypting, versionMadeBy, flagBase, 0);
1238
+}
1239
+
1240
+extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1241
+ const void* extrafield_local, uInt size_extrafield_local,
1242
+ const void* extrafield_global, uInt size_extrafield_global,
1243
+ const char* comment, int method, int level, int raw,
1244
+ int windowBits,int memLevel, int strategy,
1245
+ const char* password, uLong crcForCrypting) {
1246
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1247
+ extrafield_local, size_extrafield_local,
1248
+ extrafield_global, size_extrafield_global,
1249
+ comment, method, level, raw,
1250
+ windowBits, memLevel, strategy,
1251
+ password, crcForCrypting, VERSIONMADEBY, 0, 0);
12941252
}
12951253
12961254
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
12971255
const void* extrafield_local, uInt size_extrafield_local,
12981256
const void* extrafield_global, uInt size_extrafield_global,
12991257
const char* comment, int method, int level, int raw,
13001258
int windowBits,int memLevel, int strategy,
1301
- const char* password, uLong crcForCrypting, int zip64)
1302
-{
1303
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1304
- extrafield_local, size_extrafield_local,
1305
- extrafield_global, size_extrafield_global,
1306
- comment, method, level, raw,
1307
- windowBits, memLevel, strategy,
1308
- password, crcForCrypting, VERSIONMADEBY, 0, zip64);
1259
+ const char* password, uLong crcForCrypting, int zip64) {
1260
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1261
+ extrafield_local, size_extrafield_local,
1262
+ extrafield_global, size_extrafield_global,
1263
+ comment, method, level, raw,
1264
+ windowBits, memLevel, strategy,
1265
+ password, crcForCrypting, VERSIONMADEBY, 0, zip64);
13091266
}
13101267
13111268
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
13121269
const void* extrafield_local, uInt size_extrafield_local,
13131270
const void* extrafield_global, uInt size_extrafield_global,
1314
- const char* comment, int method, int level, int raw)
1315
-{
1316
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1317
- extrafield_local, size_extrafield_local,
1318
- extrafield_global, size_extrafield_global,
1319
- comment, method, level, raw,
1320
- -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1321
- NULL, 0, VERSIONMADEBY, 0, 0);
1271
+ const char* comment, int method, int level, int raw) {
1272
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1273
+ extrafield_local, size_extrafield_local,
1274
+ extrafield_global, size_extrafield_global,
1275
+ comment, method, level, raw,
1276
+ -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1277
+ NULL, 0, VERSIONMADEBY, 0, 0);
13221278
}
13231279
13241280
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1325
- const void* extrafield_local, uInt size_extrafield_local,
1326
- const void* extrafield_global, uInt size_extrafield_global,
1327
- const char* comment, int method, int level, int raw, int zip64)
1328
-{
1329
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1330
- extrafield_local, size_extrafield_local,
1331
- extrafield_global, size_extrafield_global,
1332
- comment, method, level, raw,
1333
- -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1334
- NULL, 0, VERSIONMADEBY, 0, zip64);
1335
-}
1336
-
1337
-extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1338
- const void* extrafield_local, uInt size_extrafield_local,
1339
- const void*extrafield_global, uInt size_extrafield_global,
1340
- const char* comment, int method, int level, int zip64)
1341
-{
1342
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1343
- extrafield_local, size_extrafield_local,
1344
- extrafield_global, size_extrafield_global,
1345
- comment, method, level, 0,
1346
- -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1347
- NULL, 0, VERSIONMADEBY, 0, zip64);
1348
-}
1349
-
1350
-extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1351
- const void* extrafield_local, uInt size_extrafield_local,
1352
- const void*extrafield_global, uInt size_extrafield_global,
1353
- const char* comment, int method, int level)
1354
-{
1355
- return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1356
- extrafield_local, size_extrafield_local,
1357
- extrafield_global, size_extrafield_global,
1358
- comment, method, level, 0,
1359
- -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1360
- NULL, 0, VERSIONMADEBY, 0, 0);
1361
-}
1362
-
1363
-local int zip64FlushWriteBuffer(zip64_internal* zi)
1364
-{
1281
+ const void* extrafield_local, uInt size_extrafield_local,
1282
+ const void* extrafield_global, uInt size_extrafield_global,
1283
+ const char* comment, int method, int level, int raw, int zip64) {
1284
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1285
+ extrafield_local, size_extrafield_local,
1286
+ extrafield_global, size_extrafield_global,
1287
+ comment, method, level, raw,
1288
+ -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1289
+ NULL, 0, VERSIONMADEBY, 0, zip64);
1290
+}
1291
+
1292
+extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1293
+ const void* extrafield_local, uInt size_extrafield_local,
1294
+ const void*extrafield_global, uInt size_extrafield_global,
1295
+ const char* comment, int method, int level, int zip64) {
1296
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1297
+ extrafield_local, size_extrafield_local,
1298
+ extrafield_global, size_extrafield_global,
1299
+ comment, method, level, 0,
1300
+ -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1301
+ NULL, 0, VERSIONMADEBY, 0, zip64);
1302
+}
1303
+
1304
+extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1305
+ const void* extrafield_local, uInt size_extrafield_local,
1306
+ const void*extrafield_global, uInt size_extrafield_global,
1307
+ const char* comment, int method, int level) {
1308
+ return zipOpenNewFileInZip4_64(file, filename, zipfi,
1309
+ extrafield_local, size_extrafield_local,
1310
+ extrafield_global, size_extrafield_global,
1311
+ comment, method, level, 0,
1312
+ -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1313
+ NULL, 0, VERSIONMADEBY, 0, 0);
1314
+}
1315
+
1316
+local int zip64FlushWriteBuffer(zip64_internal* zi) {
13651317
int err=ZIP_OK;
13661318
13671319
if (zi->ci.encrypt != 0)
13681320
{
13691321
#ifndef NOCRYPT
@@ -1397,12 +1349,11 @@
13971349
zi->ci.pos_in_buffered_data = 0;
13981350
13991351
return err;
14001352
}
14011353
1402
-extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
1403
-{
1354
+extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
14041355
zip64_internal* zi;
14051356
int err=ZIP_OK;
14061357
14071358
if (file == NULL)
14081359
return ZIP_PARAMERROR;
@@ -1448,11 +1399,11 @@
14481399
err = ZIP_OK;
14491400
}
14501401
else
14511402
#endif
14521403
{
1453
- zi->ci.stream.next_in = (Bytef*)buf;
1404
+ zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
14541405
zi->ci.stream.avail_in = len;
14551406
14561407
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
14571408
{
14581409
if (zi->ci.stream.avail_out == 0)
@@ -1499,17 +1450,15 @@
14991450
}
15001451
15011452
return err;
15021453
}
15031454
1504
-extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
1505
-{
1455
+extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
15061456
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
15071457
}
15081458
1509
-extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
1510
-{
1459
+extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
15111460
zip64_internal* zi;
15121461
ZPOS64_T compressed_size;
15131462
uLong invalidValue = 0xffffffff;
15141463
unsigned datasize = 0;
15151464
int err=ZIP_OK;
@@ -1740,17 +1689,15 @@
17401689
zi->in_opened_file_inzip = 0;
17411690
17421691
return err;
17431692
}
17441693
1745
-extern int ZEXPORT zipCloseFileInZip (zipFile file)
1746
-{
1694
+extern int ZEXPORT zipCloseFileInZip(zipFile file) {
17471695
return zipCloseFileInZipRaw (file,0,0);
17481696
}
17491697
1750
-local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
1751
-{
1698
+local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
17521699
int err = ZIP_OK;
17531700
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
17541701
17551702
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
17561703
@@ -1767,12 +1714,11 @@
17671714
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4);
17681715
17691716
return err;
17701717
}
17711718
1772
-local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
1773
-{
1719
+local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
17741720
int err = ZIP_OK;
17751721
17761722
uLong Zip64DataSize = 44;
17771723
17781724
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4);
@@ -1806,12 +1752,12 @@
18061752
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
18071753
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
18081754
}
18091755
return err;
18101756
}
1811
-local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
1812
-{
1757
+
1758
+local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
18131759
int err = ZIP_OK;
18141760
18151761
/*signature*/
18161762
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
18171763
@@ -1854,12 +1800,11 @@
18541800
}
18551801
18561802
return err;
18571803
}
18581804
1859
-local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
1860
-{
1805
+local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
18611806
int err = ZIP_OK;
18621807
uInt size_global_comment = 0;
18631808
18641809
if(global_comment != NULL)
18651810
size_global_comment = (uInt)strlen(global_comment);
@@ -1872,12 +1817,11 @@
18721817
err = ZIP_ERRNO;
18731818
}
18741819
return err;
18751820
}
18761821
1877
-extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
1878
-{
1822
+extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
18791823
zip64_internal* zi;
18801824
int err = 0;
18811825
uLong size_centraldir = 0;
18821826
ZPOS64_T centraldir_pos_inzip;
18831827
ZPOS64_T pos;
@@ -1934,19 +1878,18 @@
19341878
if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0)
19351879
if (err == ZIP_OK)
19361880
err = ZIP_ERRNO;
19371881
19381882
#ifndef NO_ADDFILEINEXISTINGZIP
1939
- TRYFREE(zi->globalcomment);
1883
+ free(zi->globalcomment);
19401884
#endif
1941
- TRYFREE(zi);
1885
+ free(zi);
19421886
19431887
return err;
19441888
}
19451889
1946
-extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
1947
-{
1890
+extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
19481891
char* p = pData;
19491892
int size = 0;
19501893
char* pNewHeader;
19511894
char* pTmp;
19521895
short header;
@@ -1994,9 +1937,9 @@
19941937
retVal = ZIP_OK;
19951938
}
19961939
else
19971940
retVal = ZIP_ERRNO;
19981941
1999
- TRYFREE(pNewHeader);
1942
+ free(pNewHeader);
20001943
20011944
return retVal;
20021945
}
20031946
--- compat/zlib/contrib/minizip/zip.c
+++ compat/zlib/contrib/minizip/zip.c
@@ -12,11 +12,11 @@
12 Changes
13 Oct-2009 - Mathias Svensson - Remove old C style function prototypes
14 Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
15 Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
16 Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
17 It is used when recreting zip archive with RAW when deleting items from a zip.
18 ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
19 Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
20 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
21
22 */
@@ -23,18 +23,17 @@
23
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
 
28 #include <time.h>
29 #include "zlib.h"
30 #include "zip.h"
31
32 #ifdef STDC
33 # include <stddef.h>
34 # include <string.h>
35 # include <stdlib.h>
36 #endif
37 #ifdef NO_ERRNO_H
38 extern int errno;
39 #else
40 # include <errno.h>
@@ -45,11 +44,11 @@
45 # define local static
46 #endif
47 /* compile with -Dlocal if your debugger can't find static symbols */
48
49 #ifndef VERSIONMADEBY
50 # define VERSIONMADEBY (0x0) /* platform depedent */
51 #endif
52
53 #ifndef Z_BUFSIZE
54 #define Z_BUFSIZE (64*1024) //(16384)
55 #endif
@@ -59,13 +58,10 @@
59 #endif
60
61 #ifndef ALLOC
62 # define ALLOC(size) (malloc(size))
63 #endif
64 #ifndef TRYFREE
65 # define TRYFREE(p) {if (p) free(p);}
66 #endif
67
68 /*
69 #define SIZECENTRALDIRITEM (0x2e)
70 #define SIZEZIPLOCALHEADER (0x1e)
71 */
@@ -136,24 +132,24 @@
136
137 int stream_initialised; /* 1 is stream is initialised */
138 uInt pos_in_buffered_data; /* last written byte in buffered_data */
139
140 ZPOS64_T pos_local_header; /* offset of the local header of the file
141 currenty writing */
142 char* central_header; /* central header data for the current file */
143 uLong size_centralExtra;
144 uLong size_centralheader; /* size of the central header for cur file */
145 uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
146 uLong flag; /* flag of the file currently writing */
147
148 int method; /* compression method of file currenty wr.*/
149 int raw; /* 1 for directly writing raw data */
150 Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
151 uLong dosDate;
152 uLong crc32;
153 int encrypt;
154 int zip64; /* Add ZIP64 extened information in the extra field */
155 ZPOS64_T pos_zip64extrainfo;
156 ZPOS64_T totalCompressedData;
157 ZPOS64_T totalUncompressedData;
158 #ifndef NOCRYPT
159 unsigned long keys[3]; /* keys defining the pseudo-random sequence */
@@ -163,14 +159,14 @@
163 } curfile64_info;
164
165 typedef struct
166 {
167 zlib_filefunc64_32_def z_filefunc;
168 voidpf filestream; /* io structore of the zipfile */
169 linkedlist_data central_dir;/* datablock with central dir in construction*/
170 int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
171 curfile64_info ci; /* info on the file curretly writing */
172
173 ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
174 ZPOS64_T add_position_when_writing_offset;
175 ZPOS64_T number_entry;
176
@@ -184,12 +180,11 @@
184 #ifndef NOCRYPT
185 #define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
186 #include "crypt.h"
187 #endif
188
189 local linkedlist_datablock_internal* allocate_new_datablock()
190 {
191 linkedlist_datablock_internal* ldi;
192 ldi = (linkedlist_datablock_internal*)
193 ALLOC(sizeof(linkedlist_datablock_internal));
194 if (ldi!=NULL)
195 {
@@ -198,34 +193,30 @@
198 ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
199 }
200 return ldi;
201 }
202
203 local void free_datablock(linkedlist_datablock_internal* ldi)
204 {
205 while (ldi!=NULL)
206 {
207 linkedlist_datablock_internal* ldinext = ldi->next_datablock;
208 TRYFREE(ldi);
209 ldi = ldinext;
210 }
211 }
212
213 local void init_linkedlist(linkedlist_data* ll)
214 {
215 ll->first_block = ll->last_block = NULL;
216 }
217
218 local void free_linkedlist(linkedlist_data* ll)
219 {
220 free_datablock(ll->first_block);
221 ll->first_block = ll->last_block = NULL;
222 }
223
224
225 local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
226 {
227 linkedlist_datablock_internal* ldi;
228 const unsigned char* from_copy;
229
230 if (ll==NULL)
231 return ZIP_INTERNALERROR;
@@ -236,11 +227,11 @@
236 if (ll->first_block == NULL)
237 return ZIP_INTERNALERROR;
238 }
239
240 ldi = ll->last_block;
241 from_copy = (unsigned char*)buf;
242
243 while (len>0)
244 {
245 uInt copy_this;
246 uInt i;
@@ -281,13 +272,11 @@
281 /* ===========================================================================
282 Inputs a long in LSB order to the given file
283 nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
284 */
285
286 local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
287 local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
288 {
289 unsigned char buf[8];
290 int n;
291 for (n = 0; n < nbByte; n++)
292 {
293 buf[n] = (unsigned char)(x & 0xff);
@@ -305,13 +294,11 @@
305 return ZIP_ERRNO;
306 else
307 return ZIP_OK;
308 }
309
310 local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
311 local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
312 {
313 unsigned char* buf=(unsigned char*)dest;
314 int n;
315 for (n = 0; n < nbByte; n++) {
316 buf[n] = (unsigned char)(x & 0xff);
317 x >>= 8;
@@ -327,12 +314,11 @@
327 }
328
329 /****************************************************************************/
330
331
332 local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
333 {
334 uLong year = (uLong)ptm->tm_year;
335 if (year>=1980)
336 year-=1980;
337 else if (year>=80)
338 year-=80;
@@ -342,14 +328,11 @@
342 }
343
344
345 /****************************************************************************/
346
347 local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
348
349 local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
350 {
351 unsigned char c;
352 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
353 if (err==1)
354 {
355 *pi = (int)c;
@@ -366,14 +349,11 @@
366
367
368 /* ===========================================================================
369 Reads a long in LSB order from the given gz_stream. Sets
370 */
371 local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
372
373 local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
374 {
375 uLong x ;
376 int i = 0;
377 int err;
378
379 err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -388,14 +368,11 @@
388 else
389 *pX = 0;
390 return err;
391 }
392
393 local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
394
395 local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
396 {
397 uLong x ;
398 int i = 0;
399 int err;
400
401 err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -418,15 +395,12 @@
418 else
419 *pX = 0;
420 return err;
421 }
422
423 local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
424
425
426 local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
427 {
428 ZPOS64_T x;
429 int i = 0;
430 int err;
431
432 err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -473,14 +447,11 @@
473 #endif
474 /*
475 Locate the Central directory of a zipfile (at the end, just before
476 the global comment)
477 */
478 local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
479
480 local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
481 {
482 unsigned char* buf;
483 ZPOS64_T uSizeFile;
484 ZPOS64_T uBackRead;
485 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
486 ZPOS64_T uPosFound=0;
@@ -527,22 +498,19 @@
527 }
528
529 if (uPosFound!=0)
530 break;
531 }
532 TRYFREE(buf);
533 return uPosFound;
534 }
535
536 /*
537 Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
538 the global comment)
539 */
540 local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
541
542 local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
543 {
544 unsigned char* buf;
545 ZPOS64_T uSizeFile;
546 ZPOS64_T uBackRead;
547 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
548 ZPOS64_T uPosFound=0;
@@ -593,11 +561,11 @@
593
594 if (uPosFound!=0)
595 break;
596 }
597
598 TRYFREE(buf);
599 if (uPosFound == 0)
600 return 0;
601
602 /* Zip64 end of central directory locator */
603 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
@@ -635,24 +603,23 @@
635 return 0;
636
637 return relativeOffset;
638 }
639
640 local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
641 {
642 int err=ZIP_OK;
643 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
644
645 ZPOS64_T size_central_dir; /* size of the central directory */
646 ZPOS64_T offset_central_dir; /* offset of start of central directory */
647 ZPOS64_T central_pos;
648 uLong uL;
649
650 uLong number_disk; /* number of the current dist, used for
651 spaning ZIP, unsupported, always 0*/
652 uLong number_disk_with_CD; /* number the the disk with central dir, used
653 for spaning ZIP, unsupported, always 0*/
654 ZPOS64_T number_entry;
655 ZPOS64_T number_entry_CD; /* total number of entries in
656 the central dir
657 (same than number_entry on nospan) */
658 uLong VersionMadeBy;
@@ -828,11 +795,11 @@
828 if (err==ZIP_OK)
829 err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this);
830
831 size_central_dir_to_read-=read_this;
832 }
833 TRYFREE(buf_read);
834 }
835 pziinit->begin_pos = byte_before_the_zipfile;
836 pziinit->number_entry = number_entry_CD;
837
838 if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
@@ -844,12 +811,11 @@
844
845 #endif /* !NO_ADDFILEINEXISTINGZIP*/
846
847
848 /************************************************************/
849 extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
850 {
851 zip64_internal ziinit;
852 zip64_internal* zi;
853 int err=ZIP_OK;
854
855 ziinit.z_filefunc.zseek32_file = NULL;
@@ -903,24 +869,23 @@
903 # endif /* !NO_ADDFILEINEXISTINGZIP*/
904
905 if (err != ZIP_OK)
906 {
907 # ifndef NO_ADDFILEINEXISTINGZIP
908 TRYFREE(ziinit.globalcomment);
909 # endif /* !NO_ADDFILEINEXISTINGZIP*/
910 TRYFREE(zi);
911 return NULL;
912 }
913 else
914 {
915 *zi = ziinit;
916 return (zipFile)zi;
917 }
918 }
919
920 extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
921 {
922 if (pzlib_filefunc32_def != NULL)
923 {
924 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
925 fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
926 return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
@@ -927,12 +892,11 @@
927 }
928 else
929 return zipOpen3(pathname, append, globalcomment, NULL);
930 }
931
932 extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
933 {
934 if (pzlib_filefunc_def != NULL)
935 {
936 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
937 zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
938 zlib_filefunc64_32_def_fill.ztell32_file = NULL;
@@ -943,22 +907,19 @@
943 return zipOpen3(pathname, append, globalcomment, NULL);
944 }
945
946
947
948 extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
949 {
950 return zipOpen3((const void*)pathname,append,NULL,NULL);
951 }
952
953 extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
954 {
955 return zipOpen3(pathname,append,NULL,NULL);
956 }
957
958 local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
959 {
960 /* write the local header */
961 int err;
962 uInt size_filename = (uInt)strlen(filename);
963 uInt size_extrafield = size_extrafield_local;
964
@@ -1050,18 +1011,17 @@
1050 before calling this function it can be done with zipRemoveExtraInfoBlock
1051
1052 It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
1053 unnecessary allocations.
1054 */
1055 extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1056 const void* extrafield_local, uInt size_extrafield_local,
1057 const void* extrafield_global, uInt size_extrafield_global,
1058 const char* comment, int method, int level, int raw,
1059 int windowBits,int memLevel, int strategy,
1060 const char* password, uLong crcForCrypting,
1061 uLong versionMadeBy, uLong flagBase, int zip64)
1062 {
1063 zip64_internal* zi;
1064 uInt size_filename;
1065 uInt size_comment;
1066 uInt i;
1067 int err = ZIP_OK;
@@ -1260,110 +1220,102 @@
1260 if (err==Z_OK)
1261 zi->in_opened_file_inzip = 1;
1262 return err;
1263 }
1264
1265 extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1266 const void* extrafield_local, uInt size_extrafield_local,
1267 const void* extrafield_global, uInt size_extrafield_global,
1268 const char* comment, int method, int level, int raw,
1269 int windowBits,int memLevel, int strategy,
1270 const char* password, uLong crcForCrypting,
1271 uLong versionMadeBy, uLong flagBase)
1272 {
1273 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1274 extrafield_local, size_extrafield_local,
1275 extrafield_global, size_extrafield_global,
1276 comment, method, level, raw,
1277 windowBits, memLevel, strategy,
1278 password, crcForCrypting, versionMadeBy, flagBase, 0);
1279 }
1280
1281 extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1282 const void* extrafield_local, uInt size_extrafield_local,
1283 const void* extrafield_global, uInt size_extrafield_global,
1284 const char* comment, int method, int level, int raw,
1285 int windowBits,int memLevel, int strategy,
1286 const char* password, uLong crcForCrypting)
1287 {
1288 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1289 extrafield_local, size_extrafield_local,
1290 extrafield_global, size_extrafield_global,
1291 comment, method, level, raw,
1292 windowBits, memLevel, strategy,
1293 password, crcForCrypting, VERSIONMADEBY, 0, 0);
1294 }
1295
1296 extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1297 const void* extrafield_local, uInt size_extrafield_local,
1298 const void* extrafield_global, uInt size_extrafield_global,
1299 const char* comment, int method, int level, int raw,
1300 int windowBits,int memLevel, int strategy,
1301 const char* password, uLong crcForCrypting, int zip64)
1302 {
1303 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1304 extrafield_local, size_extrafield_local,
1305 extrafield_global, size_extrafield_global,
1306 comment, method, level, raw,
1307 windowBits, memLevel, strategy,
1308 password, crcForCrypting, VERSIONMADEBY, 0, zip64);
1309 }
1310
1311 extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1312 const void* extrafield_local, uInt size_extrafield_local,
1313 const void* extrafield_global, uInt size_extrafield_global,
1314 const char* comment, int method, int level, int raw)
1315 {
1316 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1317 extrafield_local, size_extrafield_local,
1318 extrafield_global, size_extrafield_global,
1319 comment, method, level, raw,
1320 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1321 NULL, 0, VERSIONMADEBY, 0, 0);
1322 }
1323
1324 extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1325 const void* extrafield_local, uInt size_extrafield_local,
1326 const void* extrafield_global, uInt size_extrafield_global,
1327 const char* comment, int method, int level, int raw, int zip64)
1328 {
1329 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1330 extrafield_local, size_extrafield_local,
1331 extrafield_global, size_extrafield_global,
1332 comment, method, level, raw,
1333 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1334 NULL, 0, VERSIONMADEBY, 0, zip64);
1335 }
1336
1337 extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1338 const void* extrafield_local, uInt size_extrafield_local,
1339 const void*extrafield_global, uInt size_extrafield_global,
1340 const char* comment, int method, int level, int zip64)
1341 {
1342 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1343 extrafield_local, size_extrafield_local,
1344 extrafield_global, size_extrafield_global,
1345 comment, method, level, 0,
1346 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1347 NULL, 0, VERSIONMADEBY, 0, zip64);
1348 }
1349
1350 extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
1351 const void* extrafield_local, uInt size_extrafield_local,
1352 const void*extrafield_global, uInt size_extrafield_global,
1353 const char* comment, int method, int level)
1354 {
1355 return zipOpenNewFileInZip4_64 (file, filename, zipfi,
1356 extrafield_local, size_extrafield_local,
1357 extrafield_global, size_extrafield_global,
1358 comment, method, level, 0,
1359 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1360 NULL, 0, VERSIONMADEBY, 0, 0);
1361 }
1362
1363 local int zip64FlushWriteBuffer(zip64_internal* zi)
1364 {
1365 int err=ZIP_OK;
1366
1367 if (zi->ci.encrypt != 0)
1368 {
1369 #ifndef NOCRYPT
@@ -1397,12 +1349,11 @@
1397 zi->ci.pos_in_buffered_data = 0;
1398
1399 return err;
1400 }
1401
1402 extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
1403 {
1404 zip64_internal* zi;
1405 int err=ZIP_OK;
1406
1407 if (file == NULL)
1408 return ZIP_PARAMERROR;
@@ -1448,11 +1399,11 @@
1448 err = ZIP_OK;
1449 }
1450 else
1451 #endif
1452 {
1453 zi->ci.stream.next_in = (Bytef*)buf;
1454 zi->ci.stream.avail_in = len;
1455
1456 while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
1457 {
1458 if (zi->ci.stream.avail_out == 0)
@@ -1499,17 +1450,15 @@
1499 }
1500
1501 return err;
1502 }
1503
1504 extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
1505 {
1506 return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
1507 }
1508
1509 extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
1510 {
1511 zip64_internal* zi;
1512 ZPOS64_T compressed_size;
1513 uLong invalidValue = 0xffffffff;
1514 unsigned datasize = 0;
1515 int err=ZIP_OK;
@@ -1740,17 +1689,15 @@
1740 zi->in_opened_file_inzip = 0;
1741
1742 return err;
1743 }
1744
1745 extern int ZEXPORT zipCloseFileInZip (zipFile file)
1746 {
1747 return zipCloseFileInZipRaw (file,0,0);
1748 }
1749
1750 local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
1751 {
1752 int err = ZIP_OK;
1753 ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
1754
1755 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
1756
@@ -1767,12 +1714,11 @@
1767 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4);
1768
1769 return err;
1770 }
1771
1772 local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
1773 {
1774 int err = ZIP_OK;
1775
1776 uLong Zip64DataSize = 44;
1777
1778 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4);
@@ -1806,12 +1752,12 @@
1806 ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
1807 err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
1808 }
1809 return err;
1810 }
1811 local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
1812 {
1813 int err = ZIP_OK;
1814
1815 /*signature*/
1816 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
1817
@@ -1854,12 +1800,11 @@
1854 }
1855
1856 return err;
1857 }
1858
1859 local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
1860 {
1861 int err = ZIP_OK;
1862 uInt size_global_comment = 0;
1863
1864 if(global_comment != NULL)
1865 size_global_comment = (uInt)strlen(global_comment);
@@ -1872,12 +1817,11 @@
1872 err = ZIP_ERRNO;
1873 }
1874 return err;
1875 }
1876
1877 extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
1878 {
1879 zip64_internal* zi;
1880 int err = 0;
1881 uLong size_centraldir = 0;
1882 ZPOS64_T centraldir_pos_inzip;
1883 ZPOS64_T pos;
@@ -1934,19 +1878,18 @@
1934 if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0)
1935 if (err == ZIP_OK)
1936 err = ZIP_ERRNO;
1937
1938 #ifndef NO_ADDFILEINEXISTINGZIP
1939 TRYFREE(zi->globalcomment);
1940 #endif
1941 TRYFREE(zi);
1942
1943 return err;
1944 }
1945
1946 extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
1947 {
1948 char* p = pData;
1949 int size = 0;
1950 char* pNewHeader;
1951 char* pTmp;
1952 short header;
@@ -1994,9 +1937,9 @@
1994 retVal = ZIP_OK;
1995 }
1996 else
1997 retVal = ZIP_ERRNO;
1998
1999 TRYFREE(pNewHeader);
2000
2001 return retVal;
2002 }
2003
--- compat/zlib/contrib/minizip/zip.c
+++ compat/zlib/contrib/minizip/zip.c
@@ -12,11 +12,11 @@
12 Changes
13 Oct-2009 - Mathias Svensson - Remove old C style function prototypes
14 Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
15 Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
16 Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
17 It is used when recreating zip archive with RAW when deleting items from a zip.
18 ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
19 Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
20 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
21
22 */
@@ -23,18 +23,17 @@
23
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdint.h>
29 #include <time.h>
30 #include "zlib.h"
31 #include "zip.h"
32
33 #ifdef STDC
34 # include <stddef.h>
 
 
35 #endif
36 #ifdef NO_ERRNO_H
37 extern int errno;
38 #else
39 # include <errno.h>
@@ -45,11 +44,11 @@
44 # define local static
45 #endif
46 /* compile with -Dlocal if your debugger can't find static symbols */
47
48 #ifndef VERSIONMADEBY
49 # define VERSIONMADEBY (0x0) /* platform dependent */
50 #endif
51
52 #ifndef Z_BUFSIZE
53 #define Z_BUFSIZE (64*1024) //(16384)
54 #endif
@@ -59,13 +58,10 @@
58 #endif
59
60 #ifndef ALLOC
61 # define ALLOC(size) (malloc(size))
62 #endif
 
 
 
63
64 /*
65 #define SIZECENTRALDIRITEM (0x2e)
66 #define SIZEZIPLOCALHEADER (0x1e)
67 */
@@ -136,24 +132,24 @@
132
133 int stream_initialised; /* 1 is stream is initialised */
134 uInt pos_in_buffered_data; /* last written byte in buffered_data */
135
136 ZPOS64_T pos_local_header; /* offset of the local header of the file
137 currently writing */
138 char* central_header; /* central header data for the current file */
139 uLong size_centralExtra;
140 uLong size_centralheader; /* size of the central header for cur file */
141 uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
142 uLong flag; /* flag of the file currently writing */
143
144 int method; /* compression method of file currently wr.*/
145 int raw; /* 1 for directly writing raw data */
146 Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
147 uLong dosDate;
148 uLong crc32;
149 int encrypt;
150 int zip64; /* Add ZIP64 extended information in the extra field */
151 ZPOS64_T pos_zip64extrainfo;
152 ZPOS64_T totalCompressedData;
153 ZPOS64_T totalUncompressedData;
154 #ifndef NOCRYPT
155 unsigned long keys[3]; /* keys defining the pseudo-random sequence */
@@ -163,14 +159,14 @@
159 } curfile64_info;
160
161 typedef struct
162 {
163 zlib_filefunc64_32_def z_filefunc;
164 voidpf filestream; /* io structure of the zipfile */
165 linkedlist_data central_dir;/* datablock with central dir in construction*/
166 int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
167 curfile64_info ci; /* info on the file currently writing */
168
169 ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
170 ZPOS64_T add_position_when_writing_offset;
171 ZPOS64_T number_entry;
172
@@ -184,12 +180,11 @@
180 #ifndef NOCRYPT
181 #define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
182 #include "crypt.h"
183 #endif
184
185 local linkedlist_datablock_internal* allocate_new_datablock(void) {
 
186 linkedlist_datablock_internal* ldi;
187 ldi = (linkedlist_datablock_internal*)
188 ALLOC(sizeof(linkedlist_datablock_internal));
189 if (ldi!=NULL)
190 {
@@ -198,34 +193,30 @@
193 ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
194 }
195 return ldi;
196 }
197
198 local void free_datablock(linkedlist_datablock_internal* ldi) {
 
199 while (ldi!=NULL)
200 {
201 linkedlist_datablock_internal* ldinext = ldi->next_datablock;
202 free(ldi);
203 ldi = ldinext;
204 }
205 }
206
207 local void init_linkedlist(linkedlist_data* ll) {
 
208 ll->first_block = ll->last_block = NULL;
209 }
210
211 local void free_linkedlist(linkedlist_data* ll) {
 
212 free_datablock(ll->first_block);
213 ll->first_block = ll->last_block = NULL;
214 }
215
216
217 local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
 
218 linkedlist_datablock_internal* ldi;
219 const unsigned char* from_copy;
220
221 if (ll==NULL)
222 return ZIP_INTERNALERROR;
@@ -236,11 +227,11 @@
227 if (ll->first_block == NULL)
228 return ZIP_INTERNALERROR;
229 }
230
231 ldi = ll->last_block;
232 from_copy = (const unsigned char*)buf;
233
234 while (len>0)
235 {
236 uInt copy_this;
237 uInt i;
@@ -281,13 +272,11 @@
272 /* ===========================================================================
273 Inputs a long in LSB order to the given file
274 nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
275 */
276
277 local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
 
 
278 unsigned char buf[8];
279 int n;
280 for (n = 0; n < nbByte; n++)
281 {
282 buf[n] = (unsigned char)(x & 0xff);
@@ -305,13 +294,11 @@
294 return ZIP_ERRNO;
295 else
296 return ZIP_OK;
297 }
298
299 local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
 
 
300 unsigned char* buf=(unsigned char*)dest;
301 int n;
302 for (n = 0; n < nbByte; n++) {
303 buf[n] = (unsigned char)(x & 0xff);
304 x >>= 8;
@@ -327,12 +314,11 @@
314 }
315
316 /****************************************************************************/
317
318
319 local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
 
320 uLong year = (uLong)ptm->tm_year;
321 if (year>=1980)
322 year-=1980;
323 else if (year>=80)
324 year-=80;
@@ -342,14 +328,11 @@
328 }
329
330
331 /****************************************************************************/
332
333 local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
 
 
 
334 unsigned char c;
335 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
336 if (err==1)
337 {
338 *pi = (int)c;
@@ -366,14 +349,11 @@
349
350
351 /* ===========================================================================
352 Reads a long in LSB order from the given gz_stream. Sets
353 */
354 local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
 
 
 
355 uLong x ;
356 int i = 0;
357 int err;
358
359 err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -388,14 +368,11 @@
368 else
369 *pX = 0;
370 return err;
371 }
372
373 local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
 
 
 
374 uLong x ;
375 int i = 0;
376 int err;
377
378 err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -418,15 +395,12 @@
395 else
396 *pX = 0;
397 return err;
398 }
399
 
400
401 local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
 
 
402 ZPOS64_T x;
403 int i = 0;
404 int err;
405
406 err = zip64local_getByte(pzlib_filefunc_def,filestream,&i);
@@ -473,14 +447,11 @@
447 #endif
448 /*
449 Locate the Central directory of a zipfile (at the end, just before
450 the global comment)
451 */
452 local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
 
 
 
453 unsigned char* buf;
454 ZPOS64_T uSizeFile;
455 ZPOS64_T uBackRead;
456 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
457 ZPOS64_T uPosFound=0;
@@ -527,22 +498,19 @@
498 }
499
500 if (uPosFound!=0)
501 break;
502 }
503 free(buf);
504 return uPosFound;
505 }
506
507 /*
508 Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
509 the global comment)
510 */
511 local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
 
 
 
512 unsigned char* buf;
513 ZPOS64_T uSizeFile;
514 ZPOS64_T uBackRead;
515 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
516 ZPOS64_T uPosFound=0;
@@ -593,11 +561,11 @@
561
562 if (uPosFound!=0)
563 break;
564 }
565
566 free(buf);
567 if (uPosFound == 0)
568 return 0;
569
570 /* Zip64 end of central directory locator */
571 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
@@ -635,24 +603,23 @@
603 return 0;
604
605 return relativeOffset;
606 }
607
608 local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
 
609 int err=ZIP_OK;
610 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
611
612 ZPOS64_T size_central_dir; /* size of the central directory */
613 ZPOS64_T offset_central_dir; /* offset of start of central directory */
614 ZPOS64_T central_pos;
615 uLong uL;
616
617 uLong number_disk; /* number of the current dist, used for
618 spanning ZIP, unsupported, always 0*/
619 uLong number_disk_with_CD; /* number the the disk with central dir, used
620 for spanning ZIP, unsupported, always 0*/
621 ZPOS64_T number_entry;
622 ZPOS64_T number_entry_CD; /* total number of entries in
623 the central dir
624 (same than number_entry on nospan) */
625 uLong VersionMadeBy;
@@ -828,11 +795,11 @@
795 if (err==ZIP_OK)
796 err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this);
797
798 size_central_dir_to_read-=read_this;
799 }
800 free(buf_read);
801 }
802 pziinit->begin_pos = byte_before_the_zipfile;
803 pziinit->number_entry = number_entry_CD;
804
805 if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
@@ -844,12 +811,11 @@
811
812 #endif /* !NO_ADDFILEINEXISTINGZIP*/
813
814
815 /************************************************************/
816 extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
 
817 zip64_internal ziinit;
818 zip64_internal* zi;
819 int err=ZIP_OK;
820
821 ziinit.z_filefunc.zseek32_file = NULL;
@@ -903,24 +869,23 @@
869 # endif /* !NO_ADDFILEINEXISTINGZIP*/
870
871 if (err != ZIP_OK)
872 {
873 # ifndef NO_ADDFILEINEXISTINGZIP
874 free(ziinit.globalcomment);
875 # endif /* !NO_ADDFILEINEXISTINGZIP*/
876 free(zi);
877 return NULL;
878 }
879 else
880 {
881 *zi = ziinit;
882 return (zipFile)zi;
883 }
884 }
885
886 extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
 
887 if (pzlib_filefunc32_def != NULL)
888 {
889 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
890 fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def);
891 return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill);
@@ -927,12 +892,11 @@
892 }
893 else
894 return zipOpen3(pathname, append, globalcomment, NULL);
895 }
896
897 extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
 
898 if (pzlib_filefunc_def != NULL)
899 {
900 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
901 zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
902 zlib_filefunc64_32_def_fill.ztell32_file = NULL;
@@ -943,22 +907,19 @@
907 return zipOpen3(pathname, append, globalcomment, NULL);
908 }
909
910
911
912 extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
 
913 return zipOpen3((const void*)pathname,append,NULL,NULL);
914 }
915
916 extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
 
917 return zipOpen3(pathname,append,NULL,NULL);
918 }
919
920 local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
 
921 /* write the local header */
922 int err;
923 uInt size_filename = (uInt)strlen(filename);
924 uInt size_extrafield = size_extrafield_local;
925
@@ -1050,18 +1011,17 @@
1011 before calling this function it can be done with zipRemoveExtraInfoBlock
1012
1013 It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
1014 unnecessary allocations.
1015 */
1016 extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1017 const void* extrafield_local, uInt size_extrafield_local,
1018 const void* extrafield_global, uInt size_extrafield_global,
1019 const char* comment, int method, int level, int raw,
1020 int windowBits,int memLevel, int strategy,
1021 const char* password, uLong crcForCrypting,
1022 uLong versionMadeBy, uLong flagBase, int zip64) {
 
1023 zip64_internal* zi;
1024 uInt size_filename;
1025 uInt size_comment;
1026 uInt i;
1027 int err = ZIP_OK;
@@ -1260,110 +1220,102 @@
1220 if (err==Z_OK)
1221 zi->in_opened_file_inzip = 1;
1222 return err;
1223 }
1224
1225 extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1226 const void* extrafield_local, uInt size_extrafield_local,
1227 const void* extrafield_global, uInt size_extrafield_global,
1228 const char* comment, int method, int level, int raw,
1229 int windowBits,int memLevel, int strategy,
1230 const char* password, uLong crcForCrypting,
1231 uLong versionMadeBy, uLong flagBase) {
1232 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1233 extrafield_local, size_extrafield_local,
1234 extrafield_global, size_extrafield_global,
1235 comment, method, level, raw,
1236 windowBits, memLevel, strategy,
1237 password, crcForCrypting, versionMadeBy, flagBase, 0);
1238 }
1239
1240 extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1241 const void* extrafield_local, uInt size_extrafield_local,
1242 const void* extrafield_global, uInt size_extrafield_global,
1243 const char* comment, int method, int level, int raw,
1244 int windowBits,int memLevel, int strategy,
1245 const char* password, uLong crcForCrypting) {
1246 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1247 extrafield_local, size_extrafield_local,
1248 extrafield_global, size_extrafield_global,
1249 comment, method, level, raw,
1250 windowBits, memLevel, strategy,
1251 password, crcForCrypting, VERSIONMADEBY, 0, 0);
 
 
1252 }
1253
1254 extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1255 const void* extrafield_local, uInt size_extrafield_local,
1256 const void* extrafield_global, uInt size_extrafield_global,
1257 const char* comment, int method, int level, int raw,
1258 int windowBits,int memLevel, int strategy,
1259 const char* password, uLong crcForCrypting, int zip64) {
1260 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1261 extrafield_local, size_extrafield_local,
1262 extrafield_global, size_extrafield_global,
1263 comment, method, level, raw,
1264 windowBits, memLevel, strategy,
1265 password, crcForCrypting, VERSIONMADEBY, 0, zip64);
 
1266 }
1267
1268 extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1269 const void* extrafield_local, uInt size_extrafield_local,
1270 const void* extrafield_global, uInt size_extrafield_global,
1271 const char* comment, int method, int level, int raw) {
1272 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1273 extrafield_local, size_extrafield_local,
1274 extrafield_global, size_extrafield_global,
1275 comment, method, level, raw,
1276 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1277 NULL, 0, VERSIONMADEBY, 0, 0);
 
1278 }
1279
1280 extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1281 const void* extrafield_local, uInt size_extrafield_local,
1282 const void* extrafield_global, uInt size_extrafield_global,
1283 const char* comment, int method, int level, int raw, int zip64) {
1284 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1285 extrafield_local, size_extrafield_local,
1286 extrafield_global, size_extrafield_global,
1287 comment, method, level, raw,
1288 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1289 NULL, 0, VERSIONMADEBY, 0, zip64);
1290 }
1291
1292 extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1293 const void* extrafield_local, uInt size_extrafield_local,
1294 const void*extrafield_global, uInt size_extrafield_global,
1295 const char* comment, int method, int level, int zip64) {
1296 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1297 extrafield_local, size_extrafield_local,
1298 extrafield_global, size_extrafield_global,
1299 comment, method, level, 0,
1300 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1301 NULL, 0, VERSIONMADEBY, 0, zip64);
1302 }
1303
1304 extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
1305 const void* extrafield_local, uInt size_extrafield_local,
1306 const void*extrafield_global, uInt size_extrafield_global,
1307 const char* comment, int method, int level) {
1308 return zipOpenNewFileInZip4_64(file, filename, zipfi,
1309 extrafield_local, size_extrafield_local,
1310 extrafield_global, size_extrafield_global,
1311 comment, method, level, 0,
1312 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
1313 NULL, 0, VERSIONMADEBY, 0, 0);
1314 }
1315
1316 local int zip64FlushWriteBuffer(zip64_internal* zi) {
 
 
 
 
1317 int err=ZIP_OK;
1318
1319 if (zi->ci.encrypt != 0)
1320 {
1321 #ifndef NOCRYPT
@@ -1397,12 +1349,11 @@
1349 zi->ci.pos_in_buffered_data = 0;
1350
1351 return err;
1352 }
1353
1354 extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
 
1355 zip64_internal* zi;
1356 int err=ZIP_OK;
1357
1358 if (file == NULL)
1359 return ZIP_PARAMERROR;
@@ -1448,11 +1399,11 @@
1399 err = ZIP_OK;
1400 }
1401 else
1402 #endif
1403 {
1404 zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
1405 zi->ci.stream.avail_in = len;
1406
1407 while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
1408 {
1409 if (zi->ci.stream.avail_out == 0)
@@ -1499,17 +1450,15 @@
1450 }
1451
1452 return err;
1453 }
1454
1455 extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
 
1456 return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
1457 }
1458
1459 extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
 
1460 zip64_internal* zi;
1461 ZPOS64_T compressed_size;
1462 uLong invalidValue = 0xffffffff;
1463 unsigned datasize = 0;
1464 int err=ZIP_OK;
@@ -1740,17 +1689,15 @@
1689 zi->in_opened_file_inzip = 0;
1690
1691 return err;
1692 }
1693
1694 extern int ZEXPORT zipCloseFileInZip(zipFile file) {
 
1695 return zipCloseFileInZipRaw (file,0,0);
1696 }
1697
1698 local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
 
1699 int err = ZIP_OK;
1700 ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
1701
1702 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
1703
@@ -1767,12 +1714,11 @@
1714 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4);
1715
1716 return err;
1717 }
1718
1719 local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
 
1720 int err = ZIP_OK;
1721
1722 uLong Zip64DataSize = 44;
1723
1724 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4);
@@ -1806,12 +1752,12 @@
1752 ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
1753 err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
1754 }
1755 return err;
1756 }
1757
1758 local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
1759 int err = ZIP_OK;
1760
1761 /*signature*/
1762 err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
1763
@@ -1854,12 +1800,11 @@
1800 }
1801
1802 return err;
1803 }
1804
1805 local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
 
1806 int err = ZIP_OK;
1807 uInt size_global_comment = 0;
1808
1809 if(global_comment != NULL)
1810 size_global_comment = (uInt)strlen(global_comment);
@@ -1872,12 +1817,11 @@
1817 err = ZIP_ERRNO;
1818 }
1819 return err;
1820 }
1821
1822 extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
 
1823 zip64_internal* zi;
1824 int err = 0;
1825 uLong size_centraldir = 0;
1826 ZPOS64_T centraldir_pos_inzip;
1827 ZPOS64_T pos;
@@ -1934,19 +1878,18 @@
1878 if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0)
1879 if (err == ZIP_OK)
1880 err = ZIP_ERRNO;
1881
1882 #ifndef NO_ADDFILEINEXISTINGZIP
1883 free(zi->globalcomment);
1884 #endif
1885 free(zi);
1886
1887 return err;
1888 }
1889
1890 extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
 
1891 char* p = pData;
1892 int size = 0;
1893 char* pNewHeader;
1894 char* pTmp;
1895 short header;
@@ -1994,9 +1937,9 @@
1937 retVal = ZIP_OK;
1938 }
1939 else
1940 retVal = ZIP_ERRNO;
1941
1942 free(pNewHeader);
1943
1944 return retVal;
1945 }
1946
--- compat/zlib/contrib/minizip/zip.h
+++ compat/zlib/contrib/minizip/zip.h
@@ -111,12 +111,12 @@
111111
112112
#define APPEND_STATUS_CREATE (0)
113113
#define APPEND_STATUS_CREATEAFTER (1)
114114
#define APPEND_STATUS_ADDINZIP (2)
115115
116
-extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
117
-extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
116
+extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
117
+extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
118118
/*
119119
Create a zipfile.
120120
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
121121
an Unix computer "zlib/zlib113.zip".
122122
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
@@ -129,50 +129,50 @@
129129
of this zip package.
130130
*/
131131
132132
/* Note : there is no delete function into a zipfile.
133133
If you want delete file into a zipfile, you must open a zipfile, and create another
134
- Of couse, you can use RAW reading and writing to copy the file you did not want delte
135
-*/
136
-
137
-extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
138
- int append,
139
- zipcharpc* globalcomment,
140
- zlib_filefunc_def* pzlib_filefunc_def));
141
-
142
-extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
143
- int append,
144
- zipcharpc* globalcomment,
145
- zlib_filefunc64_def* pzlib_filefunc_def));
146
-
147
-extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
148
- int append,
149
- zipcharpc* globalcomment,
150
- zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
151
-
152
-extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
153
- const char* filename,
154
- const zip_fileinfo* zipfi,
155
- const void* extrafield_local,
156
- uInt size_extrafield_local,
157
- const void* extrafield_global,
158
- uInt size_extrafield_global,
159
- const char* comment,
160
- int method,
161
- int level));
162
-
163
-extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
164
- const char* filename,
165
- const zip_fileinfo* zipfi,
166
- const void* extrafield_local,
167
- uInt size_extrafield_local,
168
- const void* extrafield_global,
169
- uInt size_extrafield_global,
170
- const char* comment,
171
- int method,
172
- int level,
173
- int zip64));
134
+ Of course, you can use RAW reading and writing to copy the file you did not want delete
135
+*/
136
+
137
+extern zipFile ZEXPORT zipOpen2(const char *pathname,
138
+ int append,
139
+ zipcharpc* globalcomment,
140
+ zlib_filefunc_def* pzlib_filefunc_def);
141
+
142
+extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
143
+ int append,
144
+ zipcharpc* globalcomment,
145
+ zlib_filefunc64_def* pzlib_filefunc_def);
146
+
147
+extern zipFile ZEXPORT zipOpen3(const void *pathname,
148
+ int append,
149
+ zipcharpc* globalcomment,
150
+ zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
151
+
152
+extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
153
+ const char* filename,
154
+ const zip_fileinfo* zipfi,
155
+ const void* extrafield_local,
156
+ uInt size_extrafield_local,
157
+ const void* extrafield_global,
158
+ uInt size_extrafield_global,
159
+ const char* comment,
160
+ int method,
161
+ int level);
162
+
163
+extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
164
+ const char* filename,
165
+ const zip_fileinfo* zipfi,
166
+ const void* extrafield_local,
167
+ uInt size_extrafield_local,
168
+ const void* extrafield_global,
169
+ uInt size_extrafield_global,
170
+ const char* comment,
171
+ int method,
172
+ int level,
173
+ int zip64);
174174
175175
/*
176176
Open a file in the ZIP for writing.
177177
filename : the filename in zip (if NULL, '-' without quote will be used
178178
*zipfi contain supplemental information
@@ -187,164 +187,161 @@
187187
this MUST be '1' if the uncompressed size is >= 0xffffffff.
188188
189189
*/
190190
191191
192
-extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
193
- const char* filename,
194
- const zip_fileinfo* zipfi,
195
- const void* extrafield_local,
196
- uInt size_extrafield_local,
197
- const void* extrafield_global,
198
- uInt size_extrafield_global,
199
- const char* comment,
200
- int method,
201
- int level,
202
- int raw));
203
-
204
-
205
-extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
206
- const char* filename,
207
- const zip_fileinfo* zipfi,
208
- const void* extrafield_local,
209
- uInt size_extrafield_local,
210
- const void* extrafield_global,
211
- uInt size_extrafield_global,
212
- const char* comment,
213
- int method,
214
- int level,
215
- int raw,
216
- int zip64));
192
+extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
193
+ const char* filename,
194
+ const zip_fileinfo* zipfi,
195
+ const void* extrafield_local,
196
+ uInt size_extrafield_local,
197
+ const void* extrafield_global,
198
+ uInt size_extrafield_global,
199
+ const char* comment,
200
+ int method,
201
+ int level,
202
+ int raw);
203
+
204
+
205
+extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
206
+ const char* filename,
207
+ const zip_fileinfo* zipfi,
208
+ const void* extrafield_local,
209
+ uInt size_extrafield_local,
210
+ const void* extrafield_global,
211
+ uInt size_extrafield_global,
212
+ const char* comment,
213
+ int method,
214
+ int level,
215
+ int raw,
216
+ int zip64);
217217
/*
218218
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
219219
*/
220220
221
-extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
222
- const char* filename,
223
- const zip_fileinfo* zipfi,
224
- const void* extrafield_local,
225
- uInt size_extrafield_local,
226
- const void* extrafield_global,
227
- uInt size_extrafield_global,
228
- const char* comment,
229
- int method,
230
- int level,
231
- int raw,
232
- int windowBits,
233
- int memLevel,
234
- int strategy,
235
- const char* password,
236
- uLong crcForCrypting));
237
-
238
-extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
239
- const char* filename,
240
- const zip_fileinfo* zipfi,
241
- const void* extrafield_local,
242
- uInt size_extrafield_local,
243
- const void* extrafield_global,
244
- uInt size_extrafield_global,
245
- const char* comment,
246
- int method,
247
- int level,
248
- int raw,
249
- int windowBits,
250
- int memLevel,
251
- int strategy,
252
- const char* password,
253
- uLong crcForCrypting,
254
- int zip64
255
- ));
221
+extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
222
+ const char* filename,
223
+ const zip_fileinfo* zipfi,
224
+ const void* extrafield_local,
225
+ uInt size_extrafield_local,
226
+ const void* extrafield_global,
227
+ uInt size_extrafield_global,
228
+ const char* comment,
229
+ int method,
230
+ int level,
231
+ int raw,
232
+ int windowBits,
233
+ int memLevel,
234
+ int strategy,
235
+ const char* password,
236
+ uLong crcForCrypting);
237
+
238
+extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
239
+ const char* filename,
240
+ const zip_fileinfo* zipfi,
241
+ const void* extrafield_local,
242
+ uInt size_extrafield_local,
243
+ const void* extrafield_global,
244
+ uInt size_extrafield_global,
245
+ const char* comment,
246
+ int method,
247
+ int level,
248
+ int raw,
249
+ int windowBits,
250
+ int memLevel,
251
+ int strategy,
252
+ const char* password,
253
+ uLong crcForCrypting,
254
+ int zip64);
256255
257256
/*
258257
Same than zipOpenNewFileInZip2, except
259258
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
260259
password : crypting password (NULL for no crypting)
261260
crcForCrypting : crc of file to compress (needed for crypting)
262261
*/
263262
264
-extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
265
- const char* filename,
266
- const zip_fileinfo* zipfi,
267
- const void* extrafield_local,
268
- uInt size_extrafield_local,