From 179771acd25ee5ff8e36a5fd192682d4d55c52af Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 26 Jan 2023 15:23:43 +0100 Subject: Fixing FLUID file corruption from issue #653 (#662) Removing all globals in file writer (#653 ) Fix some static analyser complaints Valgrind: handle width==0 in GfxDrivers on Wayland and X11 Don't use `Fl_Input_::static_value`, it accesses previous buffer that may be deleted Project file write encapsulated, removing globals Encapsulating project file reader, removing states in glbals Project i/o increased source code readability --- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx') diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx index 6433cf5c1..e0cbf26ce 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx @@ -1271,6 +1271,7 @@ double Fl_Cairo_Graphics_Driver::width(unsigned int utf32) { double Fl_Cairo_Graphics_Driver::width(const char* str, int n) { if (!font_descriptor()) return -1; + if ((str == NULL) || (n == 0)) return 0.; if (n == fl_utf8len(*str)) { // str contains a single unicode character int l; unsigned c = fl_utf8decode(str, str+n, &l); -- cgit v1.2.3