File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040#include < TargetConditionals.h>
4141#endif
4242
43+ #ifdef _WIN32
44+ # define llama_mmap_ftell _ftelli64
45+ # define llama_mmap_fseek _fseeki64
46+ #else
47+ # define llama_mmap_ftell ftello
48+ # define llama_mmap_fseek fseeko
49+ #endif
50+
4351// TODO: consider moving to llama-impl.h if needed in more places
4452#if defined(_WIN32)
4553static std::string llama_format_win_err (DWORD err) {
@@ -226,7 +234,7 @@ struct llama_file::impl {
226234
227235 size_t tell () const {
228236 if (fd == -1 ) {
229- long ret = std::ftell (fp);
237+ off_t ret = llama_mmap_ftell (fp);
230238 if (ret == -1 ) {
231239 throw std::runtime_error (format (" ftell error: %s" , strerror (errno)));
232240 }
@@ -244,7 +252,7 @@ struct llama_file::impl {
244252 void seek (size_t offset, int whence) const {
245253 off_t ret = 0 ;
246254 if (fd == -1 ) {
247- ret = std::fseek (fp, ( long ) offset, whence);
255+ ret = llama_mmap_fseek (fp, offset, whence);
248256 } else {
249257 ret = lseek (fd, offset, whence);
250258 }
You can’t perform that action at this time.
0 commit comments