parent
9e2a0de843
commit
7cbfbc55c8
9
rwkv.cpp
9
rwkv.cpp
|
@ -16,6 +16,11 @@
|
||||||
|
|
||||||
#include <sys/stat.h> // fstat
|
#include <sys/stat.h> // fstat
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define stat64 _stat64
|
||||||
|
#define fstat64 _fstat64
|
||||||
|
#endif
|
||||||
|
|
||||||
// --- Error handling ---
|
// --- Error handling ---
|
||||||
|
|
||||||
thread_local enum rwkv_error_flags global_last_error = RWKV_ERROR_NONE;
|
thread_local enum rwkv_error_flags global_last_error = RWKV_ERROR_NONE;
|
||||||
|
@ -292,8 +297,8 @@ struct rwkv_context * rwkv_init_from_file(const char * file_path, const uint32_t
|
||||||
RWKV_ASSERT_NULL_MSG(RWKV_ERROR_FILE | RWKV_ERROR_FILE_OPEN, file, "Failed to open file %s", file_path);
|
RWKV_ASSERT_NULL_MSG(RWKV_ERROR_FILE | RWKV_ERROR_FILE_OPEN, file, "Failed to open file %s", file_path);
|
||||||
rwkv_file_guard file_guard { file };
|
rwkv_file_guard file_guard { file };
|
||||||
|
|
||||||
struct stat file_stat;
|
struct stat64 file_stat;
|
||||||
RWKV_ASSERT_NULL_MSG(RWKV_ERROR_FILE | RWKV_ERROR_FILE_STAT, fstat(fileno(file), &file_stat) == 0, "Failed to stat file %s", file_path);
|
RWKV_ASSERT_NULL_MSG(RWKV_ERROR_FILE | RWKV_ERROR_FILE_STAT, fstat64(fileno(file), &file_stat) == 0, "Failed to stat file %s", file_path);
|
||||||
|
|
||||||
int32_t magic;
|
int32_t magic;
|
||||||
RWKV_ASSERT_NULL(RWKV_ERROR_FILE, read_int32(file, &magic, "magic"));
|
RWKV_ASSERT_NULL(RWKV_ERROR_FILE, read_int32(file, &magic, "magic"));
|
||||||
|
|
Loading…
Reference in New Issue