MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / stbi__refill_buffer

Function stbi__refill_buffer

common/stb_image.h:1541–1555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1539enum { STBI__SCAN_load = 0, STBI__SCAN_type, STBI__SCAN_header };
1540
1541static void stbi__refill_buffer(stbi__context * s) {
1542 int n = (s->io.read)(s->io_user_data, (char *)s->buffer_start, s->buflen);
1543 s->callback_already_read += (int)(s->img_buffer - s->img_buffer_original);
1544 if (n == 0) {
1545 // at end of file, treat same as if from memory, but need to handle case
1546 // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file
1547 s->read_from_callbacks = 0;
1548 s->img_buffer = s->buffer_start;
1549 s->img_buffer_end = s->buffer_start + 1;
1550 *s->img_buffer = 0;
1551 } else {
1552 s->img_buffer = s->buffer_start;
1553 s->img_buffer_end = s->buffer_start + n;
1554 }
1555}
1556
1557stbi_inline static stbi_uc stbi__get8(stbi__context * s) {
1558 if (s->img_buffer < s->img_buffer_end)

Callers 2

stbi__start_callbacksFunction · 0.85
stbi__get8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected