file
buffer_ops.h
Enums
- enum compare_result { CMP_OOB, CMP_EQ, CMP_NEQ }
Typedefs
-
using compare_result = enum compare_
result
Functions
-
auto buffer_is_eq(const uint8_t** current,
size_t* remaining,
const uint8_t* data,
size_t data_size) -> compare_
result - A
memcmp
wrapper to comparecurrent
anddata
untildata_size
length with bounds checking. - auto read_byte(const uint8_t** current, size_t* remaining, uint8_t* destination) -> bool
- Reads an 8 bit number with bounds checking.
- auto read_byte_un(const uint8_t** buffer) -> uint8_t
- Reads an 8 bit number without bounds checking.
- auto read_le_short(const uint8_t** current, size_t* remaining, uint16_t* destination) -> bool
- Reads a 16 bit little-endian number with bounds checking.
- auto read_le_short_un(const uint8_t** buffer) -> uint16_t
- Reads a 16 bit little-endian number without bounds checking.
- auto skip_bytes(const uint8_t** current, size_t* remaining, size_t count) -> bool
- Skips
count
number of bytes with bounds checking. - auto read_color_un(const uint8_t** buffer) -> uint32_t
- Reads a 3 byte color in the RGB format.
-
auto read_color_table(const uint8_t** current,
size_t* remaining,
uint32_t** destination,
uint8_t size,
gif_
allocator allocator) -> gif_ result_ code - Reads a color table.
Function documentation
compare_ result buffer_is_eq(const uint8_t** current,
size_t* remaining,
const uint8_t* data,
size_t data_size)
A memcmp
wrapper to compare current
and data
until data_size
length with bounds checking.
Returns | Result of the equality comparison or an indication of OOB |
---|
This function will advance the pointer pointed to by current
by data_size
if the read isn't OOB.
bool read_byte(const uint8_t** current, size_t* remaining, uint8_t* destination)
Reads an 8 bit number with bounds checking.
Returns | true if the read isn't OOB, otherwise false |
---|
This function will advance the pointer pointed to by current
by 1 if the read isn't OOB.
uint8_t read_byte_un(const uint8_t** buffer)
Reads an 8 bit number without bounds checking.
This function will advance the pointer pointed to by buffer
by 1.
bool read_le_short(const uint8_t** current, size_t* remaining, uint16_t* destination)
Reads a 16 bit little-endian number with bounds checking.
Returns | true if the read isn't OOB, otherwise false |
---|
This function will advance the pointer pointed to by current
by 2 if the read isn't OOB.
uint16_t read_le_short_un(const uint8_t** buffer)
Reads a 16 bit little-endian number without bounds checking.
This function will advance the pointer pointed to by buffer
by 2.
bool skip_bytes(const uint8_t** current, size_t* remaining, size_t count)
Skips count
number of bytes with bounds checking.
This function will advance the pointer pointed to by current
by count
.
uint32_t read_color_un(const uint8_t** buffer)
Reads a 3 byte color in the RGB format.
Returns | 32 bit integer in the 0x00RRGGBB format that encodes an RGB color |
---|
This function will advance the pointer pointed to by current
by 3.
gif_ result_ code read_color_table(const uint8_t** current,
size_t* remaining,
uint32_t** destination,
uint8_t size,
gif_ allocator allocator)
Reads a color table.
This function will advance the pointer pointed to by current
by (2 << size) * 3
. The allocated color table will be output via the destination
parameter.