2
0
Эх сурвалжийг харах

stbi_is_hdr_from_file needs to reset file position

Sean Barrett 7 жил өмнө
parent
commit
9b2522c3d5
1 өөрчлөгдсөн 4 нэмэгдсэн , 1 устгасан
  1. 4 1
      stb_image.h

+ 4 - 1
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;