|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Define the client-resource operations used by a TIFF handle. More...
Typedefs | |
| typedef tmsize_t(* | TIFFReadWriteProc) (thandle_t fd, void *buf, tmsize_t size) |
| Transfer bytes at the current position of a client I/O resource. | |
| typedef toff_t(* | TIFFSeekProc) (thandle_t fd, toff_t off, int whence) |
| Change the current position of a client I/O resource. | |
| typedef int(* | TIFFCloseProc) (thandle_t fd) |
| Release a client I/O resource or its adapter context. | |
| typedef toff_t(* | TIFFSizeProc) (thandle_t fd) |
| Query the byte length of a client I/O resource. | |
| typedef int(* | TIFFMapFileProc) (thandle_t fd, void **base, toff_t *size) |
| Provide a readable whole-file view of a client resource. | |
| typedef void(* | TIFFUnmapFileProc) (thandle_t fd, void *base, toff_t size) |
| Release a whole-file view supplied by a mapping callback. | |
Define the client-resource operations used by a TIFF handle.
| typedef int(* TIFFCloseProc) (thandle_t fd) |
Release a client I/O resource or its adapter context.
TIFFClose() calls this once after TIFFCleanup() has invalidated the handle. TIFFCleanup() and a NULL-returning client open do not call it. The callback defines whether it closes a resource, frees a wrapper, or both; it must not access the freed TIFF handle. A C++ stream callback deletes the adapter but leaves the borrowed stream open. Failure does not restore the TIFF handle, and no automatic library diagnostic for close failure is guaranteed.
| [in,out] | fd | Client context passed to close after the TIFF handle is freed. |
Provide a readable whole-file view of a client resource.
The view starts at TIFF-file offset zero and must remain readable and valid until its matching TIFFUnmapFileProc call. Library mapping paths are read-only. The library borrows the view and releases it through the supplied unmapper, not _TIFFfree(). On failure the outputs are not guaranteed valid and must not be used. A failed mapping normally permits fallback to read/seek I/O without a library error. NULL mapproc is replaced by an always-failing dummy.
| [in,out] | fd | Opaque client context used to obtain a mapping. |
| [out] | base | Non-NULL output pointer for the view base on success. |
| [out] | size | Non-NULL output pointer for the view length in bytes on success. |
Transfer bytes at the current position of a client I/O resource.
Used for both readproc and writeproc. Reads fill buf, writes consume buf; either may advance the client position. Library callers normally require an exact transfer and do not provide general retry/rollback. A failure may follow partial I/O. Buffer storage remains caller-owned and can be reused immediately after return; do not retain it. Zero- length behaviour and errno/GetLastError are backend-specific. Callbacks must remain valid for the handle lifetime and must not destroy or recursively perform I/O on the invoking handle.
| [in,out] | fd | Opaque client context; the callback may update its I/O state. |
| [in,out] | buf | For reads, writable destination; for writes, readable source that must not be modified. Capacity is at least size bytes. |
| [in] | size | Requested nonnegative byte count representable by tmsize_t. |
Change the current position of a client I/O resource.
Offsets and returned positions use TIFF-file coordinates. A callback must support the seeks needed by the chosen operations, including absolute seeks from the beginning of the TIFF data. A failed seek need not preserve position. No storage ownership transfers. Backend diagnostics are not implied; the library may separately diagnose an unexpected position. Do not destroy or recursively perform I/O on the invoking handle.
| [in,out] | fd | Opaque client context whose position may change. |
| [in] | off | Byte offset interpreted according to whence; the interface uses an unsigned type. |
| [in] | whence | SEEK_SET, SEEK_CUR, or SEEK_END. |
Query the byte length of a client I/O resource.
If implemented by seeking, restore the prior position where possible. The library performs no independent position rollback and does not acquire storage ownership. Failure reporting and errno/GetLastError follow the callback. Keep the callback and context valid for the handle lifetime.
| [in,out] | fd | Opaque client context; a seek-based implementation may temporarily change position. |
Release a whole-file view supplied by a mapping callback.
Invalidates the mapped view according to the client mapping contract. Returns no status; the library cannot detect or report an unmap failure through this interface. It does not replace the client close callback. A NULL unmapproc installs a no-op, so supply a real unmapper whenever a successful mapping requires explicit release. The current early read-open failure cleanup can also invoke this callback with base = NULL and size = 0 before any mapping call. Tolerate that no-view case without assuming that a mapping was acquired.
| [in,out] | fd | Matching client context, still valid for view release. |
| [in] | base | Mapped-view base, or NULL in early no-view cleanup. |
| [in] | size | Mapped length in bytes, or zero in early no-view cleanup. |