mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
backends/native: Avoid -Wmaybe-uninitialized warning
Ensure that color_ptr gets set, and avoid color_char usage too in that case. Fixes: ../../../../Source/gnome/mutter/src/backends/native/meta-monitor-manager-kms.c: In function ‘meta_monitor_manager_kms_set_crtc_gamma’: ../../../../Source/gnome/mutter/src/backends/native/meta-monitor-manager-kms.c:370:7: warning: ‘color_char’ may be used uninitialized in this function [-Wmaybe-uninitialized] 370 | g_string_append_printf (string, " %c: ", color_char); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../Source/gnome/mutter/src/backends/native/meta-monitor-manager-kms.c:351:12: note: ‘color_char’ was declared here 351 | char color_char; | ^~~~~~~~~~ ../../../../Source/gnome/mutter/src/backends/native/meta-monitor-manager-kms.c:391:36: warning: ‘color_ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized] 391 | (*color_ptr)[i]); | ~^~~~~~~~~~~ ../../../../Source/gnome/mutter/src/backends/native/meta-monitor-manager-kms.c:350:24: note: ‘color_ptr’ was declared here 350 | unsigned short **color_ptr; | ^~~~~~~~~ Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1624>
This commit is contained in:
parent
745ccc5b01
commit
20ac791f4b
@ -347,7 +347,7 @@ generate_gamma_ramp_string (size_t size,
|
|||||||
string = g_string_new ("[");
|
string = g_string_new ("[");
|
||||||
for (color = 0; color < 3; color++)
|
for (color = 0; color < 3; color++)
|
||||||
{
|
{
|
||||||
unsigned short **color_ptr;
|
unsigned short **color_ptr = NULL;
|
||||||
char color_char;
|
char color_char;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -367,6 +367,7 @@ generate_gamma_ramp_string (size_t size,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert (color_ptr);
|
||||||
g_string_append_printf (string, " %c: ", color_char);
|
g_string_append_printf (string, " %c: ", color_char);
|
||||||
for (i = 0; i < MIN (4, size); i++)
|
for (i = 0; i < MIN (4, size); i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user