Read GIF header.
6-byte GIF file header is:
+0 3CHARS Signature ('GIF') +3 3CHARS Version ('87a' or '89a')
- Parameters
-
| [in] | gif | The GIF object we're decoding. |
| [in,out] | pos | The current buffer position, updated on success. |
| [in] | strict | Whether to require a known GIF version. |
- Returns
- NSGIF_OK on success, appropriate error otherwise.
Definition at line 1544 of file gif.cpp.hpp.
1548{
1550 fl::size len = gif->
buf + gif->
buf_len - data;
1551
1552 if (len < 6) {
1554 }
1555
1556 if (
strncmp((
const char *) data,
"GIF", 3) != 0) {
1558 }
1559 data += 3;
1560
1561 if (strict == true) {
1562 if ((
strncmp((
const char *) data,
"87a", 3) != 0) &&
1563 (
strncmp((
const char *) data,
"89a", 3) != 0)) {
1565 }
1566 }
1567 data += 3;
1568
1571}
@ NSGIF_ERR_END_OF_DATA
Unexpected end of GIF source data.
@ NSGIF_ERR_DATA
GIF source data is invalid, and no frames are recoverable.
fl::size buf_len
total number of bytes of GIF data available
const fl::u8 * buf
pointer to GIF data
int strncmp(const char *s1, const char *s2, size_t n) FL_NOEXCEPT
References FL_NOEXCEPT, NSGIF_ERR_DATA, NSGIF_ERR_END_OF_DATA, NSGIF_OK, pos, and fl::strncmp().
Referenced by nsgif_data_scan().