[olympic,nostalgia] Address unsafe buffer warnings
This commit is contained in:
@ -44,10 +44,10 @@ static ox::Result<std::size_t> findPreloadSection() noexcept {
|
||||
// media section
|
||||
constexpr auto headerP2 = "DER_____________";
|
||||
constexpr auto headerP1 = "KEEL_PRELOAD_HEA";
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
constexpr auto headerP1Len = ox::strlen(headerP2);
|
||||
constexpr auto headerP2Len = ox::strlen(headerP1);
|
||||
constexpr auto headerLen = headerP1Len + headerP2Len;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
for (auto current = MEM_ROM; current < reinterpret_cast<char*>(0x0a000000); current += headerLen) {
|
||||
if (memcmp(current, headerP1, headerP1Len) == 0 &&
|
||||
memcmp(current + headerP1Len, headerP2, headerP2Len) == 0) {
|
||||
|
@ -18,7 +18,9 @@ ox::String getClipboardText(Context &ctx) noexcept {
|
||||
|
||||
void setClipboardText(Context &ctx, ox::StringViewCR text) noexcept {
|
||||
auto cstr = ox_malloca(text.bytes() + 1, char);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::strncpy(cstr.get(), text.data(), text.bytes());
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
glfwSetClipboardString(ctx.window, cstr.get());
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,9 @@ ox::Error setWindowIcon(Context &ctx, ox::SpanView<ox::SpanView<uint8_t>> const
|
||||
|
||||
void setWindowTitle(Context &ctx, ox::StringViewCR title) noexcept {
|
||||
auto cstr = ox_malloca(title.bytes() + 1, char);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::strncpy(cstr.get(), title.data(), title.bytes());
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
glfwSetWindowTitle(ctx.window, cstr.get());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user