mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Prohibit use of malloc
This commit is contained in:
parent
eb9c84309f
commit
1d95c65526
@ -35,7 +35,6 @@ Checks: >
|
|||||||
-cppcoreguidelines-macro-to-enum,
|
-cppcoreguidelines-macro-to-enum,
|
||||||
-cppcoreguidelines-macro-usage,
|
-cppcoreguidelines-macro-usage,
|
||||||
-cppcoreguidelines-narrowing-conversions,
|
-cppcoreguidelines-narrowing-conversions,
|
||||||
-cppcoreguidelines-no-malloc,
|
|
||||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||||
-cppcoreguidelines-owning-memory,
|
-cppcoreguidelines-owning-memory,
|
||||||
-cppcoreguidelines-prefer-member-initializer,
|
-cppcoreguidelines-prefer-member-initializer,
|
||||||
|
@ -957,8 +957,10 @@ void WindowImplX11::setIcon(const Vector2u& size, const std::uint8_t* pixels)
|
|||||||
{
|
{
|
||||||
// X11 wants BGRA pixels: swap red and blue channels
|
// X11 wants BGRA pixels: swap red and blue channels
|
||||||
// Note: this memory will be freed by X11Ptr<XImage> deleter
|
// Note: this memory will be freed by X11Ptr<XImage> deleter
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-no-malloc)
|
||||||
auto* iconPixels = static_cast<std::uint8_t*>(
|
auto* iconPixels = static_cast<std::uint8_t*>(
|
||||||
std::malloc(static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y) * 4));
|
std::malloc(static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y) * 4));
|
||||||
|
// NOLINTEND(cppcoreguidelines-no-malloc)
|
||||||
for (std::size_t i = 0; i < static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y); ++i)
|
for (std::size_t i = 0; i < static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y); ++i)
|
||||||
{
|
{
|
||||||
iconPixels[i * 4 + 0] = pixels[i * 4 + 2];
|
iconPixels[i * 4 + 0] = pixels[i * 4 + 2];
|
||||||
|
Loading…
Reference in New Issue
Block a user