comparison mupdf-source/thirdparty/extract/src/zip.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 #ifndef ARTIFEX_EXTRACT_ZIP
2 #define ARTIFEX_EXTRACT_ZIP
3
4 /* Only for internal use by extract code. */
5
6 #include "extract/buffer.h"
7
8 #include <stddef.h>
9
10
11 /*
12 Support for creating zip file content.
13
14 Content is compressed using deflate.
15
16 Unless otherwise stated, all functions return 0 on success or -1 with errno
17 set.
18 */
19
20 /* Abstract handle for zipfile state. */
21 typedef struct extract_zip_t extract_zip_t;
22
23
24 /*
25 Creates an extract_zip_t that writes to specified buffer.
26
27 We reuse <buffer>'s allocator for zlib's allocation needs.
28
29 buffer:
30 Destination for zip file content.
31 o_zip:
32 Out-param.
33 */
34 int extract_zip_open(extract_buffer_t *buffer, extract_zip_t **o_zip);
35
36 /*
37 Writes specified data into the zip file.
38
39 Returns same as extract_buffer_write(): 0 on success, +1 if short write due to
40 EOF or -1 with errno set.
41
42 zip:
43 From extract_zip_open().
44 data:
45 File contents.
46 data_length:
47 Length in bytes of file contents.
48 name:
49 Name of file within the zip file.
50 */
51 int extract_zip_write_file(
52 extract_zip_t *zip,
53 const void *data,
54 size_t data_length,
55 const char *name);
56
57
58 /*
59 Finishes writing the zip file (e.g. appends Central directory file headers
60 and End of central directory record).
61
62 Does not call extract_buffer_close().
63
64 zip:
65 From extract_zip_open().
66 */
67 int extract_zip_close(extract_zip_t **pzip);
68
69 #endif