stbi_is_hdr_from_file needs to reset file position

This commit is contained in:
Sean Barrett 2018-01-29 07:48:12 -08:00
parent 87352fdcb5
commit 9b2522c3d5

View File

@ -1333,9 +1333,12 @@ STBIDEF int stbi_is_hdr (char const *filename)
STBIDEF int stbi_is_hdr_from_file(FILE *f) STBIDEF int stbi_is_hdr_from_file(FILE *f)
{ {
#ifndef STBI_NO_HDR #ifndef STBI_NO_HDR
long pos = ftell(f), res;
stbi__context s; stbi__context s;
stbi__start_file(&s,f); stbi__start_file(&s,f);
return stbi__hdr_test(&s); res = stbi__hdr_test(&s);
fseek(f, pos, SEEK_SET);
return res;
#else #else
STBI_NOTUSED(f); STBI_NOTUSED(f);
return 0; return 0;