[PATCH dockapps 00/10] C23 Fixes

28 views
Skip to first unread message

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:36 PMFeb 26
to Window Maker Dev
The next release of GCC, v15, will default to the GNU dialect of C23. Building
the Debian packages for a number of dockapps hosted by dockapps.net with gcc-15
failed because of incompatibilities with C23. This patch series fixes those
incompatibilities and a couple of other bugs.

Patches 1, 3-5, 7-10 fix C23-related bugs.
Patch 2 removes some defunct source-files.
Patch 6 fixes a UAF bug.

Jeremy Sowden (10):
wmCalClock: remove pre-ANSI function declarations
wmcube: remove unused wmgeneral sources
wmcube: remove pre-ANSI function declaration
wmget: update pre-ANSI function definitions
wmget: rename `CHAR_`-prefixed constants
wmhdplop: remove code that contains use-after-free
wmhdplop: update pre-ANSI function definitions
wmix: replace local boolean definitions with `<stdbool.h>`
wmmoonclock: fix pre-ANSI function declarations
wmsun: remove pre-ANSI function declarations

wmCalClock/Src/wmCalClock.c | 11 +-
wmcube/wmcube/wmcube.c | 2 +-
wmcube/wmgeneral/list.c | 170 ------------
wmcube/wmgeneral/list.h | 55 ----
wmcube/wmgeneral/misc.c | 164 ------------
wmcube/wmgeneral/misc.h | 9 -
wmcube/wmgeneral/wmgeneral.c | 481 ----------------------------------
wmcube/wmgeneral/wmgeneral.h | 59 -----
wmget/configure.c | 20 +-
wmget/server.c | 60 ++---
wmhdplop/util.c | 58 ----
wmhdplop/util.h | 3 -
wmhdplop/wmhdplop.c | 8 +-
wmix/include/common.h | 5 +-
wmmoonclock/src/CalcEphem.c | 40 ++-
wmmoonclock/src/CalcEphem.h | 5 +
wmmoonclock/src/Moon.c | 11 +-
wmmoonclock/src/Moon.h | 5 +
wmmoonclock/src/MoonRise.c | 9 +-
wmmoonclock/src/wmMoonClock.c | 2 +-
wmsun/SunRise.c | 20 +-
21 files changed, 99 insertions(+), 1098 deletions(-)
delete mode 100644 wmcube/wmgeneral/list.c
delete mode 100644 wmcube/wmgeneral/list.h
delete mode 100644 wmcube/wmgeneral/misc.c
delete mode 100644 wmcube/wmgeneral/misc.h
delete mode 100644 wmcube/wmgeneral/wmgeneral.c
delete mode 100644 wmcube/wmgeneral/wmgeneral.h

--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:37 PMFeb 26
to Window Maker Dev
Pre-ANSI function declarators which do not declare their parameters have been
removed in C23 and the syntax reused for declaring functions with no parameters
(like C++).

Replace an obsolete declaration with its modern equivalent.

Link: https://bugs.debian.org/1098102
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmcube/wmcube/wmcube.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wmcube/wmcube/wmcube.c b/wmcube/wmcube/wmcube.c
index b2cdf3ad1d5e..3d5124735330 100644
--- a/wmcube/wmcube/wmcube.c
+++ b/wmcube/wmcube/wmcube.c
@@ -96,7 +96,7 @@ void triangle(int x1, int y1, int x2, int y2, int x3, int y3, int c);
void BlitString(char *name, int x, int y);
void BlitNum(int num, int x, int y);
void clearscr();
-void draw();
+void draw(int color);
void set_plugin();
void startup_seq();
int red = 0;
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:37 PMFeb 26
to Window Maker Dev
Pre-ANSI function declarators have been removed in C23 and the syntax reused for
declaring and defining functions with no parameters (like C++).

Update prototypes of two functions which have no parameters and remove super-
fluous arguments from function calls.

https://bugs.debian.org/1098105
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmhdplop/wmhdplop.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/wmhdplop/wmhdplop.c b/wmhdplop/wmhdplop.c
index bbbe971e12d5..1ba055c1ef2b 100644
--- a/wmhdplop/wmhdplop.c
+++ b/wmhdplop/wmhdplop.c
@@ -380,13 +380,13 @@ void change_displayed_hd(int dir) {
app->displayed_hd_changed = 1;
}

-void next_displayed_hd() {
+void next_displayed_hd(void) {
BLAHBLAH(1,printf("next_displayed_hd() : filter_hd=%d, filter_part=%d\n", app->filter_hd, app->filter_part));
change_displayed_hd(-1);
init_stats(app->update_display_delay_ms*1e-3*app->update_stats_mult);
}

-void prev_displayed_hd() {
+void prev_displayed_hd(void) {
BLAHBLAH(1,printf("prev_displayed_hd() : filter_hd=%d, filter_part=%d\n", app->filter_hd, app->filter_part));
change_displayed_hd(+1);
init_stats(app->update_display_delay_ms*1e-3*app->update_stats_mult);
@@ -609,8 +609,8 @@ static void event_loop(App *app) {
break;
case ButtonRelease:
//exit(0);
- if (ev.xbutton.button == Button4) prev_displayed_hd(-1);
- else if (ev.xbutton.button == Button5 || ev.xbutton.button == Button1) next_displayed_hd(+1);
+ if (ev.xbutton.button == Button4) prev_displayed_hd();
+ else if (ev.xbutton.button == Button5 || ev.xbutton.button == Button1) next_displayed_hd();
break;
case ConfigureNotify: {
if (app->dock->iconwin == None &&
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:37 PMFeb 26
to Window Maker Dev
Pre-ANSI function declarators which do not declare their parameters have been
removed in C23 and the syntax reused for declaring functions with no parameters
(like C++).

Replace some obsolete declarations with modern equivalents, and update the
definitions of these function to have prototypes where these are missing.

Link: https://bugs.debian.org/1098106
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmmoonclock/src/CalcEphem.c | 40 +++++++++++++----------------------
wmmoonclock/src/CalcEphem.h | 5 +++++
wmmoonclock/src/Moon.c | 11 +++++-----
wmmoonclock/src/Moon.h | 5 +++++
wmmoonclock/src/MoonRise.c | 9 ++++----
wmmoonclock/src/wmMoonClock.c | 2 +-
6 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/wmmoonclock/src/CalcEphem.c b/wmmoonclock/src/CalcEphem.c
index 281f4a0a769e..0af769ed66a9 100644
--- a/wmmoonclock/src/CalcEphem.c
+++ b/wmmoonclock/src/CalcEphem.c
@@ -1,11 +1,12 @@
-#include "CalcEphem.h"
#include <math.h>
#include <string.h>

-void CalcEphem(date, UT, c)
-long int date; /* integer containing the date (e.g. 960829) */
-double UT; /* Universal Time */
-CTrans *c; /* structure containing all the relevent coord trans info */
+#include "CalcEphem.h"
+#include "Moon.h"
+
+void CalcEphem(long int date, /* integer containing the date (e.g. 960829) */
+ double UT, /* Universal Time */
+ CTrans *c) /* structure containing all the relevent coord trans info */
{

int year, month, day;
@@ -16,8 +17,7 @@ CTrans *c; /* structure containing all the relevent coord trans info */
double r0, earth_sun_distance;
double RA, DEC, RA_Moon, DEC_Moon;
double TDT, AGE, LambdaMoon, BetaMoon, R;
- double jd(), hour24(), angle2pi(), angle360(), kepler(), Moon(), NewMoon();
- double Ta, Tb, Tc, frac();
+ double Ta, Tb, Tc;
double SinGlat, CosGlat, Tau, lmst, x, y, z;
double SinTau, CosTau, SinDec, CosDec;

@@ -190,8 +190,7 @@ CTrans *c; /* structure containing all the relevent coord trans info */



-double kepler(M, e)
-double M, e;
+double kepler(double M, double e)
{
int n=0;
double E, Eold, eps = 1.0e-8;
@@ -211,21 +210,17 @@ double M, e;



-int DayofYear(year, month, day)
-int year, month, day;
+int DayofYear(int year, int month, int day)
{
- double jd();
return((int)(jd(year, month, day, 0.0) - jd(year, 1, 0, 0.0)));
}




-int DayofWeek(year, month, day, dowstr)
-int year, month, day;
-char dowstr[];
+int DayofWeek(int year, int month, int day, char dowstr[])
{
- double JD, A, Afrac, jd();
+ double JD, A, Afrac;
int n, iA;

JD = jd(year, month, day, 0.0);
@@ -267,9 +262,7 @@ char dowstr[];
* Compute the Julian Day number for the given date.
* Julian Date is the number of days since noon of Jan 1 4713 B.C.
*/
-double jd(ny, nm, nd, UT)
-int ny, nm, nd;
-double UT;
+double jd(int ny, int nm, int nd, double UT)
{
double A, B, C, D, JD, day;

@@ -304,8 +297,7 @@ double UT;

}

-double hour24(hour)
-double hour;
+double hour24(double hour)
{
int n;

@@ -322,8 +314,7 @@ double hour;
}
}

-double angle2pi(angle)
-double angle;
+double angle2pi(double angle)
{
int n;
double a;
@@ -342,8 +333,7 @@ double angle;
}
}

-double angle360(angle)
-double angle;
+double angle360(double angle)
{
int n;

diff --git a/wmmoonclock/src/CalcEphem.h b/wmmoonclock/src/CalcEphem.h
index e2908edb5d27..1d7d18e5e9a4 100644
--- a/wmmoonclock/src/CalcEphem.h
+++ b/wmmoonclock/src/CalcEphem.h
@@ -55,3 +55,8 @@ void CalcEphem(long int, double, CTrans*);
int DayofWeek(int, int, int, char*);
int DayofYear(int, int, int);

+double kepler(double, double);
+double jd(int ny, int nm, int nd, double UT);
+double hour24(double);
+double angle2pi(double angle);
+double angle360(double angle);
diff --git a/wmmoonclock/src/Moon.c b/wmmoonclock/src/Moon.c
index 6cc4e211fceb..39050dbc9c44 100644
--- a/wmmoonclock/src/Moon.c
+++ b/wmmoonclock/src/Moon.c
@@ -3,11 +3,13 @@
*/

#include <math.h>
+
+#include "CalcEphem.h"
+#include "Moon.h"
+
#define DegPerRad 57.29577951308232087680
#define RadPerDeg 0.01745329251994329576

-double angle360();
-
void addthe(double, double, double, double, double*, double*);
void addsol(double, double, double, double, int, int, int, int);
void addn(double, int, int, int, int);
@@ -15,7 +17,6 @@ void term(int, int, int, int, double*, double*);

double TwoPi = 6.283185308;
double ARC = 206264.81;
-double sine(), frac();
double DLAM, DLAMS;
double DS;
double GAM1C;
@@ -337,7 +338,7 @@ void addn(double COEFFN, int P, int Q, int R, int S){

double NewMoon(double ax, double bx, double cx){

- double f1, f2, x0, x1, x2, x3, Moon();
+ double f1, f2, x0, x1, x2, x3;
double L, B, Rad, AGE, tol=1e-7;

x0 = ax;
@@ -388,7 +389,7 @@ double NewMoon(double ax, double bx, double cx){
void MiniMoon(double T, double *RA, double *DEC){

double L0,L,LS,F,D,H,S,N,DL,CB,L_MOON,B_MOON,V,W,X,Y,Z,RHO;
- double frac(), cosEPS, sinEPS, P2, ARC;
+ double cosEPS, sinEPS, P2, ARC;


cosEPS = 0.91748;
diff --git a/wmmoonclock/src/Moon.h b/wmmoonclock/src/Moon.h
index e8616dcabb40..a62754bf6170 100644
--- a/wmmoonclock/src/Moon.h
+++ b/wmmoonclock/src/Moon.h
@@ -2,5 +2,10 @@
#define MOON_H

void MiniMoon(double, double*, double*);
+double Moon(double T, double *LAMBDA, double *BETA, double *R, double *AGE);
+double NewMoon(double ax, double bx, double cx);
+
+double sine(double);
+double frac(double);

#endif
diff --git a/wmmoonclock/src/MoonRise.c b/wmmoonclock/src/MoonRise.c
index e8ff484d3ca8..e06e3fe086e0 100644
--- a/wmmoonclock/src/MoonRise.c
+++ b/wmmoonclock/src/MoonRise.c
@@ -1,4 +1,5 @@
#include <math.h>
+#include "CalcEphem.h"
#include "MoonRise.h"
#include "Moon.h"

@@ -7,11 +8,12 @@

extern double Glon, SinGlat, CosGlat, TimeZone;

+static double SinH(int year, int month, int day, double UT);

void MoonRise(int year, int month, int day, double LocalHour, double *UTRise, double *UTSet){

double UT, ym, y0, yp, SinH0;
- double xe, ye, z1, z2, SinH(), hour24();
+ double xe, ye, z1, z2;
int Rise, Set, nz;

SinH0 = sin( 8.0/60.0 * RadPerDeg );
@@ -133,9 +135,8 @@ void Interp(double ym, double y0, double yp, double *xe, double *ye, double *z1,

double SinH(int year, int month, int day, double UT){

- double TU, frac(), jd();
- double RA_Moon, DEC_Moon, gmst, lmst, Tau, Moon();
- double angle2pi();
+ double TU;
+ double RA_Moon, DEC_Moon, gmst, lmst, Tau;

TU = (jd(year, month, day, UT) - 2451545.0)/36525.0;

diff --git a/wmmoonclock/src/wmMoonClock.c b/wmmoonclock/src/wmMoonClock.c
index bf34b534c3fa..da552004a32a 100644
--- a/wmmoonclock/src/wmMoonClock.c
+++ b/wmmoonclock/src/wmMoonClock.c
@@ -159,7 +159,7 @@ int main(int argc, char *argv[]) {
int i, n, j, ImageNumber, Year, Month, DayOfMonth, digit;
time_t CurrentLocalTime, CurrentGMTTime;
long date;
- double UT, val, RA, DEC, UTRise, UTSet, LocalHour, hour24();
+ double UT, val, RA, DEC, UTRise, UTSet, LocalHour;
int D, H, M, S, sgn, A, B, q;
CTrans c;
struct timeval timeout;
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:37 PMFeb 26
to Window Maker Dev
`str_noaccent_casestr` returns a pointer to freed memory. However, it is never
called, so remove it.

Also remove `str_noaccent_tolower` and `chr_noaccent_tolower`, which are only
called by `str_noaccent_casestr`.

Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmhdplop/util.c | 58 -------------------------------------------------
wmhdplop/util.h | 3 ---
2 files changed, 61 deletions(-)

diff --git a/wmhdplop/util.c b/wmhdplop/util.c
index d66ec329efd0..b58660b33818 100644
--- a/wmhdplop/util.c
+++ b/wmhdplop/util.c
@@ -176,64 +176,6 @@ unsigned str_hash(const unsigned char *s, int max_len) /* calculate the crc v
return( crc^0xFFFFFFFF );
}

-
-unsigned char char_trans[256];
-static int char_trans_init = 0;
-
-static void
-init_char_trans()
-{
- const unsigned char *trans_accents =
- (const unsigned char*) "ИХКЙйкихЮБАДюбадШЭЫыГгНОМЛонмлТСРУтсруЯ";
- const unsigned char *trans_accents2 =
- (const unsigned char*) "eeeeeeeeaaaaaaaauuuucciiiiiiiioooooooon";
- int i;
-
- for (i=0; i < 256; i++) {
- unsigned char *p;
- if ((p=(unsigned char*)strchr((char*)trans_accents, i))) {
- char_trans[i] = trans_accents2[(p - trans_accents)];
- } else if (i < (unsigned char)'A' || i > (unsigned char)'Z') {
- char_trans[i] = i;
- } else {
- char_trans[i] = i + 'a' - 'A';
- }
- }
- char_trans_init = 1;
-}
-
-unsigned char
-chr_noaccent_tolower(unsigned char c)
-{
- if (char_trans_init == 0) init_char_trans();
- return char_trans[c];
-}
-
-void
-str_noaccent_tolower(unsigned char *s)
-{
- int i;
- if (s == NULL) return;
- if (char_trans_init == 0) init_char_trans();
- i = 0; while(s[i]) {
- s[i] = char_trans[s[i]]; i++;
- }
-}
-
-unsigned char *
-str_noaccent_casestr(const unsigned char *meule, const unsigned char *aiguille)
-{
- unsigned char *res;
- char *m = strdup((char*)meule);
- char *a = strdup((char*)aiguille);
-
- str_noaccent_tolower((unsigned char*)m);
- str_noaccent_tolower((unsigned char*)a);
- res = (unsigned char*)strstr(m, a);
- free(a); free(m);
- return res;
-}
-
/* un printf pas trХs fin, mais avec allocation dynamique..
c'est pratique ces ptites choses */
char *
diff --git a/wmhdplop/util.h b/wmhdplop/util.h
index df3954084f9a..76cb94591b33 100644
--- a/wmhdplop/util.h
+++ b/wmhdplop/util.h
@@ -53,9 +53,6 @@ char *str_multi_substitute(const char *src, const char **keys, const char **subs
char *str_substitute(const char *src, const char *key, const char *substitution);
char *shell_quote(const char *src);
unsigned str_hash(const unsigned char *s, int max_len);
-unsigned char chr_noaccent_tolower(unsigned char c);
-void str_noaccent_tolower(unsigned char *s);
-unsigned char *str_noaccent_casestr(const unsigned char *meule, const unsigned char *aiguille);
char *str_printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
char *str_fget_line(FILE *f);
void str_trim(unsigned char *s);
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:37 PMFeb 26
to Window Maker Dev
In C23, `bool` has been changed from a macro defined in `<stdbool.h>` to a
keyword; `true` and `false` are also predefined constants. Wmix defines its own
`bool` type and `true` and `false` constants.

Remove the local definitions and include `<stdbool.h>` instead.

Link: https://bugs.debian.org/1098107
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmix/include/common.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/wmix/include/common.h b/wmix/include/common.h
index 6d6e89567fff..235c75de5f4e 100644
--- a/wmix/include/common.h
+++ b/wmix/include/common.h
@@ -18,10 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

-typedef unsigned int bool;
-
-#define false 0
-#define true (!false)
+#include <stdbool.h>

#define NULL_CURSOR 1
#define NORMAL_CURSOR 2
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:37 PMFeb 26
to Window Maker Dev
Pre-ANSI function declarators which do not declare their parameters have been
removed in C23 and the syntax reused for declaring functions with no parameters
(like C++).

Replace some obsolete function declarations with modern equivalents. Update the
definitions of the affected function to have ANSI prototypes where these are
missing and make them static.

Link: https://bugs.debian.org/1098100
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmCalClock/Src/wmCalClock.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/wmCalClock/Src/wmCalClock.c b/wmCalClock/Src/wmCalClock.c
index 4ba7780ed5bf..73be97e88b79 100644
--- a/wmCalClock/Src/wmCalClock.c
+++ b/wmCalClock/Src/wmCalClock.c
@@ -119,6 +119,8 @@



+static double jd(int ny, int nm, int nd, double UT);
+static double hour24(double hour);

void ParseCMDLine(int argc, char *argv[]);
void ButtonPressEvent(XButtonEvent *);
@@ -310,7 +312,7 @@ int main(int argc, char *argv[]) {
int Year, Month, DayOfWeek, DayOfMonth, OldDayOfMonth;
int Hours, Mins, Secs, OldSecs, digit, xoff, D[10], xsize;
time_t CurrentLocalTime;
- double UT, TU, TU2, TU3, T0, gmst, jd(), hour24();
+ double UT, TU, TU2, TU3, T0, gmst;


/*
@@ -939,9 +941,7 @@ void print_usage(){
* Compute the Julian Day number for the given date.
* Julian Date is the number of days since noon of Jan 1 4713 B.C.
*/
-double jd(ny, nm, nd, UT)
-int ny, nm, nd;
-double UT;
+static double jd(int ny, int nm, int nd, double UT)
{
double A, B, C, D, JD, day;

@@ -976,8 +976,7 @@ double UT;

}

-double hour24(hour)
-double hour;
+static double hour24(double hour)
{
int n;

--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:39 PMFeb 26
to Window Maker Dev
Pre-ANSI function declarators which do not declare their parameters have been
removed in C23 and the syntax reused for declaring functions with no parameters
(like C++).

Use consistent, up-to-date function prototypes in wmget's option-parsing code.

Link: https://bugs.debian.org/1098103
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmget/configure.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/wmget/configure.c b/wmget/configure.c
index 73b44a3f08d5..0e4f49c6bf6c 100644
--- a/wmget/configure.c
+++ b/wmget/configure.c
@@ -76,13 +76,13 @@ void clear_request (Request *req)
}


-static void set_silent ()
+static void set_silent (Request *r, ServerConfig *c, const char *v)
{
set_output_level (OL_SILENT);
}


-static void set_verbose ()
+static void set_verbose (Request *r, ServerConfig *c, const char *v)
{
set_output_level (OL_DEBUG);
}
@@ -137,14 +137,14 @@ static void set_display (Request *r, ServerConfig *c, const char *value)
}


-static void set_overwrite (Request *r, ServerConfig *c)
+static void set_overwrite (Request *r, ServerConfig *c, const char *v)
{
if (r) r->overwrite = 1;
if (c) c->job_defaults.overwrite = 1;
}


-static void set_continue (Request *r, ServerConfig *c)
+static void set_continue (Request *r, ServerConfig *c, const char *v)
{
if (r) r->continue_from = 1;
if (c) c->job_defaults.continue_from = 1;
@@ -172,7 +172,7 @@ static void set_user_agent (Request *r, ServerConfig *c, const char *v)
}


-static void set_ascii (Request *r, ServerConfig *c)
+static void set_ascii (Request *r, ServerConfig *c, const char *v)
{
if (r) r->use_ascii = 1;
if (c) c->job_defaults.use_ascii = 1;
@@ -186,7 +186,7 @@ static void set_referer (Request *r, ServerConfig *c, const char *v)
}


-static void set_headers (Request *r, ServerConfig *c)
+static void set_headers (Request *r, ServerConfig *c, const char *v)
{
if (r) r->include = 1;
if (c) c->job_defaults.include = 1;
@@ -249,11 +249,11 @@ static int load_cmdline (int argc, char **argv,
default:
return 1;

-#define yes , optarg
-#define no
+#define yes optarg
+#define no NULL
#define O(s,l,a,t) \
case optchar_##l: \
- set_##l (req, cfg a); \
+ set_##l (req, cfg, a); \
break;
#include "config.def"
#undef O
@@ -338,7 +338,7 @@ static void read_rcfile (FILE *rcfp, ServerConfig *cfg)
"extra argument: '%s'", value); \
} else { \
debug ("set " #NAM " <no value>"); \
- set_##NAM (0, cfg); \
+ set_##NAM (0, cfg, NULL); \
}

# define O(s,l,a,t) \
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:33:39 PMFeb 26
to Window Maker Dev
wmcube was updated to use libdockapp in commit 99f6e622c5e9 ("wmcube: use
wmgeneral functions in libdockapp instead of the private copy."), but the
wmgeneral sources were left behind. Remove them.

Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmcube/wmgeneral/list.c | 170 -------------
wmcube/wmgeneral/list.h | 55 ----
wmcube/wmgeneral/misc.c | 164 ------------
wmcube/wmgeneral/misc.h | 9 -
wmcube/wmgeneral/wmgeneral.c | 481 -----------------------------------
wmcube/wmgeneral/wmgeneral.h | 59 -----
6 files changed, 938 deletions(-)
delete mode 100644 wmcube/wmgeneral/list.c
delete mode 100644 wmcube/wmgeneral/list.h
delete mode 100644 wmcube/wmgeneral/misc.c
delete mode 100644 wmcube/wmgeneral/misc.h
delete mode 100644 wmcube/wmgeneral/wmgeneral.c
delete mode 100644 wmcube/wmgeneral/wmgeneral.h

diff --git a/wmcube/wmgeneral/list.c b/wmcube/wmgeneral/list.c
deleted file mode 100644
index 1e3764b05e85..000000000000
--- a/wmcube/wmgeneral/list.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Generic single linked list to keep various information
- Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-
-
-Author: Kresten Krab Thorup
-
-Many modifications by Alfredo K. Kojima
-
-Modified by Douglas Torrance
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not cause the resulting executable
- to be covered by the GNU General Public License. This exception does not
- however invalidate any other reasons why the executable file might be
- covered by the GNU General Public License. */
-
-#include "list.h"
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#include <stdlib.h>
-
-/* Return a cons cell produced from (head . tail) */
-
-LinkedList*
-list_cons(void* head, LinkedList* tail)
-{
- LinkedList* cell;
-
- cell = (LinkedList*)malloc(sizeof(LinkedList));
- cell->head = head;
- cell->tail = tail;
- return cell;
-}
-
-/* Return the length of a list, list_length(NULL) returns zero */
-
-int
-list_length(LinkedList* list)
-{
- int i = 0;
- while(list)
- {
- i += 1;
- list = list->tail;
- }
- return i;
-}
-
-/* Return the Nth element of LIST, where N count from zero. If N
- larger than the list length, NULL is returned */
-
-void*
-list_nth(int index, LinkedList* list)
-{
- while(index-- != 0)
- {
- if(list->tail)
- list = list->tail;
- else
- return 0;
- }
- return list->head;
-}
-
-/* Remove the element at the head by replacing it by its successor */
-
-void
-list_remove_head(LinkedList** list)
-{
- if (!*list) return;
- if ((*list)->tail)
- {
- LinkedList* tail = (*list)->tail; /* fetch next */
- *(*list) = *tail; /* copy next to list head */
- free(tail); /* free next */
- }
- else /* only one element in list */
- {
- free(*list);
- (*list) = 0;
- }
-}
-
-
-/* Remove the element with `car' set to ELEMENT */
-/*
-void
-list_remove_elem(LinkedList** list, void* elem)
-{
- while (*list)
- {
- if ((*list)->head == elem)
- list_remove_head(list);
- *list = (*list ? (*list)->tail : NULL);
- }
-}*/
-
-LinkedList *
-list_remove_elem(LinkedList* list, void* elem)
-{
- LinkedList *tmp;
-
- if (list) {
- if (list->head == elem) {
- tmp = list->tail;
- free(list);
- return tmp;
- }
- list->tail = list_remove_elem(list->tail, elem);
- return list;
- }
- return NULL;
-}
-
-
-/* Return element that has ELEM as car */
-
-LinkedList*
-list_find(LinkedList* list, void* elem)
-{
- while(list)
- {
- if (list->head == elem)
- return list;
- list = list->tail;
- }
- return NULL;
-}
-
-/* Free list (backwards recursive) */
-
-void
-list_free(LinkedList* list)
-{
- if(list)
- {
- list_free(list->tail);
- free(list);
- }
-}
-
-/* Map FUNCTION over all elements in LIST */
-
-void
-list_mapcar(LinkedList* list, void(*function)(void*))
-{
- while(list)
- {
- (*function)(list->head);
- list = list->tail;
- }
-}
diff --git a/wmcube/wmgeneral/list.h b/wmcube/wmgeneral/list.h
deleted file mode 100644
index 7491b6b8063d..000000000000
--- a/wmcube/wmgeneral/list.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Generic single linked list to keep various information
- Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-
-Author: Kresten Krab Thorup
-
-Modified by Douglas Torrance
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not cause the resulting executable
- to be covered by the GNU General Public License. This exception does not
- however invalidate any other reasons why the executable file might be
- covered by the GNU General Public License. */
-
-#ifndef __LIST_H_
-#define __LIST_H_
-
-typedef struct LinkedList {
- void *head;
- struct LinkedList *tail;
-} LinkedList;
-
-LinkedList* list_cons(void* head, LinkedList* tail);
-
-int list_length(LinkedList* list);
-
-void* list_nth(int index, LinkedList* list);
-
-void list_remove_head(LinkedList** list);
-
-LinkedList *list_remove_elem(LinkedList* list, void* elem);
-
-void list_mapcar(LinkedList* list, void(*function)(void*));
-
-LinkedList*list_find(LinkedList* list, void* elem);
-
-void list_free(LinkedList* list);
-
-#endif
diff --git a/wmcube/wmgeneral/misc.c b/wmcube/wmgeneral/misc.c
deleted file mode 100644
index 34281e2c089a..000000000000
--- a/wmcube/wmgeneral/misc.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* dock.c- built-in Dock module for WindowMaker
- *
- * WindowMaker window manager
- *
- * Copyright (c) 1997 Alfredo K. Kojima
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "list.h"
-#include "misc.h"
-
-/*
- *----------------------------------------------------------------------
- * parse_command--
- * Divides a command line into a argv/argc pair.
- *----------------------------------------------------------------------
- */
-#define PRC_ALPHA 0
-#define PRC_BLANK 1
-#define PRC_ESCAPE 2
-#define PRC_DQUOTE 3
-#define PRC_EOS 4
-#define PRC_SQUOTE 5
-
-typedef struct {
- short nstate;
- short output;
-} DFA;
-
-
-static DFA mtable[9][6] = {
- {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
- {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
- {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
- {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
- {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
- {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
- {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
- {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
- {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
-};
-
-char*
-next_token(char *word, char **next)
-{
- char *ptr;
- char *ret, *t;
- int state, ctype;
-
- t = ret = malloc(strlen(word)+1);
- ptr = word;
-
- state = 0;
- *t = 0;
- while (1) {
- if (*ptr==0)
- ctype = PRC_EOS;
- else if (*ptr=='\\')
- ctype = PRC_ESCAPE;
- else if (*ptr=='"')
- ctype = PRC_DQUOTE;
- else if (*ptr=='\'')
- ctype = PRC_SQUOTE;
- else if (*ptr==' ' || *ptr=='\t')
- ctype = PRC_BLANK;
- else
- ctype = PRC_ALPHA;
-
- if (mtable[state][ctype].output) {
- *t = *ptr; t++;
- *t = 0;
- }
- state = mtable[state][ctype].nstate;
- ptr++;
- if (mtable[state][0].output<0) {
- break;
- }
- }
-
- if (*ret==0)
- t = NULL;
- else
- t = strdup(ret);
-
- free(ret);
-
- if (ctype==PRC_EOS)
- *next = NULL;
- else
- *next = ptr;
-
- return t;
-}
-
-
-extern void
-parse_command(char *command, char ***argv, int *argc)
-{
- LinkedList *list = NULL;
- char *token, *line;
- int count, i;
-
- line = command;
- do {
- token = next_token(line, &line);
- if (token) {
- list = list_cons(token, list);
- }
- } while (token!=NULL && line!=NULL);
-
- count = list_length(list);
- *argv = malloc(sizeof(char*)*count);
- i = count;
- while (list!=NULL) {
- (*argv)[--i] = list->head;
- list_remove_head(&list);
- }
- *argc = count;
-}
-
-extern pid_t
-execCommand(char *command)
-{
- pid_t pid;
- char **argv;
- int argc;
-
- parse_command(command, &argv, &argc);
-
- if (argv==NULL) {
- return 0;
- }
-
- if ((pid=fork())==0) {
- char **args;
- int i;
-
- args = malloc(sizeof(char*)*(argc+1));
- if (!args)
- exit(10);
- for (i=0; i<argc; i++) {
- args[i] = argv[i];
- }
- args[argc] = NULL;
- execvp(argv[0], args);
- exit(10);
- }
- return pid;
-}
diff --git a/wmcube/wmgeneral/misc.h b/wmcube/wmgeneral/misc.h
deleted file mode 100644
index 602e1b76f6e7..000000000000
--- a/wmcube/wmgeneral/misc.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __MISC_H
-#define __MISC_H
-
-#include <unistd.h>
-
-extern void parse_command(char *, char ***, int *);
-
-extern pid_t execCommand(char *);
-#endif /* __MISC_H */
diff --git a/wmcube/wmgeneral/wmgeneral.c b/wmcube/wmgeneral/wmgeneral.c
deleted file mode 100644
index c99a7d6e1ab8..000000000000
--- a/wmcube/wmgeneral/wmgeneral.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- Best viewed with vim5, using ts=4
-
- wmgeneral was taken from wmppp.
-
- It has a lot of routines which most of the wm* programs use.
-
- ------------------------------------------------------------
-
- Author: Martijn Pieterse (piet...@xs4all.nl)
-
- ---
- CHANGES:
- ---
- 14/09/1998 (Dave Clark, cla...@skyia.com)
- * Updated createXBMfromXPM routine
- * Now supports >256 colors
- 11/09/1998 (Martijn Pieterse, piet...@xs4all.nl)
- * Removed a bug from parse_rcfile. You could
- not use "start" in a command if a label was
- also start.
- * Changed the needed geometry string.
- We don't use window size, and don't support
- negative positions.
- 03/09/1998 (Martijn Pieterse, piet...@xs4all.nl)
- * Added parse_rcfile2
- 02/09/1998 (Martijn Pieterse, piet...@xs4all.nl)
- * Added -geometry support (untested)
- 28/08/1998 (Martijn Pieterse, piet...@xs4all.nl)
- * Added createXBMfromXPM routine
- * Saves a lot of work with changing xpm's.
- 02/05/1998 (Martijn Pieterse, piet...@xs4all.nl)
- * changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
- * debugged the parse_rc file.
- 30/04/1998 (Martijn Pieterse, piet...@xs4all.nl)
- * Ripped similar code from all the wm* programs,
- and put them in a single file.
-
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <stdarg.h>
-
-#include <X11/Xlib.h>
-#include <X11/xpm.h>
-#include <X11/extensions/shape.h>
-
-#include "wmgeneral.h"
-
- /*****************/
- /* X11 Variables */
-/*****************/
-
-Window Root;
-int screen;
-int x_fd;
-int d_depth;
-XSizeHints mysizehints;
-XWMHints mywmhints;
-Pixel back_pix, fore_pix;
-char *Geometry = "";
-Window iconwin, win;
-GC NormalGC;
-XpmIcon wmgen;
-Pixmap pixmask;
-
- /*****************/
- /* Mouse Regions */
-/*****************/
-
-typedef struct {
- int enable;
- int top;
- int bottom;
- int left;
- int right;
-} MOUSE_REGION;
-
-MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
-
- /***********************/
- /* Function Prototypes */
-/***********************/
-
-static void GetXPM(XpmIcon *, char **);
-static Pixel GetColor(char *);
-void RedrawWindow(void);
-void AddMouseRegion(unsigned, int, int, int, int);
-int CheckMouseRegion(int, int);
-
-/*******************************************************************************\
-|* parse_rcfile *|
-\*******************************************************************************/
-
-void parse_rcfile(const char *filename, rckeys *keys) {
-
- char *p,*q;
- char temp[128];
- char *tokens = " :\t\n";
- FILE *fp;
- int i,key;
-
- fp = fopen(filename, "r");
- if (fp) {
- while (fgets(temp, 128, fp)) {
- key = 0;
- q = strdup(temp);
- q = strtok(q, tokens);
- while (key >= 0 && keys[key].label) {
- if ((!strcmp(q, keys[key].label))) {
- p = strstr(temp, keys[key].label);
- p += strlen(keys[key].label);
- p += strspn(p, tokens);
- if ((i = strcspn(p, "#\n"))) p[i] = 0;
- free(*keys[key].var);
- *keys[key].var = strdup(p);
- key = -1;
- } else key++;
- }
- free(q);
- }
- fclose(fp);
- }
-}
-
-/*******************************************************************************\
-|* parse_rcfile2 *|
-\*******************************************************************************/
-
-void parse_rcfile2(const char *filename, rckeys2 *keys) {
-
- char *p;
- char temp[128];
- char *tokens = " :\t\n";
- FILE *fp;
- int i,key;
- char *family = NULL;
-
- fp = fopen(filename, "r");
- if (fp) {
- while (fgets(temp, 128, fp)) {
- key = 0;
- while (key >= 0 && keys[key].label) {
- if ((p = strstr(temp, keys[key].label))) {
- p += strlen(keys[key].label);
- p += strspn(p, tokens);
- if ((i = strcspn(p, "#\n"))) p[i] = 0;
- free(*keys[key].var);
- *keys[key].var = strdup(p);
- key = -1;
- } else key++;
- }
- }
- fclose(fp);
- }
- free(family);
-}
-
-
-/*******************************************************************************\
-|* GetXPM *|
-\*******************************************************************************/
-
-static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
-
- XWindowAttributes attributes;
- int err;
-
- /* For the colormap */
- XGetWindowAttributes(display, Root, &attributes);
-
- wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
-
- err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
- &(wmgen->mask), &(wmgen->attributes));
-
- if (err != XpmSuccess) {
- fprintf(stderr, "Not enough free colorcells.\n");
- exit(1);
- }
-}
-
-/*******************************************************************************\
-|* GetColor *|
-\*******************************************************************************/
-
-static Pixel GetColor(char *name) {
-
- XColor color;
- XWindowAttributes attributes;
-
- XGetWindowAttributes(display, Root, &attributes);
-
- color.pixel = 0;
- if (!XParseColor(display, attributes.colormap, name, &color)) {
- fprintf(stderr, "wm.app: can't parse %s.\n", name);
- } else if (!XAllocColor(display, attributes.colormap, &color)) {
- fprintf(stderr, "wm.app: can't allocate %s.\n", name);
- }
- return color.pixel;
-}
-
-/*******************************************************************************\
-|* flush_expose *|
-\*******************************************************************************/
-
-static int flush_expose(Window w) {
-
- XEvent dummy;
- int i=0;
-
- while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
- i++;
-
- return i;
-}
-
-/*******************************************************************************\
-|* RedrawWindow *|
-\*******************************************************************************/
-
-void RedrawWindow(void) {
-
- flush_expose(iconwin);
- XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
- 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
- flush_expose(win);
- XCopyArea(display, wmgen.pixmap, win, NormalGC,
- 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
-}
-
-/*******************************************************************************\
-|* RedrawWindowXY *|
-\*******************************************************************************/
-
-void RedrawWindowXY(int x, int y) {
-
- flush_expose(iconwin);
- XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
- x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
- flush_expose(win);
- XCopyArea(display, wmgen.pixmap, win, NormalGC,
- x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
-}
-
-/*******************************************************************************\
-|* AddMouseRegion *|
-\*******************************************************************************/
-
-void AddMouseRegion(unsigned index, int left, int top, int right, int bottom) {
-
- if (index < MAX_MOUSE_REGION) {
- mouse_region[index].enable = 1;
- mouse_region[index].top = top;
- mouse_region[index].left = left;
- mouse_region[index].bottom = bottom;
- mouse_region[index].right = right;
- }
-}
-
-/*******************************************************************************\
-|* CheckMouseRegion *|
-\*******************************************************************************/
-
-int CheckMouseRegion(int x, int y) {
-
- int i;
- int found;
-
- found = 0;
-
- for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
- if (mouse_region[i].enable &&
- x <= mouse_region[i].right &&
- x >= mouse_region[i].left &&
- y <= mouse_region[i].bottom &&
- y >= mouse_region[i].top)
- found = 1;
- }
- if (!found) return -1;
- return (i-1);
-}
-
-/*******************************************************************************\
-|* createXBMfromXPM *|
-\*******************************************************************************/
-void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
-
- int i,j,k;
- int width, height, numcol, depth;
- int zero=0;
- unsigned char bwrite;
- int bcount;
- int curpixel;
-
- sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
-
-
- for (k=0; k!=depth; k++)
- {
- zero <<=8;
- zero |= xpm[1][k];
- }
-
- for (i=numcol+1; i < numcol+sy+1; i++) {
- bcount = 0;
- bwrite = 0;
- for (j=0; j<sx*depth; j+=depth) {
- bwrite >>= 1;
-
- curpixel=0;
- for (k=0; k!=depth; k++)
- {
- curpixel <<=8;
- curpixel |= xpm[i][j+k];
- }
-
- if ( curpixel != zero ) {
- bwrite += 128;
- }
- bcount++;
- if (bcount == 8) {
- *xbm = bwrite;
- xbm++;
- bcount = 0;
- bwrite = 0;
- }
- }
- }
-}
-
-/*******************************************************************************\
-|* copyXPMArea *|
-\*******************************************************************************/
-
-void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
-
- XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
-
-}
-
-/*******************************************************************************\
-|* copyXBMArea *|
-\*******************************************************************************/
-
-void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
-
- XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
-}
-
-
-/*******************************************************************************\
-|* setMaskXY *|
-\*******************************************************************************/
-
-void setMaskXY(int x, int y) {
-
- XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
- XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
-}
-
-/*******************************************************************************\
-|* openXwindow *|
-\*******************************************************************************/
-void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
-
- unsigned int borderwidth = 1;
- XClassHint classHint;
- char *display_name = NULL;
- char *wname = argv[0];
- XTextProperty name;
-
- XGCValues gcv;
- unsigned long gcm;
-
- char *geometry = NULL;
-
- int dummy=0;
- int i, wx, wy;
-
- for (i=1; argv[i]; i++) {
- if (!strcmp(argv[i], "-display")) {
- display_name = argv[i+1];
- i++;
- }
- if (!strcmp(argv[i], "-geometry")) {
- geometry = argv[i+1];
- i++;
- }
- }
-
- if (!(display = XOpenDisplay(display_name))) {
- fprintf(stderr, "%s: can't open display %s\n",
- wname, XDisplayName(display_name));
- exit(1);
- }
- screen = DefaultScreen(display);
- Root = RootWindow(display, screen);
- d_depth = DefaultDepth(display, screen);
- x_fd = XConnectionNumber(display);
-
- /* Convert XPM to XImage */
- GetXPM(&wmgen, pixmap_bytes);
-
- /* Create a window to hold the stuff */
- mysizehints.flags = USSize | USPosition;
- mysizehints.x = 0;
- mysizehints.y = 0;
-
- back_pix = GetColor("white");
- fore_pix = GetColor("black");
-
- XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
- &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
-
- mysizehints.width = 64;
- mysizehints.height = 64;
-
- win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
- mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
-
- iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
- mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
-
- /* Activate hints */
- XSetWMNormalHints(display, win, &mysizehints);
- classHint.res_name = wname;
- classHint.res_class = wname;
- XSetClassHint(display, win, &classHint);
-
- XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
- XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
-
- if (XStringListToTextProperty(&wname, 1, &name) == 0) {
- fprintf(stderr, "%s: can't allocate window name\n", wname);
- exit(1);
- }
-
- XSetWMName(display, win, &name);
-
- /* Create GC for drawing */
-
- gcm = GCForeground | GCBackground | GCGraphicsExposures;
- gcv.foreground = fore_pix;
- gcv.background = back_pix;
- gcv.graphics_exposures = 0;
- NormalGC = XCreateGC(display, Root, gcm, &gcv);
-
- /* ONLYSHAPE ON */
-
- pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
-
- XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
- XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
-
- /* ONLYSHAPE OFF */
-
- mywmhints.initial_state = WithdrawnState;
- mywmhints.icon_window = iconwin;
- mywmhints.icon_x = mysizehints.x;
- mywmhints.icon_y = mysizehints.y;
- mywmhints.window_group = win;
- mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
-
- XSetWMHints(display, win, &mywmhints);
-
- XSetCommand(display, win, argv, argc);
- XMapWindow(display, win);
-
- if (geometry) {
- if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
- fprintf(stderr, "Bad geometry string.\n");
- exit(1);
- }
- XMoveWindow(display, win, wx, wy);
- }
-}
diff --git a/wmcube/wmgeneral/wmgeneral.h b/wmcube/wmgeneral/wmgeneral.h
deleted file mode 100644
index dd3ecc60eaf9..000000000000
--- a/wmcube/wmgeneral/wmgeneral.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef WMGENERAL_H_INCLUDED
-#define WMGENERAL_H_INCLUDED
-
- /***********/
- /* Defines */
-/***********/
-
-#define MAX_MOUSE_REGION (16)
-
- /************/
- /* Typedefs */
-/************/
-
-typedef struct _rckeys rckeys;
-
-struct _rckeys {
- const char *label;
- char **var;
-};
-
-typedef struct _rckeys2 rckeys2;
-
-struct _rckeys2 {
- const char *family;
- const char *label;
- char **var;
-};
-
-typedef struct {
- Pixmap pixmap;
- Pixmap mask;
- XpmAttributes attributes;
-} XpmIcon;
-
- /*******************/
- /* Global variable */
-/*******************/
-
-Display *display;
-
- /***********************/
- /* Function Prototypes */
-/***********************/
-
-void AddMouseRegion(unsigned index, int left, int top, int right, int bottom);
-int CheckMouseRegion(int x, int y);
-
-void openXwindow(int argc, char *argv[], char **, char *, int, int);
-void RedrawWindow(void);
-void RedrawWindowXY(int x, int y);
-
-void createXBMfromXPM(char *, char **, int, int);
-void copyXPMArea(int, int, int, int, int, int);
-void copyXBMArea(int, int, int, int, int, int);
-void setMaskXY(int, int);
-
-void parse_rcfile(const char *, rckeys *);
-
-#endif
--
2.47.2

Jeremy Sowden

unread,
Feb 26, 2025, 5:37:14 PMFeb 26
to Window Maker Dev
Pre-ANSI function declarators which do not declare their parameters have been
removed in C23 and the syntax reused for declaring functions with no parameters
(like C++).

Update the function definitions to have prototypes where these are missing, make
them static and replace the obsolete declarations with modern equivalents.

Link: https://bugs.debian.org/1098109
Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
wmsun/SunRise.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/wmsun/SunRise.c b/wmsun/SunRise.c
index 289cfb1204fc..af65ddc17fd2 100644
--- a/wmsun/SunRise.c
+++ b/wmsun/SunRise.c
@@ -5,6 +5,11 @@

extern double Glon, SinGlat, CosGlat, TimeZone;

+static double SinH(int year, int month, int day, double UT);
+static double hour24(double hour);
+static double jd(int ny, int nm, int nd, double UT);
+static double frac(double x);
+
double cosEPS = 0.91748;
double sinEPS = 0.39778;
double P2 = 6.283185307;
@@ -40,7 +45,7 @@ int Interp(double ym, double y0, double yp, double *xe, double *ye, double *z1,
void SunRise(int year, int month, int day, double LocalHour, double *UTRise, double *UTSet){

double UT, ym, SinH0;
- double xe, ye, z1, z2, SinH(), hour24();
+ double xe, ye, z1, z2;
int Rise, Set, nz;

(void) LocalHour;
@@ -107,9 +112,9 @@ void SunRise(int year, int month, int day, double LocalHour, double *UTRise, dou

}

-double SinH(int year, int month, int day, double UT){
+static double SinH(int year, int month, int day, double UT){

- double TU, frac(), jd();
+ double TU;
double RA_Sun, DEC_Sun, gmst, lmst, Tau;
double M, DL, L, SL, X, Y, Z, RHO;

@@ -146,9 +151,7 @@ double SinH(int year, int month, int day, double UT){
* Compute the Julian Day number for the given date.
* Julian Date is the number of days since noon of Jan 1 4713 B.C.
*/
-double jd(ny, nm, nd, UT)
-int ny, nm, nd;
-double UT;
+static double jd(int ny, int nm, int nd, double UT)
{
double B, C, D, JD, day;

@@ -185,8 +188,7 @@ double UT;

}

-double hour24(hour)
-double hour;
+static double hour24(double hour)
{
int n;

@@ -203,7 +205,7 @@ double hour;
}
}

-double frac(double x){
+static double frac(double x){

x -= (int)x;
return( (x<0) ? x+1.0 : x );
--
2.47.2

Carlos R. Mafra

unread,
Feb 27, 2025, 3:38:16 AMFeb 27
to wmake...@googlegroups.com
Hi Jeremy,

Thank you for doing this.

Can you resend this patch though? It didn't apply cleanly and the
error was cryptic, so I applied all the other patches and excluded
this (see the repo now).

Best, Carlos
> --
> You received this message because you are subscribed to the Google Groups "Window Maker Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wmaker-dev+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/wmaker-dev/20250226223318.466096-7-jeremy%40azazel.net.

Jeremy Sowden

unread,
Feb 27, 2025, 1:55:12 PMFeb 27
to Window Maker Dev
`str_noaccent_casestr` returns a pointer to freed memory. However, it is never
called, so remove it.

Also remove `str_noaccent_tolower` and `chr_noaccent_tolower`, which are only
called by `str_noaccent_casestr`.

Signed-off-by: Jeremy Sowden <jer...@azazel.net>
---
Changes since v1

* The source file is encoded in latin1, not utf8. Use the correct charset
in the Content-Type header.

Jeremy Sowden

unread,
Feb 27, 2025, 2:28:05 PMFeb 27
to Window Maker Dev
On 2025-02-27, at 18:55:00 +0000, Jeremy Sowden wrote:
> `str_noaccent_casestr` returns a pointer to freed memory. However, it is never
> called, so remove it.
>
> Also remove `str_noaccent_tolower` and `chr_noaccent_tolower`, which are only
> called by `str_noaccent_casestr`.
>
> Signed-off-by: Jeremy Sowden <jer...@azazel.net>
> ---
> Changes since v1
>
> * The source file is encoded in latin1, not utf8. Use the correct charset
> in the Content-Type header.

Google Groups has very unhelpfully transcoded the message to UTF-8, so
it still doesn't apply. Argh! I have compressed the original patch
file and attached it to this mail.

J.
> --
> You received this message because you are subscribed to the Google Groups "Window Maker Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wmaker-dev+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/wmaker-dev/20250227185502.482054-1-jeremy%40azazel.net.
wmhdplop-remove-code-that-contains-use-after-free.patch.xz
signature.asc

Carlos R. Mafra

unread,
Feb 27, 2025, 3:45:23 PMFeb 27
to wmake...@googlegroups.com
On Thu, 27 Feb 2025 at 19:27:59 +0000, Jeremy Sowden wrote:
> On 2025-02-27, at 18:55:00 +0000, Jeremy Sowden wrote:
> > `str_noaccent_casestr` returns a pointer to freed memory. However, it is never
> > called, so remove it.
> >
> > Also remove `str_noaccent_tolower` and `chr_noaccent_tolower`, which are only
> > called by `str_noaccent_casestr`.
> >
> > Signed-off-by: Jeremy Sowden <jer...@azazel.net>
> > ---
> > Changes since v1
> >
> > * The source file is encoded in latin1, not utf8. Use the correct charset
> > in the Content-Type header.
>
> Google Groups has very unhelpfully transcoded the message to UTF-8, so
> it still doesn't apply. Argh! I have compressed the original patch
> file and attached it to this mail.
>
> J.

Thank you for identifying the problem and for the attached patch.
> To view this discussion visit https://groups.google.com/d/msgid/wmaker-dev/20250227192759.GA3342055%40celephais.dreamlands.




Reply all
Reply to author
Forward
0 new messages