From ceb491c599e2f34aee89fa323ec07b257b21a4ee Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Sat, 16 Aug 2025 10:37:01 +0200 Subject: [PATCH] Make cppcheck happy wrt std::span usage We don't gain anything using a span here, so just don't. ``` source/graphics/Font.cpp:535:35: error: Out of bounds access in 'tempDstRow[3]', if 'tempDstRow' size is 2 and '3' is 3 [containerOutOfBounds] const float dstAlpha{tempDstRow[3] / 255.0f}; ^ source/graphics/Font.cpp:543:14: error: Out of bounds access in 'tempDstRow[2]', if 'tempDstRow' size is 2 and '2' is 2 [containerOutOfBounds] tempDstRow[2] = static_cast(std::round(((b * srcAlpha + tempDstRow[2] * dstAlpha * (1.0f - srcAlpha)) / outAlpha))); ^ source/graphics/Font.cpp:544:14: error: Out of bounds access in 'tempDstRow[3]', if 'tempDstRow' size is 2 and '3' is 3 [containerOutOfBounds] tempDstRow[3] = static_cast(std::round(outAlpha * 255.0f)); ^ ``` Signed-off-by: Ralph Sennhauser --- source/graphics/Font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/graphics/Font.cpp b/source/graphics/Font.cpp index c3b5157619..197e915bb6 100644 --- a/source/graphics/Font.cpp +++ b/source/graphics/Font.cpp @@ -528,7 +528,7 @@ void CFont::BlendGlyphBitmapToTextureRGBA(const FT_Bitmap& bitmap, int targetX, for (uint x{0}; x != bitmap.width; ++x) { - const std::span tempDstRow{dstRow + x * m_TextureFormatStride, 4}; + u8* tempDstRow{dstRow + x * m_TextureFormatStride}; u8 alpha{srcRow[x]}; const float srcAlpha{m_StrokeWidth > 0 ? (*m_GammaCorrectionLUT)[alpha] : alpha/255.0f};