zzip_disk_entry_to_data(3)
β¨ zzip_disk_entry_to_data β the zziplib function list page, bestie edition β¨
okay so hi π you've landed on a page from zziplib (version 0.13.72, she's an icon, she's been serving since forever). This one's about a lil family of helper functions for the (mmapped) zip access api β specifically the ones that take a disk entry and turn it into something useful. Grab a strawberry π and let's go.
πΈ NAME πΈ
zzip_disk_entry_to_data, zzip_disk_entry_to_file_header, zzip_disk_entry_strdup_name, zzip_disk_entry_strdup_comment β helper functions for (mmapped) zip access api π
π SYNOPSIS π
#include <zzip/mmapped.h>
zzip_byte_t *
zzip_disk_entry_to_data(ZZIP_DISK * disk, struct zzip_disk_entry * entry)
struct zzip_file_header *
zzip_disk_entry_to_file_header(ZZIP_DISK * disk, struct zzip_disk_entry *entry)
zzip__new__ char *
zzip_disk_entry_strdup_name(ZZIP_DISK * disk, struct zzip_disk_entry *entry)
zzip__new__ char *
zzip_disk_entry_strdup_comment(ZZIP_DISK * disk, struct zzip_disk_entry *entry)
like, four functions, all taking a ZZIP_DISK * disk and a struct zzip_disk_entry * entry, and honestly? they're all doing little transformations. slay.
π DESCRIPTION π
π zzip_disk_entry_to_data
The zzip_disk_entry_to_data function augments the other zzip_disk_entry_* helpers: here we move a disk_entry pointer (as returned by the _find* functions) into a pointer to the data block right after the file_header. Only disk->buffer would be needed to perform the seek, but we check the mmapped range end as well. π¦
The zzip_disk_entry_to_data function returns a pointer into disk->buffer or 0 on error (errno).
β¨ zzip_disk_entry_to_file_header
The zzip_disk_entry_to_file_header function does half the job of zzip_disk_entry_to_data, where it can augment with the zzip_file_header_to_data helper from format/fetch.h. iykyk π§
The zzip_disk_entry_to_file_header function returns a pointer into disk->buffer or 0 on error (errno).
π zzip_disk_entry_strdup_name
The zzip_disk_entry_strdup_name function is a big helper despite its little name: in a zip file the encoded filenames are usually NOT zero-terminated, but for common usage with libc we need it that way. Secondly, the filename SHOULD be present in the zip central directory, but if not, then we fallback to the filename given in the file_header of each compressed data portion. no cap, that's the whole plot π«Ά
The zzip_disk_entry_strdup_name function returns a new string buffer, or null on error. If no name can be found then an empty string is returned.
π
zzip_disk_entry_strdup_comment
The zzip_disk_entry_strdup_comment function is similar, creating a reference to a zero terminated string, but it can only exist in the zip central directory entry.
The zzip_disk_entry_strdup_comment function returns a new string buffer, or null on error (errno). If no name can be found then an empty string is returned.
ngl bestie, watch out for those returns β some of them hand you a fresh string you now own, and some just point into disk->buffer. Different vibes, different responsibilities, fr fr. π
π¦ AUTHOR π¦
Guido Draheim <guidod@gmx.de>
π COPYRIGHT π
Copyright (c)Guido Draheim, use under copyleft (LGPL,MPL)
okay that's the whole page, you ate it up π this was the zziplib 0.13.72 manual for zzip_disk_entry_to_data(3) β go forth and mmap responsibly, bestie, main character energy only πβ¨
π¦ where this page comes from
- debian bookworm: libzzip-dev 0.13.72+dfsg.1-1.1
- ubuntu jammy: libzzip-dev 0.13.72+dfsg.1-1.1
- ubuntu noble: libzzip-dev 0.13.72+dfsg.1-1.2build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms