Thomas Klausner | fa02d9d | 2004-11-18 17:26:55 +0000 | [diff] [blame] | 1 | .\" zip_source_buffer.mdoc -- create zip data source from buffer |
Thomas Klausner | 9c5347e | 2021-06-18 11:33:22 +0200 | [diff] [blame] | 2 | .\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 3 | .\" |
| 4 | .\" This file is part of libzip, a library to manipulate ZIP archives. |
Dieter Baron | b86c433 | 2007-11-07 14:35:13 +0100 | [diff] [blame] | 5 | .\" The authors can be contacted at <libzip@nih.at> |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 6 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without |
| 8 | .\" modification, are permitted provided that the following conditions |
| 9 | .\" are met: |
| 10 | .\" 1. Redistributions of source code must retain the above copyright |
| 11 | .\" notice, this list of conditions and the following disclaimer. |
| 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 13 | .\" notice, this list of conditions and the following disclaimer in |
| 14 | .\" the documentation and/or other materials provided with the |
| 15 | .\" distribution. |
| 16 | .\" 3. The names of the authors may not be used to endorse or promote |
| 17 | .\" products derived from this software without specific prior |
| 18 | .\" written permission. |
| 19 | .\" |
| 20 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS |
| 21 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 22 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY |
| 24 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 26 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 27 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 28 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 29 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 30 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | .\" |
Thomas Klausner | 9647a97 | 2017-12-18 21:49:31 +0100 | [diff] [blame] | 32 | .Dd December 18, 2017 |
Thomas Klausner | 86a346b | 2014-08-02 12:10:27 +0200 | [diff] [blame] | 33 | .Dt ZIP_SOURCE_BUFFER 3 |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 34 | .Os |
| 35 | .Sh NAME |
Thomas Klausner | 2a5214f | 2017-12-11 13:45:36 +0100 | [diff] [blame] | 36 | .Nm zip_source_buffer , |
| 37 | .Nm zip_source_buffer_create |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 38 | .Nd create zip data source from buffer |
| 39 | .Sh LIBRARY |
| 40 | libzip (-lzip) |
| 41 | .Sh SYNOPSIS |
| 42 | .In zip.h |
Dieter Baron | 1d9dfeb | 2014-09-28 23:02:54 +0200 | [diff] [blame] | 43 | .Ft zip_source_t * |
Thomas Klausner | 9874efb | 2016-12-30 01:32:09 +0100 | [diff] [blame] | 44 | .Fn zip_source_buffer "zip_t *archive" "const void *data" "zip_uint64_t len" "int freep" |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 45 | .Ft zip_source_t * |
Thomas Klausner | 9874efb | 2016-12-30 01:32:09 +0100 | [diff] [blame] | 46 | .Fn zip_source_buffer_create "const void *data" "zip_uint64_t len" "int freep" "zip_error_t *error" |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 47 | .Sh DESCRIPTION |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 48 | The functions |
Thomas Klausner | fa02d9d | 2004-11-18 17:26:55 +0000 | [diff] [blame] | 49 | .Fn zip_source_buffer |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 50 | and |
| 51 | .Fn zip_source_buffer_create |
Thomas Klausner | 47617c7 | 2014-11-18 15:12:38 +0100 | [diff] [blame] | 52 | create a zip source from the buffer |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 53 | .Ar data |
| 54 | of size |
| 55 | .Ar len . |
| 56 | If |
| 57 | .Ar freep |
Dieter Baron | 8e05831 | 2008-05-16 08:33:00 +0200 | [diff] [blame] | 58 | is non-zero, the buffer will be freed when it is no longer needed. |
Dieter Baron | c25f33b | 2014-04-27 22:29:52 +0200 | [diff] [blame] | 59 | .Ar data |
| 60 | must remain valid for the lifetime of the created source. |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 61 | .Pp |
| 62 | The source can be used to open a zip archive from. |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 63 | .Sh RETURN VALUES |
| 64 | Upon successful completion, the created source is returned. |
| 65 | Otherwise, |
| 66 | .Dv NULL |
| 67 | is returned and the error code in |
| 68 | .Ar archive |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 69 | or |
| 70 | .Ar error |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 71 | is set to indicate the error. |
| 72 | .Sh ERRORS |
Thomas Klausner | fa02d9d | 2004-11-18 17:26:55 +0000 | [diff] [blame] | 73 | .Fn zip_source_buffer |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 74 | and |
| 75 | .Fn zip_source_buffer_create |
| 76 | fail if: |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 77 | .Bl -tag -width Er |
Thomas Klausner | d5cb87f | 2008-08-01 17:31:30 +0200 | [diff] [blame] | 78 | .It Bq Er ZIP_ER_INVAL |
Thomas Klausner | cab859e | 2004-11-18 15:10:49 +0000 | [diff] [blame] | 79 | .Ar len |
| 80 | is greater than zero and |
| 81 | .Ar data |
| 82 | is |
| 83 | .Dv NULL . |
| 84 | .It Bq Er ZIP_ER_MEMORY |
| 85 | Required memory could not be allocated. |
| 86 | .El |
| 87 | .Sh SEE ALSO |
Thomas Klausner | bec1cfe | 2005-06-09 18:50:27 +0000 | [diff] [blame] | 88 | .Xr libzip 3 , |
Thomas Klausner | e484034 | 2018-06-28 07:59:57 +0200 | [diff] [blame] | 89 | .Xr zip_file_add 3 , |
| 90 | .Xr zip_file_replace 3 , |
Thomas Klausner | c897550 | 2014-11-18 14:39:03 +0100 | [diff] [blame] | 91 | .Xr zip_open_from_source 3 , |
Thomas Klausner | 86a346b | 2014-08-02 12:10:27 +0200 | [diff] [blame] | 92 | .Xr zip_source 3 |
Thomas Klausner | 0f3bbd6 | 2017-12-18 17:39:22 +0100 | [diff] [blame] | 93 | .Sh HISTORY |
| 94 | .Fn zip_source_buffer |
| 95 | and |
| 96 | .Fn zip_source_buffer_create |
| 97 | were added in libzip 1.0. |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 98 | .Sh AUTHORS |
| 99 | .An -nosplit |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 100 | .An Dieter Baron Aq Mt dillo@nih.at |
Thomas Klausner | 39b5f9e | 2005-06-09 21:14:54 +0000 | [diff] [blame] | 101 | and |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 102 | .An Thomas Klausner Aq Mt tk@giga.or.at |