From 9b2522c3d53b16cefa99af660e1d0079cbaf4a9e Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Mon, 29 Jan 2018 07:48:12 -0800 Subject: [PATCH] stbi_is_hdr_from_file needs to reset file position --- stb_image.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stb_image.h b/stb_image.h index 0990b0d..14c2f7e 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1333,9 +1333,12 @@ STBIDEF int stbi_is_hdr (char const *filename) STBIDEF int stbi_is_hdr_from_file(FILE *f) { #ifndef STBI_NO_HDR + long pos = ftell(f), res; stbi__context s; stbi__start_file(&s,f); - return stbi__hdr_test(&s); + res = stbi__hdr_test(&s); + fseek(f, pos, SEEK_SET); + return res; #else STBI_NOTUSED(f); return 0;