ZIP_SOURCE_ZIP(3)
π zip_source_zip β the NAME moment π
okay bestie, gather round, because this page is literally called zip_source_zip, zip_source_zip_create and what it does is create a data source from a zip file β and yes, it's the obsolete interface, we'll get to that, don't panic π«Ά
π LIBRARY π
libzip (-lzip) β that's the one, that's the girl π
β¨ SYNOPSIS β¨
#include <zip.h>
zip_source_t *
zip_source_zip(zip_t *archive, zip_t *srcarchive, zip_uint64_t srcidx,
zip_flags_t flags, zip_uint64_t start, zip_int64_t len);
zip_source_t *
zip_source_zip_create(zip_t *srcarchive, zip_uint64_t srcidx,
zip_flags_t flags, zip_uint64_t start, zip_int64_t len,
zip_error_t *error);
like look at those signatures, they ate π₯
π¦ DESCRIPTION π¦
so. real talk. zip_source_zip() and zip_source_zip_create() are the obsolete versions of zip_source_zip_file(3) and zip_source_zip_file_create(3) respectively. old queens, still iconic, but the newer ones are the main characters now. π
if what you actually want is the compressed data of the complete file, you do this instead:
zip_source_zip_file(za, source_archive, source_index,
ZIP_FL_COMPRESSED, 0, -1, NULL)
periodt. write that down.
now, what do the old ones actually do? They create a zip source from a file inside a zip archive. So:
srcarchiveis the (open!) zip archive that's holding the source zip file, and that file lives at indexsrcidxβ got it? index, not name, bestie.lenbytes starting from offsetstartget used in the zip_source.- if
lenis0or-1, then it's the rest of the file, starting fromstart. simple as. - and if
startis zero andlenis-1, the whole file gets copied without decompressing it. no decompression, just vibes. π
the flags that are supported (just the one, she's lowkey solo):
ZIP_FL_UNCHANGEDβ try to get the original data, without any of the changes that may have been made tosrcarchiveafter it was opened. like, pre-edit footage. no cap.
π RETURN VALUES π
if it works? the created source is returned. slay. π
if it doesn't? NULL comes back, and the error code in archive or error is set to tell you what went wrong. it's giving "we need to talk". π
π ERRORS π
zip_source_zip() and zip_source_zip_create() fail if:
[ZIP_ER_CHANGED]β you asked for unchanged data, but it's just not available. she's not there, babe. π[ZIP_ER_INVAL]βsrcarchive,srcidx,start, orlenare invalid. check ur args bestie.[ZIP_ER_MEMORY]β the memory it needed could not be allocated. π
and additionally, it can return all error codes from zip_stat_index() and zip_fopen_index(). so many possibilities, she contains multitudes β¨
π SEE ALSO π
libzip(3), zip_file_add(3), zip_file_replace(3), zip_source(5)
go read them, iykyk π
πΈ HISTORY πΈ
zip_source_zip()was added in libzip 1.0.zip_source_zip_create()was added in libzip 1.8.0.- Both were deprecated in libzip 1.10.0. π rip boo, you had a good run.
- Use
zip_source_zip_file()orzip_source_zip_file_create()instead. that's the assignment. π«Ά
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β the parents of this whole thing, obsessed with them π
and that's the page!! this was the Debian build of the zip_source_zip(3) manual, dated January 23, 2023 β mwah, thanks for reading, love u, bye bestie!! π
β¨ππ¦πΈ
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2004-2021 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms