From e2b8dc50f54ce91a6c5c26a4b5c798fd94b488e3 Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Fri, 12 Nov 2010 17:22:13 +0100 Subject: Dropped XLFont option, code cleanup --- gfxtools.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gfxtools.cpp') diff --git a/gfxtools.cpp b/gfxtools.cpp index d76ef3a..ef53b7a 100644 --- a/gfxtools.cpp +++ b/gfxtools.cpp @@ -97,7 +97,8 @@ bool DrawXpm(char *Xpm[], areaT *drawable,int x0,int y0,winhandleT winhand,bool } int NoneColorIndex = MAXNUMCOLORS; - tColor cols[n]; + tColor *cols = new tColor[n]; + if (!cols) return false; for (int i = 0; i < n; i++) { @@ -105,12 +106,14 @@ bool DrawXpm(char *Xpm[], areaT *drawable,int x0,int y0,winhandleT winhand,bool if (int(strlen(s)) < c) { esyslog("ERROR: faulty 'colors' line in XPM: '%s'", s); + delete [] cols; return false; } s = skipspace(s + c); if (*s != 'c') { esyslog("ERROR: unknown color key in XPM: '%c'", *s); + delete [] cols; return false; } s = skipspace(s + 1); @@ -122,6 +125,7 @@ bool DrawXpm(char *Xpm[], areaT *drawable,int x0,int y0,winhandleT winhand,bool if (*s != '#') { esyslog("ERROR: unknown color code in XPM: '%c'", *s); + delete [] cols; return false; } unsigned int col=strtoul(++s, NULL, 16); @@ -143,6 +147,7 @@ bool DrawXpm(char *Xpm[], areaT *drawable,int x0,int y0,winhandleT winhand,bool if (int(strlen(s)) != w * c) { esyslog("ERROR: faulty pixel line in XPM: %d '%s'", y, s); + delete [] cols; return false; } for (int x = 0; x < w; x++) @@ -161,5 +166,6 @@ bool DrawXpm(char *Xpm[], areaT *drawable,int x0,int y0,winhandleT winhand,bool s += c; } } + delete [] cols; return true; } -- cgit v1.2.3