|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Define small bounds-checked byte cursors for codec decoders. More...
#include "tiffiop.h"Go to the source code of this file.
Data Structures | |
| struct | TIFFByteCursor |
| Track a borrowed byte range as a pointer and a remaining count. More... | |
Functions | |
| static int | _TIFFByteCursorGetU8 (TIFFByteCursor *c, uint8_t *out) |
| Read one byte from a cursor. | |
| static int | _TIFFByteCursorFill (TIFFByteCursor *dst, uint8_t value, tmsize_t n) |
| Write n copies of value to a cursor. | |
| static int | _TIFFByteCursorCopy (TIFFByteCursor *dst, TIFFByteCursor *src, tmsize_t n) |
| Move n bytes from src to dst. | |
Define small bounds-checked byte cursors for codec decoders.
A cursor is a pointer plus the number of bytes remaining after it. The helpers check that count at the point of access and either succeed fully (advancing the pointer and decreasing the count) or do nothing and return 0, so a decoder logic error cannot turn into an out-of-bounds access.
Copies and fills go through _TIFFmemcpy()/_TIFFmemset() rather than memcpy()/memset(): with the small, bounded sizes seen in decoders, GCC otherwise expands them inline into slow "rep movs"/"rep stos" sequences.
Definition in file tif_bytecursor.h.