1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
|
<!DOCTYPE html>
<html>
<!-- This is an automatically generated file. Do not edit.
zip_source_function.mdoc -- create data source from function
Copyright (C) 2004-2022 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <info@libzip.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/>
<title>ZIP_SOURCE_FUNCTION(3)</title>
</head>
<body>
<table class="head">
<tr>
<td class="head-ltitle">ZIP_SOURCE_FUNCTION(3)</td>
<td class="head-vol">Library Functions Manual</td>
<td class="head-rtitle">ZIP_SOURCE_FUNCTION(3)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">zip_source_function</code>,
<code class="Nm">zip_source_function_create</code> —
<span class="Nd">create data source from function</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
<p class="Pp">libzip (-lzip)</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">zip.h</a>></code></p>
<p class="Pp"><var class="Ft">zip_source_t *</var>
<br/>
<code class="Fn">zip_source_function</code>(<var class="Fa" style="white-space: nowrap;">zip_t
*archive</var>,
<var class="Fa" style="white-space: nowrap;">zip_source_callback fn</var>,
<var class="Fa" style="white-space: nowrap;">void *userdata</var>);</p>
<p class="Pp"><var class="Ft">zip_source_t *</var>
<br/>
<code class="Fn">zip_source_function_create</code>(<var class="Fa" style="white-space: nowrap;">zip_source_callback
fn</var>, <var class="Fa" style="white-space: nowrap;">void *userdata</var>,
<var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The functions
<a class="permalink" href="#zip_source_function"><code class="Fn" id="zip_source_function">zip_source_function</code></a>()
and
<a class="permalink" href="#zip_source_function_create"><code class="Fn" id="zip_source_function_create">zip_source_function_create</code></a>()
create a zip source from the user-provided function
<var class="Ar">fn</var>, which must be of the following type:</p>
<p class="Pp"><var class="Ft">typedef zip_int64_t</var>
<code class="Fn">(*zip_source_callback)</code>(<var class="Fa">void
*userdata</var>, <var class="Fa">void *data</var>,
<var class="Fa">zip_uint64_t len</var>, <var class="Fa">zip_source_cmd_t
cmd</var>);</p>
<p class="Pp"><var class="Ar">archive</var> or <var class="Ar">error</var> are
used for reporting errors and can be <code class="Dv">NULL</code>.</p>
<p class="Pp">When called by the library, the first argument is the
<var class="Ar">userdata</var> argument supplied to the function. The next
two arguments are a buffer <var class="Ar">data</var> of size
<var class="Ar">len</var> when data is passed in or expected to be returned,
or else <code class="Dv">NULL</code> and 0. The last argument,
<var class="Ar">cmd</var>, specifies which action the function should
perform.</p>
<p class="Pp" id="zip_source_callback">Depending on the uses, there are three
useful sets of commands to be supported by a
<a class="permalink" href="#zip_source_callback"><code class="Fn">zip_source_callback</code></a>():</p>
<dl class="Bl-tag">
<dt>read source</dt>
<dd>Providing streamed data (for file data added to archives). Must support
<code class="Dv">ZIP_SOURCE_OPEN</code>,
<code class="Dv">ZIP_SOURCE_READ</code>,
<code class="Dv">ZIP_SOURCE_CLOSE</code>,
<code class="Dv">ZIP_SOURCE_STAT</code>, and
<code class="Dv">ZIP_SOURCE_ERROR</code>.
<p class="Pp">If your source uses any allocated memory (including
<var class="Ar">userdata</var>) it should also implement
<code class="Dv">ZIP_SOURCE_FREE</code> to avoid memory leaks.</p>
</dd>
<dt>seekable read source</dt>
<dd>Same as previous, but from a source allowing reading from arbitrary
offsets (also for read-only zip archive). Must additionally support
<code class="Dv">ZIP_SOURCE_SEEK</code>,
<code class="Dv">ZIP_SOURCE_TELL</code>, and
<code class="Dv">ZIP_SOURCE_SUPPORTS</code>.</dd>
<dt>read/write source</dt>
<dd>Same as previous, but additionally allowing writing (also for writable zip
archives). Must additionally support
<code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code>,
<code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code>,
<code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code>,
<code class="Dv">ZIP_SOURCE_SEEK_WRITE</code>,
<code class="Dv">ZIP_SOURCE_TELL_WRITE</code>, and
<code class="Dv">ZIP_SOURCE_REMOVE</code>.
<p class="Pp" id="zip_source_open">On top of the above, supporting the
pseudo-command <code class="Dv">ZIP_SOURCE_SUPPORTS_REOPEN</code> allows
calling
<a class="permalink" href="#zip_source_open"><code class="Fn">zip_source_open</code></a>()
again after calling
<a class="permalink" href="#zip_source_close"><code class="Fn" id="zip_source_close">zip_source_close</code></a>().</p>
</dd>
</dl>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_ACCEPT_EMPTY"><a class="permalink" href="#ZIP_SOURCE_ACCEPT_EMPTY"><code class="Dv">ZIP_SOURCE_ACCEPT_EMPTY</code></a></h2>
<p class="Pp">Return 1 if an empty source should be accepted as a valid zip
archive. This is the default if this command is not supported by a source.
File system backed sources should return 0.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_BEGIN_WRITE"><a class="permalink" href="#ZIP_SOURCE_BEGIN_WRITE"><code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code></a></h2>
<p class="Pp">Prepare the source for writing. Use this to create any temporary
file(s).</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_BEGIN_WRITE_CLONING"><a class="permalink" href="#ZIP_SOURCE_BEGIN_WRITE_CLONING"><code class="Dv">ZIP_SOURCE_BEGIN_WRITE_CLONING</code></a></h2>
<p class="Pp">Prepare the source for writing, keeping the first
<var class="Ar">len</var> bytes of the original file. Only implement this
command if it is more efficient than copying the data, and if it does not
destructively overwrite the original file (you still have to be able to
execute <code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code>).</p>
<p class="Pp">The next write should happen at byte
<var class="Ar">offset</var>.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_CLOSE"><a class="permalink" href="#ZIP_SOURCE_CLOSE"><code class="Dv">ZIP_SOURCE_CLOSE</code></a></h2>
<p class="Pp">Reading is done.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_COMMIT_WRITE"><a class="permalink" href="#ZIP_SOURCE_COMMIT_WRITE"><code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code></a></h2>
<p class="Pp">Finish writing to the source. Replace the original data with the
newly written data. Clean up temporary files or internal buffers.
Subsequently opening and reading from the source should return the newly
written data.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_ERROR"><a class="permalink" href="#ZIP_SOURCE_ERROR"><code class="Dv">ZIP_SOURCE_ERROR</code></a></h2>
<p class="Pp">Get error information. <var class="Ar">data</var> points to an
array of two ints, which should be filled with the libzip error code and the
corresponding system error code for the error that occurred. See
<a class="Xr" href="zip_errors.html">zip_errors(3)</a> for details on the
error codes. If the source stores error information in a zip_error_t, use
<a class="Xr" href="zip_error_to_data.html">zip_error_to_data(3)</a> and
return its return value. Otherwise, return 2 * sizeof(int).</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_FREE"><a class="permalink" href="#ZIP_SOURCE_FREE"><code class="Dv">ZIP_SOURCE_FREE</code></a></h2>
<p class="Pp">Clean up and free all resources, including
<var class="Ar">userdata</var>. The callback function will not be called
again.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_GET_FILE_ATTRIBUTES"><a class="permalink" href="#ZIP_SOURCE_GET_FILE_ATTRIBUTES"><code class="Dv">ZIP_SOURCE_GET_FILE_ATTRIBUTES</code></a></h2>
<p class="Pp">Provide information about various data. Then the data should be
put in the appropriate entry in the passed
<var class="Vt">zip_file_attributes_t</var> argument, and the appropriate
<code class="Dv">ZIP_FILE_ATTRIBUTES_*</code> value must be or'ed into the
<var class="Ar">valid</var> member to denote that the corresponding data has
been provided. A <var class="Vt">zip_file_attributes_t</var> structure can
be initialized using
<a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a>.</p>
<dl class="Bl-tag">
<dt>ASCII mode</dt>
<dd>If a file is a plaintext file in ASCII. Can be used by extraction tools to
automatically convert line endings (part of the internal file attributes).
Member <var class="Ar">ascii</var>, flag
<code class="Dv">ZIP_FILE_ATTRIBUTES_ASCII</code>.</dd>
<dt>General Purpose Bit Flags (limited to Compression Flags)</dt>
<dd>The general purpose bit flag in the zip in the local and central directory
headers contain information about the compression method. Member
<var class="Ar">general_purpose_bit_flags</var> and
<var class="Ar">general_purpose_bit_mask</var> to denote which members
have been set; flag
<code class="Dv">ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS</code>.</dd>
<dt>External File Attributes</dt>
<dd>The external file attributes (usually operating system-specific). Member
<var class="Ar">external_file_attributes</var>, flag
<code class="Dv">ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES</code>.</dd>
<dt>Version Needed</dt>
<dd>A minimum version needed required to unpack this entry (in the usual
"major * 10 + minor" format). Member
<var class="Ar">version_needed</var>, flag
<code class="Dv">ZIP_FILE_ATTRIBUTES_VERSION_NEEDED</code>.</dd>
<dt>Operating System</dt>
<dd>One of the operating systems as defined by the
<code class="Dv">ZIP_OPSYS_*</code> variables (see
<span class="Pa">zip.h</span>). This value affects the interpretation of
the external file attributes. Member <var class="Ar">host_system</var>,
flag <code class="Dv">ZIP_FILE_ATTRIBUTES_HOST_SYSTEM</code>.</dd>
</dl>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_OPEN"><a class="permalink" href="#ZIP_SOURCE_OPEN"><code class="Dv">ZIP_SOURCE_OPEN</code></a></h2>
<p class="Pp">Prepare for reading.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_READ"><a class="permalink" href="#ZIP_SOURCE_READ"><code class="Dv">ZIP_SOURCE_READ</code></a></h2>
<p class="Pp">Read data into the buffer <var class="Ar">data</var> of size
<var class="Ar">len</var>. Return the number of bytes placed into
<var class="Ar">data</var> on success, and zero for end-of-file.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_REMOVE"><a class="permalink" href="#ZIP_SOURCE_REMOVE"><code class="Dv">ZIP_SOURCE_REMOVE</code></a></h2>
<p class="Pp">Remove the underlying file. This is called if a zip archive is
empty when closed.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_ROLLBACK_WRITE"><a class="permalink" href="#ZIP_SOURCE_ROLLBACK_WRITE"><code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code></a></h2>
<p class="Pp">Abort writing to the source. Discard written data. Clean up
temporary files or internal buffers. Subsequently opening and reading from
the source should return the original data.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_SEEK"><a class="permalink" href="#ZIP_SOURCE_SEEK"><code class="Dv">ZIP_SOURCE_SEEK</code></a></h2>
<p class="Pp">Specify position to read next byte from, like
<a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>. Use
<a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ZIP_SOURCE_GET_ARGS.html">ZIP_SOURCE_GET_ARGS(3)</a> to
decode the arguments into the following struct:</p>
<div class="Bd Pp Li">
<pre>struct zip_source_args_seek {
zip_int64_t offset;
int whence;
};</pre>
</div>
<p class="Pp">If the size of the source's data is known, use
<a class="Xr" href="zip_source_seek_compute_offset.html">zip_source_seek_compute_offset(3)</a>
to validate the arguments and compute the new offset.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_SEEK_WRITE"><a class="permalink" href="#ZIP_SOURCE_SEEK_WRITE"><code class="Dv">ZIP_SOURCE_SEEK_WRITE</code></a></h2>
<p class="Pp">Specify position to write next byte to, like
<a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html">fseek(3)</a>. See
<code class="Dv">ZIP_SOURCE_SEEK</code> for details.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_STAT"><a class="permalink" href="#ZIP_SOURCE_STAT"><code class="Dv">ZIP_SOURCE_STAT</code></a></h2>
<p class="Pp">Get meta information for the input data.
<var class="Ar">data</var> points to an allocated <var class="Vt">struct
zip_stat</var>, which should be initialized using
<a class="Xr" href="zip_stat_init.html">zip_stat_init(3)</a> and then filled
in.</p>
<p class="Pp">For uncompressed, unencrypted data, all information is optional.
However, fill in as much information as is readily available.</p>
<p class="Pp">If the data is compressed,
<code class="Dv">ZIP_STAT_COMP_METHOD</code>,
<code class="Dv">ZIP_STAT_SIZE</code>, and
<code class="Dv">ZIP_STAT_CRC</code> must be filled in.</p>
<p class="Pp">If the data is encrypted,
<code class="Dv">ZIP_STAT_ENCRYPTION_METHOD</code>,
<code class="Dv">ZIP_STAT_COMP_METHOD</code>,
<code class="Dv">ZIP_STAT_SIZE</code>, and
<code class="Dv">ZIP_STAT_CRC</code> must be filled in.</p>
<p class="Pp" id="NOTE">Information only available after the source has been
read (e.g., size) can be omitted in an earlier call.
<a class="permalink" href="#NOTE"><i class="Em">NOTE</i></a>:
<a class="permalink" href="#zip_source_function~2"><code class="Fn" id="zip_source_function~2">zip_source_function</code></a>()
may be called with this argument even after being called with
<code class="Dv">ZIP_SOURCE_CLOSE</code>.</p>
<p class="Pp">Return sizeof(struct zip_stat) on success.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_SUPPORTS"><a class="permalink" href="#ZIP_SOURCE_SUPPORTS"><code class="Dv">ZIP_SOURCE_SUPPORTS</code></a></h2>
<p class="Pp">Return bitmap specifying which commands are supported. Use
<a class="Xr" href="zip_source_make_command_bitmap.html">zip_source_make_command_bitmap(3)</a>.
If this command is not implemented, the source is assumed to be a read
source without seek support.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_TELL"><a class="permalink" href="#ZIP_SOURCE_TELL"><code class="Dv">ZIP_SOURCE_TELL</code></a></h2>
<p class="Pp">Return the current read offset in the source, like
<a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html">ftell(3)</a>.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_TELL_WRITE"><a class="permalink" href="#ZIP_SOURCE_TELL_WRITE"><code class="Dv">ZIP_SOURCE_TELL_WRITE</code></a></h2>
<p class="Pp">Return the current write offset in the source, like
<a class="Xr" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html">ftell(3)</a>.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_WRITE"><a class="permalink" href="#ZIP_SOURCE_WRITE"><code class="Dv">ZIP_SOURCE_WRITE</code></a></h2>
<p class="Pp">Write data to the source. Return number of bytes written.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_SUPPORTS_REOPEN"><a class="permalink" href="#ZIP_SOURCE_SUPPORTS_REOPEN"><code class="Dv">ZIP_SOURCE_SUPPORTS_REOPEN</code></a></h2>
<p class="Pp">This command is never actually invoked, support for it signals the
ability to handle multiple open/read/close cycles.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="Return_Values"><a class="permalink" href="#Return_Values">Return
Values</a></h2>
<p class="Pp">Commands should return -1 on error.
<code class="Dv">ZIP_SOURCE_ERROR</code> will be called to retrieve the
error code. On success, commands return 0, unless specified otherwise in the
description above.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="Calling_Conventions"><a class="permalink" href="#Calling_Conventions">Calling
Conventions</a></h2>
<p class="Pp">The library will always issue
<code class="Dv">ZIP_SOURCE_OPEN</code> before issuing
<code class="Dv">ZIP_SOURCE_READ</code>,
<code class="Dv">ZIP_SOURCE_SEEK</code>, or
<code class="Dv">ZIP_SOURCE_TELL</code>. When it no longer wishes to read
from this source, it will issue <code class="Dv">ZIP_SOURCE_CLOSE</code>. If
the library wishes to read the data again, it will issue
<code class="Dv">ZIP_SOURCE_OPEN</code> a second time. If the function is
unable to provide the data again, it should return -1.</p>
<p class="Pp"><code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code> or
<code class="Dv">ZIP_SOURCE_BEGIN_WRITE_CLONING</code> will be called before
<code class="Dv">ZIP_SOURCE_WRITE</code>,
<code class="Dv">ZIP_SOURCE_SEEK_WRITE</code>, or
<code class="Dv">ZIP_SOURCE_TELL_WRITE</code>. When writing is complete,
either <code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code> or
<code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code> will be called.</p>
<p class="Pp"><code class="Dv">ZIP_SOURCE_ACCEPT_EMPTY</code>,
<code class="Dv">ZIP_SOURCE_GET_FILE_ATTRIBUTES</code>, and
<code class="Dv">ZIP_SOURCE_STAT</code> can be issued at any time.</p>
<p class="Pp"><code class="Dv">ZIP_SOURCE_ERROR</code> will only be issued in
response to the function returning -1.</p>
<p class="Pp"><code class="Dv">ZIP_SOURCE_FREE</code> will be the last command
issued; if <code class="Dv">ZIP_SOURCE_OPEN</code> was called and succeeded,
<code class="Dv">ZIP_SOURCE_CLOSE</code> will be called before
<code class="Dv">ZIP_SOURCE_FREE</code>, and similarly for
<code class="Dv">ZIP_SOURCE_BEGIN_WRITE</code> or
<code class="Dv">ZIP_SOURCE_BEGIN_WRITE_CLONING</code> and
<code class="Dv">ZIP_SOURCE_COMMIT_WRITE</code> or
<code class="Dv">ZIP_SOURCE_ROLLBACK_WRITE</code>.</p>
</section>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">Upon successful completion, the created source is returned.
Otherwise, <code class="Dv">NULL</code> is returned and the error code in
<var class="Ar">archive</var> or <var class="Ar">error</var> is set to
indicate the error (unless it is <code class="Dv">NULL</code>).</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp"><code class="Fn">zip_source_function</code>() fails if:</p>
<dl class="Bl-tag">
<dt id="ZIP_ER_MEMORY">[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er">ZIP_ER_MEMORY</code></a>]</dt>
<dd>Required memory could not be allocated.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr" href="libzip.html">libzip(3)</a>,
<a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>,
<a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a>,
<a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>,
<a class="Xr" href="zip_source.html">zip_source(5)</a>,
<a class="Xr" href="zip_stat_init.html">zip_stat_init(3)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp"><code class="Fn">zip_source_function</code>() and
<code class="Fn">zip_source_function_create</code>() were added in libzip
1.0.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp"><span class="An">Dieter Baron</span>
<<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>> and
<span class="An">Thomas Klausner</span>
<<a class="Mt" href="mailto:wiz@gatalith.at">wiz@gatalith.at</a>></p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">January 5, 2023</td>
<td class="foot-os">NiH</td>
</tr>
</table>
</body>
</html>
|