| 1630 | enum { STBI__SCAN_load = 0, STBI__SCAN_type, STBI__SCAN_header }; |
| 1631 | |
| 1632 | static void stbi__refill_buffer(stbi__context* s) { |
| 1633 | int n = (s->io.read)(s->io_user_data, (char*)s->buffer_start, s->buflen); |
| 1634 | s->callback_already_read += (int)(s->img_buffer - s->img_buffer_original); |
| 1635 | if (n == 0) { |
| 1636 | // at end of file, treat same as if from memory, but need to handle case |
| 1637 | // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file |
| 1638 | s->read_from_callbacks = 0; |
| 1639 | s->img_buffer = s->buffer_start; |
| 1640 | s->img_buffer_end = s->buffer_start + 1; |
| 1641 | *s->img_buffer = 0; |
| 1642 | } else { |
| 1643 | s->img_buffer = s->buffer_start; |
| 1644 | s->img_buffer_end = s->buffer_start + n; |
| 1645 | } |
| 1646 | } |
| 1647 | |
| 1648 | stbi_inline static stbi_uc stbi__get8(stbi__context* s) { |
| 1649 | if (s->img_buffer < s->img_buffer_end) |
no outgoing calls
no test coverage detected