stbi__skip should return immediately if skipping zero bytes.

Otherwise we might waste time or throw away state in the i/o callbacks.
This commit is contained in:
Ryan C. Gordon 2020-04-28 11:56:30 -04:00
parent d60594847e
commit 89f3f35c9f

View File

@ -1564,6 +1564,7 @@ stbi_inline static int stbi__at_eof(stbi__context *s)
#else #else
static void stbi__skip(stbi__context *s, int n) static void stbi__skip(stbi__context *s, int n)
{ {
if (n == 0) return; // already there!
if (n < 0) { if (n < 0) {
s->img_buffer = s->img_buffer_end; s->img_buffer = s->img_buffer_end;
return; return;