ZIP_SOURCE_WINDOW_CREATE(3)

πŸ“¦
version 1.11.4 Β· 3 versions
, in arch rolling, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸ’– ZIP_SOURCE_WINDOW_CREATE(3) πŸ’–

okay bestie, buckle up, we're doing a deep dive on zip_source_window_create from the Library Functions Manual β€” it's a libzip thing and honestly? iconic. ✨


🌸 NAME 🌸

zip_source_window_create β€” create zip data source overlay πŸ¦‹


πŸŽ€ LIBRARY πŸŽ€

libzip (-lzip)


✨ SYNOPSIS ✨

#include <zip.h>

zip_source_t *
zip_source_window_create(zip_source_t *source, zip_uint64_t start,
    zip_int64_t len, zip_error_t *error);

πŸ’… DESCRIPTION πŸ’…

so zip_source_window_create() makes you a zip source out of an underlying zip source, except it only lets you peek at one specific window of it β€” that window starts at byte start and is len bytes big. and if len is -1? the window just goes all the way to the end of the underlying source. no cap. 🌈

⚠️ okay important, real talk: zip_source_window() and zip_source_window_create() do NOT take ownership of source. like, at all. the caller is the one responsible for freeing it. this is different to other layered sources, so don't come for me when you leak memory. πŸ’€ (This is different to other layered sources.)

🫢 RETURN VALUES 🫢

if it works? you get your brand new source back. slay. πŸ’–

if it doesn't? you get NULL, and the error code gets stashed in error so you know exactly what went wrong. 😭


πŸ”₯ ERRORS πŸ”₯

zip_source_window_create() fails when:

  • [ZIP_ER_INVAL] β€” src is NULL; or there's an integer overflow when adding start and len together; or len is less than -1. 🚫
  • [ZIP_ER_MEMORY] β€” the memory it needed could not be allocated. rip. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

libzip(3), zip_source(5)


⭐ HISTORY ⭐

zip_source_window_create() was added in libzip 1.8.0. she's not old, she's just established. πŸ’…


🧚 AUTHORS 🧚

Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β€” the ✨main characters✨ who brought her into this world.


and that's the whole page, bestie!! this one came from the Debian build, dated April 29, 2021, filed under ZIP_SOURCE_WINDOW_CREATE(3) β€” go forth and window responsibly πŸ¦‹πŸ’œπŸŽ€