---
name: "zzip_disk_entry_to_data"
section: "3"
platform: "linux"
package: "libzzip-dev"
version: "0.13.72+dfsg.1-1.1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/zzip_disk_entry_to_data"
---

# zzip\_disk\_entry\_to\_data(3)

helper functions for (mmapped) zip access api

## 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)
```

## DESCRIPTION

 The *zzip\_disk\_entry\_to\_data* function augments the other zzip\_disk\_entry\_\* helpers: here we move a disk\_entry pointer (as returned by \_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).

 The *zzip\_disk\_entry\_to\_file\_header* function does half the job of *zzip\_disk\_entry\_to\_data* where it can augment with *zzip\_file\_header\_to\_data* helper from format/fetch.h

 The *zzip\_disk\_entry\_to\_file\_header* function returns a pointer into disk-\>buffer or 0 on error (errno).

 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.

 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.

 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.

## AUTHOR

 Guido Draheim \<guidod@gmx.de\>

## COPYRIGHT

 Copyright (c)Guido Draheim, use under copyleft (LGPL,MPL)
