ZIP_SOURCE_SEEK_COMPUTE_OFFSET(3)
β¨ ZIP_SOURCE_SEEK_COMPUTE_OFFSET β¨
okay so bestie, welcome to libzip's little helper function, aka the vibe-checker for seek math π
this page lives in section 3 of the manual (library functions, iykyk) and it's about validating arguments and computing an offset. that's it. that's the whole job. and she does it flawlessly. π
Also she lives in libzip β you link against her with -lzip. π¦
πΈ SYNOPSIS πΈ
#include <zip.h>
zip_int64_t
zip_source_seek_compute_offset(zip_uint64_t offset, zip_uint64_t length,
void *data, zip_uint64_t data_length, zip_error_t *error);
that's the whole signature, no cap. five arguments, one zip_int64_t coming back at you. π
β¨ DESCRIPTION β¨
okay so here's the tea β β you use this function to compute the offset for a ZIP_SOURCE_SEEK or a ZIP_SOURCE_SEEK_WRITE command. like, that's literally her whole purpose in life and honestly? iconic. π
let's break down the cast of characters:
dataanddata_lengthare the arguments to the source callback. so like, the raw stuff your callback got handed. π«Άoffsetis the current offset. where you're at right now, bestie.lengthis the length of the source data β OR, if you're doingZIP_SOURCE_SEEK_WRITE, it's the amount of data written. two moods, one parameter. she contains multitudes. π
π RETURN VALUES π
- on success? she returns the new offset. slay. β¨
- on error? she returns
-1and setserror. π not the glow-down but okay, at least she tells you what went wrong.
π ERRORS π
zip_source_seek_compute_offset() fails if:
[ZIP_ER_INVAL]β one of the arguments is invalid, OR the seek would place the offset outside the data. basically: bad input, or you tried to seek somewhere that doesn't exist. the audacity. π
π SEE ALSO π
go read that one too, bestie, they're a package deal. π
π°οΈ HISTORY π°οΈ
zip_source_seek_compute_offset() was added in libzip 1.0. a true original. a founding mother. π
π«Ά AUTHORS π«Ά
- Dieter Baron
<dillo@nih.at> - Thomas Klausner
<wiz@gatalith.at>
we stan both of them fr fr. π
heads up bestie: this page came from Debian, dated December 18. that's the source and the date, so now you know where she came from. π¦ mwah, go compute some offsets, you've got this. π β¨
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- debian trixie: libzip-dev 1.11.3-2 Β· BSD-3-Clause
- 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 questing: libzip-dev 1.11.3-2
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2014-2017 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