From 3cd3dd5b0b7cfe3888ae6f805a8f4c59f034834e Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Mon, 1 Jan 2024 12:22:46 +0100 Subject: Silence uninitialized variable warning Signed-off-by: Tim Wiederhake --- src/add_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 3895729..39a9325 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -1388,7 +1388,7 @@ CreateTwmColormap(Colormap c) { TwmColormap *cmap; - cmap = malloc(sizeof(TwmColormap)); + cmap = calloc(1, sizeof(TwmColormap)); if (!cmap || XSaveContext(dpy, c, ColormapContext, (XPointer) cmap)) { if (cmap) free(cmap); -- cgit v1.2.3 From 895e0e6630eea3cea07d4e4f47f0264ea5263c8e Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Rework dummy variable usage in AddWindow twm defines several "junk" variables to use with functions like XQueryPointer or XGetGeometry. In some instances, the returned values are actually used, which makes the code confusing and hard to reason about. Use dedicated variables in those cases. Signed-off-by: Tim Wiederhake --- src/add_window.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 39a9325..9a526f7 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -432,29 +432,30 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ while (TRUE) { int stat; + Window root = None; + unsigned mask = 0; XUngrabServer(dpy); XSync(dpy, 0); XGrabServer(dpy); - JunkMask = 0; - if (!XQueryPointer(dpy, Scr->Root, &JunkRoot, + if (!XQueryPointer(dpy, Scr->Root, &root, &JunkChild, &JunkX, &JunkY, - &AddingX, &AddingY, &JunkMask)) - JunkMask = 0; + &AddingX, &AddingY, &mask)) + mask = 0; - JunkMask &= (Button1Mask | Button2Mask | Button3Mask | + mask &= (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask); /* * watch out for changing screens */ if (firsttime) { - if (JunkRoot != Scr->Root) { + if (root != Scr->Root) { register int scrnum; for (scrnum = 0; scrnum < NumScreens; scrnum++) { - if (JunkRoot == RootWindow(dpy, scrnum)) + if (root == RootWindow(dpy, scrnum)) break; } @@ -467,7 +468,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * wait for buttons to come up; yuck */ - if (JunkMask != 0) + if (mask != 0) continue; /* -- cgit v1.2.3 From f6fb5b536cd2a96ef1ac26599fd48ef89a628a77 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Rework dummy variable usage in SetHighlightPixmap twm defines several "junk" variables to use with functions like XQueryPointer or XGetGeometry. In some instances, the returned values are actually used, which makes the code confusing and hard to reason about. Use dedicated variables in those cases. Signed-off-by: Tim Wiederhake --- src/add_window.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 9a526f7..1f5abe1 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -1347,15 +1347,18 @@ CreateWindowTitlebarButtons(TwmWindow *tmp_win) void SetHighlightPixmap(char *filename) { - Pixmap pm = GetBitmap(filename); + unsigned width = 0; + unsigned height = 0; + + Pixmap pm = FindBitmap(filename, &width, &height); if (pm) { if (Scr->hilitePm) { XFreePixmap(dpy, Scr->hilitePm); } Scr->hilitePm = pm; - Scr->hilite_pm_width = (int) JunkWidth; - Scr->hilite_pm_height = (int) JunkHeight; + Scr->hilite_pm_width = (int) width; + Scr->hilite_pm_height = (int) height; } } -- cgit v1.2.3 From 6ea386bd98a737a9f54e2ca4216adf45868fd6e4 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Remove global variables JunkRoot, JunkChild Replace with a local variable following the naming scheme from Identify() in src/menus.c. Signed-off-by: Tim Wiederhake --- src/add_window.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 1f5abe1..e451bfe 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -162,6 +162,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) Bool width_ever_changed_by_user; Bool height_ever_changed_by_user; char *name; + Window wdummy = None; #ifdef DEBUG fprintf(stderr, "AddWindow: w = 0x%lx\n", (unsigned long) w); @@ -440,7 +441,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XGrabServer(dpy); if (!XQueryPointer(dpy, Scr->Root, &root, - &JunkChild, &JunkX, &JunkY, + &wdummy, &JunkX, &JunkY, &AddingX, &AddingY, &mask)) mask = 0; @@ -567,7 +568,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) continue; } - XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, + XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); @@ -662,7 +663,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * using multiple GXxor lines so that we don't need to * grab the server. */ - XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, + XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); @@ -765,7 +766,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * reparented, so we'll get a DestroyNotify for it. We won't have * gotten one for anything up to here, however. */ - if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, + if (XGetGeometry(dpy, tmp_win->w, &wdummy, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) { free(tmp_win); XUngrabServer(dpy); -- cgit v1.2.3 From c5a63751f8b4eab72794e56365ead929023f2b94 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Remove global variables JunkX, JunkY Replace with a local variable following the naming scheme from Identify() in src/menus.c. Signed-off-by: Tim Wiederhake --- src/add_window.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index e451bfe..87cb51b 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -162,6 +162,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) Bool width_ever_changed_by_user; Bool height_ever_changed_by_user; char *name; + int dummy = 0; Window wdummy = None; #ifdef DEBUG @@ -441,7 +442,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XGrabServer(dpy); if (!XQueryPointer(dpy, Scr->Root, &root, - &wdummy, &JunkX, &JunkY, + &wdummy, &dummy, &dummy, &AddingX, &AddingY, &mask)) mask = 0; @@ -569,7 +570,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, - &JunkX, &JunkY, &AddingX, &AddingY, + &dummy, &dummy, &AddingX, &AddingY, &JunkMask); if (Scr->DontMoveOff) { @@ -664,7 +665,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * grab the server. */ XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, - &JunkX, &JunkY, &AddingX, &AddingY, + &dummy, &dummy, &AddingX, &AddingY, &JunkMask); if (lastx != AddingX || lasty != AddingY) { @@ -766,7 +767,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * reparented, so we'll get a DestroyNotify for it. We won't have * gotten one for anything up to here, however. */ - if (XGetGeometry(dpy, tmp_win->w, &wdummy, &JunkX, &JunkY, + if (XGetGeometry(dpy, tmp_win->w, &wdummy, &dummy, &dummy, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) { free(tmp_win); XUngrabServer(dpy); -- cgit v1.2.3 From 783b31821d87ea551457f4700f796a51f359cfd1 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Remove global variables JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask Replace with a local variable following the naming scheme from Identify() in src/menus.c. Signed-off-by: Tim Wiederhake --- src/add_window.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 87cb51b..8af8f73 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -163,6 +163,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) Bool height_ever_changed_by_user; char *name; int dummy = 0; + unsigned udummy = 0; Window wdummy = None; #ifdef DEBUG @@ -571,7 +572,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, &dummy, &dummy, &AddingX, &AddingY, - &JunkMask); + &udummy); if (Scr->DontMoveOff) { int AddingR, AddingB; @@ -666,7 +667,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ XQueryPointer(dpy, Scr->Root, &wdummy, &wdummy, &dummy, &dummy, &AddingX, &AddingY, - &JunkMask); + &udummy); if (lastx != AddingX || lasty != AddingY) { DoResize(AddingX, AddingY, tmp_win); @@ -768,7 +769,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * gotten one for anything up to here, however. */ if (XGetGeometry(dpy, tmp_win->w, &wdummy, &dummy, &dummy, - &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) { + &udummy, &udummy, &udummy, &udummy) == 0) { free(tmp_win); XUngrabServer(dpy); return (NULL); -- cgit v1.2.3 From a0a4604cab350eb6a8bd3cc56cfb35d534fa344b Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 30 Dec 2023 20:49:48 +0100 Subject: Remove storage specifier 'register' 'register' is an optimization hint to the compiler that is generally not necessary and needlessly prevents using a c++ compiler to compile twm. Signed-off-by: Tim Wiederhake --- src/add_window.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 8af8f73..d02a1c8 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -122,7 +122,7 @@ GetGravityOffsets(TwmWindow *tmp, int *xp, int *yp) { 0, 0 }, /* StaticGravity */ }; /* *INDENT-ON* */ - register int g = ((tmp->hints.flags & PWinGravity) + int g = ((tmp->hints.flags & PWinGravity) ? tmp->hints.win_gravity : NorthWestGravity); if (g < ForgetGravity || g > StaticGravity) { @@ -455,7 +455,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ if (firsttime) { if (root != Scr->Root) { - register int scrnum; + int scrnum; for (scrnum = 0; scrnum < NumScreens; scrnum++) { if (root == RootWindow(dpy, scrnum)) @@ -1217,13 +1217,13 @@ ComputeWindowTitleOffsets(TwmWindow *tmp_win, int width, Bool squeeze) * of the frame window. */ void -ComputeTitleLocation(register TwmWindow *tmp) +ComputeTitleLocation(TwmWindow *tmp) { tmp->title_x = -tmp->frame_bw; tmp->title_y = -tmp->frame_bw; if (tmp->squeeze_info) { - register SqueezeInfo *si = tmp->squeeze_info; + SqueezeInfo *si = tmp->squeeze_info; int basex; int maxwidth = tmp->frame_width; int tw = tmp->title_width; @@ -1373,8 +1373,8 @@ FetchWmProtocols(TwmWindow *tmp) int n; if (XGetWMProtocols(dpy, tmp->w, &protocols, &n)) { - register int i; - register Atom *ap; + int i; + Atom *ap; for (i = 0, ap = protocols; i < n; i++, ap++) { if (*ap == _XA_WM_TAKE_FOCUS) @@ -1467,7 +1467,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) void FetchWmColormapWindows(TwmWindow *tmp) { - register int i, j; + int i, j; Window *cmap_windows = NULL; Bool can_free_cmap_windows = False; int number_cmap_windows = 0; -- cgit v1.2.3 From f63f0a7416793f42030f56a79930b3f76c82a24d Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 30 Dec 2023 20:49:48 +0100 Subject: Rename field 'class' to 'xclass' in TwmWindow 'class' is a keyword in c++. Its usage confuses some tools that work with c and c++ source code. Signed-off-by: Tim Wiederhake --- src/add_window.c | 64 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index d02a1c8..009d8f8 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -188,8 +188,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (!I18N_FetchName(dpy, tmp_win->w, &name)) name = NULL; - tmp_win->class = NoClass; - XGetClassHint(dpy, tmp_win->w, &tmp_win->class); + tmp_win->xclass = NoClass; + XGetClassHint(dpy, tmp_win->w, &tmp_win->xclass); FetchWmProtocols(tmp_win); FetchWmColormapWindows(tmp_win); @@ -263,44 +263,44 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->transient = (short) Transient(tmp_win->w, &tmp_win->transientfor); tmp_win->nameChanged = 0; - if (tmp_win->class.res_name == NULL) - tmp_win->class.res_name = NoName; - if (tmp_win->class.res_class == NULL) - tmp_win->class.res_class = NoName; + if (tmp_win->xclass.res_name == NULL) + tmp_win->xclass.res_name = NoName; + if (tmp_win->xclass.res_class == NULL) + tmp_win->xclass.res_class = NoName; tmp_win->full_name = strdup(tmp_win->name); namelen = (int) strlen(tmp_win->name); tmp_win->highlight = Scr->Highlight && (!short_lookup LookInList(Scr->NoHighlight, tmp_win->full_name, - &tmp_win->class)); + &tmp_win->xclass)); tmp_win->stackmode = Scr->StackMode && (!short_lookup LookInList(Scr->NoStackModeL, tmp_win->full_name, - &tmp_win->class)); + &tmp_win->xclass)); tmp_win->titlehighlight = Scr->TitleHighlight && (!short_lookup LookInList(Scr->NoTitleHighlight, tmp_win->full_name, - &tmp_win->class)); + &tmp_win->xclass)); tmp_win->auto_raise = short_lookup LookInList(Scr->AutoRaise, tmp_win->full_name, - &tmp_win->class); + &tmp_win->xclass); if (tmp_win->auto_raise) Scr->NumAutoRaises++; if (Scr->IconifyByUnmapping) { tmp_win->iconify_by_unmapping = iconm ? FALSE : !short_lookup LookInList(Scr->DontIconify, tmp_win->full_name, - &tmp_win->class); + &tmp_win->xclass); } else { tmp_win->iconify_by_unmapping = Scr->IconifyByUnmapping; } tmp_win->iconify_by_unmapping |= short_lookup LookInList(Scr->IconifyByUn, tmp_win->full_name, - &tmp_win->class); + &tmp_win->xclass); - if (LookInList(Scr->WindowRingL, tmp_win->full_name, &tmp_win->class)) { + if (LookInList(Scr->WindowRingL, tmp_win->full_name, &tmp_win->xclass)) { if (Scr->Ring) { tmp_win->ring.next = Scr->Ring->ring.next; if (Scr->Ring->ring.next->ring.prev) @@ -323,10 +323,10 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ if (HasShape) { if (!LookInList(Scr->DontSqueezeTitleL, tmp_win->full_name, - &tmp_win->class)) { + &tmp_win->xclass)) { tmp_win->squeeze_info = (SqueezeInfo *) LookInList(Scr->SqueezeTitleL, tmp_win->full_name, - &tmp_win->class); + &tmp_win->xclass); if (!tmp_win->squeeze_info) { static SqueezeInfo default_squeeze = { J_LEFT, 0, 0 }; if (Scr->SqueezeTitle) @@ -348,16 +348,16 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; if (Scr->NoTitlebar) tmp_win->title_height = 0; - if (LookInList(Scr->MakeTitle, tmp_win->full_name, &tmp_win->class)) + if (LookInList(Scr->MakeTitle, tmp_win->full_name, &tmp_win->xclass)) tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; - if (LookInList(Scr->NoTitle, tmp_win->full_name, &tmp_win->class)) + if (LookInList(Scr->NoTitle, tmp_win->full_name, &tmp_win->xclass)) tmp_win->title_height = 0; /* if it is a transient window, don't put a title on it */ if (tmp_win->transient && !Scr->DecorateTransients) tmp_win->title_height = 0; - if (LookInList(Scr->StartIconified, tmp_win->full_name, &tmp_win->class)) { + if (LookInList(Scr->StartIconified, tmp_win->full_name, &tmp_win->xclass)) { if (!tmp_win->wmhints) { tmp_win->wmhints = malloc(sizeof(XWMHints)); tmp_win->wmhints->flags = 0; @@ -793,22 +793,22 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->iconc.fore = Scr->IconC.fore; tmp_win->iconc.back = Scr->IconC.back; - GetColorFromList(Scr->BorderColorL, tmp_win->full_name, &tmp_win->class, - &tmp_win->border); - GetColorFromList(Scr->IconBorderColorL, tmp_win->full_name, &tmp_win->class, - &tmp_win->icon_border); + GetColorFromList(Scr->BorderColorL, tmp_win->full_name, + &tmp_win->xclass, &tmp_win->border); + GetColorFromList(Scr->IconBorderColorL, tmp_win->full_name, + &tmp_win->xclass, &tmp_win->icon_border); GetColorFromList(Scr->BorderTileForegroundL, tmp_win->full_name, - &tmp_win->class, &tmp_win->border_tile.fore); + &tmp_win->xclass, &tmp_win->border_tile.fore); GetColorFromList(Scr->BorderTileBackgroundL, tmp_win->full_name, - &tmp_win->class, &tmp_win->border_tile.back); - GetColorFromList(Scr->TitleForegroundL, tmp_win->full_name, &tmp_win->class, - &tmp_win->title.fore); - GetColorFromList(Scr->TitleBackgroundL, tmp_win->full_name, &tmp_win->class, - &tmp_win->title.back); - GetColorFromList(Scr->IconForegroundL, tmp_win->full_name, &tmp_win->class, - &tmp_win->iconc.fore); - GetColorFromList(Scr->IconBackgroundL, tmp_win->full_name, &tmp_win->class, - &tmp_win->iconc.back); + &tmp_win->xclass, &tmp_win->border_tile.back); + GetColorFromList(Scr->TitleForegroundL, tmp_win->full_name, + &tmp_win->xclass, &tmp_win->title.fore); + GetColorFromList(Scr->TitleBackgroundL, tmp_win->full_name, + &tmp_win->xclass, &tmp_win->title.back); + GetColorFromList(Scr->IconForegroundL, tmp_win->full_name, + &tmp_win->xclass, &tmp_win->iconc.fore); + GetColorFromList(Scr->IconBackgroundL, tmp_win->full_name, + &tmp_win->xclass, &tmp_win->iconc.back); /* create windows */ -- cgit v1.2.3 From 365a94b62df6144ad016e587f3756d974b6e2018 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 30 Dec 2023 20:49:48 +0100 Subject: Add explicit cast after memory allocation Still valid c, but now also valid c++. Signed-off-by: Tim Wiederhake --- src/add_window.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 009d8f8..3caf15b 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -171,7 +171,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) #endif /* allocate space for the twm window */ - tmp_win = calloc(1, sizeof(TwmWindow)); + tmp_win = (TwmWindow *) calloc(1, sizeof(TwmWindow)); if (tmp_win == NULL) { twmWarning("Unable to allocate memory to manage window ID %lx.", w); return NULL; @@ -359,7 +359,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (LookInList(Scr->StartIconified, tmp_win->full_name, &tmp_win->xclass)) { if (!tmp_win->wmhints) { - tmp_win->wmhints = malloc(sizeof(XWMHints)); + tmp_win->wmhints = (XWMHints *) malloc(sizeof(XWMHints)); tmp_win->wmhints->flags = 0; } tmp_win->wmhints->initial_state = IconicState; @@ -1304,7 +1304,8 @@ CreateWindowTitlebarButtons(TwmWindow *tmp_win) tmp_win->titlebuttons = NULL; nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; if (nb > 0) { - tmp_win->titlebuttons = malloc((size_t) nb * sizeof(TBWindow)); + tmp_win->titlebuttons = (TBWindow *) + malloc((size_t) nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { twmWarning("unable to allocate %d titlebuttons", nb); } @@ -1395,7 +1396,7 @@ CreateTwmColormap(Colormap c) { TwmColormap *cmap; - cmap = calloc(1, sizeof(TwmColormap)); + cmap = (TwmColormap *) calloc(1, sizeof(TwmColormap)); if (!cmap || XSaveContext(dpy, c, ColormapContext, (XPointer) cmap)) { if (cmap) free(cmap); @@ -1416,7 +1417,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) TwmColormap *cmap; XWindowAttributes attributes; - cwin = malloc(sizeof(ColormapWindow)); + cwin = (ColormapWindow *) malloc(sizeof(ColormapWindow)); if (cwin) { if (!XGetWindowAttributes(dpy, w, &attributes) || XSaveContext(dpy, w, ColormapContext, (XPointer) cwin)) { @@ -1497,7 +1498,7 @@ FetchWmColormapWindows(TwmWindow *tmp) break; } if (i == number_cmap_windows) { /* not in list */ - Window *new_cmap_windows = + Window *new_cmap_windows = (Window *) malloc(sizeof(Window) * (size_t) (number_cmap_windows + 1)); if (!new_cmap_windows) { @@ -1516,7 +1517,8 @@ FetchWmColormapWindows(TwmWindow *tmp) number_cmap_windows++; } - cwins = malloc(sizeof(ColormapWindow *) * (size_t) number_cmap_windows); + cwins = (ColormapWindow **) + malloc(sizeof(ColormapWindow *) * (size_t) number_cmap_windows); if (cwins) { for (i = 0; i < number_cmap_windows; i++) { @@ -1565,7 +1567,7 @@ FetchWmColormapWindows(TwmWindow *tmp) number_cmap_windows = 1; - cwins = malloc(sizeof(ColormapWindow *)); + cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)); if (XFindContext(dpy, tmp->w, ColormapContext, (XPointer *) &cwins[0]) == XCNOENT) { cwins[0] = @@ -1585,7 +1587,7 @@ FetchWmColormapWindows(TwmWindow *tmp) tmp->cmaps.cwins = cwins; tmp->cmaps.number_cwins = number_cmap_windows; if (number_cmap_windows > 1) - tmp->cmaps.scoreboard = + tmp->cmaps.scoreboard = (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); if (previously_installed) -- cgit v1.2.3