1/**************************************************************************/
2/* zip_io.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef ZIP_IO_H
32#define ZIP_IO_H
33
34#include "core/io/file_access.h"
35
36// Not directly used in this header, but assumed available in downstream users
37// like platform/*/export/export.cpp. Could be fixed, but probably better to have
38// thirdparty includes in as little headers as possible.
39#include "thirdparty/minizip/unzip.h"
40#include "thirdparty/minizip/zip.h"
41
42// Get the current file info and safely convert the full filepath to a String.
43int godot_unzip_get_current_file_info(unzFile p_zip_file, unz_file_info64 &r_file_info, String &r_filepath);
44// Try to locate the file in the archive specified by the filepath (works with large paths and Unicode).
45int godot_unzip_locate_file(unzFile p_zip_file, String p_filepath, bool p_case_sensitive = true);
46
47//
48
49void *zipio_open(voidpf opaque, const char *p_fname, int mode);
50uLong zipio_read(voidpf opaque, voidpf stream, void *buf, uLong size);
51uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size);
52
53long zipio_tell(voidpf opaque, voidpf stream);
54long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin);
55
56int zipio_close(voidpf opaque, voidpf stream);
57
58int zipio_testerror(voidpf opaque, voidpf stream);
59
60voidpf zipio_alloc(voidpf opaque, uInt items, uInt size);
61void zipio_free(voidpf opaque, voidpf address);
62
63zlib_filefunc_def zipio_create_io(Ref<FileAccess> *p_data);
64
65#endif // ZIP_IO_H
66