---
name: "zip_source_seek_compute_offset"
section: "3"
platform: "linux"
package: "libzip"
version: "1.11.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/zip_source_seek_compute_offset"
---

# zip\_source\_seek\_compute\_offset(3)

validate arguments and compute offset

## NAME

**zip\_source\_seek\_compute\_offset** – validate arguments and compute offset

## LIBRARY

libzip (-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*);

## DESCRIPTION

Use this function to compute the offset for a ZIP\_SOURCE\_SEEK or ZIP\_SOURCE\_SEEK\_WRITE command. *data* and *data\_length* are the arguments to the source callback, *offset* is the current offset and *length* is the length of the source data or, for ZIP\_SOURCE\_SEEK\_WRITE, the amount of data written.

## RETURN VALUES

On success, it returns the new offset, on error it returns -1 and sets *error*.

## 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.

## SEE ALSO

[zip\_source\_function(3)](/zip_source_function/3.md)

## HISTORY

**zip\_source\_seek\_compute\_offset**() was added in libzip 1.0.

## AUTHORS

Dieter Baron ⟨*dillo@nih.at*⟩ and Thomas Klausner ⟨*wiz@gatalith.at*⟩
