Imported Upstream version 1.4.0
[platform/upstream/libzip.git] / man / zip_source_buffer.mdoc
1 .\" zip_source_buffer.mdoc -- create zip data source from buffer
2 .\" Copyright (C) 2004-2017 Dieter Baron and Thomas Klausner
3 .\"
4 .\" This file is part of libzip, a library to manipulate ZIP archives.
5 .\" The authors can be contacted at <libzip@nih.at>
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 .\"
32 .Dd December 18, 2017
33 .Dt ZIP_SOURCE_BUFFER 3
34 .Os
35 .Sh NAME
36 .Nm zip_source_buffer ,
37 .Nm zip_source_buffer_create
38 .Nd create zip data source from buffer
39 .Sh LIBRARY
40 libzip (-lzip)
41 .Sh SYNOPSIS
42 .In zip.h
43 .Ft zip_source_t *
44 .Fn zip_source_buffer "zip_t *archive" "const void *data" "zip_uint64_t len" "int freep"
45 .Ft zip_source_t *
46 .Fn zip_source_buffer_create "const void *data" "zip_uint64_t len" "int freep" "zip_error_t *error"
47 .Sh DESCRIPTION
48 The functions
49 .Fn zip_source_buffer
50 and
51 .Fn zip_source_buffer_create
52 create a zip source from the buffer
53 .Ar data
54 of size
55 .Ar len .
56 If
57 .Ar freep
58 is non-zero, the buffer will be freed when it is no longer needed.
59 .Ar data
60 must remain valid for the lifetime of the created source.
61 .Pp
62 The source can be used to open a zip archive from.
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
69 or
70 .Ar error
71 is set to indicate the error.
72 .Sh ERRORS
73 .Fn zip_source_buffer
74 and
75 .Fn zip_source_buffer_create
76 fail if:
77 .Bl -tag -width Er
78 .It Bq Er ZIP_ER_INVAL
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
88 .Xr libzip 3 ,
89 .Xr zip_add 3 ,
90 .Xr zip_open_from_source 3 ,
91 .Xr zip_replace 3 ,
92 .Xr zip_source 3
93 .Sh HISTORY
94 .Fn zip_source_buffer
95 and
96 .Fn zip_source_buffer_create
97 were added in libzip 1.0.
98 .Sh AUTHORS
99 .An -nosplit
100 .An Dieter Baron Aq Mt dillo@nih.at
101 and
102 .An Thomas Klausner Aq Mt tk@giga.or.at