[olympic] Enable warnings for unsafe buffers

This commit is contained in:
2024-11-26 23:58:11 -06:00
parent a0ed1b3f62
commit 86b9f9316e
7 changed files with 76 additions and 61 deletions

View File

@ -63,12 +63,14 @@ void NewMenu::addItemMaker(ox::UniquePtr<studio::ItemMaker> &&im) noexcept {
void NewMenu::drawNewItemType(studio::StudioContext &sctx) noexcept {
drawWindow(sctx.tctx, &m_open, [this] {
auto items = ox_malloca(m_types.size() * sizeof(char const*), char const*, nullptr);
auto const allocSz = m_types.size() * sizeof(char const*);
auto mem = ox_malloca(allocSz, char const*, nullptr);
auto items = ox::Span{mem.get(), allocSz};
for (auto i = 0u; auto const&im : m_types) {
items.get()[i] = im->typeName.c_str();
items[i] = im->typeName.c_str();
++i;
}
ImGui::ListBox("Item Type", &m_selectedType, items.get(), static_cast<int>(m_types.size()));
ImGui::ListBox("Item Type", &m_selectedType, items.data(), static_cast<int>(m_types.size()));
drawFirstPageButtons();
});
}