summaryrefslogtreecommitdiffhomepage
path: root/StarsEx
diff options
context:
space:
mode:
Diffstat (limited to 'StarsEx')
-rw-r--r--StarsEx/DataSource.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/StarsEx/DataSource.cpp b/StarsEx/DataSource.cpp
index ce458d3..b413d82 100644
--- a/StarsEx/DataSource.cpp
+++ b/StarsEx/DataSource.cpp
@@ -7,6 +7,7 @@
#include "DataSource.h"
#include <cstdint>
+#include <cstdio>
#include <cstring>
#include <filesystem>
@@ -165,12 +166,12 @@ FileSystemDataSource::Load(const Text& prefix, const char* name, std::uint8_t*&
std::filesystem::path full_path {m_path};
full_path.append(prefix.data());
full_path.append(name);
- FILE* f = fopen(full_path.string().c_str(), "rb");
+ auto f = std::fopen(full_path.string().c_str(), "rb");
if (!f)
return 0; // Again, -1 would be better to differentiate an error from an empty file
- fseek(f, 0, SEEK_END);
- int length = ftell(f);
- fseek(f, 0, SEEK_SET);
+ std::fseek(f, 0, SEEK_END);
+ int length = std::ftell(f);
+ std::fseek(f, 0, SEEK_SET);
if (null_terminate) {
buf = new std::uint8_t[length + 1];
if (buf)
@@ -181,7 +182,7 @@ FileSystemDataSource::Load(const Text& prefix, const char* name, std::uint8_t*&
}
int bytes = 0;
if (buf)
- bytes = fread(buf, length, 1, f);
- fclose(f);
+ bytes = std::fread(buf, length, 1, f);
+ std::fclose(f);
return bytes;
}