result = stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp);
if (result) {
// need to 'unget' all the characters in the IO buffer
- fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR);
+ if (fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR) == -1)
+ return stbi__errpuc("fseek() error", "File Seek Fail");
}
return result;
}
result = stbi__load_and_postprocess_16bit(&s,x,y,comp,req_comp);
if (result) {
// need to 'unget' all the characters in the IO buffer
- fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR);
+ if (fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR) == -1)
+ return (stbi__uint16 *) stbi__errpuc("fseek() error", "File Seek Fail");
}
return result;
}
stbi__context s;
stbi__start_file(&s,f);
res = stbi__hdr_test(&s);
- fseek(f, pos, SEEK_SET);
+ if (fseek(f, pos, SEEK_SET) == -1) return stbi__err("fseek() error", "File Seek Fail");
return res;
#else
STBI_NOTUSED(f);
long pos = ftell(f);
stbi__start_file(&s, f);
r = stbi__info_main(&s,x,y,comp);
- if (pos >= 0) fseek(f,pos,SEEK_SET);
+ if (pos >= 0) {
+ if (fseek(f,pos,SEEK_SET) == -1) return stbi__err("fseek() error", "File Seek Fail");
+ }
return r;
}
long pos = ftell(f);
stbi__start_file(&s, f);
r = stbi__is_16_main(&s);
- if (pos >= 0) fseek(f,pos,SEEK_SET);
+ if (pos >= 0) {
+ if (fseek(f,pos,SEEK_SET) == -1) return stbi__err("fseek() error", "File Seek Fail");
+ }
return r;
}
#endif // !STBI_NO_STDIO