| 1575 | }; |
| 1576 | |
| 1577 | static void stbi__refill_buffer(stbi__context *s) |
| 1578 | { |
| 1579 | int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen); |
| 1580 | s->callback_already_read += (int) (s->img_buffer - s->img_buffer_original); |
| 1581 | if (n == 0) { |
| 1582 | // at end of file, treat same as if from memory, but need to handle case |
| 1583 | // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file |
| 1584 | s->read_from_callbacks = 0; |
| 1585 | s->img_buffer = s->buffer_start; |
| 1586 | s->img_buffer_end = s->buffer_start+1; |
| 1587 | *s->img_buffer = 0; |
| 1588 | } else { |
| 1589 | s->img_buffer = s->buffer_start; |
| 1590 | s->img_buffer_end = s->buffer_start + n; |
| 1591 | } |
| 1592 | } |
| 1593 | |
| 1594 | stbi_inline static stbi_uc stbi__get8(stbi__context *s) |
| 1595 | { |
no outgoing calls
no test coverage detected