Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)

This function did a const_cast internally which made the call side look
"safe". This method is removed completely and call sites are replaced
with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the
behaviour obvious.
This commit is contained in:
asynts 2020-08-05 14:09:38 +02:00 committed by Andreas Kling
commit b3d1a05261
Notes: sideshowbarker 2024-07-19 04:14:15 +09:00
15 changed files with 42 additions and 36 deletions

View file

@ -117,7 +117,7 @@ void ResourceLoader::load(const URL& url, Function<void(const ByteBuffer&, const
if (url.protocol() == "about") {
dbg() << "Loading about: URL " << url;
deferred_invoke([success_callback = move(success_callback)](auto&) {
success_callback(ByteBuffer::wrap(String::empty().characters(), 1), {});
success_callback(ByteBuffer::wrap(const_cast<char*>(String::empty().characters()), 1), {});
});
return;
}