LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Functions
Memory services

Provide public allocation and byte-memory operations. More...

Collaboration diagram for Memory services:

Functions

void _TIFFfree (void *p)
 Release a block allocated by the public allocation family.
 
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 * _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.
 

Detailed Description

Provide public allocation and byte-memory operations.

Function Documentation

◆ _TIFFcalloc()

void * _TIFFcalloc ( tmsize_t  nmemb,
tmsize_t  siz 
)
extern

Allocate a zero-filled array through the public allocator.

Converts nonzero arguments to size_t and delegates allocation/product handling to the platform calloc(). Negative inputs are not checked and must not be supplied. Does not apply handle allocation limits, change handle state, or emit library diagnostics. errno follows the allocator.

Parameters
[in]nmembNonnegative element count.
[in]sizNonnegative element size in bytes.
Returns
An owned zero-filled block, or NULL when either argument is zero or allocation fails; release with _TIFFfree().

Definition at line 483 of file tif_unix.c.

Referenced by _TIFFcallocExt(), and TIFFOpenOptionsAlloc().

Here is the caller graph for this function:

◆ _TIFFfree()

void _TIFFfree ( void *  p)
extern

Release a block allocated by the public allocation family.

Calls platform free(); NULL is accepted. Invalidates the block and all views into it. Does not release caller resources or emit diagnostics. Blocks using handle-aware cumulative accounting must instead be released with _TIFFfreeExt() and the matching handle.

Parameters
[in]pOwned public-allocator block, or NULL.

Definition at line 491 of file tif_unix.c.

Referenced by _TIFFfreeExt(), TIFFOpenOptionsFree(), and TIFFOpenWExt().

Here is the caller graph for this function:

◆ _TIFFmalloc()

void * _TIFFmalloc ( tmsize_t  s)
extern

Allocate an uninitialised block through the public allocator.

Calls the platform malloc() for nonzero requests after conversion to size_t. Negative values are not validated and must not be supplied. Does not apply TIFFOpenOptions limits or emit library diagnostics; errno follows the allocator. Storage remains valid until freed or successfully reallocated.

Parameters
[in]sNonnegative requested byte count.
Returns
An owned block, or NULL for zero size or allocation failure; release with _TIFFfree().

Definition at line 475 of file tif_unix.c.

Referenced by _TIFFmallocExt(), and TIFFOpenWExt().

Here is the caller graph for this function:

◆ _TIFFmemcmp()

int _TIFFmemcmp ( const void *  p1,
const void *  p2,
tmsize_t  c 
)
extern

Compare two byte ranges lexicographically.

Compares bytes as unsigned char values. Returns only an ordering sign, not a promised magnitude. Does not allocate, mutate the ranges, validate bounds, transfer ownership, or emit diagnostics.

Parameters
[in]p1First range valid for c readable bytes.
[in]p2Second range valid for c readable bytes.
[in]cNonnegative byte count representable by size_t.
Returns
A negative, zero, or positive value according to memcmp(); no distinct failure result.

Definition at line 502 of file tif_unix.c.

Referenced by TIFFWriteDirectoryTagTransferfunction().

Here is the caller graph for this function:

◆ _TIFFmemcpy()

void _TIFFmemcpy ( void *  d,
const void *  s,
tmsize_t  c 
)
extern

Copy a non-overlapping byte range.

Calls memcpy() after converting c to size_t; source and destination must meet its validity/non-overlap requirements. Does not allocate, retain pointers, validate bounds, or report errors. Use an appropriate memmove() operation if overlap is possible.

Parameters
[out]dDestination valid for c writable bytes.
[in]sSource valid for c readable bytes, not overlapping d.
[in]cNonnegative byte count representable by size_t.

Definition at line 497 of file tif_unix.c.

Referenced by _TIFFByteCursorCopy(), _TIFFVSetField(), DumpModeDecode(), DumpModeEncode(), fpAcc(), fpDiff(), JBIGCopyEncodedData(), JBIGDecode(), JPEGPostEncode(), NeXTDecode(), OJPEGReadBlock(), setByteArray(), TIFFAdvanceDirectory(), TIFFCIELabToRGBInit(), TIFFClientOpenExt(), TIFFDefaultTransferFunction(), TIFFFetchDirectory(), TIFFFetchNormalTag(), TIFFFetchStripThing(), TIFFGetConfiguredCODECs(), TIFFReadDirectory(), TIFFReadDirEntryArrayWithLimit(), TIFFReadDirEntryData(), TIFFReadRawStrip1(), TIFFReadRawTile1(), TIFFRegisterCODEC(), TIFFRGBAImageBegin(), TIFFSetClientInfo(), TIFFWriteDirectorySec(), TIFFWriteDirectoryTagColormap(), TIFFWriteDirectoryTagData(), TIFFWriteDirectoryTagTransferfunction(), and TWebPDatasetWriter().

Here is the caller graph for this function:

◆ _TIFFmemset()

void _TIFFmemset ( void *  p,
int  v,
tmsize_t  c 
)
extern

Fill a byte range with one repeated byte.

Calls memset() after converting c to size_t; follows its pointer- validity requirements even for a zero count. Does not allocate, change ownership, validate bounds/counts, or emit diagnostics.

Parameters
[out]pDestination valid for c bytes.
[in]vByte value after conversion to unsigned char.
[in]cNonnegative byte count representable by size_t.

Definition at line 495 of file tif_unix.c.

Referenced by _TIFFByteCursorFill(), _TIFFCreateAnonField(), _TIFFFillStrilesInternal(), _TIFFReadEncodedTileAndAllocBuffer(), _TIFFResetTifDirAndInitStrileCounters(), _TIFFVSetField(), LogL16Decode(), LogLuvDecode24(), LogLuvDecode32(), LogLuvDecodeStrip(), LogLuvDecodeTile(), LZWDecodeCompat(), TIFFClientOpenExt(), TIFFFetchStripThing(), TIFFFreeDirectory(), TIFFGetConfiguredCODECs(), TIFFGrowStrips(), TIFFInitJPEG(), TIFFInitOJPEG(), TIFFInitPixarLog(), TIFFInitSGILog(), TIFFReadRGBATileExt(), TIFFSetupStrips(), and TIFFYCbCrToRGBInit().

Here is the caller graph for this function:

◆ _TIFFrealloc()

void * _TIFFrealloc ( void *  p,
tmsize_t  s 
)
extern

Resize a public-allocator block using platform realloc semantics.

For positive size, preserves the initial min(old size, s) bytes and invalidates the old pointer on success, even if the address is unchanged. New bytes are uninitialised. Pass the result through a temporary pointer until success is known. Negative sizes are not checked and must not be supplied. Does not apply handle limits or emit library diagnostics. Never pass an accounting-prefixed _TIFFmallocExt() block to this family.

Parameters
[in]pPublic-allocator block to resize, or NULL.
[in]sNonnegative new byte count.
Returns
The replacement owned block on success, or NULL. For positive size, NULL leaves the old block owned and valid; zero-size behaviour follows the platform realloc(), including possible release of p.

Definition at line 493 of file tif_unix.c.

Referenced by _TIFFreallocExt().

Here is the caller graph for this function: