From 43e808ff17f986217da34aad4f6e9f546018bae4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 10 Aug 2019 05:40:49 -0400 Subject: [PATCH] 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. --- Editor/ProjectManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Editor/ProjectManager.cpp b/Editor/ProjectManager.cpp index b6fae4a91..f9d0602cb 100644 --- a/Editor/ProjectManager.cpp +++ b/Editor/ProjectManager.cpp @@ -118,7 +118,12 @@ bool ProjectManager::openProject(hecl::SystemStringView path) { 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(data); + return athena::io::YAMLAthenaReader(reader, buffer, size, size_read); + }; + + yaml_parser_set_input(r.getParser(), readHandler, &reader); if (!r.ValidateClassType("UrdeSpacesState")) { return makeProj(true); }