mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add cppcoreguidelines-pro-bounds-array-to-pointer-decay clang-tidy check
Fix the warnings it emits.
This commit is contained in:
@@ -491,6 +491,7 @@ if(RUN_CLANG_TIDY)
|
||||
"cppcoreguidelines-macro-usage"
|
||||
"cppcoreguidelines-narrowing-conventions"
|
||||
"cppcoreguidelines-no-malloc"
|
||||
"cppcoreguidelines-pro-bounds-array-to-pointer-decay"
|
||||
"cppcoreguidelines-pro-bounds-constant-array-index"
|
||||
"cppcoreguidelines-pro-bounds-pointer-arithmetic"
|
||||
"cppcoreguidelines-pro-type-const-cast"
|
||||
|
||||
@@ -55,17 +55,17 @@ uint32_t GetCrc32(const std::filesystem::path& filename) {
|
||||
std::ifstream ifile(filename, std::ios::binary);
|
||||
ifile.exceptions(std::ios_base::badbit | std::ios_base::failbit);
|
||||
|
||||
static const size_t bufferSize = 8192;
|
||||
char buffer[bufferSize];
|
||||
static constexpr size_t BUFFER_SIZE = 8192;
|
||||
std::array<char, BUFFER_SIZE> buffer;
|
||||
boost::crc_32_type result;
|
||||
size_t bytesLeft = GetStreamSize(ifile);
|
||||
while (bytesLeft > 0) {
|
||||
if (bytesLeft > bufferSize)
|
||||
ifile.read(buffer, bufferSize);
|
||||
if (bytesLeft > buffer.size())
|
||||
ifile.read(buffer.data(), buffer.size());
|
||||
else
|
||||
ifile.read(buffer, bytesLeft);
|
||||
ifile.read(buffer.data(), bytesLeft);
|
||||
|
||||
result.process_bytes(buffer, ifile.gcount());
|
||||
result.process_bytes(buffer.data(), ifile.gcount());
|
||||
bytesLeft -= ifile.gcount();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user