|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Implement native Windows resource callbacks and pathname opening. More...
Go to the source code of this file.
Functions | |
| static thandle_t | thandle_from_int (int ifd) |
| Convert the native Windows integer handle representation to thandle_t. | |
| static int | thandle_to_int (thandle_t fd) |
| Convert a native Windows handle to the backend integer representation. | |
| static tmsize_t | _tiffReadProc (thandle_t fd, void *buf, tmsize_t size) |
| Read bytes from the Windows HANDLE with ReadFile(). | |
| static tmsize_t | _tiffWriteProc (thandle_t fd, void *buf, tmsize_t size) |
| Write bytes to the Windows HANDLE with WriteFile(). | |
| static uint64_t | _tiffSeekProc (thandle_t fd, uint64_t off, int whence) |
| Seek the platform resource and return its reported position. | |
| static int | _tiffCloseProc (thandle_t fd) |
| Release the backend OS resource. | |
| static uint64_t | _tiffSizeProc (thandle_t fd) |
| Query the backend resource length in bytes. | |
| static int | _tiffMapProc (thandle_t fd, void **pbase, toff_t *psize) |
| Create a read-only view of the entire backend resource. | |
| static void | _tiffUnmapProc (thandle_t fd, void *base, toff_t size) |
| Release a read-only backend mapping. | |
| TIFF * | TIFFFdOpen (int ifd, const char *name, const char *mode) |
| Attach a TIFF handle to an already-open platform resource. | |
| TIFF * | TIFFFdOpenExt (int ifd, const char *name, const char *mode, TIFFOpenOptions *opts) |
| Attach a TIFF handle to an already-open platform resource. | |
| TIFF * | TIFFOpen (const char *name, const char *mode) |
| Open a TIFF file by pathname. | |
| TIFF * | TIFFOpenExt (const char *name, const char *mode, TIFFOpenOptions *opts) |
| Open a TIFF file by pathname. | |
| TIFF * | TIFFOpenW (const wchar_t *name, const char *mode) |
| Open a TIFF file using a wide Windows pathname. | |
| TIFF * | TIFFOpenWExt (const wchar_t *name, const char *mode, TIFFOpenOptions *opts) |
| Open a TIFF file using a wide Windows pathname. | |
| void * | _TIFFmalloc (tmsize_t s) |
| Allocate an uninitialised block through the public allocator. | |
| void * | _TIFFcalloc (tmsize_t nmemb, tmsize_t siz) |
| Allocate a zero-filled array through the public allocator. | |
| void | _TIFFfree (void *p) |
| Release a block allocated by the public allocation family. | |
| void * | _TIFFrealloc (void *p, tmsize_t s) |
| Resize a public-allocator block using platform realloc semantics. | |
| void | _TIFFmemset (void *p, int v, tmsize_t c) |
| Fill a byte range with one repeated byte. | |
| void | _TIFFmemcpy (void *d, const void *s, tmsize_t c) |
| Copy a non-overlapping byte range. | |
| int | _TIFFmemcmp (const void *p1, const void *p2, tmsize_t c) |
| Compare two byte ranges lexicographically. | |
| static void | Win32WarningHandler (const char *module, const char *fmt, va_list ap) |
| Print a default warning diagnostic to stderr. | |
| static void | Win32ErrorHandler (const char *module, const char *fmt, va_list ap) |
| Print a default error diagnostic to stderr. | |
Variables | |
| TIFFErrorHandler | _TIFFwarningHandler = Win32WarningHandler |
| Store the global warning callback. | |
| TIFFErrorHandler | _TIFFerrorHandler = Win32ErrorHandler |
| Store the global error callback. | |
Implement native Windows resource callbacks and pathname opening.
Definition in file tif_win32.c.
|
static |
Release the backend OS resource.
Calls CloseHandle(). Its result is translated to the callback convention; GetLastError() describes OS failure. No library diagnostic is added. The handle is invalid after successful close.
| [in,out] | fd | Live native Windows HANDLE encoded as thandle_t. |
Definition at line 238 of file tif_win32.c.
Referenced by TIFFFdOpenExt().
Create a read-only view of the entire backend resource.
Queries file size and maps the whole resource. The view must be released through _tiffUnmapProc(), not an allocator. The temporary Windows file- mapping HANDLE is closed after MapViewOfFile(), while the view remains valid. API failure may set *pbase to NULL; earlier failures leave it unchanged. No library diagnostic is emitted.
| [in] | fd | Live native Windows HANDLE encoded as thandle_t. |
| [out] | pbase | Output view base on success; do not rely on it after failure. |
| [out] | psize | Output view length in bytes on success; unchanged on failure. |
Definition at line 290 of file tif_win32.c.
References _tiffSizeProc().
Referenced by TIFFFdOpenExt().
Read bytes from the Windows HANDLE with ReadFile().
Reads in chunks no larger than 0x80000000 bytes and stops at a short read. Zero length returns zero. API errors are exposed through the Windows last-error state; there is no library diagnostic here. The file position and destination bytes may already have changed before failure. Buffer ownership is unchanged.
| [in,out] | fd | Live native Windows HANDLE encoded as thandle_t. |
| [out] | buf | Writable destination of at least size bytes. |
| [in] | size | Nonnegative byte request representable by tmsize_t and the backend. |
Definition at line 109 of file tif_win32.c.
Referenced by TIFFFdOpenExt().
|
static |
Seek the platform resource and return its reported position.
Uses SetFilePointer; unsupported origins fall back to FILE_BEGIN. Failure is detected through GetLastError() and reported as (uint64_t)-1. Position preservation on failure is not guaranteed, and no library diagnostic is emitted.
| [in,out] | fd | Live native Windows HANDLE encoded as thandle_t. |
| [in] | off | Byte offset, reinterpreted as a signed LONGLONG. |
| [in] | whence | SEEK_SET, SEEK_CUR or SEEK_END; any other value is treated as SEEK_SET. |
Definition at line 199 of file tif_win32.c.
Referenced by TIFFFdOpenExt().
|
static |
Query the backend resource length in bytes.
Uses GetFileSizeEx() without seeking. GetLastError() follows OS failure. Does not transfer ownership or emit library diagnostics.
| [in] | fd | Live native Windows HANDLE encoded as thandle_t. |
Definition at line 251 of file tif_win32.c.
Referenced by _tiffMapProc(), and TIFFFdOpenExt().
Release a read-only backend mapping.
Calls UnmapViewOfFile() and discards its result. The view must no longer be used after successful unmapping; failures have no callback status or library diagnostic. Does not close the file HANDLE.
| [in] | fd | Unused client context. |
| [in] | base | Mapped-view base, or NULL during early failed-open cleanup. |
| [in] | size | Mapped length in bytes; unused by the Windows API. |
Definition at line 326 of file tif_win32.c.
Referenced by TIFFFdOpenExt().
Write bytes to the Windows HANDLE with WriteFile().
Writes in chunks no larger than 0x80000000 bytes and stops at a short write. Zero length returns zero. API errors are exposed through the Windows last-error state; there is no library diagnostic here. The file position and contents may already have changed before failure. Buffer ownership is unchanged.
| [in,out] | fd | Live native Windows HANDLE encoded as thandle_t. |
| [in] | buf | Readable source of at least size bytes. |
| [in] | size | Nonnegative byte request representable by tmsize_t and the backend. |
Definition at line 155 of file tif_win32.c.
Referenced by TIFFFdOpenExt().