Fossil SCM
Merge trunk into markdown-tagrefs branch.
Commit
0517bd2dd8db5b81457e9c839a307870da213dc20f4d01376538c693d5c0474c
Parent
fdd3fe21c25a45c…
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 @@ | ||
| 81 | 81 | ## --------------------------------------------------------------------- |
| 82 | 82 | |
| 83 | 83 | ENV PATH "/bin" |
| 84 | 84 | EXPOSE 8080/tcp |
| 85 | 85 | USER fossil |
| 86 | -ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ] | |
| 86 | +ENTRYPOINT [ "fossil", "server" ] | |
| 87 | 87 | CMD [ \ |
| 88 | 88 | "--create", \ |
| 89 | 89 | "--jsmode", "bundled", \ |
| 90 | - "--user", "admin" ] | |
| 90 | + "--user", "admin", \ | |
| 91 | + "museum/repo.fossil" ] | |
| 91 | 92 |
| --- 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 |
+5
| --- Makefile.in | ||
| +++ Makefile.in | ||
| @@ -7,10 +7,11 @@ | ||
| 7 | 7 | #### The toplevel directory of the source tree. Fossil can be built |
| 8 | 8 | # in a directory that is separate from the source tree. Just change |
| 9 | 9 | # the following to point from the build directory to the src/ folder. |
| 10 | 10 | # |
| 11 | 11 | SRCDIR = @srcdir@/src |
| 12 | +TOPDIR = @srcdir@ | |
| 12 | 13 | #### Upstream source files included directly in this repository. |
| 13 | 14 | # |
| 14 | 15 | SRCDIR_extsrc = @srcdir@/extsrc |
| 15 | 16 | #### In-tree tools such as code generators and translators: |
| 16 | 17 | # |
| @@ -83,10 +84,14 @@ | ||
| 83 | 84 | # https://emscripten.org/docs/getting_started/downloads.html |
| 84 | 85 | EMSDK_HOME = @EMSDK_HOME@ |
| 85 | 86 | EMSDK_ENV = @EMSDK_ENV@ |
| 86 | 87 | EMCC_OPT = @EMCC_OPT@ |
| 87 | 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@ | |
| 88 | 93 | |
| 89 | 94 | .PHONY: all tags |
| 90 | 95 | |
| 91 | 96 | include $(SRCDIR)/main.mk |
| 92 | 97 | |
| 93 | 98 |
| --- 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 |
M
VERSION
+1
-1
| --- VERSION | ||
| +++ VERSION | ||
| @@ -1,1 +1,1 @@ | ||
| 1 | -2.23 | |
| 1 | +2.24 | |
| 2 | 2 |
| --- VERSION | |
| +++ VERSION | |
| @@ -1,1 +1,1 @@ | |
| 1 | 2.23 |
| 2 |
| --- VERSION | |
| +++ VERSION | |
| @@ -1,1 +1,1 @@ | |
| 1 | 2.24 |
| 2 |
M
auto.def
+83
-10
| --- auto.def | ||
| +++ auto.def | ||
| @@ -29,23 +29,31 @@ | ||
| 29 | 29 | fusefs=1 => {Disable the Fuse Filesystem} |
| 30 | 30 | fossil-debug=0 => {Build with fossil debugging enabled} |
| 31 | 31 | no-opt=0 => {Build without optimization} |
| 32 | 32 | json=0 => {Build with fossil JSON API enabled} |
| 33 | 33 | with-emsdk:path => {Directory containing the Emscripten SDK} |
| 34 | + compile-commands=0 => | |
| 35 | + "Check for compile_commands.json support." | |
| 34 | 36 | } |
| 35 | 37 | |
| 36 | 38 | # Update the minimum required SQLite version number here, and also |
| 37 | 39 | # in src/main.c near the sqlite3_libversion_number() call. Take care |
| 38 | 40 | # that both places agree! |
| 39 | -define MINIMUM_SQLITE_VERSION "3.38.0" | |
| 41 | +define MINIMUM_SQLITE_VERSION "3.43.0" | |
| 40 | 42 | |
| 41 | 43 | # This is useful for people wanting Fossil to use an external SQLite library |
| 42 | 44 | # to compare the one they have against the minimum required |
| 43 | 45 | if {[opt-bool print-minimum-sqlite-version]} { |
| 44 | 46 | puts [get-define MINIMUM_SQLITE_VERSION] |
| 45 | 47 | exit 0 |
| 46 | 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 | +} | |
| 47 | 55 | |
| 48 | 56 | # sqlite wants these types if possible |
| 49 | 57 | cc-with {-includes {stdint.h inttypes.h}} { |
| 50 | 58 | cc-check-types uint32_t uint16_t int16_t uint8_t |
| 51 | 59 | } |
| @@ -178,13 +186,14 @@ | ||
| 178 | 186 | } |
| 179 | 187 | |
| 180 | 188 | find_system_sqlite |
| 181 | 189 | |
| 182 | 190 | 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 | |
| 186 | 195 | # |
| 187 | 196 | set cmdline {} |
| 188 | 197 | lappend cmdline {*}[get-define CCACHE] |
| 189 | 198 | lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS] |
| 190 | 199 | lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__ |
| @@ -358,18 +367,46 @@ | ||
| 358 | 367 | define-append EXTRA_CFLAGS -I$zlibdir |
| 359 | 368 | define-append LIBS $zlibdir/libz.a |
| 360 | 369 | set ::zlib_lib $zlibdir/libz.a |
| 361 | 370 | msg-result "Using zlib in source tree" |
| 362 | 371 | } else { |
| 372 | + set cftry {""} | |
| 373 | + set ldtry {""} | |
| 363 | 374 | 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" | |
| 368 | 397 | } |
| 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 | + } | |
| 371 | 408 | } |
| 372 | 409 | set ::zlib_lib -lz |
| 373 | 410 | } |
| 374 | 411 | |
| 375 | 412 | set ssldirs [opt-val with-openssl] |
| @@ -418,10 +455,12 @@ | ||
| 418 | 455 | } |
| 419 | 456 | if {$found} { |
| 420 | 457 | define FOSSIL_ENABLE_SSL |
| 421 | 458 | define-append EXTRA_CFLAGS $cflags |
| 422 | 459 | define-append EXTRA_LDFLAGS $ldflags |
| 460 | + define-append CFLAGS $cflags | |
| 461 | + define-append LDFLAGS $ldflags | |
| 423 | 462 | if {[info exists ssllibs]} { |
| 424 | 463 | define-append LIBS $ssllibs |
| 425 | 464 | } else { |
| 426 | 465 | define-append LIBS -lssl -lcrypto |
| 427 | 466 | } |
| @@ -618,10 +657,11 @@ | ||
| 618 | 657 | msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)" |
| 619 | 658 | if {!$tclprivatestubs} { |
| 620 | 659 | define-append LIBS $libs |
| 621 | 660 | } |
| 622 | 661 | define-append EXTRA_CFLAGS $cflags |
| 662 | + define-append CFLAGS $cflags | |
| 623 | 663 | if {[info exists zlibpath] && $zlibpath eq "tree"} { |
| 624 | 664 | # |
| 625 | 665 | # NOTE: When using zlib in the source tree, prevent Tcl from |
| 626 | 666 | # pulling in the system one. |
| 627 | 667 | # |
| @@ -728,10 +768,43 @@ | ||
| 728 | 768 | define FOSSIL_HAVE_FUSEFS 1 |
| 729 | 769 | define-append LIBS -lfuse |
| 730 | 770 | msg-result "FuseFS support enabled" |
| 731 | 771 | } |
| 732 | 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 | +} | |
| 733 | 806 | |
| 734 | 807 | # Add -fsanitize compile and link options late: we don't want the C |
| 735 | 808 | # checks above to run with those sanitizers enabled. It can not only |
| 736 | 809 | # be pointless, it can actually break correct tests. |
| 737 | 810 | set fsan [opt-val with-sanitizer] |
| 738 | 811 |
| --- 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 |
+1
-1
| --- autosetup/autosetup-find-tclsh | ||
| +++ autosetup/autosetup-find-tclsh | ||
| @@ -8,10 +8,10 @@ | ||
| 8 | 8 | for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do |
| 9 | 9 | { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0 |
| 10 | 10 | done |
| 11 | 11 | echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0" |
| 12 | 12 | 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 | |
| 14 | 14 | "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0 |
| 15 | 15 | done |
| 16 | 16 | echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc." |
| 17 | 17 | echo false |
| 18 | 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"; } 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 |
+2
-2
| --- 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) | |
| 2 | 2 | set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) |
| 3 | 3 | |
| 4 | 4 | project(zlib C) |
| 5 | 5 | |
| 6 | -set(VERSION "1.2.13") | |
| 6 | +set(VERSION "1.3") | |
| 7 | 7 | |
| 8 | 8 | set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") |
| 9 | 9 | set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") |
| 10 | 10 | set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") |
| 11 | 11 | set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") |
| 12 | 12 |
| --- 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 |
+19
-1
| --- compat/zlib/ChangeLog | ||
| +++ compat/zlib/ChangeLog | ||
| @@ -1,8 +1,26 @@ | ||
| 1 | 1 | |
| 2 | 2 | ChangeLog file for zlib |
| 3 | 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 | + | |
| 4 | 22 | Changes in 1.2.13 (13 Oct 2022) |
| 5 | 23 | - Fix configure issue that discarded provided CC definition |
| 6 | 24 | - Correct incorrect inputs provided to the CRC functions |
| 7 | 25 | - Repair prototypes and exporting of new CRC functions |
| 8 | 26 | - Fix inflateBack to detect invalid input with distances too far |
| @@ -1443,11 +1461,11 @@ | ||
| 1443 | 1461 | - fixed typo in zconf.h (_GNUC__ => __GNUC__) |
| 1444 | 1462 | - check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) |
| 1445 | 1463 | - fix typo in Make_vms.com (f$trnlnm -> f$getsyi) |
| 1446 | 1464 | - in fcalloc, normalize pointer if size > 65520 bytes |
| 1447 | 1465 | - 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. | |
| 1449 | 1467 | - use Z_BINARY instead of BINARY |
| 1450 | 1468 | - document that gzclose after gzdopen will close the file |
| 1451 | 1469 | - allow "a" as mode in gzopen |
| 1452 | 1470 | - fix error checking in gzread |
| 1453 | 1471 | - allow skipping .gz extra-field on pipes |
| 1454 | 1472 |
| --- 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 @@ | ||
| 2 | 2 | Frequently Asked Questions about zlib |
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 | If your question is not there, please check the zlib home page |
| 6 | 6 | 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 | |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | 1. Is zlib Y2K-compliant? |
| 11 | 11 | |
| 12 | 12 | Yes. zlib doesn't handle dates. |
| 13 | 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 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 |
+8
-2
| --- compat/zlib/Makefile.in | ||
| +++ compat/zlib/Makefile.in | ||
| @@ -26,11 +26,11 @@ | ||
| 26 | 26 | LDSHARED=$(CC) |
| 27 | 27 | CPP=$(CC) -E |
| 28 | 28 | |
| 29 | 29 | STATICLIB=libz.a |
| 30 | 30 | SHAREDLIB=libz.so |
| 31 | -SHAREDLIBV=libz.so.1.2.13 | |
| 31 | +SHAREDLIBV=libz.so.1.3 | |
| 32 | 32 | SHAREDLIBM=libz.so.1 |
| 33 | 33 | LIBS=$(STATICLIB) $(SHAREDLIBV) |
| 34 | 34 | |
| 35 | 35 | AR=ar |
| 36 | 36 | ARFLAGS=rc |
| @@ -357,12 +357,18 @@ | ||
| 357 | 357 | rm $$TEMPFILE |
| 358 | 358 | |
| 359 | 359 | zconf: $(SRCDIR)zconf.h.in |
| 360 | 360 | cp -p $(SRCDIR)zconf.h.in zconf.h |
| 361 | 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 | + | |
| 362 | 368 | mostlyclean: clean |
| 363 | -clean: | |
| 369 | +clean: minizip-clean | |
| 364 | 370 | rm -f *.o *.lo *~ \ |
| 365 | 371 | example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ |
| 366 | 372 | example64$(EXE) minigzip64$(EXE) \ |
| 367 | 373 | infcover \ |
| 368 | 374 | libz.* foo.gz so_locations \ |
| 369 | 375 |
| --- 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 |
+9
-10
| --- compat/zlib/README | ||
| +++ compat/zlib/README | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | ZLIB DATA COMPRESSION LIBRARY |
| 2 | 2 | |
| 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 | |
| 4 | 4 | thread safe. The data format used by the zlib library is described by RFCs |
| 5 | 5 | (Request for Comments) 1950 to 1952 in the files |
| 6 | 6 | http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and |
| 7 | 7 | rfc1952 (gzip format). |
| 8 | 8 | |
| @@ -27,22 +27,21 @@ | ||
| 27 | 27 | |
| 28 | 28 | PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. |
| 29 | 29 | |
| 30 | 30 | Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997 |
| 31 | 31 | 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 . | |
| 33 | 33 | |
| 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. | |
| 35 | 35 | |
| 36 | 36 | Unsupported third party contributions are provided in directory contrib/ . |
| 37 | 37 | |
| 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 . | |
| 40 | 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/ . | |
| 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 . | |
| 44 | 43 | |
| 45 | 44 | A Python interface to zlib written by A.M. Kuchling <[email protected]> is |
| 46 | 45 | available in Python 1.5 and later versions, see |
| 47 | 46 | http://docs.python.org/library/zlib.html . |
| 48 | 47 | |
| @@ -62,11 +61,11 @@ | ||
| 62 | 61 | compiler flag). The compiler bug has been reported to SGI. |
| 63 | 62 | |
| 64 | 63 | - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works |
| 65 | 64 | when compiled with cc. |
| 66 | 65 | |
| 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 | |
| 68 | 67 | necessary to get gzprintf working correctly. This is done by configure. |
| 69 | 68 | |
| 70 | 69 | - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with |
| 71 | 70 | other compilers. Use "make test" to check your compiler. |
| 72 | 71 | |
| @@ -82,11 +81,11 @@ | ||
| 82 | 81 | people who reported problems and suggested various improvements in zlib; they |
| 83 | 82 | are too numerous to cite here. |
| 84 | 83 | |
| 85 | 84 | Copyright notice: |
| 86 | 85 | |
| 87 | - (C) 1995-2022 Jean-loup Gailly and Mark Adler | |
| 86 | + (C) 1995-2023 Jean-loup Gailly and Mark Adler | |
| 88 | 87 | |
| 89 | 88 | This software is provided 'as-is', without any express or implied |
| 90 | 89 | warranty. In no event will the authors be held liable for any damages |
| 91 | 90 | arising from the use of this software. |
| 92 | 91 | |
| 93 | 92 |
| --- 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 |
+5
-27
| --- compat/zlib/adler32.c | ||
| +++ compat/zlib/adler32.c | ||
| @@ -5,12 +5,10 @@ | ||
| 5 | 5 | |
| 6 | 6 | /* @(#) $Id$ */ |
| 7 | 7 | |
| 8 | 8 | #include "zutil.h" |
| 9 | 9 | |
| 10 | -local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); | |
| 11 | - | |
| 12 | 10 | #define BASE 65521U /* largest prime smaller than 65536 */ |
| 13 | 11 | #define NMAX 5552 |
| 14 | 12 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ |
| 15 | 13 | |
| 16 | 14 | #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} |
| @@ -58,15 +56,11 @@ | ||
| 58 | 56 | # define MOD28(a) a %= BASE |
| 59 | 57 | # define MOD63(a) a %= BASE |
| 60 | 58 | #endif |
| 61 | 59 | |
| 62 | 60 | /* ========================================================================= */ |
| 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) { | |
| 68 | 62 | unsigned long sum2; |
| 69 | 63 | unsigned n; |
| 70 | 64 | |
| 71 | 65 | /* split Adler-32 into component sums */ |
| 72 | 66 | sum2 = (adler >> 16) & 0xffff; |
| @@ -129,24 +123,16 @@ | ||
| 129 | 123 | /* return recombined sums */ |
| 130 | 124 | return adler | (sum2 << 16); |
| 131 | 125 | } |
| 132 | 126 | |
| 133 | 127 | /* ========================================================================= */ |
| 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) { | |
| 139 | 129 | return adler32_z(adler, buf, len); |
| 140 | 130 | } |
| 141 | 131 | |
| 142 | 132 | /* ========================================================================= */ |
| 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) { | |
| 148 | 134 | unsigned long sum1; |
| 149 | 135 | unsigned long sum2; |
| 150 | 136 | unsigned rem; |
| 151 | 137 | |
| 152 | 138 | /* for negative len, return invalid adler32 as a clue for debugging */ |
| @@ -167,20 +153,12 @@ | ||
| 167 | 153 | if (sum2 >= BASE) sum2 -= BASE; |
| 168 | 154 | return sum1 | (sum2 << 16); |
| 169 | 155 | } |
| 170 | 156 | |
| 171 | 157 | /* ========================================================================= */ |
| 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) { | |
| 177 | 159 | return adler32_combine_(adler1, adler2, len2); |
| 178 | 160 | } |
| 179 | 161 | |
| 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) { | |
| 185 | 163 | return adler32_combine_(adler1, adler2, len2); |
| 186 | 164 | } |
| 187 | 165 |
| --- 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 |
+5
-16
| --- compat/zlib/compress.c | ||
| +++ compat/zlib/compress.c | ||
| @@ -17,17 +17,12 @@ | ||
| 17 | 17 | |
| 18 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
| 19 | 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, |
| 20 | 20 | Z_STREAM_ERROR if the level parameter is invalid. |
| 21 | 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 | -{ | |
| 22 | +int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source, | |
| 23 | + uLong sourceLen, int level) { | |
| 29 | 24 | z_stream stream; |
| 30 | 25 | int err; |
| 31 | 26 | const uInt max = (uInt)-1; |
| 32 | 27 | uLong left; |
| 33 | 28 | |
| @@ -63,24 +58,18 @@ | ||
| 63 | 58 | return err == Z_STREAM_END ? Z_OK : err; |
| 64 | 59 | } |
| 65 | 60 | |
| 66 | 61 | /* =========================================================================== |
| 67 | 62 | */ |
| 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) { | |
| 74 | 65 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); |
| 75 | 66 | } |
| 76 | 67 | |
| 77 | 68 | /* =========================================================================== |
| 78 | 69 | If the default memLevel or windowBits for deflateInit() is changed, then |
| 79 | 70 | this function needs to be updated. |
| 80 | 71 | */ |
| 81 | -uLong ZEXPORT compressBound(sourceLen) | |
| 82 | - uLong sourceLen; | |
| 83 | -{ | |
| 72 | +uLong ZEXPORT compressBound(uLong sourceLen) { | |
| 84 | 73 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + |
| 85 | 74 | (sourceLen >> 25) + 13; |
| 86 | 75 | } |
| 87 | 76 |
| --- 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 |
+16
-10
| --- compat/zlib/configure | ||
| +++ compat/zlib/configure | ||
| @@ -42,12 +42,10 @@ | ||
| 42 | 42 | # destination name for static library |
| 43 | 43 | STATICLIB=libz.a |
| 44 | 44 | |
| 45 | 45 | # extract zlib version numbers from zlib.h |
| 46 | 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 | 47 | VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` |
| 50 | 48 | |
| 51 | 49 | # establish commands for library building |
| 52 | 50 | if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then |
| 53 | 51 | AR=${AR-"${CROSS_PREFIX}ar"} |
| @@ -88,11 +86,12 @@ | ||
| 88 | 86 | zconst=0 |
| 89 | 87 | build64=0 |
| 90 | 88 | gcc=0 |
| 91 | 89 | warn=0 |
| 92 | 90 | debug=0 |
| 93 | -sanitize=0 | |
| 91 | +address=0 | |
| 92 | +memory=0 | |
| 94 | 93 | old_cc="$CC" |
| 95 | 94 | old_cflags="$CFLAGS" |
| 96 | 95 | OBJC='$(OBJZ) $(OBJG)' |
| 97 | 96 | PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' |
| 98 | 97 | |
| @@ -100,11 +99,11 @@ | ||
| 100 | 99 | leave() |
| 101 | 100 | { |
| 102 | 101 | if test "$*" != "0"; then |
| 103 | 102 | echo "** $0 aborting." | tee -a configure.log |
| 104 | 103 | 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 | |
| 106 | 105 | echo -------------------- >> configure.log |
| 107 | 106 | echo >> configure.log |
| 108 | 107 | echo >> configure.log |
| 109 | 108 | exit $1 |
| 110 | 109 | } |
| @@ -139,11 +138,13 @@ | ||
| 139 | 138 | --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; |
| 140 | 139 | --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; |
| 141 | 140 | -c* | --const) zconst=1; shift ;; |
| 142 | 141 | -w* | --warn) warn=1; shift ;; |
| 143 | 142 | -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 ;; | |
| 145 | 146 | *) |
| 146 | 147 | echo "unknown option: $1" | tee -a configure.log |
| 147 | 148 | echo "$0 --help for help" | tee -a configure.log |
| 148 | 149 | leave 1;; |
| 149 | 150 | esac |
| @@ -209,12 +210,15 @@ | ||
| 209 | 210 | CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST" |
| 210 | 211 | else |
| 211 | 212 | CFLAGS="${CFLAGS} -Wall -Wextra" |
| 212 | 213 | fi |
| 213 | 214 | 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" | |
| 216 | 220 | fi |
| 217 | 221 | if test $debug -eq 1; then |
| 218 | 222 | CFLAGS="${CFLAGS} -DZLIB_DEBUG" |
| 219 | 223 | SFLAGS="${SFLAGS} -DZLIB_DEBUG" |
| 220 | 224 | fi |
| @@ -257,12 +261,14 @@ | ||
| 257 | 261 | Darwin* | darwin* | *-darwin*) |
| 258 | 262 | shared_ext='.dylib' |
| 259 | 263 | SHAREDLIB=libz$shared_ext |
| 260 | 264 | SHAREDLIBV=libz.$VER$shared_ext |
| 261 | 265 | 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 | |
| 264 | 270 | AR="libtool" |
| 265 | 271 | else |
| 266 | 272 | AR="/usr/bin/libtool" |
| 267 | 273 | fi |
| 268 | 274 | ARFLAGS="-o" ;; |
| @@ -858,11 +864,11 @@ | ||
| 858 | 864 | echo mandir = $mandir >> configure.log |
| 859 | 865 | echo prefix = $prefix >> configure.log |
| 860 | 866 | echo sharedlibdir = $sharedlibdir >> configure.log |
| 861 | 867 | echo uname = $uname >> configure.log |
| 862 | 868 | |
| 863 | -# udpate Makefile with the configure results | |
| 869 | +# update Makefile with the configure results | |
| 864 | 870 | sed < ${SRCDIR}Makefile.in " |
| 865 | 871 | /^CC *=/s#=.*#=$CC# |
| 866 | 872 | /^CFLAGS *=/s#=.*#=$CFLAGS# |
| 867 | 873 | /^SFLAGS *=/s#=.*#=$SFLAGS# |
| 868 | 874 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# |
| 869 | 875 |
| --- 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 @@ | ||
| 150 | 150 | BufSize = number of bytes in OutBuf } |
| 151 | 151 | procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; |
| 152 | 152 | const OutBuf: Pointer; BufSize: Integer); |
| 153 | 153 | |
| 154 | 154 | const |
| 155 | - zlib_version = '1.2.13'; | |
| 155 | + zlib_version = '1.3.0'; | |
| 156 | 156 | |
| 157 | 157 | type |
| 158 | 158 | EZlibError = class(Exception); |
| 159 | 159 | ECompressionError = class(EZlibError); |
| 160 | 160 | EDecompressionError = class(EZlibError); |
| 161 | 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.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 @@ | ||
| 59 | 59 | /// <param name="offset">Where in <c>data</c> to start updating</param> |
| 60 | 60 | /// <param name="count">The number of bytes from <c>data</c> to use</param> |
| 61 | 61 | /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception> |
| 62 | 62 | /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception> |
| 63 | 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. | |
| 64 | + /// <remarks>All the other <c>Update</c> methods are implemented in terms of this one. | |
| 65 | 65 | /// This is therefore the only method a derived class has to implement</remarks> |
| 66 | 66 | public abstract void Update(byte[] data, int offset, int count); |
| 67 | 67 | |
| 68 | 68 | /// <summary> |
| 69 | 69 | /// Updates the current checksum with an array of bytes. |
| 70 | 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 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 @@ | ||
| 137 | 137 | /// Performs any codec specific cleanup |
| 138 | 138 | /// </summary> |
| 139 | 139 | /// <remarks>This must be implemented by a derived class</remarks> |
| 140 | 140 | protected abstract void CleanUp(); |
| 141 | 141 | |
| 142 | - // performs the release of the handles and calls the dereived CleanUp() | |
| 142 | + // performs the release of the handles and calls the derived CleanUp() | |
| 143 | 143 | private void CleanUp(bool isDisposing) |
| 144 | 144 | { |
| 145 | 145 | if (!_isDisposed) |
| 146 | 146 | { |
| 147 | 147 | CleanUp(); |
| @@ -158,11 +158,11 @@ | ||
| 158 | 158 | #endregion |
| 159 | 159 | |
| 160 | 160 | #region Helper methods |
| 161 | 161 | |
| 162 | 162 | /// <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 | |
| 164 | 164 | /// </summary> |
| 165 | 165 | /// <param name="data">The byte array that contains the data to copy</param> |
| 166 | 166 | /// <param name="startIndex">The index of the first byte to copy</param> |
| 167 | 167 | /// <param name="count">The number of bytes to copy from <c>data</c></param> |
| 168 | 168 | protected void copyInput(byte[] data, int startIndex, int count) |
| 169 | 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 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 @@ | ||
| 244 | 244 | { |
| 245 | 245 | throw new NotSupportedException(); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /// <summary> |
| 249 | - /// Not suppported. | |
| 249 | + /// Not supported. | |
| 250 | 250 | /// </summary> |
| 251 | 251 | /// <param name="offset"></param> |
| 252 | 252 | /// <param name="origin"></param> |
| 253 | 253 | /// <returns></returns> |
| 254 | 254 | /// <exception cref="NotSupportedException">Always thrown</exception> |
| @@ -266,11 +266,11 @@ | ||
| 266 | 266 | { |
| 267 | 267 | // left empty on purpose |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /// <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. | |
| 272 | 272 | /// </summary> |
| 273 | 273 | /// <remarks>In this implementation this property is not supported</remarks> |
| 274 | 274 | /// <exception cref="NotSupportedException">Always thrown</exception> |
| 275 | 275 | public override long Position |
| 276 | 276 | { |
| @@ -283,11 +283,11 @@ | ||
| 283 | 283 | throw new NotSupportedException(); |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /// <summary> |
| 288 | - /// Gets the size of the stream. Not suppported. | |
| 288 | + /// Gets the size of the stream. Not supported. | |
| 289 | 289 | /// </summary> |
| 290 | 290 | /// <remarks>In this implementation this property is not supported</remarks> |
| 291 | 291 | /// <exception cref="NotSupportedException">Always thrown</exception> |
| 292 | 292 | public override long Length |
| 293 | 293 | { |
| 294 | 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 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 @@ | ||
| 154 | 154 | #region Info tests |
| 155 | 155 | [Test] |
| 156 | 156 | public void Info_Version() |
| 157 | 157 | { |
| 158 | 158 | Info info = new Info(); |
| 159 | - Assert.AreEqual("1.2.13", Info.Version); | |
| 159 | + Assert.AreEqual("1.3.0", Info.Version); | |
| 160 | 160 | Assert.AreEqual(32, info.SizeOfUInt); |
| 161 | 161 | Assert.AreEqual(32, info.SizeOfULong); |
| 162 | 162 | Assert.AreEqual(32, info.SizeOfPointer); |
| 163 | 163 | Assert.AreEqual(32, info.SizeOfOffset); |
| 164 | 164 | } |
| 165 | 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.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 @@ | ||
| 34 | 34 | 2. Using NAnt: |
| 35 | 35 | Open a command prompt with access to the build environment and run nant |
| 36 | 36 | in the same directory as the DotZLib.build file. |
| 37 | 37 | You can define 2 properties on the nant command-line to control the build: |
| 38 | 38 | 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). | |
| 40 | 40 | Also the target clean will remove binaries. |
| 41 | 41 | Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release |
| 42 | 42 | or ./DotZLib/bin/debug, depending on whether you are building the release |
| 43 | 43 | or debug version of the library. |
| 44 | 44 | |
| 45 | 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 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 @@ | ||
| 14 | 14 | strm provides memory allocation functions in zalloc and zfree, or |
| 15 | 15 | Z_NULL to use the library memory allocation functions. |
| 16 | 16 | |
| 17 | 17 | window is a user-supplied window and output buffer that is 64K bytes. |
| 18 | 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 | -{ | |
| 19 | +int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window, | |
| 20 | + const char *version, int stream_size) { | |
| 25 | 21 | struct inflate_state FAR *state; |
| 26 | 22 | |
| 27 | 23 | if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || |
| 28 | 24 | stream_size != (int)(sizeof(z_stream))) |
| 29 | 25 | return Z_VERSION_ERROR; |
| @@ -49,12 +45,11 @@ | ||
| 49 | 45 | decoding. |
| 50 | 46 | */ |
| 51 | 47 | #ifdef MAKEFIXED |
| 52 | 48 | #include <stdio.h> |
| 53 | 49 | |
| 54 | -void makefixed9(void) | |
| 55 | -{ | |
| 50 | +void makefixed9(void) { | |
| 56 | 51 | unsigned sym, bits, low, size; |
| 57 | 52 | code *next, *lenfix, *distfix; |
| 58 | 53 | struct inflate_state state; |
| 59 | 54 | code fixed[544]; |
| 60 | 55 | |
| @@ -212,17 +207,12 @@ | ||
| 212 | 207 | returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format |
| 213 | 208 | error, or Z_MEM_ERROR if it could not allocate memory for the state. |
| 214 | 209 | inflateBack() can also return Z_STREAM_ERROR if the input parameters |
| 215 | 210 | are not correct, i.e. strm is Z_NULL or the state was not initialized. |
| 216 | 211 | */ |
| 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) { | |
| 224 | 214 | struct inflate_state FAR *state; |
| 225 | 215 | z_const unsigned char FAR *next; /* next input */ |
| 226 | 216 | unsigned char FAR *put; /* next output */ |
| 227 | 217 | unsigned have; /* available input */ |
| 228 | 218 | unsigned long left; /* available output */ |
| @@ -601,15 +591,13 @@ | ||
| 601 | 591 | strm->next_in = next; |
| 602 | 592 | strm->avail_in = have; |
| 603 | 593 | return ret; |
| 604 | 594 | } |
| 605 | 595 | |
| 606 | -int ZEXPORT inflateBack9End(strm) | |
| 607 | -z_stream FAR *strm; | |
| 608 | -{ | |
| 596 | +int ZEXPORT inflateBack9End(z_stream FAR *strm) { | |
| 609 | 597 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) |
| 610 | 598 | return Z_STREAM_ERROR; |
| 611 | 599 | ZFREE(strm, strm->state); |
| 612 | 600 | strm->state = Z_NULL; |
| 613 | 601 | Tracev((stderr, "inflate: end\n")); |
| 614 | 602 | return Z_OK; |
| 615 | 603 | } |
| 616 | 604 |
| --- 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 @@ | ||
| 18 | 18 | |
| 19 | 19 | #ifdef __cplusplus |
| 20 | 20 | extern "C" { |
| 21 | 21 | #endif |
| 22 | 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)); | |
| 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 | 31 | #define inflateBack9Init(strm, window) \ |
| 32 | 32 | inflateBack9Init_((strm), (window), \ |
| 33 | 33 | ZLIB_VERSION, sizeof(z_stream)) |
| 34 | 34 | |
| 35 | 35 | #ifdef __cplusplus |
| 36 | 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 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 @@ | ||
| 1 | 1 | /* inftree9.c -- generate Huffman trees for efficient decoding |
| 2 | - * Copyright (C) 1995-2022 Mark Adler | |
| 2 | + * Copyright (C) 1995-2023 Mark Adler | |
| 3 | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include "zutil.h" |
| 7 | 7 | #include "inftree9.h" |
| 8 | 8 | |
| 9 | 9 | #define MAXBITS 15 |
| 10 | 10 | |
| 11 | 11 | const char inflate9_copyright[] = |
| 12 | - " inflate9 1.2.13 Copyright 1995-2022 Mark Adler "; | |
| 12 | + " inflate9 1.3 Copyright 1995-2023 Mark Adler "; | |
| 13 | 13 | /* |
| 14 | 14 | If you use the zlib library in a product, an acknowledgment is welcome |
| 15 | 15 | in the documentation of your product. If for some reason you cannot |
| 16 | 16 | include such an acknowledgment, I would appreciate that you keep this |
| 17 | 17 | copyright string in the executable of your product. |
| @@ -27,18 +27,13 @@ | ||
| 27 | 27 | on return points to the next available entry's address. bits is the |
| 28 | 28 | requested root table index bits, and on return it is the actual root |
| 29 | 29 | table index bits. It will differ if the request is greater than the |
| 30 | 30 | longest code or if it is less than the shortest code. |
| 31 | 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 | -{ | |
| 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) { | |
| 40 | 35 | unsigned len; /* a code's length in bits */ |
| 41 | 36 | unsigned sym; /* index of code symbols */ |
| 42 | 37 | unsigned min, max; /* minimum and maximum code lengths */ |
| 43 | 38 | unsigned root; /* number of index bits for root table */ |
| 44 | 39 | unsigned curr; /* number of index bits for current table */ |
| @@ -62,11 +57,11 @@ | ||
| 62 | 57 | 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, |
| 63 | 58 | 131, 163, 195, 227, 3, 0, 0}; |
| 64 | 59 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ |
| 65 | 60 | 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, |
| 66 | 61 | 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}; | |
| 68 | 63 | static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ |
| 69 | 64 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, |
| 70 | 65 | 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, |
| 71 | 66 | 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153}; |
| 72 | 67 | static const unsigned short dext[32] = { /* Distance codes 0..31 extra */ |
| 73 | 68 |
| --- 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 @@ | ||
| 54 | 54 | CODES, |
| 55 | 55 | LENS, |
| 56 | 56 | DISTS |
| 57 | 57 | } codetype; |
| 58 | 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)); | |
| 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 | 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 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 @@ | ||
| 1 | 1 | |
| 2 | -MiniZip 1.1 was derrived from MiniZip at version 1.01f | |
| 2 | +MiniZip 1.1 was derived from MiniZip at version 1.01f | |
| 3 | 3 | |
| 4 | 4 | Change in 1.0 (Okt 2009) |
| 5 | 5 | - **TODO - Add history** |
| 6 | 6 | |
| 7 | 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 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 @@ | ||
| 1 | 1 | # -*- Autoconf -*- |
| 2 | 2 | # Process this file with autoconf to produce a configure script. |
| 3 | 3 | |
| 4 | -AC_INIT([minizip], [1.2.13], [bugzilla.redhat.com]) | |
| 4 | +AC_INIT([minizip], [1.3.0], [bugzilla.redhat.com]) | |
| 5 | 5 | AC_CONFIG_SRCDIR([minizip.c]) |
| 6 | 6 | AM_INIT_AUTOMAKE([foreign]) |
| 7 | 7 | LT_INIT |
| 8 | 8 | |
| 9 | 9 | AC_MSG_CHECKING([whether to build example programs]) |
| 10 | 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.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 @@ | ||
| 30 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) |
| 31 | 31 | |
| 32 | 32 | /*********************************************************************** |
| 33 | 33 | * Return the next byte in the pseudo-random sequence |
| 34 | 34 | */ |
| 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) { | |
| 37 | 36 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an |
| 38 | 37 | * unpredictable manner on 16-bit systems; not a problem |
| 39 | 38 | * with any known compiler so far, though */ |
| 40 | 39 | |
| 41 | 40 | (void)pcrc_32_tab; |
| @@ -44,12 +43,11 @@ | ||
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | /*********************************************************************** |
| 47 | 46 | * Update the encryption keys with the next byte of plain text |
| 48 | 47 | */ |
| 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) { | |
| 51 | 49 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); |
| 52 | 50 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; |
| 53 | 51 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; |
| 54 | 52 | { |
| 55 | 53 | register int keyshift = (int)((*(pkeys+1)) >> 24); |
| @@ -61,12 +59,11 @@ | ||
| 61 | 59 | |
| 62 | 60 | /*********************************************************************** |
| 63 | 61 | * Initialize the encryption keys and the random header according to |
| 64 | 62 | * the given password. |
| 65 | 63 | */ |
| 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) { | |
| 68 | 65 | *(pkeys+0) = 305419896L; |
| 69 | 66 | *(pkeys+1) = 591751049L; |
| 70 | 67 | *(pkeys+2) = 878082192L; |
| 71 | 68 | while (*passwd != '\0') { |
| 72 | 69 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); |
| @@ -91,12 +88,11 @@ | ||
| 91 | 88 | static unsigned crypthead(const char* passwd, /* password string */ |
| 92 | 89 | unsigned char* buf, /* where to write header */ |
| 93 | 90 | int bufSize, |
| 94 | 91 | unsigned long* pkeys, |
| 95 | 92 | const z_crc_t* pcrc_32_tab, |
| 96 | - unsigned long crcForCrypting) | |
| 97 | -{ | |
| 93 | + unsigned long crcForCrypting) { | |
| 98 | 94 | unsigned n; /* index in random header */ |
| 99 | 95 | int t; /* temporary */ |
| 100 | 96 | int c; /* random byte */ |
| 101 | 97 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ |
| 102 | 98 | static unsigned calls = 0; /* ensure different random header each time */ |
| 103 | 99 |
| --- 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 |
+18
-44
| --- compat/zlib/contrib/minizip/ioapi.c | ||
| +++ compat/zlib/contrib/minizip/ioapi.c | ||
| @@ -12,11 +12,11 @@ | ||
| 12 | 12 | |
| 13 | 13 | #if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS))) |
| 14 | 14 | #define _CRT_SECURE_NO_WARNINGS |
| 15 | 15 | #endif |
| 16 | 16 | |
| 17 | -#if defined(__APPLE__) || defined(IOAPI_NO_64) | |
| 17 | +#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) | |
| 18 | 18 | // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions |
| 19 | 19 | #define FOPEN_FUNC(filename, mode) fopen(filename, mode) |
| 20 | 20 | #define FTELLO_FUNC(stream) ftello(stream) |
| 21 | 21 | #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) |
| 22 | 22 | #else |
| @@ -26,22 +26,20 @@ | ||
| 26 | 26 | #endif |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | #include "ioapi.h" |
| 30 | 30 | |
| 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) { | |
| 33 | 32 | if (pfilefunc->zfile_func64.zopen64_file != NULL) |
| 34 | 33 | return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); |
| 35 | 34 | else |
| 36 | 35 | { |
| 37 | 36 | return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); |
| 38 | 37 | } |
| 39 | 38 | } |
| 40 | 39 | |
| 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) { | |
| 43 | 41 | if (pfilefunc->zfile_func64.zseek64_file != NULL) |
| 44 | 42 | return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); |
| 45 | 43 | else |
| 46 | 44 | { |
| 47 | 45 | uLong offsetTruncated = (uLong)offset; |
| @@ -50,12 +48,11 @@ | ||
| 50 | 48 | else |
| 51 | 49 | return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); |
| 52 | 50 | } |
| 53 | 51 | } |
| 54 | 52 | |
| 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) { | |
| 57 | 54 | if (pfilefunc->zfile_func64.zseek64_file != NULL) |
| 58 | 55 | return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); |
| 59 | 56 | else |
| 60 | 57 | { |
| 61 | 58 | uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); |
| @@ -64,15 +61,13 @@ | ||
| 64 | 61 | else |
| 65 | 62 | return tell_uLong; |
| 66 | 63 | } |
| 67 | 64 | } |
| 68 | 65 | |
| 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) { | |
| 71 | 67 | p_filefunc64_32->zfile_func64.zopen64_file = NULL; |
| 72 | 68 | p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; |
| 73 | - p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; | |
| 74 | 69 | p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; |
| 75 | 70 | p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; |
| 76 | 71 | p_filefunc64_32->zfile_func64.ztell64_file = NULL; |
| 77 | 72 | p_filefunc64_32->zfile_func64.zseek64_file = NULL; |
| 78 | 73 | p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; |
| @@ -82,20 +77,11 @@ | ||
| 82 | 77 | p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; |
| 83 | 78 | } |
| 84 | 79 | |
| 85 | 80 | |
| 86 | 81 | |
| 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) { | |
| 97 | 83 | FILE* file = NULL; |
| 98 | 84 | const char* mode_fopen = NULL; |
| 99 | 85 | (void)opaque; |
| 100 | 86 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) |
| 101 | 87 | mode_fopen = "rb"; |
| @@ -109,12 +95,11 @@ | ||
| 109 | 95 | if ((filename!=NULL) && (mode_fopen != NULL)) |
| 110 | 96 | file = fopen(filename, mode_fopen); |
| 111 | 97 | return file; |
| 112 | 98 | } |
| 113 | 99 | |
| 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) { | |
| 116 | 101 | FILE* file = NULL; |
| 117 | 102 | const char* mode_fopen = NULL; |
| 118 | 103 | (void)opaque; |
| 119 | 104 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) |
| 120 | 105 | mode_fopen = "rb"; |
| @@ -129,45 +114,40 @@ | ||
| 129 | 114 | file = FOPEN_FUNC((const char*)filename, mode_fopen); |
| 130 | 115 | return file; |
| 131 | 116 | } |
| 132 | 117 | |
| 133 | 118 | |
| 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) { | |
| 136 | 120 | uLong ret; |
| 137 | 121 | (void)opaque; |
| 138 | 122 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); |
| 139 | 123 | return ret; |
| 140 | 124 | } |
| 141 | 125 | |
| 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) { | |
| 144 | 127 | uLong ret; |
| 145 | 128 | (void)opaque; |
| 146 | 129 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); |
| 147 | 130 | return ret; |
| 148 | 131 | } |
| 149 | 132 | |
| 150 | -static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) | |
| 151 | -{ | |
| 133 | +static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) { | |
| 152 | 134 | long ret; |
| 153 | 135 | (void)opaque; |
| 154 | 136 | ret = ftell((FILE *)stream); |
| 155 | 137 | return ret; |
| 156 | 138 | } |
| 157 | 139 | |
| 158 | 140 | |
| 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) { | |
| 161 | 142 | ZPOS64_T ret; |
| 162 | 143 | (void)opaque; |
| 163 | 144 | ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream); |
| 164 | 145 | return ret; |
| 165 | 146 | } |
| 166 | 147 | |
| 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) { | |
| 169 | 149 | int fseek_origin=0; |
| 170 | 150 | long ret; |
| 171 | 151 | (void)opaque; |
| 172 | 152 | switch (origin) |
| 173 | 153 | { |
| @@ -186,12 +166,11 @@ | ||
| 186 | 166 | if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0) |
| 187 | 167 | ret = -1; |
| 188 | 168 | return ret; |
| 189 | 169 | } |
| 190 | 170 | |
| 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) { | |
| 193 | 172 | int fseek_origin=0; |
| 194 | 173 | long ret; |
| 195 | 174 | (void)opaque; |
| 196 | 175 | switch (origin) |
| 197 | 176 | { |
| @@ -206,36 +185,32 @@ | ||
| 206 | 185 | break; |
| 207 | 186 | default: return -1; |
| 208 | 187 | } |
| 209 | 188 | ret = 0; |
| 210 | 189 | |
| 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) | |
| 212 | 191 | ret = -1; |
| 213 | 192 | |
| 214 | 193 | return ret; |
| 215 | 194 | } |
| 216 | 195 | |
| 217 | 196 | |
| 218 | -static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) | |
| 219 | -{ | |
| 197 | +static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) { | |
| 220 | 198 | int ret; |
| 221 | 199 | (void)opaque; |
| 222 | 200 | ret = fclose((FILE *)stream); |
| 223 | 201 | return ret; |
| 224 | 202 | } |
| 225 | 203 | |
| 226 | -static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) | |
| 227 | -{ | |
| 204 | +static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) { | |
| 228 | 205 | int ret; |
| 229 | 206 | (void)opaque; |
| 230 | 207 | ret = ferror((FILE *)stream); |
| 231 | 208 | return ret; |
| 232 | 209 | } |
| 233 | 210 | |
| 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) { | |
| 237 | 212 | pzlib_filefunc_def->zopen_file = fopen_file_func; |
| 238 | 213 | pzlib_filefunc_def->zread_file = fread_file_func; |
| 239 | 214 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; |
| 240 | 215 | pzlib_filefunc_def->ztell_file = ftell_file_func; |
| 241 | 216 | pzlib_filefunc_def->zseek_file = fseek_file_func; |
| @@ -242,16 +217,15 @@ | ||
| 242 | 217 | pzlib_filefunc_def->zclose_file = fclose_file_func; |
| 243 | 218 | pzlib_filefunc_def->zerror_file = ferror_file_func; |
| 244 | 219 | pzlib_filefunc_def->opaque = NULL; |
| 245 | 220 | } |
| 246 | 221 | |
| 247 | -void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) | |
| 248 | -{ | |
| 222 | +void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) { | |
| 249 | 223 | pzlib_filefunc_def->zopen64_file = fopen64_file_func; |
| 250 | 224 | pzlib_filefunc_def->zread_file = fread_file_func; |
| 251 | 225 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; |
| 252 | 226 | pzlib_filefunc_def->ztell64_file = ftell64_file_func; |
| 253 | 227 | pzlib_filefunc_def->zseek64_file = fseek64_file_func; |
| 254 | 228 | pzlib_filefunc_def->zclose_file = fclose_file_func; |
| 255 | 229 | pzlib_filefunc_def->zerror_file = ferror_file_func; |
| 256 | 230 | pzlib_filefunc_def->opaque = NULL; |
| 257 | 231 | } |
| 258 | 232 |
| --- 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 |
+19
-19
| --- compat/zlib/contrib/minizip/ioapi.h | ||
| +++ compat/zlib/contrib/minizip/ioapi.h | ||
| @@ -48,11 +48,11 @@ | ||
| 48 | 48 | #if defined(USE_FILE32API) |
| 49 | 49 | #define fopen64 fopen |
| 50 | 50 | #define ftello64 ftell |
| 51 | 51 | #define fseeko64 fseek |
| 52 | 52 | #else |
| 53 | -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) | |
| 53 | +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) | |
| 54 | 54 | #define fopen64 fopen |
| 55 | 55 | #define ftello64 ftello |
| 56 | 56 | #define fseeko64 fseeko |
| 57 | 57 | #endif |
| 58 | 58 | #ifdef _MSC_VER |
| @@ -80,11 +80,11 @@ | ||
| 80 | 80 | |
| 81 | 81 | #ifdef HAVE_MINIZIP64_CONF_H |
| 82 | 82 | #include "mz64conf.h" |
| 83 | 83 | #endif |
| 84 | 84 | |
| 85 | -/* a type choosen by DEFINE */ | |
| 85 | +/* a type chosen by DEFINE */ | |
| 86 | 86 | #ifdef HAVE_64BIT_INT_CUSTOM |
| 87 | 87 | typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; |
| 88 | 88 | #else |
| 89 | 89 | #ifdef HAS_STDINT_H |
| 90 | 90 | #include "stdint.h" |
| @@ -132,18 +132,18 @@ | ||
| 132 | 132 | #endif |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 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)); | |
| 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 | 145 | |
| 146 | 146 | |
| 147 | 147 | /* here is the "old" 32 bits structure structure */ |
| 148 | 148 | typedef struct zlib_filefunc_def_s |
| 149 | 149 | { |
| @@ -155,13 +155,13 @@ | ||
| 155 | 155 | close_file_func zclose_file; |
| 156 | 156 | testerror_file_func zerror_file; |
| 157 | 157 | voidpf opaque; |
| 158 | 158 | } zlib_filefunc_def; |
| 159 | 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)); | |
| 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 | 163 | |
| 164 | 164 | typedef struct zlib_filefunc64_def_s |
| 165 | 165 | { |
| 166 | 166 | open64_file_func zopen64_file; |
| 167 | 167 | read_file_func zread_file; |
| @@ -171,12 +171,12 @@ | ||
| 171 | 171 | close_file_func zclose_file; |
| 172 | 172 | testerror_file_func zerror_file; |
| 173 | 173 | voidpf opaque; |
| 174 | 174 | } zlib_filefunc64_def; |
| 175 | 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)); | |
| 176 | +void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def); | |
| 177 | +void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def); | |
| 178 | 178 | |
| 179 | 179 | /* now internal definition, only for zip.c and unzip.h */ |
| 180 | 180 | typedef struct zlib_filefunc64_32_def_s |
| 181 | 181 | { |
| 182 | 182 | zlib_filefunc64_def zfile_func64; |
| @@ -191,15 +191,15 @@ | ||
| 191 | 191 | //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) |
| 192 | 192 | //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) |
| 193 | 193 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) |
| 194 | 194 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) |
| 195 | 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)); | |
| 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 | 199 | |
| 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); | |
| 201 | 201 | |
| 202 | 202 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) |
| 203 | 203 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) |
| 204 | 204 | #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) |
| 205 | 205 | |
| 206 | 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__) |
| 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 |
+19
-46
| --- compat/zlib/contrib/minizip/iowin32.c | ||
| +++ compat/zlib/contrib/minizip/iowin32.c | ||
| @@ -36,18 +36,10 @@ | ||
| 36 | 36 | #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) |
| 37 | 37 | #define IOWIN32_USING_WINRT_API 1 |
| 38 | 38 | #endif |
| 39 | 39 | #endif |
| 40 | 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 | 41 | typedef struct |
| 50 | 42 | { |
| 51 | 43 | HANDLE hf; |
| 52 | 44 | int error; |
| 53 | 45 | } WIN32FILE_IOWIN; |
| @@ -55,12 +47,11 @@ | ||
| 55 | 47 | |
| 56 | 48 | static void win32_translate_open_mode(int mode, |
| 57 | 49 | DWORD* lpdwDesiredAccess, |
| 58 | 50 | DWORD* lpdwCreationDisposition, |
| 59 | 51 | DWORD* lpdwShareMode, |
| 60 | - DWORD* lpdwFlagsAndAttributes) | |
| 61 | -{ | |
| 52 | + DWORD* lpdwFlagsAndAttributes) { | |
| 62 | 53 | *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; |
| 63 | 54 | |
| 64 | 55 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) |
| 65 | 56 | { |
| 66 | 57 | *lpdwDesiredAccess = GENERIC_READ; |
| @@ -77,12 +68,11 @@ | ||
| 77 | 68 | *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; |
| 78 | 69 | *lpdwCreationDisposition = CREATE_ALWAYS; |
| 79 | 70 | } |
| 80 | 71 | } |
| 81 | 72 | |
| 82 | -static voidpf win32_build_iowin(HANDLE hFile) | |
| 83 | -{ | |
| 73 | +static voidpf win32_build_iowin(HANDLE hFile) { | |
| 84 | 74 | voidpf ret=NULL; |
| 85 | 75 | |
| 86 | 76 | if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) |
| 87 | 77 | { |
| 88 | 78 | WIN32FILE_IOWIN w32fiow; |
| @@ -96,12 +86,11 @@ | ||
| 96 | 86 | *((WIN32FILE_IOWIN*)ret) = w32fiow; |
| 97 | 87 | } |
| 98 | 88 | return ret; |
| 99 | 89 | } |
| 100 | 90 | |
| 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) { | |
| 103 | 92 | const char* mode_fopen = NULL; |
| 104 | 93 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
| 105 | 94 | HANDLE hFile = NULL; |
| 106 | 95 | |
| 107 | 96 | win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); |
| @@ -125,12 +114,11 @@ | ||
| 125 | 114 | |
| 126 | 115 | return win32_build_iowin(hFile); |
| 127 | 116 | } |
| 128 | 117 | |
| 129 | 118 | |
| 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) { | |
| 132 | 120 | const char* mode_fopen = NULL; |
| 133 | 121 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
| 134 | 122 | HANDLE hFile = NULL; |
| 135 | 123 | |
| 136 | 124 | win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); |
| @@ -149,12 +137,11 @@ | ||
| 149 | 137 | |
| 150 | 138 | return win32_build_iowin(hFile); |
| 151 | 139 | } |
| 152 | 140 | |
| 153 | 141 | |
| 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) { | |
| 156 | 143 | const char* mode_fopen = NULL; |
| 157 | 144 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
| 158 | 145 | HANDLE hFile = NULL; |
| 159 | 146 | |
| 160 | 147 | win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); |
| @@ -169,12 +156,11 @@ | ||
| 169 | 156 | |
| 170 | 157 | return win32_build_iowin(hFile); |
| 171 | 158 | } |
| 172 | 159 | |
| 173 | 160 | |
| 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) { | |
| 176 | 162 | const char* mode_fopen = NULL; |
| 177 | 163 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
| 178 | 164 | HANDLE hFile = NULL; |
| 179 | 165 | |
| 180 | 166 | win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); |
| @@ -198,12 +184,11 @@ | ||
| 198 | 184 | |
| 199 | 185 | return win32_build_iowin(hFile); |
| 200 | 186 | } |
| 201 | 187 | |
| 202 | 188 | |
| 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) { | |
| 205 | 190 | uLong ret=0; |
| 206 | 191 | HANDLE hFile = NULL; |
| 207 | 192 | if (stream!=NULL) |
| 208 | 193 | hFile = ((WIN32FILE_IOWIN*)stream) -> hf; |
| 209 | 194 | |
| @@ -220,12 +205,11 @@ | ||
| 220 | 205 | |
| 221 | 206 | return ret; |
| 222 | 207 | } |
| 223 | 208 | |
| 224 | 209 | |
| 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) { | |
| 227 | 211 | uLong ret=0; |
| 228 | 212 | HANDLE hFile = NULL; |
| 229 | 213 | if (stream!=NULL) |
| 230 | 214 | hFile = ((WIN32FILE_IOWIN*)stream) -> hf; |
| 231 | 215 | |
| @@ -241,12 +225,11 @@ | ||
| 241 | 225 | } |
| 242 | 226 | |
| 243 | 227 | return ret; |
| 244 | 228 | } |
| 245 | 229 | |
| 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) { | |
| 248 | 231 | #ifdef IOWIN32_USING_WINRT_API |
| 249 | 232 | return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); |
| 250 | 233 | #else |
| 251 | 234 | LONG lHigh = pos.HighPart; |
| 252 | 235 | DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod); |
| @@ -261,12 +244,11 @@ | ||
| 261 | 244 | } |
| 262 | 245 | return fOk; |
| 263 | 246 | #endif |
| 264 | 247 | } |
| 265 | 248 | |
| 266 | -long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) | |
| 267 | -{ | |
| 249 | +long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) { | |
| 268 | 250 | long ret=-1; |
| 269 | 251 | HANDLE hFile = NULL; |
| 270 | 252 | if (stream!=NULL) |
| 271 | 253 | hFile = ((WIN32FILE_IOWIN*)stream) -> hf; |
| 272 | 254 | if (hFile != NULL) |
| @@ -284,12 +266,11 @@ | ||
| 284 | 266 | ret=(long)pos.LowPart; |
| 285 | 267 | } |
| 286 | 268 | return ret; |
| 287 | 269 | } |
| 288 | 270 | |
| 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) { | |
| 291 | 272 | ZPOS64_T ret= (ZPOS64_T)-1; |
| 292 | 273 | HANDLE hFile = NULL; |
| 293 | 274 | if (stream!=NULL) |
| 294 | 275 | hFile = ((WIN32FILE_IOWIN*)stream)->hf; |
| 295 | 276 | |
| @@ -309,12 +290,11 @@ | ||
| 309 | 290 | } |
| 310 | 291 | return ret; |
| 311 | 292 | } |
| 312 | 293 | |
| 313 | 294 | |
| 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) { | |
| 316 | 296 | DWORD dwMoveMethod=0xFFFFFFFF; |
| 317 | 297 | HANDLE hFile = NULL; |
| 318 | 298 | |
| 319 | 299 | long ret=-1; |
| 320 | 300 | if (stream!=NULL) |
| @@ -347,12 +327,11 @@ | ||
| 347 | 327 | ret=0; |
| 348 | 328 | } |
| 349 | 329 | return ret; |
| 350 | 330 | } |
| 351 | 331 | |
| 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) { | |
| 354 | 333 | DWORD dwMoveMethod=0xFFFFFFFF; |
| 355 | 334 | HANDLE hFile = NULL; |
| 356 | 335 | long ret=-1; |
| 357 | 336 | |
| 358 | 337 | if (stream!=NULL) |
| @@ -386,12 +365,11 @@ | ||
| 386 | 365 | ret=0; |
| 387 | 366 | } |
| 388 | 367 | return ret; |
| 389 | 368 | } |
| 390 | 369 | |
| 391 | -int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) | |
| 392 | -{ | |
| 370 | +int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) { | |
| 393 | 371 | int ret=-1; |
| 394 | 372 | |
| 395 | 373 | if (stream!=NULL) |
| 396 | 374 | { |
| 397 | 375 | HANDLE hFile; |
| @@ -404,22 +382,20 @@ | ||
| 404 | 382 | free(stream); |
| 405 | 383 | } |
| 406 | 384 | return ret; |
| 407 | 385 | } |
| 408 | 386 | |
| 409 | -int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream) | |
| 410 | -{ | |
| 387 | +int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) { | |
| 411 | 388 | int ret=-1; |
| 412 | 389 | if (stream!=NULL) |
| 413 | 390 | { |
| 414 | 391 | ret = ((WIN32FILE_IOWIN*)stream) -> error; |
| 415 | 392 | } |
| 416 | 393 | return ret; |
| 417 | 394 | } |
| 418 | 395 | |
| 419 | -void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) | |
| 420 | -{ | |
| 396 | +void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def) { | |
| 421 | 397 | pzlib_filefunc_def->zopen_file = win32_open_file_func; |
| 422 | 398 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
| 423 | 399 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
| 424 | 400 | pzlib_filefunc_def->ztell_file = win32_tell_file_func; |
| 425 | 401 | pzlib_filefunc_def->zseek_file = win32_seek_file_func; |
| @@ -426,12 +402,11 @@ | ||
| 426 | 402 | pzlib_filefunc_def->zclose_file = win32_close_file_func; |
| 427 | 403 | pzlib_filefunc_def->zerror_file = win32_error_file_func; |
| 428 | 404 | pzlib_filefunc_def->opaque = NULL; |
| 429 | 405 | } |
| 430 | 406 | |
| 431 | -void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) | |
| 432 | -{ | |
| 407 | +void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) { | |
| 433 | 408 | pzlib_filefunc_def->zopen64_file = win32_open64_file_func; |
| 434 | 409 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
| 435 | 410 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
| 436 | 411 | pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; |
| 437 | 412 | pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; |
| @@ -439,12 +414,11 @@ | ||
| 439 | 414 | pzlib_filefunc_def->zerror_file = win32_error_file_func; |
| 440 | 415 | pzlib_filefunc_def->opaque = NULL; |
| 441 | 416 | } |
| 442 | 417 | |
| 443 | 418 | |
| 444 | -void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) | |
| 445 | -{ | |
| 419 | +void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) { | |
| 446 | 420 | pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; |
| 447 | 421 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
| 448 | 422 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
| 449 | 423 | pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; |
| 450 | 424 | pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; |
| @@ -452,16 +426,15 @@ | ||
| 452 | 426 | pzlib_filefunc_def->zerror_file = win32_error_file_func; |
| 453 | 427 | pzlib_filefunc_def->opaque = NULL; |
| 454 | 428 | } |
| 455 | 429 | |
| 456 | 430 | |
| 457 | -void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) | |
| 458 | -{ | |
| 431 | +void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) { | |
| 459 | 432 | pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; |
| 460 | 433 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
| 461 | 434 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
| 462 | 435 | pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; |
| 463 | 436 | pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; |
| 464 | 437 | pzlib_filefunc_def->zclose_file = win32_close_file_func; |
| 465 | 438 | pzlib_filefunc_def->zerror_file = win32_error_file_func; |
| 466 | 439 | pzlib_filefunc_def->opaque = NULL; |
| 467 | 440 | } |
| 468 | 441 |
| --- 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 @@ | ||
| 16 | 16 | |
| 17 | 17 | #ifdef __cplusplus |
| 18 | 18 | extern "C" { |
| 19 | 19 | #endif |
| 20 | 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)); | |
| 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 | 25 | |
| 26 | 26 | #ifdef __cplusplus |
| 27 | 27 | } |
| 28 | 28 | #endif |
| 29 | 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 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 |
+22
-48
| --- compat/zlib/contrib/minizip/miniunz.c | ||
| +++ compat/zlib/contrib/minizip/miniunz.c | ||
| @@ -25,11 +25,11 @@ | ||
| 25 | 25 | #ifndef _FILE_OFFSET_BIT |
| 26 | 26 | #define _FILE_OFFSET_BIT 64 |
| 27 | 27 | #endif |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | -#ifdef __APPLE__ | |
| 30 | +#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) | |
| 31 | 31 | // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions |
| 32 | 32 | #define FOPEN_FUNC(filename, mode) fopen(filename, mode) |
| 33 | 33 | #define FTELLO_FUNC(stream) ftello(stream) |
| 34 | 34 | #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) |
| 35 | 35 | #else |
| @@ -79,15 +79,11 @@ | ||
| 79 | 79 | |
| 80 | 80 | /* change_file_date : change the date/time of a file |
| 81 | 81 | filename : the filename of the file where date/time must be modified |
| 82 | 82 | dosdate : the new date at the MSDos format (4 bytes) |
| 83 | 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 | -{ | |
| 84 | +static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { | |
| 89 | 85 | #ifdef _WIN32 |
| 90 | 86 | HANDLE hFile; |
| 91 | 87 | FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; |
| 92 | 88 | |
| 93 | 89 | hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE, |
| @@ -113,35 +109,37 @@ | ||
| 113 | 109 | newdate.tm_year=tmu_date.tm_year ; |
| 114 | 110 | newdate.tm_isdst=-1; |
| 115 | 111 | |
| 116 | 112 | ut.actime=ut.modtime=mktime(&newdate); |
| 117 | 113 | utime(filename,&ut); |
| 114 | +#else | |
| 115 | + (void)filename; | |
| 116 | + (void)dosdate; | |
| 117 | + (void)tmu_date; | |
| 118 | 118 | #endif |
| 119 | 119 | #endif |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | /* mymkdir and change_file_date are not 100 % portable |
| 124 | 124 | As I don't know well Unix, I wait feedback for the unix portion */ |
| 125 | 125 | |
| 126 | -static int mymkdir(dirname) | |
| 127 | - const char* dirname; | |
| 128 | -{ | |
| 126 | +static int mymkdir(const char* dirname) { | |
| 129 | 127 | int ret=0; |
| 130 | 128 | #ifdef _WIN32 |
| 131 | 129 | ret = _mkdir(dirname); |
| 132 | 130 | #elif unix |
| 133 | 131 | ret = mkdir (dirname,0775); |
| 134 | 132 | #elif __APPLE__ |
| 135 | 133 | ret = mkdir (dirname,0775); |
| 134 | +#else | |
| 135 | + (void)dirname; | |
| 136 | 136 | #endif |
| 137 | 137 | return ret; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | -static int makedir (newdir) | |
| 141 | - const char *newdir; | |
| 142 | -{ | |
| 140 | +static int makedir(const char *newdir) { | |
| 143 | 141 | char *buffer ; |
| 144 | 142 | char *p; |
| 145 | 143 | size_t len = strlen(newdir); |
| 146 | 144 | |
| 147 | 145 | if (len == 0) |
| @@ -185,30 +183,27 @@ | ||
| 185 | 183 | } |
| 186 | 184 | free(buffer); |
| 187 | 185 | return 1; |
| 188 | 186 | } |
| 189 | 187 | |
| 190 | -static void do_banner() | |
| 191 | -{ | |
| 188 | +static void do_banner(void) { | |
| 192 | 189 | printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); |
| 193 | 190 | printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); |
| 194 | 191 | } |
| 195 | 192 | |
| 196 | -static void do_help() | |
| 197 | -{ | |
| 193 | +static void do_help(void) { | |
| 198 | 194 | printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ |
| 199 | 195 | " -e Extract without pathname (junk paths)\n" \ |
| 200 | 196 | " -x Extract with pathname\n" \ |
| 201 | 197 | " -v list files\n" \ |
| 202 | 198 | " -l list files\n" \ |
| 203 | 199 | " -d directory to extract into\n" \ |
| 204 | 200 | " -o overwrite files without prompting\n" \ |
| 205 | - " -p extract crypted file using password\n\n"); | |
| 201 | + " -p extract encrypted file using password\n\n"); | |
| 206 | 202 | } |
| 207 | 203 | |
| 208 | -static void Display64BitsSize(ZPOS64_T n, int size_char) | |
| 209 | -{ | |
| 204 | +static void Display64BitsSize(ZPOS64_T n, int size_char) { | |
| 210 | 205 | /* to avoid compatibility problem , we do here the conversion */ |
| 211 | 206 | char number[21]; |
| 212 | 207 | int offset=19; |
| 213 | 208 | int pos_string = 19; |
| 214 | 209 | number[20]=0; |
| @@ -231,13 +226,11 @@ | ||
| 231 | 226 | } |
| 232 | 227 | |
| 233 | 228 | printf("%s",&number[pos_string]); |
| 234 | 229 | } |
| 235 | 230 | |
| 236 | -static int do_list(uf) | |
| 237 | - unzFile uf; | |
| 238 | -{ | |
| 231 | +static int do_list(unzFile uf) { | |
| 239 | 232 | uLong i; |
| 240 | 233 | unz_global_info64 gi; |
| 241 | 234 | int err; |
| 242 | 235 | |
| 243 | 236 | err = unzGetGlobalInfo64(uf,&gi); |
| @@ -248,11 +241,11 @@ | ||
| 248 | 241 | for (i=0;i<gi.number_entry;i++) |
| 249 | 242 | { |
| 250 | 243 | char filename_inzip[256]; |
| 251 | 244 | unz_file_info64 file_info; |
| 252 | 245 | uLong ratio=0; |
| 253 | - const char *string_method; | |
| 246 | + const char *string_method = ""; | |
| 254 | 247 | char charCrypt=' '; |
| 255 | 248 | err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); |
| 256 | 249 | if (err!=UNZ_OK) |
| 257 | 250 | { |
| 258 | 251 | printf("error %d with zipfile in unzGetCurrentFileInfo\n",err); |
| @@ -259,11 +252,11 @@ | ||
| 259 | 252 | break; |
| 260 | 253 | } |
| 261 | 254 | if (file_info.uncompressed_size>0) |
| 262 | 255 | ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size); |
| 263 | 256 | |
| 264 | - /* display a '*' if the file is crypted */ | |
| 257 | + /* display a '*' if the file is encrypted */ | |
| 265 | 258 | if ((file_info.flag & 1) != 0) |
| 266 | 259 | charCrypt='*'; |
| 267 | 260 | |
| 268 | 261 | if (file_info.compression_method==0) |
| 269 | 262 | string_method="Stored"; |
| @@ -309,16 +302,11 @@ | ||
| 309 | 302 | |
| 310 | 303 | return 0; |
| 311 | 304 | } |
| 312 | 305 | |
| 313 | 306 | |
| 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) { | |
| 320 | 308 | char filename_inzip[256]; |
| 321 | 309 | char* filename_withoutpath; |
| 322 | 310 | char* p; |
| 323 | 311 | int err=UNZ_OK; |
| 324 | 312 | FILE *fout=NULL; |
| @@ -471,16 +459,11 @@ | ||
| 471 | 459 | free(buf); |
| 472 | 460 | return err; |
| 473 | 461 | } |
| 474 | 462 | |
| 475 | 463 | |
| 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) { | |
| 482 | 465 | uLong i; |
| 483 | 466 | unz_global_info64 gi; |
| 484 | 467 | int err; |
| 485 | 468 | |
| 486 | 469 | err = unzGetGlobalInfo64(uf,&gi); |
| @@ -506,17 +489,11 @@ | ||
| 506 | 489 | } |
| 507 | 490 | |
| 508 | 491 | return 0; |
| 509 | 492 | } |
| 510 | 493 | |
| 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) { | |
| 518 | 495 | if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) |
| 519 | 496 | { |
| 520 | 497 | printf("file %s not found in the zipfile\n",filename); |
| 521 | 498 | return 2; |
| 522 | 499 | } |
| @@ -528,14 +505,11 @@ | ||
| 528 | 505 | else |
| 529 | 506 | return 1; |
| 530 | 507 | } |
| 531 | 508 | |
| 532 | 509 | |
| 533 | -int main(argc,argv) | |
| 534 | - int argc; | |
| 535 | - char *argv[]; | |
| 536 | -{ | |
| 510 | +int main(int argc, char *argv[]) { | |
| 537 | 511 | const char *zipfilename=NULL; |
| 538 | 512 | const char *filename_to_extract=NULL; |
| 539 | 513 | const char *password=NULL; |
| 540 | 514 | char filename_try[MAXFILENAME+16] = ""; |
| 541 | 515 | int i; |
| @@ -604,11 +578,11 @@ | ||
| 604 | 578 | # ifdef USEWIN32IOAPI |
| 605 | 579 | zlib_filefunc64_def ffunc; |
| 606 | 580 | # endif |
| 607 | 581 | |
| 608 | 582 | 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. */ | |
| 610 | 584 | filename_try[ MAXFILENAME ] = '\0'; |
| 611 | 585 | |
| 612 | 586 | # ifdef USEWIN32IOAPI |
| 613 | 587 | fill_win32_filefunc64A(&ffunc); |
| 614 | 588 | uf = unzOpen2_64(zipfilename,&ffunc); |
| 615 | 589 |
| --- 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 |
+24
-36
| --- compat/zlib/contrib/minizip/minizip.c | ||
| +++ compat/zlib/contrib/minizip/minizip.c | ||
| @@ -26,11 +26,11 @@ | ||
| 26 | 26 | #ifndef _FILE_OFFSET_BIT |
| 27 | 27 | #define _FILE_OFFSET_BIT 64 |
| 28 | 28 | #endif |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | -#ifdef __APPLE__ | |
| 31 | +#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) | |
| 32 | 32 | // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions |
| 33 | 33 | #define FOPEN_FUNC(filename, mode) fopen(filename, mode) |
| 34 | 34 | #define FTELLO_FUNC(stream) ftello(stream) |
| 35 | 35 | #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) |
| 36 | 36 | #else |
| @@ -69,15 +69,13 @@ | ||
| 69 | 69 | |
| 70 | 70 | #define WRITEBUFFERSIZE (16384) |
| 71 | 71 | #define MAXFILENAME (256) |
| 72 | 72 | |
| 73 | 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 | -{ | |
| 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) { | |
| 79 | 77 | int ret = 0; |
| 80 | 78 | { |
| 81 | 79 | FILETIME ftLocal; |
| 82 | 80 | HANDLE hFind; |
| 83 | 81 | WIN32_FIND_DATAA ff32; |
| @@ -93,15 +91,13 @@ | ||
| 93 | 91 | } |
| 94 | 92 | return ret; |
| 95 | 93 | } |
| 96 | 94 | #else |
| 97 | 95 | #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) { | |
| 103 | 99 | (void)dt; |
| 104 | 100 | int ret=0; |
| 105 | 101 | struct stat s; /* results of stat() */ |
| 106 | 102 | struct tm* filedate; |
| 107 | 103 | time_t tm_t=0; |
| @@ -112,11 +108,11 @@ | ||
| 112 | 108 | size_t len = strlen(f); |
| 113 | 109 | if (len > MAXFILENAME) |
| 114 | 110 | len = MAXFILENAME; |
| 115 | 111 | |
| 116 | 112 | 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. */ | |
| 118 | 114 | name[ MAXFILENAME ] = '\0'; |
| 119 | 115 | |
| 120 | 116 | if (name[len - 1] == '/') |
| 121 | 117 | name[len - 1] = '\0'; |
| 122 | 118 | /* not all systems allow stat'ing a file with / appended */ |
| @@ -136,26 +132,25 @@ | ||
| 136 | 132 | tmzip->tm_year = filedate->tm_year; |
| 137 | 133 | |
| 138 | 134 | return ret; |
| 139 | 135 | } |
| 140 | 136 | #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; | |
| 146 | 143 | return 0; |
| 147 | 144 | } |
| 148 | 145 | #endif |
| 149 | 146 | #endif |
| 150 | 147 | |
| 151 | 148 | |
| 152 | 149 | |
| 153 | 150 | |
| 154 | -static int check_exist_file(filename) | |
| 155 | - const char* filename; | |
| 156 | -{ | |
| 151 | +static int check_exist_file(const char* filename) { | |
| 157 | 152 | FILE* ftestexist; |
| 158 | 153 | int ret = 1; |
| 159 | 154 | ftestexist = FOPEN_FUNC(filename,"rb"); |
| 160 | 155 | if (ftestexist==NULL) |
| 161 | 156 | ret = 0; |
| @@ -162,18 +157,16 @@ | ||
| 162 | 157 | else |
| 163 | 158 | fclose(ftestexist); |
| 164 | 159 | return ret; |
| 165 | 160 | } |
| 166 | 161 | |
| 167 | -static void do_banner() | |
| 168 | -{ | |
| 162 | +static void do_banner(void) { | |
| 169 | 163 | printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); |
| 170 | 164 | printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); |
| 171 | 165 | } |
| 172 | 166 | |
| 173 | -static void do_help() | |
| 174 | -{ | |
| 167 | +static void do_help(void) { | |
| 175 | 168 | printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ |
| 176 | 169 | " -o Overwrite existing file.zip\n" \ |
| 177 | 170 | " -a Append to existing file.zip\n" \ |
| 178 | 171 | " -0 Store only\n" \ |
| 179 | 172 | " -1 Compress faster\n" \ |
| @@ -181,12 +174,11 @@ | ||
| 181 | 174 | " -j exclude path. store only the file name.\n\n"); |
| 182 | 175 | } |
| 183 | 176 | |
| 184 | 177 | /* calculate the CRC32 of a file, |
| 185 | 178 | 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) { | |
| 188 | 180 | unsigned long calculate_crc=0; |
| 189 | 181 | int err=ZIP_OK; |
| 190 | 182 | FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); |
| 191 | 183 | |
| 192 | 184 | unsigned long size_read = 0; |
| @@ -220,22 +212,21 @@ | ||
| 220 | 212 | *result_crc=calculate_crc; |
| 221 | 213 | printf("file %s crc %lx\n", filenameinzip, calculate_crc); |
| 222 | 214 | return err; |
| 223 | 215 | } |
| 224 | 216 | |
| 225 | -static int isLargeFile(const char* filename) | |
| 226 | -{ | |
| 217 | +static int isLargeFile(const char* filename) { | |
| 227 | 218 | int largeFile = 0; |
| 228 | 219 | ZPOS64_T pos = 0; |
| 229 | 220 | FILE* pFile = FOPEN_FUNC(filename, "rb"); |
| 230 | 221 | |
| 231 | 222 | if(pFile != NULL) |
| 232 | 223 | { |
| 233 | 224 | FSEEKO_FUNC(pFile, 0, SEEK_END); |
| 234 | 225 | pos = (ZPOS64_T)FTELLO_FUNC(pFile); |
| 235 | 226 | |
| 236 | - printf("File : %s is %lld bytes\n", filename, pos); | |
| 227 | + printf("File : %s is %llu bytes\n", filename, pos); | |
| 237 | 228 | |
| 238 | 229 | if(pos >= 0xffffffff) |
| 239 | 230 | largeFile = 1; |
| 240 | 231 | |
| 241 | 232 | fclose(pFile); |
| @@ -242,14 +233,11 @@ | ||
| 242 | 233 | } |
| 243 | 234 | |
| 244 | 235 | return largeFile; |
| 245 | 236 | } |
| 246 | 237 | |
| 247 | -int main(argc,argv) | |
| 248 | - int argc; | |
| 249 | - char *argv[]; | |
| 250 | -{ | |
| 238 | +int main(int argc, char *argv[]) { | |
| 251 | 239 | int i; |
| 252 | 240 | int opt_overwrite=0; |
| 253 | 241 | int opt_compress_level=Z_DEFAULT_COMPRESSION; |
| 254 | 242 | int opt_exclude_path=0; |
| 255 | 243 | int zipfilenamearg = 0; |
| @@ -321,11 +309,11 @@ | ||
| 321 | 309 | int i,len; |
| 322 | 310 | int dot_found=0; |
| 323 | 311 | |
| 324 | 312 | zipok = 1 ; |
| 325 | 313 | 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. */ | |
| 327 | 315 | filename_try[ MAXFILENAME ] = '\0'; |
| 328 | 316 | |
| 329 | 317 | len=(int)strlen(filename_try); |
| 330 | 318 | for (i=0;i<len;i++) |
| 331 | 319 | if (filename_try[i]=='.') |
| @@ -391,14 +379,14 @@ | ||
| 391 | 379 | { |
| 392 | 380 | if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) && |
| 393 | 381 | ((argv[i][1]=='o') || (argv[i][1]=='O') || |
| 394 | 382 | (argv[i][1]=='a') || (argv[i][1]=='A') || |
| 395 | 383 | (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'))) && | |
| 397 | 385 | (strlen(argv[i]) == 2))) |
| 398 | 386 | { |
| 399 | - FILE * fin; | |
| 387 | + FILE * fin = NULL; | |
| 400 | 388 | size_t size_read; |
| 401 | 389 | const char* filenameinzip = argv[i]; |
| 402 | 390 | const char *savefilenameinzip; |
| 403 | 391 | zip_fileinfo zi; |
| 404 | 392 | unsigned long crcFile=0; |
| 405 | 393 |
| --- 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 @@ | ||
| 25 | 25 | #define WRITE_32(buff, n) do { \ |
| 26 | 26 | WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ |
| 27 | 27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ |
| 28 | 28 | } while(0) |
| 29 | 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 | -{ | |
| 30 | +extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) { | |
| 37 | 31 | int err = Z_OK; |
| 38 | 32 | FILE* fpZip = fopen(file, "rb"); |
| 39 | 33 | FILE* fpOut = fopen(fileOut, "wb"); |
| 40 | 34 | FILE* fpOutCD = fopen(fileOutTmp, "wb"); |
| 41 | 35 | if (fpZip != NULL && fpOut != NULL) { |
| 42 | 36 |
| --- 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 |
+196
-341
| --- compat/zlib/contrib/minizip/unzip.c | ||
| +++ compat/zlib/contrib/minizip/unzip.c | ||
| @@ -47,16 +47,16 @@ | ||
| 47 | 47 | 2007-2008 - Even Rouault - Add unzip support for ZIP64 |
| 48 | 48 | |
| 49 | 49 | Copyright (C) 2007-2008 Even Rouault |
| 50 | 50 | |
| 51 | 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). | |
| 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 | 53 | Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G |
| 54 | 54 | should only read the compressed/uncompressed size from the Zip64 format if |
| 55 | 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) | |
| 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 | 58 | Patch created by Daniel Borca |
| 59 | 59 | |
| 60 | 60 | Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer |
| 61 | 61 | |
| 62 | 62 | Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson |
| @@ -75,12 +75,10 @@ | ||
| 75 | 75 | #include "zlib.h" |
| 76 | 76 | #include "unzip.h" |
| 77 | 77 | |
| 78 | 78 | #ifdef STDC |
| 79 | 79 | # include <stddef.h> |
| 80 | -# include <string.h> | |
| 81 | -# include <stdlib.h> | |
| 82 | 80 | #endif |
| 83 | 81 | #ifdef NO_ERRNO_H |
| 84 | 82 | extern int errno; |
| 85 | 83 | #else |
| 86 | 84 | # include <errno.h> |
| @@ -109,13 +107,10 @@ | ||
| 109 | 107 | #endif |
| 110 | 108 | |
| 111 | 109 | #ifndef ALLOC |
| 112 | 110 | # define ALLOC(size) (malloc(size)) |
| 113 | 111 | #endif |
| 114 | -#ifndef TRYFREE | |
| 115 | -# define TRYFREE(p) { free(p);} | |
| 116 | -#endif | |
| 117 | 112 | |
| 118 | 113 | #define SIZECENTRALDIRITEM (0x2e) |
| 119 | 114 | #define SIZEZIPLOCALHEADER (0x1e) |
| 120 | 115 | |
| 121 | 116 | |
| @@ -151,11 +146,11 @@ | ||
| 151 | 146 | uLong crc32; /* crc32 of all data uncompressed */ |
| 152 | 147 | uLong crc32_wait; /* crc32 we must obtain after decompress all */ |
| 153 | 148 | ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */ |
| 154 | 149 | ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/ |
| 155 | 150 | zlib_filefunc64_32_def z_filefunc; |
| 156 | - voidpf filestream; /* io structore of the zipfile */ | |
| 151 | + voidpf filestream; /* io structure of the zipfile */ | |
| 157 | 152 | uLong compression_method; /* compression method (0==store) */ |
| 158 | 153 | ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ |
| 159 | 154 | int raw; |
| 160 | 155 | } file_in_zip64_read_info_s; |
| 161 | 156 | |
| @@ -164,11 +159,11 @@ | ||
| 164 | 159 | */ |
| 165 | 160 | typedef struct |
| 166 | 161 | { |
| 167 | 162 | zlib_filefunc64_32_def z_filefunc; |
| 168 | 163 | int is64bitOpenFunction; |
| 169 | - voidpf filestream; /* io structore of the zipfile */ | |
| 164 | + voidpf filestream; /* io structure of the zipfile */ | |
| 170 | 165 | unz_global_info64 gi; /* public global information */ |
| 171 | 166 | ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ |
| 172 | 167 | ZPOS64_T num_file; /* number of the current file in the zipfile*/ |
| 173 | 168 | ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/ |
| 174 | 169 | ZPOS64_T current_file_ok; /* flag about the usability of the current file*/ |
| @@ -194,162 +189,80 @@ | ||
| 194 | 189 | |
| 195 | 190 | |
| 196 | 191 | #ifndef NOUNCRYPT |
| 197 | 192 | #include "crypt.h" |
| 198 | 193 | #endif |
| 194 | + | |
| 199 | 195 | |
| 200 | 196 | /* =========================================================================== |
| 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 | |
| 204 | 198 | */ |
| 205 | 199 | |
| 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); | |
| 219 | 250 | return UNZ_OK; |
| 220 | 251 | } |
| 221 | 252 | else |
| 222 | 253 | { |
| 254 | + *pX = 0; | |
| 223 | 255 | if (ZERROR64(*pzlib_filefunc_def,filestream)) |
| 224 | 256 | return UNZ_ERRNO; |
| 225 | 257 | else |
| 226 | 258 | return UNZ_EOF; |
| 227 | 259 | } |
| 228 | 260 | } |
| 229 | 261 | |
| 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 | 262 | /* 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) { | |
| 351 | 264 | for (;;) |
| 352 | 265 | { |
| 353 | 266 | char c1=*(fileName1++); |
| 354 | 267 | char c2=*(fileName2++); |
| 355 | 268 | if ((c1>='a') && (c1<='z')) |
| @@ -377,23 +290,21 @@ | ||
| 377 | 290 | #ifndef STRCMPCASENOSENTIVEFUNCTION |
| 378 | 291 | #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal |
| 379 | 292 | #endif |
| 380 | 293 | |
| 381 | 294 | /* |
| 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 | |
| 385 | 298 | 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 | |
| 387 | 300 | (like 1 on Unix, 2 on Windows) |
| 388 | 301 | |
| 389 | 302 | */ |
| 390 | 303 | extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, |
| 391 | - const char* fileName2, | |
| 392 | - int iCaseSensitivity) | |
| 393 | - | |
| 394 | -{ | |
| 304 | + const char* fileName2, | |
| 305 | + int iCaseSensitivity) { | |
| 395 | 306 | if (iCaseSensitivity==0) |
| 396 | 307 | iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; |
| 397 | 308 | |
| 398 | 309 | if (iCaseSensitivity==1) |
| 399 | 310 | return strcmp(fileName1,fileName2); |
| @@ -403,35 +314,37 @@ | ||
| 403 | 314 | |
| 404 | 315 | #ifndef BUFREADCOMMENT |
| 405 | 316 | #define BUFREADCOMMENT (0x400) |
| 406 | 317 | #endif |
| 407 | 318 | |
| 319 | +#ifndef CENTRALDIRINVALID | |
| 320 | +#define CENTRALDIRINVALID ((ZPOS64_T)(-1)) | |
| 321 | +#endif | |
| 322 | + | |
| 408 | 323 | /* |
| 409 | 324 | Locate the Central directory of a zipfile (at the end, just before |
| 410 | 325 | the global comment) |
| 411 | 326 | */ |
| 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) { | |
| 415 | 328 | unsigned char* buf; |
| 416 | 329 | ZPOS64_T uSizeFile; |
| 417 | 330 | ZPOS64_T uBackRead; |
| 418 | 331 | ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ |
| 419 | - ZPOS64_T uPosFound=0; | |
| 332 | + ZPOS64_T uPosFound=CENTRALDIRINVALID; | |
| 420 | 333 | |
| 421 | 334 | if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) |
| 422 | - return 0; | |
| 335 | + return CENTRALDIRINVALID; | |
| 423 | 336 | |
| 424 | 337 | |
| 425 | 338 | uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); |
| 426 | 339 | |
| 427 | 340 | if (uMaxBack>uSizeFile) |
| 428 | 341 | uMaxBack = uSizeFile; |
| 429 | 342 | |
| 430 | 343 | buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); |
| 431 | 344 | if (buf==NULL) |
| 432 | - return 0; | |
| 345 | + return CENTRALDIRINVALID; | |
| 433 | 346 | |
| 434 | 347 | uBackRead = 4; |
| 435 | 348 | while (uBackRead<uMaxBack) |
| 436 | 349 | { |
| 437 | 350 | uLong uReadSize; |
| @@ -457,49 +370,44 @@ | ||
| 457 | 370 | { |
| 458 | 371 | uPosFound = uReadPos+(unsigned)i; |
| 459 | 372 | break; |
| 460 | 373 | } |
| 461 | 374 | |
| 462 | - if (uPosFound!=0) | |
| 375 | + if (uPosFound!=CENTRALDIRINVALID) | |
| 463 | 376 | break; |
| 464 | 377 | } |
| 465 | - TRYFREE(buf); | |
| 378 | + free(buf); | |
| 466 | 379 | return uPosFound; |
| 467 | 380 | } |
| 468 | 381 | |
| 469 | 382 | |
| 470 | 383 | /* |
| 471 | 384 | Locate the Central directory 64 of a zipfile (at the end, just before |
| 472 | 385 | the global comment) |
| 473 | 386 | */ |
| 474 | -local ZPOS64_T unz64local_SearchCentralDir64 OF(( | |
| 475 | - const zlib_filefunc64_32_def* pzlib_filefunc_def, | |
| 476 | - voidpf filestream)); | |
| 477 | - | |
| 478 | 387 | local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, |
| 479 | - voidpf filestream) | |
| 480 | -{ | |
| 388 | + voidpf filestream) { | |
| 481 | 389 | unsigned char* buf; |
| 482 | 390 | ZPOS64_T uSizeFile; |
| 483 | 391 | ZPOS64_T uBackRead; |
| 484 | 392 | ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ |
| 485 | - ZPOS64_T uPosFound=0; | |
| 393 | + ZPOS64_T uPosFound=CENTRALDIRINVALID; | |
| 486 | 394 | uLong uL; |
| 487 | 395 | ZPOS64_T relativeOffset; |
| 488 | 396 | |
| 489 | 397 | if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) |
| 490 | - return 0; | |
| 398 | + return CENTRALDIRINVALID; | |
| 491 | 399 | |
| 492 | 400 | |
| 493 | 401 | uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); |
| 494 | 402 | |
| 495 | 403 | if (uMaxBack>uSizeFile) |
| 496 | 404 | uMaxBack = uSizeFile; |
| 497 | 405 | |
| 498 | 406 | buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); |
| 499 | 407 | if (buf==NULL) |
| 500 | - return 0; | |
| 408 | + return CENTRALDIRINVALID; | |
| 501 | 409 | |
| 502 | 410 | uBackRead = 4; |
| 503 | 411 | while (uBackRead<uMaxBack) |
| 504 | 412 | { |
| 505 | 413 | uLong uReadSize; |
| @@ -525,51 +433,51 @@ | ||
| 525 | 433 | { |
| 526 | 434 | uPosFound = uReadPos+(unsigned)i; |
| 527 | 435 | break; |
| 528 | 436 | } |
| 529 | 437 | |
| 530 | - if (uPosFound!=0) | |
| 438 | + if (uPosFound!=CENTRALDIRINVALID) | |
| 531 | 439 | break; |
| 532 | 440 | } |
| 533 | - TRYFREE(buf); | |
| 534 | - if (uPosFound == 0) | |
| 535 | - return 0; | |
| 441 | + free(buf); | |
| 442 | + if (uPosFound == CENTRALDIRINVALID) | |
| 443 | + return CENTRALDIRINVALID; | |
| 536 | 444 | |
| 537 | 445 | /* Zip64 end of central directory locator */ |
| 538 | 446 | if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) |
| 539 | - return 0; | |
| 447 | + return CENTRALDIRINVALID; | |
| 540 | 448 | |
| 541 | 449 | /* the signature, already checked */ |
| 542 | 450 | if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
| 543 | - return 0; | |
| 451 | + return CENTRALDIRINVALID; | |
| 544 | 452 | |
| 545 | 453 | /* number of the disk with the start of the zip64 end of central directory */ |
| 546 | 454 | if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
| 547 | - return 0; | |
| 455 | + return CENTRALDIRINVALID; | |
| 548 | 456 | if (uL != 0) |
| 549 | - return 0; | |
| 457 | + return CENTRALDIRINVALID; | |
| 550 | 458 | |
| 551 | 459 | /* relative offset of the zip64 end of central directory record */ |
| 552 | 460 | if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK) |
| 553 | - return 0; | |
| 461 | + return CENTRALDIRINVALID; | |
| 554 | 462 | |
| 555 | 463 | /* total number of disks */ |
| 556 | 464 | if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
| 557 | - return 0; | |
| 465 | + return CENTRALDIRINVALID; | |
| 558 | 466 | if (uL != 1) |
| 559 | - return 0; | |
| 467 | + return CENTRALDIRINVALID; | |
| 560 | 468 | |
| 561 | 469 | /* Goto end of central directory record */ |
| 562 | 470 | if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0) |
| 563 | - return 0; | |
| 471 | + return CENTRALDIRINVALID; | |
| 564 | 472 | |
| 565 | 473 | /* the signature */ |
| 566 | 474 | if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) |
| 567 | - return 0; | |
| 475 | + return CENTRALDIRINVALID; | |
| 568 | 476 | |
| 569 | 477 | if (uL != 0x06064b50) |
| 570 | - return 0; | |
| 478 | + return CENTRALDIRINVALID; | |
| 571 | 479 | |
| 572 | 480 | return relativeOffset; |
| 573 | 481 | } |
| 574 | 482 | |
| 575 | 483 | /* |
| @@ -579,23 +487,22 @@ | ||
| 579 | 487 | If the zipfile cannot be opened (file doesn't exist or in not valid), the |
| 580 | 488 | return value is NULL. |
| 581 | 489 | Else, the return value is a unzFile Handle, usable with other function |
| 582 | 490 | of this unzip package. |
| 583 | 491 | */ |
| 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) { | |
| 588 | 495 | unz64_s us; |
| 589 | 496 | unz64_s *s; |
| 590 | 497 | ZPOS64_T central_pos; |
| 591 | 498 | uLong uL; |
| 592 | 499 | |
| 593 | 500 | uLong number_disk; /* number of the current dist, used for |
| 594 | - spaning ZIP, unsupported, always 0*/ | |
| 501 | + spanning ZIP, unsupported, always 0*/ | |
| 595 | 502 | 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*/ | |
| 597 | 504 | ZPOS64_T number_entry_CD; /* total number of entries in |
| 598 | 505 | the central dir |
| 599 | 506 | (same than number_entry on nospan) */ |
| 600 | 507 | |
| 601 | 508 | int err=UNZ_OK; |
| @@ -619,11 +526,11 @@ | ||
| 619 | 526 | ZLIB_FILEFUNC_MODE_EXISTING); |
| 620 | 527 | if (us.filestream==NULL) |
| 621 | 528 | return NULL; |
| 622 | 529 | |
| 623 | 530 | central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream); |
| 624 | - if (central_pos) | |
| 531 | + if (central_pos!=CENTRALDIRINVALID) | |
| 625 | 532 | { |
| 626 | 533 | uLong uS; |
| 627 | 534 | ZPOS64_T uL64; |
| 628 | 535 | |
| 629 | 536 | us.isZip64 = 1; |
| @@ -681,11 +588,11 @@ | ||
| 681 | 588 | us.gi.size_comment = 0; |
| 682 | 589 | } |
| 683 | 590 | else |
| 684 | 591 | { |
| 685 | 592 | central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream); |
| 686 | - if (central_pos==0) | |
| 593 | + if (central_pos==CENTRALDIRINVALID) | |
| 687 | 594 | err=UNZ_ERRNO; |
| 688 | 595 | |
| 689 | 596 | us.isZip64 = 0; |
| 690 | 597 | |
| 691 | 598 | if (ZSEEK64(us.z_filefunc, us.filestream, |
| @@ -760,13 +667,12 @@ | ||
| 760 | 667 | } |
| 761 | 668 | return (unzFile)s; |
| 762 | 669 | } |
| 763 | 670 | |
| 764 | 671 | |
| 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) { | |
| 768 | 674 | if (pzlib_filefunc32_def != NULL) |
| 769 | 675 | { |
| 770 | 676 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
| 771 | 677 | fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); |
| 772 | 678 | return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 0); |
| @@ -773,13 +679,12 @@ | ||
| 773 | 679 | } |
| 774 | 680 | else |
| 775 | 681 | return unzOpenInternal(path, NULL, 0); |
| 776 | 682 | } |
| 777 | 683 | |
| 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) { | |
| 781 | 686 | if (pzlib_filefunc_def != NULL) |
| 782 | 687 | { |
| 783 | 688 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
| 784 | 689 | zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; |
| 785 | 690 | zlib_filefunc64_32_def_fill.ztell32_file = NULL; |
| @@ -788,57 +693,52 @@ | ||
| 788 | 693 | } |
| 789 | 694 | else |
| 790 | 695 | return unzOpenInternal(path, NULL, 1); |
| 791 | 696 | } |
| 792 | 697 | |
| 793 | -extern unzFile ZEXPORT unzOpen (const char *path) | |
| 794 | -{ | |
| 698 | +extern unzFile ZEXPORT unzOpen(const char *path) { | |
| 795 | 699 | return unzOpenInternal(path, NULL, 0); |
| 796 | 700 | } |
| 797 | 701 | |
| 798 | -extern unzFile ZEXPORT unzOpen64 (const void *path) | |
| 799 | -{ | |
| 702 | +extern unzFile ZEXPORT unzOpen64(const void *path) { | |
| 800 | 703 | return unzOpenInternal(path, NULL, 1); |
| 801 | 704 | } |
| 802 | 705 | |
| 803 | 706 | /* |
| 804 | 707 | Close a ZipFile opened with unzOpen. |
| 805 | 708 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
| 806 | 709 | these files MUST be closed with unzCloseCurrentFile before call unzClose. |
| 807 | 710 | return UNZ_OK if there is no problem. */ |
| 808 | -extern int ZEXPORT unzClose (unzFile file) | |
| 809 | -{ | |
| 711 | +extern int ZEXPORT unzClose(unzFile file) { | |
| 810 | 712 | unz64_s* s; |
| 811 | 713 | if (file==NULL) |
| 812 | 714 | return UNZ_PARAMERROR; |
| 813 | 715 | s=(unz64_s*)file; |
| 814 | 716 | |
| 815 | 717 | if (s->pfile_in_zip_read!=NULL) |
| 816 | 718 | unzCloseCurrentFile(file); |
| 817 | 719 | |
| 818 | 720 | ZCLOSE64(s->z_filefunc, s->filestream); |
| 819 | - TRYFREE(s); | |
| 721 | + free(s); | |
| 820 | 722 | return UNZ_OK; |
| 821 | 723 | } |
| 822 | 724 | |
| 823 | 725 | |
| 824 | 726 | /* |
| 825 | 727 | Write info about the ZipFile in the *pglobal_info structure. |
| 826 | 728 | No preparation of the structure is needed |
| 827 | 729 | 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) { | |
| 830 | 731 | unz64_s* s; |
| 831 | 732 | if (file==NULL) |
| 832 | 733 | return UNZ_PARAMERROR; |
| 833 | 734 | s=(unz64_s*)file; |
| 834 | 735 | *pglobal_info=s->gi; |
| 835 | 736 | return UNZ_OK; |
| 836 | 737 | } |
| 837 | 738 | |
| 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) { | |
| 840 | 740 | unz64_s* s; |
| 841 | 741 | if (file==NULL) |
| 842 | 742 | return UNZ_PARAMERROR; |
| 843 | 743 | s=(unz64_s*)file; |
| 844 | 744 | /* to do : check if number_entry is not truncated */ |
| @@ -845,14 +745,13 @@ | ||
| 845 | 745 | pglobal_info32->number_entry = (uLong)s->gi.number_entry; |
| 846 | 746 | pglobal_info32->size_comment = s->gi.size_comment; |
| 847 | 747 | return UNZ_OK; |
| 848 | 748 | } |
| 849 | 749 | /* |
| 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) | |
| 851 | 751 | */ |
| 852 | -local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) | |
| 853 | -{ | |
| 752 | +local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) { | |
| 854 | 753 | ZPOS64_T uDate; |
| 855 | 754 | uDate = (ZPOS64_T)(ulDosDate>>16); |
| 856 | 755 | ptm->tm_mday = (int)(uDate&0x1f) ; |
| 857 | 756 | ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ; |
| 858 | 757 | ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ; |
| @@ -863,32 +762,20 @@ | ||
| 863 | 762 | } |
| 864 | 763 | |
| 865 | 764 | /* |
| 866 | 765 | Get Info about the current file in the zipfile, with internal only info |
| 867 | 766 | */ |
| 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) { | |
| 890 | 777 | unz64_s* s; |
| 891 | 778 | unz_file_info64 file_info; |
| 892 | 779 | unz_file_info64_internal file_info_internal; |
| 893 | 780 | int err=UNZ_OK; |
| 894 | 781 | uLong uMagic; |
| @@ -1036,37 +923,35 @@ | ||
| 1036 | 923 | err=UNZ_ERRNO; |
| 1037 | 924 | |
| 1038 | 925 | /* ZIP64 extra fields */ |
| 1039 | 926 | if (headerId == 0x0001) |
| 1040 | 927 | { |
| 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 | + } | |
| 1068 | 953 | |
| 1069 | 954 | } |
| 1070 | 955 | else |
| 1071 | 956 | { |
| 1072 | 957 | if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0) |
| @@ -1119,28 +1004,26 @@ | ||
| 1119 | 1004 | /* |
| 1120 | 1005 | Write info about the ZipFile in the *pglobal_info structure. |
| 1121 | 1006 | No preparation of the structure is needed |
| 1122 | 1007 | return UNZ_OK if there is no problem. |
| 1123 | 1008 | */ |
| 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) { | |
| 1130 | 1014 | 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); | |
| 1134 | 1018 | } |
| 1135 | 1019 | |
| 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) { | |
| 1142 | 1025 | int err; |
| 1143 | 1026 | unz_file_info64 file_info64; |
| 1144 | 1027 | err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, |
| 1145 | 1028 | szFileName,fileNameBufferSize, |
| 1146 | 1029 | extraField,extraFieldBufferSize, |
| @@ -1160,11 +1043,11 @@ | ||
| 1160 | 1043 | |
| 1161 | 1044 | pfile_info->disk_num_start = file_info64.disk_num_start; |
| 1162 | 1045 | pfile_info->internal_fa = file_info64.internal_fa; |
| 1163 | 1046 | pfile_info->external_fa = file_info64.external_fa; |
| 1164 | 1047 | |
| 1165 | - pfile_info->tmu_date = file_info64.tmu_date, | |
| 1048 | + pfile_info->tmu_date = file_info64.tmu_date; | |
| 1166 | 1049 | |
| 1167 | 1050 | |
| 1168 | 1051 | pfile_info->compressed_size = (uLong)file_info64.compressed_size; |
| 1169 | 1052 | pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; |
| 1170 | 1053 | |
| @@ -1173,12 +1056,11 @@ | ||
| 1173 | 1056 | } |
| 1174 | 1057 | /* |
| 1175 | 1058 | Set the current file of the zipfile to the first file. |
| 1176 | 1059 | return UNZ_OK if there is no problem |
| 1177 | 1060 | */ |
| 1178 | -extern int ZEXPORT unzGoToFirstFile (unzFile file) | |
| 1179 | -{ | |
| 1061 | +extern int ZEXPORT unzGoToFirstFile(unzFile file) { | |
| 1180 | 1062 | int err=UNZ_OK; |
| 1181 | 1063 | unz64_s* s; |
| 1182 | 1064 | if (file==NULL) |
| 1183 | 1065 | return UNZ_PARAMERROR; |
| 1184 | 1066 | s=(unz64_s*)file; |
| @@ -1194,12 +1076,11 @@ | ||
| 1194 | 1076 | /* |
| 1195 | 1077 | Set the current file of the zipfile to the next file. |
| 1196 | 1078 | return UNZ_OK if there is no problem |
| 1197 | 1079 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
| 1198 | 1080 | */ |
| 1199 | -extern int ZEXPORT unzGoToNextFile (unzFile file) | |
| 1200 | -{ | |
| 1081 | +extern int ZEXPORT unzGoToNextFile(unzFile file) { | |
| 1201 | 1082 | unz64_s* s; |
| 1202 | 1083 | int err; |
| 1203 | 1084 | |
| 1204 | 1085 | if (file==NULL) |
| 1205 | 1086 | return UNZ_PARAMERROR; |
| @@ -1227,12 +1108,11 @@ | ||
| 1227 | 1108 | |
| 1228 | 1109 | return value : |
| 1229 | 1110 | UNZ_OK if the file is found. It becomes the current file. |
| 1230 | 1111 | UNZ_END_OF_LIST_OF_FILE if the file is not found |
| 1231 | 1112 | */ |
| 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) { | |
| 1234 | 1114 | unz64_s* s; |
| 1235 | 1115 | int err; |
| 1236 | 1116 | |
| 1237 | 1117 | /* We remember the 'current' position in the file so that we can jump |
| 1238 | 1118 | * back there if we fail. |
| @@ -1303,12 +1183,11 @@ | ||
| 1303 | 1183 | ZPOS64_T pos_in_zip_directory; // offset in file |
| 1304 | 1184 | ZPOS64_T num_of_file; // # of file |
| 1305 | 1185 | } unz_file_pos; |
| 1306 | 1186 | */ |
| 1307 | 1187 | |
| 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) { | |
| 1310 | 1189 | unz64_s* s; |
| 1311 | 1190 | |
| 1312 | 1191 | if (file==NULL || file_pos==NULL) |
| 1313 | 1192 | return UNZ_PARAMERROR; |
| 1314 | 1193 | s=(unz64_s*)file; |
| @@ -1319,14 +1198,11 @@ | ||
| 1319 | 1198 | file_pos->num_of_file = s->num_file; |
| 1320 | 1199 | |
| 1321 | 1200 | return UNZ_OK; |
| 1322 | 1201 | } |
| 1323 | 1202 | |
| 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) { | |
| 1328 | 1204 | unz64_file_pos file_pos64; |
| 1329 | 1205 | int err = unzGetFilePos64(file,&file_pos64); |
| 1330 | 1206 | if (err==UNZ_OK) |
| 1331 | 1207 | { |
| 1332 | 1208 | file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory; |
| @@ -1333,12 +1209,11 @@ | ||
| 1333 | 1209 | file_pos->num_of_file = (uLong)file_pos64.num_of_file; |
| 1334 | 1210 | } |
| 1335 | 1211 | return err; |
| 1336 | 1212 | } |
| 1337 | 1213 | |
| 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) { | |
| 1340 | 1215 | unz64_s* s; |
| 1341 | 1216 | int err; |
| 1342 | 1217 | |
| 1343 | 1218 | if (file==NULL || file_pos==NULL) |
| 1344 | 1219 | return UNZ_PARAMERROR; |
| @@ -1355,14 +1230,11 @@ | ||
| 1355 | 1230 | /* return results */ |
| 1356 | 1231 | s->current_file_ok = (err == UNZ_OK); |
| 1357 | 1232 | return err; |
| 1358 | 1233 | } |
| 1359 | 1234 | |
| 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) { | |
| 1364 | 1236 | unz64_file_pos file_pos64; |
| 1365 | 1237 | if (file_pos == NULL) |
| 1366 | 1238 | return UNZ_PARAMERROR; |
| 1367 | 1239 | |
| 1368 | 1240 | file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory; |
| @@ -1380,14 +1252,13 @@ | ||
| 1380 | 1252 | Check the coherency of the local header and info in the end of central |
| 1381 | 1253 | directory about this file |
| 1382 | 1254 | store in *piSizeVar the size of extra info in local header |
| 1383 | 1255 | (filename and size of extra field data) |
| 1384 | 1256 | */ |
| 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) { | |
| 1389 | 1260 | uLong uMagic,uData,uFlags; |
| 1390 | 1261 | uLong size_filename; |
| 1391 | 1262 | uLong size_extra_field; |
| 1392 | 1263 | int err=UNZ_OK; |
| 1393 | 1264 | |
| @@ -1467,13 +1338,12 @@ | ||
| 1467 | 1338 | |
| 1468 | 1339 | /* |
| 1469 | 1340 | Open for reading data the current file in the zipfile. |
| 1470 | 1341 | If there is no error and the file is opened, the return value is UNZ_OK. |
| 1471 | 1342 | */ |
| 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) { | |
| 1475 | 1345 | int err=UNZ_OK; |
| 1476 | 1346 | uInt iSizeVar; |
| 1477 | 1347 | unz64_s* s; |
| 1478 | 1348 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1479 | 1349 | ZPOS64_T offset_local_extrafield; /* offset of the local extra field */ |
| @@ -1507,11 +1377,11 @@ | ||
| 1507 | 1377 | pfile_in_zip_read_info->pos_local_extrafield=0; |
| 1508 | 1378 | pfile_in_zip_read_info->raw=raw; |
| 1509 | 1379 | |
| 1510 | 1380 | if (pfile_in_zip_read_info->read_buffer==NULL) |
| 1511 | 1381 | { |
| 1512 | - TRYFREE(pfile_in_zip_read_info); | |
| 1382 | + free(pfile_in_zip_read_info); | |
| 1513 | 1383 | return UNZ_INTERNALERROR; |
| 1514 | 1384 | } |
| 1515 | 1385 | |
| 1516 | 1386 | pfile_in_zip_read_info->stream_initialised=0; |
| 1517 | 1387 | |
| @@ -1564,12 +1434,12 @@ | ||
| 1564 | 1434 | err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0); |
| 1565 | 1435 | if (err == Z_OK) |
| 1566 | 1436 | pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; |
| 1567 | 1437 | else |
| 1568 | 1438 | { |
| 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); | |
| 1571 | 1441 | return err; |
| 1572 | 1442 | } |
| 1573 | 1443 | #else |
| 1574 | 1444 | pfile_in_zip_read_info->raw=1; |
| 1575 | 1445 | #endif |
| @@ -1585,12 +1455,12 @@ | ||
| 1585 | 1455 | err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); |
| 1586 | 1456 | if (err == Z_OK) |
| 1587 | 1457 | pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; |
| 1588 | 1458 | else |
| 1589 | 1459 | { |
| 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); | |
| 1592 | 1462 | return err; |
| 1593 | 1463 | } |
| 1594 | 1464 | /* windowBits is passed < 0 to tell that there is no zlib header. |
| 1595 | 1465 | * Note that in this case inflate *requires* an extra "dummy" byte |
| 1596 | 1466 | * after the compressed stream in order to complete decompression and |
| @@ -1638,29 +1508,25 @@ | ||
| 1638 | 1508 | |
| 1639 | 1509 | |
| 1640 | 1510 | return UNZ_OK; |
| 1641 | 1511 | } |
| 1642 | 1512 | |
| 1643 | -extern int ZEXPORT unzOpenCurrentFile (unzFile file) | |
| 1644 | -{ | |
| 1513 | +extern int ZEXPORT unzOpenCurrentFile(unzFile file) { | |
| 1645 | 1514 | return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); |
| 1646 | 1515 | } |
| 1647 | 1516 | |
| 1648 | -extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password) | |
| 1649 | -{ | |
| 1517 | +extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) { | |
| 1650 | 1518 | return unzOpenCurrentFile3(file, NULL, NULL, 0, password); |
| 1651 | 1519 | } |
| 1652 | 1520 | |
| 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) { | |
| 1655 | 1522 | return unzOpenCurrentFile3(file, method, level, raw, NULL); |
| 1656 | 1523 | } |
| 1657 | 1524 | |
| 1658 | 1525 | /** Addition for GDAL : START */ |
| 1659 | 1526 | |
| 1660 | -extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) | |
| 1661 | -{ | |
| 1527 | +extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) { | |
| 1662 | 1528 | unz64_s* s; |
| 1663 | 1529 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1664 | 1530 | s=(unz64_s*)file; |
| 1665 | 1531 | if (file==NULL) |
| 1666 | 1532 | return 0; //UNZ_PARAMERROR; |
| @@ -1676,17 +1542,16 @@ | ||
| 1676 | 1542 | /* |
| 1677 | 1543 | Read bytes from the current file. |
| 1678 | 1544 | buf contain buffer where data must be copied |
| 1679 | 1545 | len the size of buf. |
| 1680 | 1546 | |
| 1681 | - return the number of byte copied if somes bytes are copied | |
| 1547 | + return the number of byte copied if some bytes are copied | |
| 1682 | 1548 | return 0 if the end of file was reached |
| 1683 | 1549 | return <0 with error code if there is an error |
| 1684 | 1550 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) |
| 1685 | 1551 | */ |
| 1686 | -extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) | |
| 1687 | -{ | |
| 1552 | +extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) { | |
| 1688 | 1553 | int err=UNZ_OK; |
| 1689 | 1554 | uInt iRead = 0; |
| 1690 | 1555 | unz64_s* s; |
| 1691 | 1556 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1692 | 1557 | if (file==NULL) |
| @@ -1889,12 +1754,11 @@ | ||
| 1889 | 1754 | |
| 1890 | 1755 | |
| 1891 | 1756 | /* |
| 1892 | 1757 | Give the current position in uncompressed data |
| 1893 | 1758 | */ |
| 1894 | -extern z_off_t ZEXPORT unztell (unzFile file) | |
| 1895 | -{ | |
| 1759 | +extern z_off_t ZEXPORT unztell(unzFile file) { | |
| 1896 | 1760 | unz64_s* s; |
| 1897 | 1761 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1898 | 1762 | if (file==NULL) |
| 1899 | 1763 | return UNZ_PARAMERROR; |
| 1900 | 1764 | s=(unz64_s*)file; |
| @@ -1904,12 +1768,11 @@ | ||
| 1904 | 1768 | return UNZ_PARAMERROR; |
| 1905 | 1769 | |
| 1906 | 1770 | return (z_off_t)pfile_in_zip_read_info->stream.total_out; |
| 1907 | 1771 | } |
| 1908 | 1772 | |
| 1909 | -extern ZPOS64_T ZEXPORT unztell64 (unzFile file) | |
| 1910 | -{ | |
| 1773 | +extern ZPOS64_T ZEXPORT unztell64(unzFile file) { | |
| 1911 | 1774 | |
| 1912 | 1775 | unz64_s* s; |
| 1913 | 1776 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1914 | 1777 | if (file==NULL) |
| 1915 | 1778 | return (ZPOS64_T)-1; |
| @@ -1924,12 +1787,11 @@ | ||
| 1924 | 1787 | |
| 1925 | 1788 | |
| 1926 | 1789 | /* |
| 1927 | 1790 | return 1 if the end of file was reached, 0 elsewhere |
| 1928 | 1791 | */ |
| 1929 | -extern int ZEXPORT unzeof (unzFile file) | |
| 1930 | -{ | |
| 1792 | +extern int ZEXPORT unzeof(unzFile file) { | |
| 1931 | 1793 | unz64_s* s; |
| 1932 | 1794 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1933 | 1795 | if (file==NULL) |
| 1934 | 1796 | return UNZ_PARAMERROR; |
| 1935 | 1797 | s=(unz64_s*)file; |
| @@ -1956,12 +1818,11 @@ | ||
| 1956 | 1818 | if buf!=NULL, len is the size of the buffer, the extra header is copied in |
| 1957 | 1819 | buf. |
| 1958 | 1820 | the return value is the number of bytes copied in buf, or (if <0) |
| 1959 | 1821 | the error code |
| 1960 | 1822 | */ |
| 1961 | -extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) | |
| 1962 | -{ | |
| 1823 | +extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) { | |
| 1963 | 1824 | unz64_s* s; |
| 1964 | 1825 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 1965 | 1826 | uInt read_now; |
| 1966 | 1827 | ZPOS64_T size_to_read; |
| 1967 | 1828 | |
| @@ -2004,12 +1865,11 @@ | ||
| 2004 | 1865 | |
| 2005 | 1866 | /* |
| 2006 | 1867 | Close the file in zip opened with unzOpenCurrentFile |
| 2007 | 1868 | Return UNZ_CRCERROR if all the file was read but the CRC is not good |
| 2008 | 1869 | */ |
| 2009 | -extern int ZEXPORT unzCloseCurrentFile (unzFile file) | |
| 2010 | -{ | |
| 1870 | +extern int ZEXPORT unzCloseCurrentFile(unzFile file) { | |
| 2011 | 1871 | int err=UNZ_OK; |
| 2012 | 1872 | |
| 2013 | 1873 | unz64_s* s; |
| 2014 | 1874 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
| 2015 | 1875 | if (file==NULL) |
| @@ -2027,11 +1887,11 @@ | ||
| 2027 | 1887 | if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) |
| 2028 | 1888 | err=UNZ_CRCERROR; |
| 2029 | 1889 | } |
| 2030 | 1890 | |
| 2031 | 1891 | |
| 2032 | - TRYFREE(pfile_in_zip_read_info->read_buffer); | |
| 1892 | + free(pfile_in_zip_read_info->read_buffer); | |
| 2033 | 1893 | pfile_in_zip_read_info->read_buffer = NULL; |
| 2034 | 1894 | if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) |
| 2035 | 1895 | inflateEnd(&pfile_in_zip_read_info->stream); |
| 2036 | 1896 | #ifdef HAVE_BZIP2 |
| 2037 | 1897 | else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) |
| @@ -2038,11 +1898,11 @@ | ||
| 2038 | 1898 | BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); |
| 2039 | 1899 | #endif |
| 2040 | 1900 | |
| 2041 | 1901 | |
| 2042 | 1902 | pfile_in_zip_read_info->stream_initialised = 0; |
| 2043 | - TRYFREE(pfile_in_zip_read_info); | |
| 1903 | + free(pfile_in_zip_read_info); | |
| 2044 | 1904 | |
| 2045 | 1905 | s->pfile_in_zip_read=NULL; |
| 2046 | 1906 | |
| 2047 | 1907 | return err; |
| 2048 | 1908 | } |
| @@ -2051,12 +1911,11 @@ | ||
| 2051 | 1911 | /* |
| 2052 | 1912 | Get the global comment string of the ZipFile, in the szComment buffer. |
| 2053 | 1913 | uSizeBuf is the size of the szComment buffer. |
| 2054 | 1914 | return the number of byte copied or an error code <0 |
| 2055 | 1915 | */ |
| 2056 | -extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf) | |
| 2057 | -{ | |
| 1916 | +extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) { | |
| 2058 | 1917 | unz64_s* s; |
| 2059 | 1918 | uLong uReadThis ; |
| 2060 | 1919 | if (file==NULL) |
| 2061 | 1920 | return (int)UNZ_PARAMERROR; |
| 2062 | 1921 | s=(unz64_s*)file; |
| @@ -2079,12 +1938,11 @@ | ||
| 2079 | 1938 | *(szComment+s->gi.size_comment)='\0'; |
| 2080 | 1939 | return (int)uReadThis; |
| 2081 | 1940 | } |
| 2082 | 1941 | |
| 2083 | 1942 | /* Additions by RX '2004 */ |
| 2084 | -extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) | |
| 2085 | -{ | |
| 1943 | +extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) { | |
| 2086 | 1944 | unz64_s* s; |
| 2087 | 1945 | |
| 2088 | 1946 | if (file==NULL) |
| 2089 | 1947 | return 0; //UNZ_PARAMERROR; |
| 2090 | 1948 | s=(unz64_s*)file; |
| @@ -2094,22 +1952,20 @@ | ||
| 2094 | 1952 | if (s->num_file==s->gi.number_entry) |
| 2095 | 1953 | return 0; |
| 2096 | 1954 | return s->pos_in_central_dir; |
| 2097 | 1955 | } |
| 2098 | 1956 | |
| 2099 | -extern uLong ZEXPORT unzGetOffset (unzFile file) | |
| 2100 | -{ | |
| 1957 | +extern uLong ZEXPORT unzGetOffset(unzFile file) { | |
| 2101 | 1958 | ZPOS64_T offset64; |
| 2102 | 1959 | |
| 2103 | 1960 | if (file==NULL) |
| 2104 | 1961 | return 0; //UNZ_PARAMERROR; |
| 2105 | 1962 | offset64 = unzGetOffset64(file); |
| 2106 | 1963 | return (uLong)offset64; |
| 2107 | 1964 | } |
| 2108 | 1965 | |
| 2109 | -extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) | |
| 2110 | -{ | |
| 1966 | +extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) { | |
| 2111 | 1967 | unz64_s* s; |
| 2112 | 1968 | int err; |
| 2113 | 1969 | |
| 2114 | 1970 | if (file==NULL) |
| 2115 | 1971 | return UNZ_PARAMERROR; |
| @@ -2122,9 +1978,8 @@ | ||
| 2122 | 1978 | NULL,0,NULL,0,NULL,0); |
| 2123 | 1979 | s->current_file_ok = (err == UNZ_OK); |
| 2124 | 1980 | return err; |
| 2125 | 1981 | } |
| 2126 | 1982 | |
| 2127 | -extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) | |
| 2128 | -{ | |
| 1983 | +extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) { | |
| 2129 | 1984 | return unzSetOffset64(file,pos); |
| 2130 | 1985 | } |
| 2131 | 1986 |
| --- 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 |
+68
-68
| --- compat/zlib/contrib/minizip/unzip.h | ||
| +++ compat/zlib/contrib/minizip/unzip.h | ||
| @@ -148,25 +148,25 @@ | ||
| 148 | 148 | uLong external_fa; /* external file attributes 4 bytes */ |
| 149 | 149 | |
| 150 | 150 | tm_unz tmu_date; |
| 151 | 151 | } unz_file_info; |
| 152 | 152 | |
| 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); | |
| 156 | 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 | |
| 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 | 160 | 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 | |
| 162 | 162 | (like 1 on Unix, 2 on Windows) |
| 163 | 163 | */ |
| 164 | 164 | |
| 165 | 165 | |
| 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); | |
| 168 | 168 | /* |
| 169 | 169 | Open a Zip file. path contain the full pathname (by example, |
| 170 | 170 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer |
| 171 | 171 | "zlib/zlib113.zip". |
| 172 | 172 | If the zipfile cannot be opened (file don't exist or in not valid), the |
| @@ -179,45 +179,45 @@ | ||
| 179 | 179 | is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* |
| 180 | 180 | does not describe the reality |
| 181 | 181 | */ |
| 182 | 182 | |
| 183 | 183 | |
| 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); | |
| 186 | 186 | /* |
| 187 | 187 | Open a Zip file, like unzOpen, but provide a set of file low level API |
| 188 | 188 | for read/write the zip file (see ioapi.h) |
| 189 | 189 | */ |
| 190 | 190 | |
| 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); | |
| 193 | 193 | /* |
| 194 | 194 | Open a Zip file, like unz64Open, but provide a set of file low level API |
| 195 | 195 | for read/write the zip file (see ioapi.h) |
| 196 | 196 | */ |
| 197 | 197 | |
| 198 | -extern int ZEXPORT unzClose OF((unzFile file)); | |
| 198 | +extern int ZEXPORT unzClose(unzFile file); | |
| 199 | 199 | /* |
| 200 | 200 | Close a ZipFile opened with unzOpen. |
| 201 | 201 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
| 202 | 202 | these files MUST be closed with unzCloseCurrentFile before call unzClose. |
| 203 | 203 | return UNZ_OK if there is no problem. */ |
| 204 | 204 | |
| 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); | |
| 207 | 207 | |
| 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); | |
| 210 | 210 | /* |
| 211 | 211 | Write info about the ZipFile in the *pglobal_info structure. |
| 212 | 212 | No preparation of the structure is needed |
| 213 | 213 | return UNZ_OK if there is no problem. */ |
| 214 | 214 | |
| 215 | 215 | |
| 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); | |
| 219 | 219 | /* |
| 220 | 220 | Get the global comment string of the ZipFile, in the szComment buffer. |
| 221 | 221 | uSizeBuf is the size of the szComment buffer. |
| 222 | 222 | return the number of byte copied or an error code <0 |
| 223 | 223 | */ |
| @@ -224,26 +224,26 @@ | ||
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | /***************************************************************************/ |
| 227 | 227 | /* Unzip package allow you browse the directory of the zipfile */ |
| 228 | 228 | |
| 229 | -extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); | |
| 229 | +extern int ZEXPORT unzGoToFirstFile(unzFile file); | |
| 230 | 230 | /* |
| 231 | 231 | Set the current file of the zipfile to the first file. |
| 232 | 232 | return UNZ_OK if there is no problem |
| 233 | 233 | */ |
| 234 | 234 | |
| 235 | -extern int ZEXPORT unzGoToNextFile OF((unzFile file)); | |
| 235 | +extern int ZEXPORT unzGoToNextFile(unzFile file); | |
| 236 | 236 | /* |
| 237 | 237 | Set the current file of the zipfile to the next file. |
| 238 | 238 | return UNZ_OK if there is no problem |
| 239 | 239 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
| 240 | 240 | */ |
| 241 | 241 | |
| 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); | |
| 245 | 245 | /* |
| 246 | 246 | Try locate the file szFileName in the zipfile. |
| 247 | 247 | For the iCaseSensitivity signification, see unzStringFileNameCompare |
| 248 | 248 | |
| 249 | 249 | return value : |
| @@ -283,30 +283,30 @@ | ||
| 283 | 283 | unzFile file, |
| 284 | 284 | const unz64_file_pos* file_pos); |
| 285 | 285 | |
| 286 | 286 | /* ****************************************** */ |
| 287 | 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)); | |
| 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 | 305 | /* |
| 306 | 306 | 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 | |
| 308 | 308 | the current file |
| 309 | 309 | if szFileName!=NULL, the filemane string will be copied in szFileName |
| 310 | 310 | (fileNameBufferSize is the size of the buffer) |
| 311 | 311 | if extraField!=NULL, the extra field information will be copied in extraField |
| 312 | 312 | (extraFieldBufferSize is the size of the buffer). |
| @@ -316,52 +316,52 @@ | ||
| 316 | 316 | */ |
| 317 | 317 | |
| 318 | 318 | |
| 319 | 319 | /** Addition for GDAL : START */ |
| 320 | 320 | |
| 321 | -extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); | |
| 321 | +extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file); | |
| 322 | 322 | |
| 323 | 323 | /** Addition for GDAL : END */ |
| 324 | 324 | |
| 325 | 325 | |
| 326 | 326 | /***************************************************************************/ |
| 327 | 327 | /* for reading the content of the current zipfile, you can open it, read data |
| 328 | 328 | from it, and close it (you can close it before reading all the file) |
| 329 | 329 | */ |
| 330 | 330 | |
| 331 | -extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); | |
| 331 | +extern int ZEXPORT unzOpenCurrentFile(unzFile file); | |
| 332 | 332 | /* |
| 333 | 333 | Open for reading data the current file in the zipfile. |
| 334 | 334 | If there is no error, the return value is UNZ_OK. |
| 335 | 335 | */ |
| 336 | 336 | |
| 337 | -extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, | |
| 338 | - const char* password)); | |
| 337 | +extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, | |
| 338 | + const char* password); | |
| 339 | 339 | /* |
| 340 | 340 | Open for reading data the current file in the zipfile. |
| 341 | 341 | password is a crypting password |
| 342 | 342 | If there is no error, the return value is UNZ_OK. |
| 343 | 343 | */ |
| 344 | 344 | |
| 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); | |
| 349 | 349 | /* |
| 350 | 350 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) |
| 351 | 351 | if raw==1 |
| 352 | 352 | *method will receive method of compression, *level will receive level of |
| 353 | 353 | compression |
| 354 | 354 | note : you can set level parameter as NULL (if you did not want known level, |
| 355 | 355 | but you CANNOT set method parameter as NULL |
| 356 | 356 | */ |
| 357 | 357 | |
| 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); | |
| 363 | 363 | /* |
| 364 | 364 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) |
| 365 | 365 | if raw==1 |
| 366 | 366 | *method will receive method of compression, *level will receive level of |
| 367 | 367 | compression |
| @@ -368,45 +368,45 @@ | ||
| 368 | 368 | note : you can set level parameter as NULL (if you did not want known level, |
| 369 | 369 | but you CANNOT set method parameter as NULL |
| 370 | 370 | */ |
| 371 | 371 | |
| 372 | 372 | |
| 373 | -extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); | |
| 373 | +extern int ZEXPORT unzCloseCurrentFile(unzFile file); | |
| 374 | 374 | /* |
| 375 | 375 | Close the file in zip opened with unzOpenCurrentFile |
| 376 | 376 | Return UNZ_CRCERROR if all the file was read but the CRC is not good |
| 377 | 377 | */ |
| 378 | 378 | |
| 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); | |
| 382 | 382 | /* |
| 383 | 383 | Read bytes from the current file (opened by unzOpenCurrentFile) |
| 384 | 384 | buf contain buffer where data must be copied |
| 385 | 385 | len the size of buf. |
| 386 | 386 | |
| 387 | - return the number of byte copied if somes bytes are copied | |
| 387 | + return the number of byte copied if some bytes are copied | |
| 388 | 388 | return 0 if the end of file was reached |
| 389 | 389 | return <0 with error code if there is an error |
| 390 | 390 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) |
| 391 | 391 | */ |
| 392 | 392 | |
| 393 | -extern z_off_t ZEXPORT unztell OF((unzFile file)); | |
| 393 | +extern z_off_t ZEXPORT unztell(unzFile file); | |
| 394 | 394 | |
| 395 | -extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); | |
| 395 | +extern ZPOS64_T ZEXPORT unztell64(unzFile file); | |
| 396 | 396 | /* |
| 397 | 397 | Give the current position in uncompressed data |
| 398 | 398 | */ |
| 399 | 399 | |
| 400 | -extern int ZEXPORT unzeof OF((unzFile file)); | |
| 400 | +extern int ZEXPORT unzeof(unzFile file); | |
| 401 | 401 | /* |
| 402 | 402 | return 1 if the end of file was reached, 0 elsewhere |
| 403 | 403 | */ |
| 404 | 404 | |
| 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); | |
| 408 | 408 | /* |
| 409 | 409 | Read extra field from the current file (opened by unzOpenCurrentFile) |
| 410 | 410 | This is the local-header version of the extra field (sometimes, there is |
| 411 | 411 | more info in the local-header version than in the central-header) |
| 412 | 412 | |
| 413 | 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 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 |
+137
-194
| --- compat/zlib/contrib/minizip/zip.c | ||
| +++ compat/zlib/contrib/minizip/zip.c | ||
| @@ -12,11 +12,11 @@ | ||
| 12 | 12 | Changes |
| 13 | 13 | Oct-2009 - Mathias Svensson - Remove old C style function prototypes |
| 14 | 14 | Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives |
| 15 | 15 | Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions. |
| 16 | 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. | |
| 17 | + It is used when recreating zip archive with RAW when deleting items from a zip. | |
| 18 | 18 | ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed. |
| 19 | 19 | Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required) |
| 20 | 20 | Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer |
| 21 | 21 | |
| 22 | 22 | */ |
| @@ -23,18 +23,17 @@ | ||
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | #include <stdio.h> |
| 26 | 26 | #include <stdlib.h> |
| 27 | 27 | #include <string.h> |
| 28 | +#include <stdint.h> | |
| 28 | 29 | #include <time.h> |
| 29 | 30 | #include "zlib.h" |
| 30 | 31 | #include "zip.h" |
| 31 | 32 | |
| 32 | 33 | #ifdef STDC |
| 33 | 34 | # include <stddef.h> |
| 34 | -# include <string.h> | |
| 35 | -# include <stdlib.h> | |
| 36 | 35 | #endif |
| 37 | 36 | #ifdef NO_ERRNO_H |
| 38 | 37 | extern int errno; |
| 39 | 38 | #else |
| 40 | 39 | # include <errno.h> |
| @@ -45,11 +44,11 @@ | ||
| 45 | 44 | # define local static |
| 46 | 45 | #endif |
| 47 | 46 | /* compile with -Dlocal if your debugger can't find static symbols */ |
| 48 | 47 | |
| 49 | 48 | #ifndef VERSIONMADEBY |
| 50 | -# define VERSIONMADEBY (0x0) /* platform depedent */ | |
| 49 | +# define VERSIONMADEBY (0x0) /* platform dependent */ | |
| 51 | 50 | #endif |
| 52 | 51 | |
| 53 | 52 | #ifndef Z_BUFSIZE |
| 54 | 53 | #define Z_BUFSIZE (64*1024) //(16384) |
| 55 | 54 | #endif |
| @@ -59,13 +58,10 @@ | ||
| 59 | 58 | #endif |
| 60 | 59 | |
| 61 | 60 | #ifndef ALLOC |
| 62 | 61 | # define ALLOC(size) (malloc(size)) |
| 63 | 62 | #endif |
| 64 | -#ifndef TRYFREE | |
| 65 | -# define TRYFREE(p) {if (p) free(p);} | |
| 66 | -#endif | |
| 67 | 63 | |
| 68 | 64 | /* |
| 69 | 65 | #define SIZECENTRALDIRITEM (0x2e) |
| 70 | 66 | #define SIZEZIPLOCALHEADER (0x1e) |
| 71 | 67 | */ |
| @@ -136,24 +132,24 @@ | ||
| 136 | 132 | |
| 137 | 133 | int stream_initialised; /* 1 is stream is initialised */ |
| 138 | 134 | uInt pos_in_buffered_data; /* last written byte in buffered_data */ |
| 139 | 135 | |
| 140 | 136 | ZPOS64_T pos_local_header; /* offset of the local header of the file |
| 141 | - currenty writing */ | |
| 137 | + currently writing */ | |
| 142 | 138 | char* central_header; /* central header data for the current file */ |
| 143 | 139 | uLong size_centralExtra; |
| 144 | 140 | uLong size_centralheader; /* size of the central header for cur file */ |
| 145 | 141 | uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */ |
| 146 | 142 | uLong flag; /* flag of the file currently writing */ |
| 147 | 143 | |
| 148 | - int method; /* compression method of file currenty wr.*/ | |
| 144 | + int method; /* compression method of file currently wr.*/ | |
| 149 | 145 | int raw; /* 1 for directly writing raw data */ |
| 150 | 146 | Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/ |
| 151 | 147 | uLong dosDate; |
| 152 | 148 | uLong crc32; |
| 153 | 149 | int encrypt; |
| 154 | - int zip64; /* Add ZIP64 extened information in the extra field */ | |
| 150 | + int zip64; /* Add ZIP64 extended information in the extra field */ | |
| 155 | 151 | ZPOS64_T pos_zip64extrainfo; |
| 156 | 152 | ZPOS64_T totalCompressedData; |
| 157 | 153 | ZPOS64_T totalUncompressedData; |
| 158 | 154 | #ifndef NOCRYPT |
| 159 | 155 | unsigned long keys[3]; /* keys defining the pseudo-random sequence */ |
| @@ -163,14 +159,14 @@ | ||
| 163 | 159 | } curfile64_info; |
| 164 | 160 | |
| 165 | 161 | typedef struct |
| 166 | 162 | { |
| 167 | 163 | zlib_filefunc64_32_def z_filefunc; |
| 168 | - voidpf filestream; /* io structore of the zipfile */ | |
| 164 | + voidpf filestream; /* io structure of the zipfile */ | |
| 169 | 165 | linkedlist_data central_dir;/* datablock with central dir in construction*/ |
| 170 | 166 | 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 */ | |
| 172 | 168 | |
| 173 | 169 | ZPOS64_T begin_pos; /* position of the beginning of the zipfile */ |
| 174 | 170 | ZPOS64_T add_position_when_writing_offset; |
| 175 | 171 | ZPOS64_T number_entry; |
| 176 | 172 | |
| @@ -184,12 +180,11 @@ | ||
| 184 | 180 | #ifndef NOCRYPT |
| 185 | 181 | #define INCLUDECRYPTINGCODE_IFCRYPTALLOWED |
| 186 | 182 | #include "crypt.h" |
| 187 | 183 | #endif |
| 188 | 184 | |
| 189 | -local linkedlist_datablock_internal* allocate_new_datablock() | |
| 190 | -{ | |
| 185 | +local linkedlist_datablock_internal* allocate_new_datablock(void) { | |
| 191 | 186 | linkedlist_datablock_internal* ldi; |
| 192 | 187 | ldi = (linkedlist_datablock_internal*) |
| 193 | 188 | ALLOC(sizeof(linkedlist_datablock_internal)); |
| 194 | 189 | if (ldi!=NULL) |
| 195 | 190 | { |
| @@ -198,34 +193,30 @@ | ||
| 198 | 193 | ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ; |
| 199 | 194 | } |
| 200 | 195 | return ldi; |
| 201 | 196 | } |
| 202 | 197 | |
| 203 | -local void free_datablock(linkedlist_datablock_internal* ldi) | |
| 204 | -{ | |
| 198 | +local void free_datablock(linkedlist_datablock_internal* ldi) { | |
| 205 | 199 | while (ldi!=NULL) |
| 206 | 200 | { |
| 207 | 201 | linkedlist_datablock_internal* ldinext = ldi->next_datablock; |
| 208 | - TRYFREE(ldi); | |
| 202 | + free(ldi); | |
| 209 | 203 | ldi = ldinext; |
| 210 | 204 | } |
| 211 | 205 | } |
| 212 | 206 | |
| 213 | -local void init_linkedlist(linkedlist_data* ll) | |
| 214 | -{ | |
| 207 | +local void init_linkedlist(linkedlist_data* ll) { | |
| 215 | 208 | ll->first_block = ll->last_block = NULL; |
| 216 | 209 | } |
| 217 | 210 | |
| 218 | -local void free_linkedlist(linkedlist_data* ll) | |
| 219 | -{ | |
| 211 | +local void free_linkedlist(linkedlist_data* ll) { | |
| 220 | 212 | free_datablock(ll->first_block); |
| 221 | 213 | ll->first_block = ll->last_block = NULL; |
| 222 | 214 | } |
| 223 | 215 | |
| 224 | 216 | |
| 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) { | |
| 227 | 218 | linkedlist_datablock_internal* ldi; |
| 228 | 219 | const unsigned char* from_copy; |
| 229 | 220 | |
| 230 | 221 | if (ll==NULL) |
| 231 | 222 | return ZIP_INTERNALERROR; |
| @@ -236,11 +227,11 @@ | ||
| 236 | 227 | if (ll->first_block == NULL) |
| 237 | 228 | return ZIP_INTERNALERROR; |
| 238 | 229 | } |
| 239 | 230 | |
| 240 | 231 | ldi = ll->last_block; |
| 241 | - from_copy = (unsigned char*)buf; | |
| 232 | + from_copy = (const unsigned char*)buf; | |
| 242 | 233 | |
| 243 | 234 | while (len>0) |
| 244 | 235 | { |
| 245 | 236 | uInt copy_this; |
| 246 | 237 | uInt i; |
| @@ -281,13 +272,11 @@ | ||
| 281 | 272 | /* =========================================================================== |
| 282 | 273 | Inputs a long in LSB order to the given file |
| 283 | 274 | nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T) |
| 284 | 275 | */ |
| 285 | 276 | |
| 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) { | |
| 289 | 278 | unsigned char buf[8]; |
| 290 | 279 | int n; |
| 291 | 280 | for (n = 0; n < nbByte; n++) |
| 292 | 281 | { |
| 293 | 282 | buf[n] = (unsigned char)(x & 0xff); |
| @@ -305,13 +294,11 @@ | ||
| 305 | 294 | return ZIP_ERRNO; |
| 306 | 295 | else |
| 307 | 296 | return ZIP_OK; |
| 308 | 297 | } |
| 309 | 298 | |
| 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) { | |
| 313 | 300 | unsigned char* buf=(unsigned char*)dest; |
| 314 | 301 | int n; |
| 315 | 302 | for (n = 0; n < nbByte; n++) { |
| 316 | 303 | buf[n] = (unsigned char)(x & 0xff); |
| 317 | 304 | x >>= 8; |
| @@ -327,12 +314,11 @@ | ||
| 327 | 314 | } |
| 328 | 315 | |
| 329 | 316 | /****************************************************************************/ |
| 330 | 317 | |
| 331 | 318 | |
| 332 | -local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) | |
| 333 | -{ | |
| 319 | +local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) { | |
| 334 | 320 | uLong year = (uLong)ptm->tm_year; |
| 335 | 321 | if (year>=1980) |
| 336 | 322 | year-=1980; |
| 337 | 323 | else if (year>=80) |
| 338 | 324 | year-=80; |
| @@ -342,14 +328,11 @@ | ||
| 342 | 328 | } |
| 343 | 329 | |
| 344 | 330 | |
| 345 | 331 | /****************************************************************************/ |
| 346 | 332 | |
| 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) { | |
| 351 | 334 | unsigned char c; |
| 352 | 335 | int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); |
| 353 | 336 | if (err==1) |
| 354 | 337 | { |
| 355 | 338 | *pi = (int)c; |
| @@ -366,14 +349,11 @@ | ||
| 366 | 349 | |
| 367 | 350 | |
| 368 | 351 | /* =========================================================================== |
| 369 | 352 | Reads a long in LSB order from the given gz_stream. Sets |
| 370 | 353 | */ |
| 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) { | |
| 375 | 355 | uLong x ; |
| 376 | 356 | int i = 0; |
| 377 | 357 | int err; |
| 378 | 358 | |
| 379 | 359 | err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); |
| @@ -388,14 +368,11 @@ | ||
| 388 | 368 | else |
| 389 | 369 | *pX = 0; |
| 390 | 370 | return err; |
| 391 | 371 | } |
| 392 | 372 | |
| 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) { | |
| 397 | 374 | uLong x ; |
| 398 | 375 | int i = 0; |
| 399 | 376 | int err; |
| 400 | 377 | |
| 401 | 378 | err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); |
| @@ -418,15 +395,12 @@ | ||
| 418 | 395 | else |
| 419 | 396 | *pX = 0; |
| 420 | 397 | return err; |
| 421 | 398 | } |
| 422 | 399 | |
| 423 | -local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)); | |
| 424 | 400 | |
| 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) { | |
| 428 | 402 | ZPOS64_T x; |
| 429 | 403 | int i = 0; |
| 430 | 404 | int err; |
| 431 | 405 | |
| 432 | 406 | err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); |
| @@ -473,14 +447,11 @@ | ||
| 473 | 447 | #endif |
| 474 | 448 | /* |
| 475 | 449 | Locate the Central directory of a zipfile (at the end, just before |
| 476 | 450 | the global comment) |
| 477 | 451 | */ |
| 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) { | |
| 482 | 453 | unsigned char* buf; |
| 483 | 454 | ZPOS64_T uSizeFile; |
| 484 | 455 | ZPOS64_T uBackRead; |
| 485 | 456 | ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ |
| 486 | 457 | ZPOS64_T uPosFound=0; |
| @@ -527,22 +498,19 @@ | ||
| 527 | 498 | } |
| 528 | 499 | |
| 529 | 500 | if (uPosFound!=0) |
| 530 | 501 | break; |
| 531 | 502 | } |
| 532 | - TRYFREE(buf); | |
| 503 | + free(buf); | |
| 533 | 504 | return uPosFound; |
| 534 | 505 | } |
| 535 | 506 | |
| 536 | 507 | /* |
| 537 | 508 | Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before |
| 538 | 509 | the global comment) |
| 539 | 510 | */ |
| 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) { | |
| 544 | 512 | unsigned char* buf; |
| 545 | 513 | ZPOS64_T uSizeFile; |
| 546 | 514 | ZPOS64_T uBackRead; |
| 547 | 515 | ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ |
| 548 | 516 | ZPOS64_T uPosFound=0; |
| @@ -593,11 +561,11 @@ | ||
| 593 | 561 | |
| 594 | 562 | if (uPosFound!=0) |
| 595 | 563 | break; |
| 596 | 564 | } |
| 597 | 565 | |
| 598 | - TRYFREE(buf); | |
| 566 | + free(buf); | |
| 599 | 567 | if (uPosFound == 0) |
| 600 | 568 | return 0; |
| 601 | 569 | |
| 602 | 570 | /* Zip64 end of central directory locator */ |
| 603 | 571 | if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) |
| @@ -635,24 +603,23 @@ | ||
| 635 | 603 | return 0; |
| 636 | 604 | |
| 637 | 605 | return relativeOffset; |
| 638 | 606 | } |
| 639 | 607 | |
| 640 | -local int LoadCentralDirectoryRecord(zip64_internal* pziinit) | |
| 641 | -{ | |
| 608 | +local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { | |
| 642 | 609 | int err=ZIP_OK; |
| 643 | 610 | ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ |
| 644 | 611 | |
| 645 | 612 | ZPOS64_T size_central_dir; /* size of the central directory */ |
| 646 | 613 | ZPOS64_T offset_central_dir; /* offset of start of central directory */ |
| 647 | 614 | ZPOS64_T central_pos; |
| 648 | 615 | uLong uL; |
| 649 | 616 | |
| 650 | 617 | uLong number_disk; /* number of the current dist, used for |
| 651 | - spaning ZIP, unsupported, always 0*/ | |
| 618 | + spanning ZIP, unsupported, always 0*/ | |
| 652 | 619 | 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*/ | |
| 654 | 621 | ZPOS64_T number_entry; |
| 655 | 622 | ZPOS64_T number_entry_CD; /* total number of entries in |
| 656 | 623 | the central dir |
| 657 | 624 | (same than number_entry on nospan) */ |
| 658 | 625 | uLong VersionMadeBy; |
| @@ -828,11 +795,11 @@ | ||
| 828 | 795 | if (err==ZIP_OK) |
| 829 | 796 | err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this); |
| 830 | 797 | |
| 831 | 798 | size_central_dir_to_read-=read_this; |
| 832 | 799 | } |
| 833 | - TRYFREE(buf_read); | |
| 800 | + free(buf_read); | |
| 834 | 801 | } |
| 835 | 802 | pziinit->begin_pos = byte_before_the_zipfile; |
| 836 | 803 | pziinit->number_entry = number_entry_CD; |
| 837 | 804 | |
| 838 | 805 | if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0) |
| @@ -844,12 +811,11 @@ | ||
| 844 | 811 | |
| 845 | 812 | #endif /* !NO_ADDFILEINEXISTINGZIP*/ |
| 846 | 813 | |
| 847 | 814 | |
| 848 | 815 | /************************************************************/ |
| 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) { | |
| 851 | 817 | zip64_internal ziinit; |
| 852 | 818 | zip64_internal* zi; |
| 853 | 819 | int err=ZIP_OK; |
| 854 | 820 | |
| 855 | 821 | ziinit.z_filefunc.zseek32_file = NULL; |
| @@ -903,24 +869,23 @@ | ||
| 903 | 869 | # endif /* !NO_ADDFILEINEXISTINGZIP*/ |
| 904 | 870 | |
| 905 | 871 | if (err != ZIP_OK) |
| 906 | 872 | { |
| 907 | 873 | # ifndef NO_ADDFILEINEXISTINGZIP |
| 908 | - TRYFREE(ziinit.globalcomment); | |
| 874 | + free(ziinit.globalcomment); | |
| 909 | 875 | # endif /* !NO_ADDFILEINEXISTINGZIP*/ |
| 910 | - TRYFREE(zi); | |
| 876 | + free(zi); | |
| 911 | 877 | return NULL; |
| 912 | 878 | } |
| 913 | 879 | else |
| 914 | 880 | { |
| 915 | 881 | *zi = ziinit; |
| 916 | 882 | return (zipFile)zi; |
| 917 | 883 | } |
| 918 | 884 | } |
| 919 | 885 | |
| 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) { | |
| 922 | 887 | if (pzlib_filefunc32_def != NULL) |
| 923 | 888 | { |
| 924 | 889 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
| 925 | 890 | fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); |
| 926 | 891 | return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill); |
| @@ -927,12 +892,11 @@ | ||
| 927 | 892 | } |
| 928 | 893 | else |
| 929 | 894 | return zipOpen3(pathname, append, globalcomment, NULL); |
| 930 | 895 | } |
| 931 | 896 | |
| 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) { | |
| 934 | 898 | if (pzlib_filefunc_def != NULL) |
| 935 | 899 | { |
| 936 | 900 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
| 937 | 901 | zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; |
| 938 | 902 | zlib_filefunc64_32_def_fill.ztell32_file = NULL; |
| @@ -943,22 +907,19 @@ | ||
| 943 | 907 | return zipOpen3(pathname, append, globalcomment, NULL); |
| 944 | 908 | } |
| 945 | 909 | |
| 946 | 910 | |
| 947 | 911 | |
| 948 | -extern zipFile ZEXPORT zipOpen (const char* pathname, int append) | |
| 949 | -{ | |
| 912 | +extern zipFile ZEXPORT zipOpen(const char* pathname, int append) { | |
| 950 | 913 | return zipOpen3((const void*)pathname,append,NULL,NULL); |
| 951 | 914 | } |
| 952 | 915 | |
| 953 | -extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append) | |
| 954 | -{ | |
| 916 | +extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) { | |
| 955 | 917 | return zipOpen3(pathname,append,NULL,NULL); |
| 956 | 918 | } |
| 957 | 919 | |
| 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) { | |
| 960 | 921 | /* write the local header */ |
| 961 | 922 | int err; |
| 962 | 923 | uInt size_filename = (uInt)strlen(filename); |
| 963 | 924 | uInt size_extrafield = size_extrafield_local; |
| 964 | 925 | |
| @@ -1050,18 +1011,17 @@ | ||
| 1050 | 1011 | before calling this function it can be done with zipRemoveExtraInfoBlock |
| 1051 | 1012 | |
| 1052 | 1013 | It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize |
| 1053 | 1014 | unnecessary allocations. |
| 1054 | 1015 | */ |
| 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) { | |
| 1063 | 1023 | zip64_internal* zi; |
| 1064 | 1024 | uInt size_filename; |
| 1065 | 1025 | uInt size_comment; |
| 1066 | 1026 | uInt i; |
| 1067 | 1027 | int err = ZIP_OK; |
| @@ -1260,110 +1220,102 @@ | ||
| 1260 | 1220 | if (err==Z_OK) |
| 1261 | 1221 | zi->in_opened_file_inzip = 1; |
| 1262 | 1222 | return err; |
| 1263 | 1223 | } |
| 1264 | 1224 | |
| 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); | |
| 1294 | 1252 | } |
| 1295 | 1253 | |
| 1296 | 1254 | extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
| 1297 | 1255 | const void* extrafield_local, uInt size_extrafield_local, |
| 1298 | 1256 | const void* extrafield_global, uInt size_extrafield_global, |
| 1299 | 1257 | const char* comment, int method, int level, int raw, |
| 1300 | 1258 | 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); | |
| 1309 | 1266 | } |
| 1310 | 1267 | |
| 1311 | 1268 | extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
| 1312 | 1269 | const void* extrafield_local, uInt size_extrafield_local, |
| 1313 | 1270 | 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); | |
| 1322 | 1278 | } |
| 1323 | 1279 | |
| 1324 | 1280 | 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) { | |
| 1365 | 1317 | int err=ZIP_OK; |
| 1366 | 1318 | |
| 1367 | 1319 | if (zi->ci.encrypt != 0) |
| 1368 | 1320 | { |
| 1369 | 1321 | #ifndef NOCRYPT |
| @@ -1397,12 +1349,11 @@ | ||
| 1397 | 1349 | zi->ci.pos_in_buffered_data = 0; |
| 1398 | 1350 | |
| 1399 | 1351 | return err; |
| 1400 | 1352 | } |
| 1401 | 1353 | |
| 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) { | |
| 1404 | 1355 | zip64_internal* zi; |
| 1405 | 1356 | int err=ZIP_OK; |
| 1406 | 1357 | |
| 1407 | 1358 | if (file == NULL) |
| 1408 | 1359 | return ZIP_PARAMERROR; |
| @@ -1448,11 +1399,11 @@ | ||
| 1448 | 1399 | err = ZIP_OK; |
| 1449 | 1400 | } |
| 1450 | 1401 | else |
| 1451 | 1402 | #endif |
| 1452 | 1403 | { |
| 1453 | - zi->ci.stream.next_in = (Bytef*)buf; | |
| 1404 | + zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf; | |
| 1454 | 1405 | zi->ci.stream.avail_in = len; |
| 1455 | 1406 | |
| 1456 | 1407 | while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) |
| 1457 | 1408 | { |
| 1458 | 1409 | if (zi->ci.stream.avail_out == 0) |
| @@ -1499,17 +1450,15 @@ | ||
| 1499 | 1450 | } |
| 1500 | 1451 | |
| 1501 | 1452 | return err; |
| 1502 | 1453 | } |
| 1503 | 1454 | |
| 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) { | |
| 1506 | 1456 | return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32); |
| 1507 | 1457 | } |
| 1508 | 1458 | |
| 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) { | |
| 1511 | 1460 | zip64_internal* zi; |
| 1512 | 1461 | ZPOS64_T compressed_size; |
| 1513 | 1462 | uLong invalidValue = 0xffffffff; |
| 1514 | 1463 | unsigned datasize = 0; |
| 1515 | 1464 | int err=ZIP_OK; |
| @@ -1740,17 +1689,15 @@ | ||
| 1740 | 1689 | zi->in_opened_file_inzip = 0; |
| 1741 | 1690 | |
| 1742 | 1691 | return err; |
| 1743 | 1692 | } |
| 1744 | 1693 | |
| 1745 | -extern int ZEXPORT zipCloseFileInZip (zipFile file) | |
| 1746 | -{ | |
| 1694 | +extern int ZEXPORT zipCloseFileInZip(zipFile file) { | |
| 1747 | 1695 | return zipCloseFileInZipRaw (file,0,0); |
| 1748 | 1696 | } |
| 1749 | 1697 | |
| 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) { | |
| 1752 | 1699 | int err = ZIP_OK; |
| 1753 | 1700 | ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset; |
| 1754 | 1701 | |
| 1755 | 1702 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4); |
| 1756 | 1703 | |
| @@ -1767,12 +1714,11 @@ | ||
| 1767 | 1714 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4); |
| 1768 | 1715 | |
| 1769 | 1716 | return err; |
| 1770 | 1717 | } |
| 1771 | 1718 | |
| 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) { | |
| 1774 | 1720 | int err = ZIP_OK; |
| 1775 | 1721 | |
| 1776 | 1722 | uLong Zip64DataSize = 44; |
| 1777 | 1723 | |
| 1778 | 1724 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4); |
| @@ -1806,12 +1752,12 @@ | ||
| 1806 | 1752 | ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; |
| 1807 | 1753 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8); |
| 1808 | 1754 | } |
| 1809 | 1755 | return err; |
| 1810 | 1756 | } |
| 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) { | |
| 1813 | 1759 | int err = ZIP_OK; |
| 1814 | 1760 | |
| 1815 | 1761 | /*signature*/ |
| 1816 | 1762 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); |
| 1817 | 1763 | |
| @@ -1854,12 +1800,11 @@ | ||
| 1854 | 1800 | } |
| 1855 | 1801 | |
| 1856 | 1802 | return err; |
| 1857 | 1803 | } |
| 1858 | 1804 | |
| 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) { | |
| 1861 | 1806 | int err = ZIP_OK; |
| 1862 | 1807 | uInt size_global_comment = 0; |
| 1863 | 1808 | |
| 1864 | 1809 | if(global_comment != NULL) |
| 1865 | 1810 | size_global_comment = (uInt)strlen(global_comment); |
| @@ -1872,12 +1817,11 @@ | ||
| 1872 | 1817 | err = ZIP_ERRNO; |
| 1873 | 1818 | } |
| 1874 | 1819 | return err; |
| 1875 | 1820 | } |
| 1876 | 1821 | |
| 1877 | -extern int ZEXPORT zipClose (zipFile file, const char* global_comment) | |
| 1878 | -{ | |
| 1822 | +extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { | |
| 1879 | 1823 | zip64_internal* zi; |
| 1880 | 1824 | int err = 0; |
| 1881 | 1825 | uLong size_centraldir = 0; |
| 1882 | 1826 | ZPOS64_T centraldir_pos_inzip; |
| 1883 | 1827 | ZPOS64_T pos; |
| @@ -1934,19 +1878,18 @@ | ||
| 1934 | 1878 | if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0) |
| 1935 | 1879 | if (err == ZIP_OK) |
| 1936 | 1880 | err = ZIP_ERRNO; |
| 1937 | 1881 | |
| 1938 | 1882 | #ifndef NO_ADDFILEINEXISTINGZIP |
| 1939 | - TRYFREE(zi->globalcomment); | |
| 1883 | + free(zi->globalcomment); | |
| 1940 | 1884 | #endif |
| 1941 | - TRYFREE(zi); | |
| 1885 | + free(zi); | |
| 1942 | 1886 | |
| 1943 | 1887 | return err; |
| 1944 | 1888 | } |
| 1945 | 1889 | |
| 1946 | -extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader) | |
| 1947 | -{ | |
| 1890 | +extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) { | |
| 1948 | 1891 | char* p = pData; |
| 1949 | 1892 | int size = 0; |
| 1950 | 1893 | char* pNewHeader; |
| 1951 | 1894 | char* pTmp; |
| 1952 | 1895 | short header; |
| @@ -1994,9 +1937,9 @@ | ||
| 1994 | 1937 | retVal = ZIP_OK; |
| 1995 | 1938 | } |
| 1996 | 1939 | else |
| 1997 | 1940 | retVal = ZIP_ERRNO; |
| 1998 | 1941 | |
| 1999 | - TRYFREE(pNewHeader); | |
| 1942 | + free(pNewHeader); | |
| 2000 | 1943 | |
| 2001 | 1944 | return retVal; |
| 2002 | 1945 | } |
| 2003 | 1946 |
| --- 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 |
+153
-156
| --- compat/zlib/contrib/minizip/zip.h | ||
| +++ compat/zlib/contrib/minizip/zip.h | ||
| @@ -111,12 +111,12 @@ | ||
| 111 | 111 | |
| 112 | 112 | #define APPEND_STATUS_CREATE (0) |
| 113 | 113 | #define APPEND_STATUS_CREATEAFTER (1) |
| 114 | 114 | #define APPEND_STATUS_ADDINZIP (2) |
| 115 | 115 | |
| 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); | |
| 118 | 118 | /* |
| 119 | 119 | Create a zipfile. |
| 120 | 120 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on |
| 121 | 121 | an Unix computer "zlib/zlib113.zip". |
| 122 | 122 | if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip |
| @@ -129,50 +129,50 @@ | ||
| 129 | 129 | of this zip package. |
| 130 | 130 | */ |
| 131 | 131 | |
| 132 | 132 | /* Note : there is no delete function into a zipfile. |
| 133 | 133 | 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); | |
| 174 | 174 | |
| 175 | 175 | /* |
| 176 | 176 | Open a file in the ZIP for writing. |
| 177 | 177 | filename : the filename in zip (if NULL, '-' without quote will be used |
| 178 | 178 | *zipfi contain supplemental information |
| @@ -187,164 +187,161 @@ | ||
| 187 | 187 | this MUST be '1' if the uncompressed size is >= 0xffffffff. |
| 188 | 188 | |
| 189 | 189 | */ |
| 190 | 190 | |
| 191 | 191 | |
| 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); | |
| 217 | 217 | /* |
| 218 | 218 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file |
| 219 | 219 | */ |
| 220 | 220 | |
| 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); | |
| 256 | 255 | |
| 257 | 256 | /* |
| 258 | 257 | Same than zipOpenNewFileInZip2, except |
| 259 | 258 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 |
| 260 | 259 | password : crypting password (NULL for no crypting) |
| 261 | 260 | crcForCrypting : crc of file to compress (needed for crypting) |
| 262 | 261 | */ |
| 263 | 262 | |
| 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, | |