|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Configure checked allocations and per-handle diagnostics for opening. More...
Typedefs | |
| typedef int(* | TIFFErrorHandlerExtR) (TIFF *tif, void *user_data, const char *module, const char *fmt, va_list ap) |
| Handle a diagnostic using a per-handle borrowed context. | |
Functions | |
| TIFFOpenOptions * | TIFFOpenOptionsAlloc (void) |
| Allocate default options for opening a TIFF handle. | |
| void | TIFFOpenOptionsFree (TIFFOpenOptions *opts) |
| Release an open-options object. | |
| void | TIFFOpenOptionsSetMaxSingleMemAlloc (TIFFOpenOptions *opts, tmsize_t max_single_mem_alloc) |
| Set the single checked allocation limit for subsequent opens. | |
| void | TIFFOpenOptionsSetMaxCumulatedMemAlloc (TIFFOpenOptions *opts, tmsize_t max_cumulated_mem_alloc) |
| Set the cumulative checked allocation limit for subsequent opens. | |
| void | TIFFOpenOptionsSetWarnAboutUnknownTags (TIFFOpenOptions *opts, int warn_about_unknown_tags) |
| Select whether subsequent opens warn about unknown tags. | |
| void | TIFFOpenOptionsSetErrorHandlerExtR (TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *errorhandler_user_data) |
| Set the per-handle error callback for subsequent opens. | |
| void | TIFFOpenOptionsSetWarningHandlerExtR (TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *warnhandler_user_data) |
| Set the per-handle warning callback for subsequent opens. | |
Configure checked allocations and per-handle diagnostics for opening.
| typedef int(* TIFFErrorHandlerExtR) (TIFF *tif, void *user_data, const char *module, const char *fmt, va_list ap) |
Handle a diagnostic using a per-handle borrowed context.
The same signature is used for per-handle errors and warnings. Invocation is synchronous; do not destroy the invoking handle or recursively mutate its I/O state. The callback and context must remain valid through opening, normal use, and close. The library does not own the context or retain module/fmt/ap beyond the call. Early errors may supply tif = NULL. Callback exceptions are not caught by the C library.
| [in] | tif | Invoking handle, or NULL for an error before a handle exists. |
| [in,out] | user_data | Borrowed context supplied through open options; possibly NULL. |
| [in] | module | Borrowed diagnostic module name, possibly NULL. |
| [in] | fmt | Borrowed printf-style format string. |
| [in,out] | ap | Borrowed argument list valid during this invocation; use va_copy() for an independent traversal. |
|
extern |
Allocate default options for opening a TIFF handle.
The object starts with no per-handle diagnostic callbacks, no allocation limits, and unknown-tag warnings disabled. Allocation failure is reported only by NULL; this function does not emit a library diagnostic. The object has no owned callback-context storage.
Definition at line 85 of file tif_open.c.
References _TIFFcalloc().
|
extern |
Release an open-options object.
Invalidates opts without freeing callback contexts or affecting settings already copied into an open handle. NULL is accepted. There is no status result or library diagnostic. Any callback contexts copied into a handle must remain alive until their last invocation, including during close.
| [in] | opts | Options returned by TIFFOpenOptionsAlloc(), or NULL. |
Definition at line 92 of file tif_open.c.
References _TIFFfree().
|
extern |
Set the per-handle error callback for subsequent opens.
Stores the callback and borrowed context for subsequent opens; existing handles are unchanged. NULL removes the per-handle callback from these options. There is no allocation, context copy, diagnostic, or status result.
Opening copies the function and context pointers, so the options may then be freed while the context remains valid through the last callback on the resulting handle. The callback is synchronous and may run during opening and closing. Nonzero callback return suppresses the legacy global handlers for that message, not the underlying operation. Early opening errors can invoke the handler with a NULL TIFF pointer; no callback may assume that a fully initialised handle exists.
| [in,out] | opts | Non-NULL open-options object. |
| [in] | handler | Callback to store, or NULL for the normal global- handler path. |
| [in] | errorhandler_user_data | Borrowed context, possibly NULL, passed to the callback. |
Definition at line 112 of file tif_open.c.
References TIFFOpenOptions::errorhandler, and TIFFOpenOptions::errorhandler_user_data.
|
extern |
Set the cumulative checked allocation limit for subsequent opens.
Stores the value for subsequent opens; already-open handles are unchanged. Zero is the default and means unlimited. Negative values are stored without validation and do not activate the positive-limit checks. No allocation or diagnostic occurs and no status is returned.
The positive limit applies to the total tracked by the handle-aware allocation helpers, not total process memory. The initial handle/name allocation is checked against this limit separately, but is not added to that tracked total. Direct _TIFFmalloc()/_TIFFrealloc() calls, mappings, caller storage, and other untracked allocations are not covered.
| [in,out] | opts | Non-NULL open-options object. |
| [in] | max_cumulated_mem_alloc | Byte limit; positive enables checking, zero leaves it unlimited. |
Definition at line 100 of file tif_open.c.
References TIFFOpenOptions::max_cumulated_mem_alloc.
|
extern |
Set the single checked allocation limit for subsequent opens.
Stores the value for subsequent opens; already-open handles are unchanged. Zero is the default and means unlimited. Negative values are stored without validation and do not activate the positive-limit checks. No allocation or diagnostic occurs and no status is returned.
The positive limit is applied to the initial handle/name allocation and requests through the handle-aware allocation helpers. It does not limit direct calls to _TIFFmalloc() or _TIFFrealloc(), caller storage, or allocations outside those checked paths.
| [in,out] | opts | Non-NULL open-options object. |
| [in] | max_single_mem_alloc | Byte limit; positive enables checking, zero leaves it unlimited. |
Definition at line 94 of file tif_open.c.
References TIFFOpenOptions::max_single_mem_alloc.
|
extern |
Select whether subsequent opens warn about unknown tags.
Stores the value without allocating, emitting diagnostics, or changing existing handles. There is no status result. The default is zero since 4.7.1; this setting controls unknown-tag warnings rather than making unknown tags valid or invalid.
| [in,out] | opts | Non-NULL open-options object. |
| [in] | warn_about_unknown_tags | Zero disables warnings; nonzero enables them. |
Definition at line 106 of file tif_open.c.
References TIFFOpenOptions::warn_about_unknown_tags.
|
extern |
Set the per-handle warning callback for subsequent opens.
Stores the callback and borrowed context for subsequent opens; existing handles are unchanged. NULL removes the per-handle callback from these options. There is no allocation, context copy, diagnostic, or status result.
Opening copies the function and context pointers, so the options may then be freed while the context remains valid through the last callback on the resulting handle. The callback is synchronous and may run during opening and closing. Nonzero callback return suppresses the legacy global handlers for that message, not the underlying operation. The callback follows the TIFFErrorHandlerExtR signature; its return value does not change operation success.
| [in,out] | opts | Non-NULL open-options object. |
| [in] | handler | Callback to store, or NULL for the normal global- handler path. |
| [in] | warnhandler_user_data | Borrowed context, possibly NULL, passed to the callback. |
Definition at line 120 of file tif_open.c.
References TIFFOpenOptions::warnhandler, and TIFFOpenOptions::warnhandler_user_data.