|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Track borrowed streams and implement their client I/O callbacks. More...
Data Structures | |
| struct | tiffis_data |
| Track a borrowed input stream and its initial position. More... | |
| struct | tiffos_data |
| Track a borrowed output stream and its initial position. More... | |
Functions | |
| static tmsize_t | _tiffosReadProc (thandle_t fd, void *buf, tmsize_t size) |
| Refuse reads on an output-stream adapter. | |
| static tmsize_t | _tiffisReadProc (thandle_t fd, void *buf, tmsize_t size) |
| Read bytes from the borrowed input stream. | |
| static tmsize_t | _tiffosWriteProc (thandle_t fd, void *buf, tmsize_t size) |
| Write bytes to the borrowed output stream. | |
| static tmsize_t | _tiffisWriteProc (thandle_t fd, void *buf, tmsize_t size) |
| Refuse writes on an input-stream adapter. | |
| static uint64_t | _tiffosSeekProc (thandle_t fd, uint64_t off, int whence) |
| Seek the borrowed output stream, with a zero-fill extension fallback. | |
| static uint64_t | _tiffisSeekProc (thandle_t fd, uint64_t off, int whence) |
| Seek the borrowed input stream relative to its recorded TIFF origin. | |
| static uint64_t | _tiffosSizeProc (thandle_t fd) |
| Query the absolute end position of the borrowed stream. | |
| static uint64_t | _tiffisSizeProc (thandle_t fd) |
| Query the absolute end position of the borrowed stream. | |
| static int | _tiffosCloseProc (thandle_t fd) |
| Delete a stream adapter without closing the borrowed stream. | |
| static int | _tiffisCloseProc (thandle_t fd) |
| Delete a stream adapter without closing the borrowed stream. | |
| static int | _tiffDummyMapProcCxx (thandle_t fd, void **base, toff_t *size) |
| Decline mapping for the C++ stream adapter. | |
| static void | _tiffDummyUnmapProcCxx (thandle_t fd, void *base, toff_t size) |
| Provide a no-op unmapper for the C++ stream adapter. | |
| static TIFF * | _tiffStreamOpen (const char *name, const char *mode, void *fd) |
| Allocate a stream context and attach it through TIFFClientOpen(). | |
Track borrowed streams and implement their client I/O callbacks.
Decline mapping for the C++ stream adapter.
Performs no I/O, allocation, or diagnostic; outputs must not be used as a view.
| [in] | fd | Unused client context. |
| [in] | base | Unused view output; not written. |
| [in] | size | Unused length output; not written. |
Definition at line 600 of file tif_stream.cxx.
Referenced by _tiffStreamOpen().
Provide a no-op unmapper for the C++ stream adapter.
Does not release storage, perform I/O, or emit diagnostics. Returns no status; the stream mapper never supplies a view.
| [in] | fd | Unused client context. |
| [in] | base | Unused view address. |
| [in] | size | Unused view byte length. |
Definition at line 607 of file tif_stream.cxx.
Referenced by _tiffStreamOpen().
|
static |
Delete a stream adapter without closing the borrowed stream.
Deletes only the adapter allocated by _tiffStreamOpen(). Does not close, flush, or delete the caller-owned stream and does not emit a diagnostic.
| [in] | fd | Live tiffis_data allocation; invalid after return. |
Definition at line 593 of file tif_stream.cxx.
Referenced by _tiffStreamOpen().
Read bytes from the borrowed input stream.
Reads at the current get position, which advances by the transferred bytes. Stream fail/eof state may change, and a failed/short read may modify part of buf. Does not emit a library diagnostic or take buffer ownership. Stream exceptions propagate without cleanup or status conversion.
| [in,out] | fd | Live tiffis_data context. |
| [out] | buf | Destination with at least size writable bytes. |
| [in] | size | Requested nonnegative byte count. |
Definition at line 326 of file tif_stream.cxx.
References tiffis_data::stream.
Referenced by _tiffStreamOpen().
|
static |
Seek the borrowed input stream relative to its recorded TIFF origin.
SEEK_SET adds start_pos; other origins use stream-relative seeking. Does not clear an existing fail state, restore position on failure, allocate, or emit a library diagnostic. Input stream state can change and exceptions propagate.
| [in,out] | fd | Live tiffis_data context. |
| [in] | off | Unsigned byte offset interpreted by whence. |
| [in] | whence | SEEK_SET, SEEK_CUR, or SEEK_END; any other value performs no seek and returns the current relative position. |
Definition at line 459 of file tif_stream.cxx.
References tiffis_data::start_pos, and tiffis_data::stream.
Referenced by _tiffStreamOpen().
|
static |
Query the absolute end position of the borrowed stream.
Saves the get position, seeks to the end, then restores the saved position. If the initial tellg() fails, returns zero without seeking. If the end seek or end query fails, temporarily clears failbit to restore the position, then reinstates the failed stream state; restoration itself is not guaranteed. The size does not subtract start_pos. Does not release or explicitly flush the stream, and emits no library diagnostic. Stream exceptions propagate.
| [in,out] | fd | Live tiffis_data context. |
Definition at line 551 of file tif_stream.cxx.
References tiffis_data::stream.
Referenced by _tiffStreamOpen().
Refuse writes on an input-stream adapter.
Performs no I/O, allocation, release, or diagnostic; an input adapter cannot write.
| [in] | fd | Unused client context. |
| [in] | buf | Unused caller buffer; not read. |
| [in] | size | Unused requested byte count. |
Definition at line 356 of file tif_stream.cxx.
Referenced by _tiffStreamOpen().
|
static |
Delete a stream adapter without closing the borrowed stream.
Deletes only the adapter allocated by _tiffStreamOpen(). Does not close, flush, or delete the caller-owned stream and does not emit a diagnostic.
| [in] | fd | Live tiffos_data allocation; invalid after return. |
Definition at line 586 of file tif_stream.cxx.
Referenced by _tiffStreamOpen().
Refuse reads on an output-stream adapter.
Performs no I/O, allocation, release, or diagnostic; an output adapter cannot read.
| [in] | fd | Unused client context. |
| [in] | buf | Unused caller buffer; not written. |
| [in] | size | Unused requested byte count. |
Definition at line 324 of file tif_stream.cxx.
Referenced by _tiffStreamOpen().
|
static |
Seek the borrowed output stream, with a zero-fill extension fallback.
SEEK_SET adds start_pos. If the seek fails, clears failbit and, when the target lies beyond start_pos, extends the stream with null bytes up to the target and seeks again. This can change bytes, position, and flags even on failure. An unrecognised whence performs no seek. Final tellp() is not normalised to the TIFF origin; nonzero-origin output is not reliably supported. No library diagnostic or allocation ownership transfer occurs; exceptions propagate.
| [in,out] | fd | Live tiffos_data context. |
| [in] | off | Unsigned byte offset interpreted by whence. |
| [in] | whence | SEEK_SET, SEEK_CUR, or SEEK_END; any other value leaves the position unchanged. |
Definition at line 358 of file tif_stream.cxx.
References tiffos_data::start_pos, and tiffos_data::stream.
Referenced by _tiffStreamOpen().
|
static |
Query the absolute end position of the borrowed stream.
Saves the put position, seeks to the end, then restores the saved position. If the initial tellp() fails, returns zero without seeking. If the end seek or end query fails, temporarily clears failbit to restore the position, then reinstates the failed stream state; restoration itself is not guaranteed. The size does not subtract start_pos. Does not release or explicitly flush the stream, and emits no library diagnostic. Stream exceptions propagate.
| [in,out] | fd | Live tiffos_data context. |
Definition at line 515 of file tif_stream.cxx.
References tiffos_data::stream.
Referenced by _tiffStreamOpen().
Write bytes to the borrowed output stream.
Writes at the current put position without explicitly flushing the stream. Failure changes stream state and may follow partial output; failed tellp() values are not independently checked here, so the difference is not a reliable general failure sentinel. Buffer ownership is unchanged. Stream exceptions propagate.
| [in,out] | fd | Live tiffos_data context. |
| [in] | buf | Source with at least size readable bytes. |
| [in] | size | Requested nonnegative byte count. |
Definition at line 340 of file tif_stream.cxx.
References tiffos_data::stream.
Referenced by _tiffStreamOpen().
|
static |
Allocate a stream context and attach it through TIFFClientOpen().
Allocates the appropriate tiffos_data/tiffis_data object, records tellp()/tellg(), and installs its callbacks. Successful handles release the adapter through the client close callback. A normal NULL return deletes the adapter; the borrowed stream remains alive but may have changed bytes, position, or flags. No exception cleanup guard protects an adapter already allocated before a throwing stream/library callback.
| [in] | name | Non-NULL copied diagnostic name. |
| [in] | mode | Internal mode string; presence of w selects output, otherwise input. |
| [in,out] | fd | Borrowed ostream or istream pointer matching mode. |
Definition at line 616 of file tif_stream.cxx.
References _tiffDummyMapProcCxx(), _tiffDummyUnmapProcCxx(), _tiffisCloseProc(), _tiffisReadProc(), _tiffisSeekProc(), _tiffisSizeProc(), _tiffisWriteProc(), _tiffosCloseProc(), _tiffosReadProc(), _tiffosSeekProc(), _tiffosSizeProc(), _tiffosWriteProc(), tiffis_data::start_pos, tiffos_data::start_pos, tiffis_data::stream, tiffos_data::stream, and TIFFClientOpen().
Referenced by TIFFStreamOpen(), and TIFFStreamOpen().