Editor/ProjectManager: Remove pointer cast in GetObj()

Pointer casting like this is technically undefined behavior, we can just
use a lambda and forward the arguments over to the athena read handler.
This commit is contained in:
Lioncash 2019-08-10 05:40:49 -04:00
parent df663359c7
commit 43e808ff17
1 changed files with 6 additions and 1 deletions

View File

@ -118,7 +118,12 @@ bool ProjectManager::openProject(hecl::SystemStringView path) {
return makeProj(true); return makeProj(true);
} }
yaml_parser_set_input(r.getParser(), (yaml_read_handler_t*)athena::io::YAMLAthenaReader, &reader); const auto readHandler = [](void* data, unsigned char* buffer, size_t size, size_t* size_read) {
auto* const reader = static_cast<athena::io::IStreamReader*>(data);
return athena::io::YAMLAthenaReader(reader, buffer, size, size_read);
};
yaml_parser_set_input(r.getParser(), readHandler, &reader);
if (!r.ValidateClassType("UrdeSpacesState")) { if (!r.ValidateClassType("UrdeSpacesState")) {
return makeProj(true); return makeProj(true);
} }