From 89f3f35c9fb82f215e2f765ab4aeb05c245fcb8e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 28 Apr 2020 11:56:30 -0400 Subject: [PATCH] stbi__skip should return immediately if skipping zero bytes. Otherwise we might waste time or throw away state in the i/o callbacks. --- stb_image.h | 1 + 1 file changed, 1 insertion(+) diff --git a/stb_image.h b/stb_image.h index 153ada2..8286b22 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1564,6 +1564,7 @@ stbi_inline static int stbi__at_eof(stbi__context *s) #else static void stbi__skip(stbi__context *s, int n) { + if (n == 0) return; // already there! if (n < 0) { s->img_buffer = s->img_buffer_end; return;