[olympic] Enable warnings for unsafe buffers
This commit is contained in:
@ -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();
|
||||
});
|
||||
}
|
||||
|
@ -22,10 +22,12 @@ static ox::Result<ox::String> toResult(nfdresult_t r, NFD::UniquePathN const&pat
|
||||
switch (r) {
|
||||
case NFD_OKAY: {
|
||||
ox::String out;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
for (auto i = 0u; path.get()[i]; ++i) {
|
||||
auto const c = static_cast<char>(path.get()[i]);
|
||||
std::ignore = out.append(&c, 1);
|
||||
}
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return out;
|
||||
}
|
||||
case NFD_CANCEL:
|
||||
@ -35,11 +37,11 @@ static ox::Result<ox::String> toResult(nfdresult_t r, NFD::UniquePathN const&pat
|
||||
}
|
||||
}
|
||||
|
||||
ox::Result<ox::String> saveFile(ox::Vector<FDFilterItem> const&filters) noexcept {
|
||||
ox::Result<ox::String> saveFile(ox::Vector<FDFilterItem> const&exts) noexcept {
|
||||
NFD::Guard const guard;
|
||||
NFD::UniquePathN path;
|
||||
ox::Vector<nfdnfilteritem_t, 5> filterItems(filters.size());
|
||||
for (auto i = 0u; auto const&f : filters) {
|
||||
ox::Vector<nfdnfilteritem_t, 5> filterItems(exts.size());
|
||||
for (auto i = 0u; auto const&f : exts) {
|
||||
filterItems[i].name = f.name.data();
|
||||
filterItems[i].spec = f.spec.data();
|
||||
++i;
|
||||
|
Reference in New Issue
Block a user