libogg - function - oggpack_writecheck

libogg documentation | libogg release 1.3.4 - 20190830

# oggpack_writecheck

declared in "ogg/ogg.h";

This function checks the readiness status of an oggpack_buffer previously initialized for writing using the Ogg bitpacking functions. A write buffer that encounters an error (such as a failed malloc) will clear its internal state and release any in-use memory, flagging itself as 'not ready'. Subsequent attempts to write using the buffer will silently fail. This error state may be detected at any later time by using oggpack_writecheck(). It is safe but not necessary to call oggpack_writeclear() on a buffer that has flagged an error and released its resources.

Important note to developers: Although libogg checks the results of memory allocations, these checks are only useful on a narrow range of embedded platforms. Allocation checks perform no useful service on a general purpose desktop OS where pages are routinely overallocated and all allocations succeed whether memory is available or not. The only way to detect an out of memory condition on the vast majority of OSes is to watch for and capture segmentation faults. This function is useful only to embedded developers.

    int  oggpack_writecheck(oggpack_buffer *b);

### Parameters

b
  An oggpack_buffer previously initialized for writing.

### Return Values

> - zero: buffer is ready for writing
> - nonzero: buffer is not ready or encountered an error

copyright © 2000-2019 Xiph.Org Foundation | Ogg Container Format
libogg documentation | libogg release 1.3.4 - 20190830