[nostalgia] Cleanup unnecessary cast

This commit is contained in:
Gary Talent 2020-01-24 23:16:38 -06:00
parent 892fec6905
commit 22680ffaf0
4 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,7 @@
namespace nostalgia::core {
uint8_t *loadRom(const char*) {
char *loadRom(const char*) {
// put the header in the wrong order to prevent mistaking this code for the
// media section
constexpr auto headerP2 = "_HEADER_________";
@ -23,7 +23,7 @@ uint8_t *loadRom(const char*) {
constexpr auto headerP2Len = 16;
constexpr auto headerLen = headerP1Len + headerP2Len + 1;
for (auto current = &MEM_ROM; current < reinterpret_cast<uint8_t*>(0x0a000000); current += headerLen) {
for (auto current = &MEM_ROM; current < reinterpret_cast<char*>(0x0a000000); current += headerLen) {
if (ox_memcmp(current, headerP1, headerP1Len) == 0 &&
ox_memcmp(current + headerP1Len, headerP2, headerP2Len) == 0) {
return current + headerLen;
@ -32,7 +32,7 @@ uint8_t *loadRom(const char*) {
return nullptr;
}
void unloadRom(uint8_t*) {
void unloadRom(char*) {
}
}

View File

@ -12,8 +12,8 @@
namespace nostalgia::core {
uint8_t *loadRom(const char *path = "");
char *loadRom(const char *path = "");
void unloadRom(uint8_t*);
void unloadRom(char*);
}

View File

@ -14,7 +14,7 @@
namespace nostalgia::core {
uint8_t *loadRom(const char *path) {
char *loadRom(const char *path) {
std::ifstream file(path, std::ios::binary | std::ios::ate);
if (!file.good()) {
oxTrace("nostalgia::core::userland::loadRom") << "Read failed:" << path;
@ -23,12 +23,12 @@ uint8_t *loadRom(const char *path) {
const std::size_t size = file.tellg();
file.seekg(0, std::ios::beg);
auto buff = new uint8_t[size];
file.read(reinterpret_cast<char*>(buff), size);
auto buff = new char[size];
file.read(buff, size);
return buff;
}
void unloadRom(uint8_t *rom) {
void unloadRom(char *rom) {
delete rom;
}

View File

@ -29,7 +29,7 @@ ox::Error run(ox::FileSystem *fs) {
int main(int argc, const char **argv) {
if (argc > 1) {
ox::FileSystem *fs = nullptr;
uint8_t *rom = nullptr;
char *rom = nullptr;
auto path = argv[1];
const auto lastDot = ox_lastIndexOf(path, '.');
const auto fsExt = lastDot != -1 ? path + lastDot : "";