MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__getn

Function stbi__getn

Source/Utils/stb_image.h:1665–1687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1663// nothing
1664#else
1665static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)
1666{
1667 if (s->io.read) {
1668 int blen = (int) (s->img_buffer_end - s->img_buffer);
1669 if (blen < n) {
1670 int res, count;
1671
1672 memcpy(buffer, s->img_buffer, blen);
1673
1674 count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen);
1675 res = (count == (n-blen));
1676 s->img_buffer = s->img_buffer_end;
1677 return res;
1678 }
1679 }
1680
1681 if (s->img_buffer+n <= s->img_buffer_end) {
1682 memcpy(buffer, s->img_buffer, n);
1683 s->img_buffer += n;
1684 return 1;
1685 } else
1686 return 0;
1687}
1688#endif
1689
1690#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)

Callers 4

stbi__parse_png_fileFunction · 0.85
stbi__tga_loadFunction · 0.85
stbi__hdr_loadFunction · 0.85
stbi__pnm_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected