gif_engine.c file
Contents
- Reference
Functions
-
auto gif_parse(const void* buffer,
size_t buffer_size,
gif_
details* details, gif_ allocator allocator) -> gif_ parse_ result - Parses the GIF file located at
buffer. -
auto gif_decode(gif_
details* details, gif_ allocator allocator) -> gif_ decode_ result - Decodes the frame data parsed by gif_
parse. -
static void free_frame_vector(const gif_
frame_ vector frame_vector, const gif_ deallocator deallocator) -
void gif_free_details(const gif_
details* details, gif_ deallocator deallocator) - Frees the gif_
details struct populated by gif_ parse.
Function documentation
gif_ parse_ result gif_parse(const void* buffer,
size_t buffer_size,
gif_ details* details,
gif_ allocator allocator)
Parses the GIF file located at buffer.
This function will parse the contents of buffer in a way that makes OOB reads impossible, if the provided buffer and buffer_size arguments are valid. Because this function must allocate, the user can provide an allocator function using the allocator arguments, which is a pointer to a function with a signature matching that of realloc. The details argument is a pointer to a gif_
gif_details details; gif_parse_result result = gif_parse(buffer, buffer_size, &details, &realloc);
The code member of the returned gif_code is GIF_data member will hold the number of bytes remaining after the tail block in the buffer. Note that the number of bytes is a size_t value memcpy'd into this field, so you have to copy it out in a similar manner:
size_t leftover_bytes; memcpy(&leftover_bytes, &result.data, sizeof(size_t));
If the code member is GIF_allocator function to fail in a realloc context (i.e. when the first argument isn't NULL) will be returned in the data member as is.
This function is thread-safe.
gif_ decode_ result gif_decode(gif_ details* details,
gif_ allocator allocator)
Decodes the frame data parsed by gif_
This function is not yet implemented.
void gif_free_details(const gif_ details* details,
gif_ deallocator deallocator)
Frees the gif_
This function should be called even if the gif_