diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2025-03-31 08:33:08 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2025-03-31 08:33:08 -0500 |
commit | 8b0bc70db73b48d833a3b5791e55921768cf6932 (patch) | |
tree | 862ae34933a7fc9f480038d974f59d7683a82605 /source/fud_file.cpp | |
parent | c426110f24516f92ecb8a5374e2a281f2c79787a (diff) |
Remove reinterpret_cast usage in favor of std::bit_cast.
Diffstat (limited to 'source/fud_file.cpp')
-rw-r--r-- | source/fud_file.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/fud_file.cpp b/source/fud_file.cpp index 7219638..9666b14 100644 --- a/source/fud_file.cpp +++ b/source/fud_file.cpp @@ -728,8 +728,7 @@ DrainResult BufferedRegularFile::readUtf8(Utf8& sink, Option<size_t> maxExtraAtt { size_t extraAttempts{maxExtraAttempts.valueOr(0)}; Array<utf8, 4> utf8Data{}; - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - auto drainResult = read(reinterpret_cast<std::byte*>(utf8Data.data()), 1, maxExtraAttempts); + auto drainResult = read(std::bit_cast<std::byte*>(utf8Data.data()), 1, maxExtraAttempts); if (drainResult.status != FudStatus::Success) { return drainResult; } @@ -756,8 +755,7 @@ DrainResult BufferedRegularFile::readUtf8(Utf8& sink, Option<size_t> maxExtraAtt } if (bytesToRead > 0) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - auto utf8ReadResult = read(reinterpret_cast<std::byte*>(utf8Data.data() + 1), bytesToRead, extraAttempts); + auto utf8ReadResult = read(std::bit_cast<std::byte*>(utf8Data.data() + 1), bytesToRead, extraAttempts); drainResult.status = utf8ReadResult.status; drainResult.bytesDrained += utf8ReadResult.bytesDrained; } @@ -784,7 +782,7 @@ void BufferedRegularFile::drainReadBuffer(std::byte*& sink, size_t& length, Drai } } -// NOLINTNEXTLINE(readability-convert-member-functions-to-static,cppcoreguidelines-rvalue-*) +// NOLINTNEXTLINE(cppcoreguidelines-rvalue-*) FudStatus BufferedRegularFile::setBuffer(Vector<std::byte>&& buffer, bool discardOldBuffer) { static_cast<void>(buffer); |