From 00a14befa954162723142571caf301f9679c6059 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Sat, 13 Sep 2025 18:27:14 +0300 Subject: fix: Resolve variable shadowing warnings This commit addresses cppcheck warnings about local variables that shadow outer function names (shadowFunction). Variable shadowing can make code confusing and error-prone as it's unclear which variable is being referenced. Changes made: - kmscube/cube-egl.cpp: Renamed 'config' to 'cfg' in loop to avoid shadowing the config() member function - kmscube/cube-gbm.cpp: Renamed 'width' and 'height' local variables to 'bo_width' and 'bo_height' to avoid shadowing width() and height() member functions These changes improve code clarity and eliminate potential confusion about variable scope and naming. --- kmscube/cube-egl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kmscube/cube-egl.cpp') diff --git a/kmscube/cube-egl.cpp b/kmscube/cube-egl.cpp index 3ff6ea9..8184a7d 100644 --- a/kmscube/cube-egl.cpp +++ b/kmscube/cube-egl.cpp @@ -84,16 +84,16 @@ EglState::EglState(void* native_display, EGLint native_visual_id) // elgChooseConfig does implement matching by EGL_NATIVE_VISUAL_ID, do a manual // loop. Picks the first returned if native_visual_id is not set. - for (const auto& config : configs) { + for (const auto& cfg : configs) { EGLint id; - b = eglGetConfigAttrib(m_display, config, EGL_NATIVE_VISUAL_ID, &id); + b = eglGetConfigAttrib(m_display, cfg, EGL_NATIVE_VISUAL_ID, &id); if (!b) { printf("failed to get native visual id\n"); continue; } if (id == native_visual_id || !native_visual_id) { - m_config = config; + m_config = cfg; break; } } -- cgit v1.2.3