diff --git a/src/xenia/cpu/raw_module.cc b/src/xenia/cpu/raw_module.cc index 9a4e1b8d8..f2289d995 100644 --- a/src/xenia/cpu/raw_module.cc +++ b/src/xenia/cpu/raw_module.cc @@ -26,9 +26,8 @@ RawModule::~RawModule() {} bool RawModule::LoadFile(uint32_t base_address, const std::filesystem::path& path) { FILE* file = xe::filesystem::OpenFile(path, "rb"); - fseek(file, 0, SEEK_END); - uint32_t file_length = static_cast(ftell(file)); - fseek(file, 0, SEEK_SET); + const uint32_t file_length = + static_cast(std::filesystem::file_size(path)); // Allocate memory. // Since we have no real heap just load it wherever. diff --git a/src/xenia/gpu/shader_compiler_main.cc b/src/xenia/gpu/shader_compiler_main.cc index 4fdcec736..d8c1f3a3b 100644 --- a/src/xenia/gpu/shader_compiler_main.cc +++ b/src/xenia/gpu/shader_compiler_main.cc @@ -100,9 +100,7 @@ int shader_compiler_main(const std::vector& args) { xe::path_to_utf8(cvars::shader_input)); return 1; } - fseek(input_file, 0, SEEK_END); - size_t input_file_size = ftell(input_file); - fseek(input_file, 0, SEEK_SET); + size_t input_file_size = std::filesystem::file_size(cvars::shader_input); std::vector ucode_dwords(input_file_size / 4); fread(ucode_dwords.data(), 4, ucode_dwords.size(), input_file); fclose(input_file); diff --git a/src/xenia/kernel/xam/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc index 5559feff9..f5168dad4 100644 --- a/src/xenia/kernel/xam/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -307,9 +307,7 @@ X_RESULT ContentManager::GetContentThumbnail( auto thumb_path = package_path / kThumbnailFileName; if (std::filesystem::exists(thumb_path)) { auto file = xe::filesystem::OpenFile(thumb_path, "rb"); - fseek(file, 0, SEEK_END); - size_t file_len = ftell(file); - fseek(file, 0, SEEK_SET); + size_t file_len = std::filesystem::file_size(thumb_path); buffer->resize(file_len); fread(const_cast(buffer->data()), 1, buffer->size(), file); fclose(file);