From b5b839e4f00f5cb0dde2de165ebb7c4bcbf65c3c Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 19 Jan 2024 19:38:11 +0100 Subject: Fix compiler warning [-Wmaybe-uninitialized] 'buf' could indeed be used uninitialized if the switch statement below was executed with an unknown style (no default case). --- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx index 36fa8edb8..07c05eb54 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx @@ -1,7 +1,7 @@ // // Line style code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2021 by Bill Spitzak and others. +// Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -30,7 +30,7 @@ void Fl_Xlib_Graphics_Driver::line_style_unscaled(int style, int width, char* da int ndashes = dashes ? strlen(dashes) : 0; // emulate the Windows dash patterns on X - char buf[7]; + char buf[7] = {0}; if (!ndashes && (style&0xff)) { int w = width ? width : 1; char dash, dot, gap; -- cgit v1.2.3