All: Fix a lot of compiler warnings from header files

While reworking build system, header files started to report warnings.
This commit is contained in:
2024-06-18 20:32:43 +03:00
parent 526d4369ce
commit 318ce5dec8
59 changed files with 339 additions and 326 deletions

View File

@@ -608,12 +608,12 @@ namespace LibImage
return BAN::Error::from_errno(EINVAL);
}
if (chunk.name == "IHDR"sv)
if (chunk.name == "IHDR"_sv)
{
dwarnln_if(DEBUG_PNG, "PNG stream has IDHR chunk defined multiple times");
return BAN::Error::from_errno(EINVAL);
}
else if (chunk.name == "PLTE"sv)
else if (chunk.name == "PLTE"_sv)
{
if (chunk.data.size() == 0 || chunk.data.size() % 3)
{
@@ -639,15 +639,15 @@ namespace LibImage
palette[i].a = 0xFF;
}
}
else if (chunk.name == "IDAT"sv)
else if (chunk.name == "IDAT"_sv)
{
TRY(zlib_stream.push_back(chunk.data));
}
else if (chunk.name == "IEND"sv)
else if (chunk.name == "IEND"_sv)
{
break;
}
else if (chunk.name == "tEXt"sv)
else if (chunk.name == "tEXt"_sv)
{
auto data_sv = BAN::StringView(chunk.data.as_span<const char>().data(), chunk.data.size());
if (auto idx = data_sv.find('\0'); !idx.has_value())

View File

@@ -63,9 +63,9 @@ namespace LibImage
return false;
if (height > static_cast<uint64_t>(BAN::numeric_limits<int64_t>::max()))
return false;
if (BAN::Math::will_multiplication_overflow(width, height))
if (BAN::Math::will_multiplication_overflow<uint64_t>(width, height))
return false;
if (BAN::Math::will_multiplication_overflow(width * height, sizeof(Color)))
if (BAN::Math::will_multiplication_overflow<uint64_t>(width * height, sizeof(Color)))
return false;
return true;
}