blob: 081e7e2a488d4b50ed1164357a9306bfdac8fcd4 [file] [log] [blame]
Thomas Klausnerfa02d9d2004-11-18 17:26:55 +00001.\" zip_source_buffer.mdoc -- create zip data source from buffer
Thomas Klausner9c5347e2021-06-18 11:33:22 +02002.\" Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
Thomas Klausnercab859e2004-11-18 15:10:49 +00003.\"
4.\" This file is part of libzip, a library to manipulate ZIP archives.
Dieter Baronb86c4332007-11-07 14:35:13 +01005.\" The authors can be contacted at <libzip@nih.at>
Thomas Klausnercab859e2004-11-18 15:10:49 +00006.\"
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 Klausner9647a972017-12-18 21:49:31 +010032.Dd December 18, 2017
Thomas Klausner86a346b2014-08-02 12:10:27 +020033.Dt ZIP_SOURCE_BUFFER 3
Thomas Klausnercab859e2004-11-18 15:10:49 +000034.Os
35.Sh NAME
Thomas Klausner2a5214f2017-12-11 13:45:36 +010036.Nm zip_source_buffer ,
37.Nm zip_source_buffer_create
Thomas Klausnercab859e2004-11-18 15:10:49 +000038.Nd create zip data source from buffer
39.Sh LIBRARY
40libzip (-lzip)
41.Sh SYNOPSIS
42.In zip.h
Dieter Baron1d9dfeb2014-09-28 23:02:54 +020043.Ft zip_source_t *
Thomas Klausner9874efb2016-12-30 01:32:09 +010044.Fn zip_source_buffer "zip_t *archive" "const void *data" "zip_uint64_t len" "int freep"
Thomas Klausnerc8975502014-11-18 14:39:03 +010045.Ft zip_source_t *
Thomas Klausner9874efb2016-12-30 01:32:09 +010046.Fn zip_source_buffer_create "const void *data" "zip_uint64_t len" "int freep" "zip_error_t *error"
Thomas Klausnercab859e2004-11-18 15:10:49 +000047.Sh DESCRIPTION
Thomas Klausnerc8975502014-11-18 14:39:03 +010048The functions
Thomas Klausnerfa02d9d2004-11-18 17:26:55 +000049.Fn zip_source_buffer
Thomas Klausnerc8975502014-11-18 14:39:03 +010050and
51.Fn zip_source_buffer_create
Thomas Klausner47617c72014-11-18 15:12:38 +010052create a zip source from the buffer
Thomas Klausnercab859e2004-11-18 15:10:49 +000053.Ar data
54of size
55.Ar len .
56If
57.Ar freep
Dieter Baron8e058312008-05-16 08:33:00 +020058is non-zero, the buffer will be freed when it is no longer needed.
Dieter Baronc25f33b2014-04-27 22:29:52 +020059.Ar data
60must remain valid for the lifetime of the created source.
Thomas Klausnerc8975502014-11-18 14:39:03 +010061.Pp
62The source can be used to open a zip archive from.
Thomas Klausnercab859e2004-11-18 15:10:49 +000063.Sh RETURN VALUES
64Upon successful completion, the created source is returned.
65Otherwise,
66.Dv NULL
67is returned and the error code in
68.Ar archive
Thomas Klausnerc8975502014-11-18 14:39:03 +010069or
70.Ar error
Thomas Klausnercab859e2004-11-18 15:10:49 +000071is set to indicate the error.
72.Sh ERRORS
Thomas Klausnerfa02d9d2004-11-18 17:26:55 +000073.Fn zip_source_buffer
Thomas Klausnerc8975502014-11-18 14:39:03 +010074and
75.Fn zip_source_buffer_create
76fail if:
Thomas Klausnercab859e2004-11-18 15:10:49 +000077.Bl -tag -width Er
Thomas Klausnerd5cb87f2008-08-01 17:31:30 +020078.It Bq Er ZIP_ER_INVAL
Thomas Klausnercab859e2004-11-18 15:10:49 +000079.Ar len
80is greater than zero and
81.Ar data
82is
83.Dv NULL .
84.It Bq Er ZIP_ER_MEMORY
85Required memory could not be allocated.
86.El
87.Sh SEE ALSO
Thomas Klausnerbec1cfe2005-06-09 18:50:27 +000088.Xr libzip 3 ,
Thomas Klausnere4840342018-06-28 07:59:57 +020089.Xr zip_file_add 3 ,
90.Xr zip_file_replace 3 ,
Thomas Klausnerc8975502014-11-18 14:39:03 +010091.Xr zip_open_from_source 3 ,
Thomas Klausner86a346b2014-08-02 12:10:27 +020092.Xr zip_source 3
Thomas Klausner0f3bbd62017-12-18 17:39:22 +010093.Sh HISTORY
94.Fn zip_source_buffer
95and
96.Fn zip_source_buffer_create
97were added in libzip 1.0.
Thomas Klausnera456cf52005-06-09 21:13:13 +000098.Sh AUTHORS
99.An -nosplit
Thomas Klausner0acbab42013-07-28 23:29:08 +0200100.An Dieter Baron Aq Mt dillo@nih.at
Thomas Klausner39b5f9e2005-06-09 21:14:54 +0000101and
Thomas Klausner0acbab42013-07-28 23:29:08 +0200102.An Thomas Klausner Aq Mt tk@giga.or.at