Fix various issues reported by clang. Minor cleanups.
SVN revision: 81671
This commit is contained in:
parent
da6a87c10e
commit
ba7d9cc4a9
14
src/aclass.c
14
src/aclass.c
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2011 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -134,6 +134,9 @@ ActionAddTo(Action * aa, const char *params)
|
|||
{
|
||||
ActionType *pptr, *ptr, *at;
|
||||
|
||||
if (!aa)
|
||||
return;
|
||||
|
||||
at = EMALLOC(ActionType, 1);
|
||||
if (!at)
|
||||
return;
|
||||
|
@ -161,6 +164,8 @@ ActionAddTo(Action * aa, const char *params)
|
|||
void
|
||||
ActionclassAddAction(ActionClass * ac, Action * aa)
|
||||
{
|
||||
if (!ac || !aa)
|
||||
return;
|
||||
ac->num++;
|
||||
ac->list = EREALLOC(Action *, ac->list, ac->num);
|
||||
ac->list[ac->num - 1] = aa;
|
||||
|
@ -658,6 +663,7 @@ ActionEncode(Action * aa, char *buf, int len)
|
|||
(aa->action->params) ? aa->action->params : "");
|
||||
break;
|
||||
|
||||
#if 0 /* Not implemented */
|
||||
case EVENT_FOCUS_IN:
|
||||
event = "FocusIn";
|
||||
goto encode_fc;
|
||||
|
@ -666,6 +672,7 @@ ActionEncode(Action * aa, char *buf, int len)
|
|||
goto encode_fc;
|
||||
encode_fc:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -736,9 +743,6 @@ AclassConfigLineParse(char *s, ActionClass ** pac, Action ** paa)
|
|||
return;
|
||||
|
||||
aa = ActionDecode(s);
|
||||
if (!aa)
|
||||
return;
|
||||
|
||||
ActionclassAddAction(ac, aa);
|
||||
GrabActionKey(aa);
|
||||
}
|
||||
|
@ -1324,7 +1328,7 @@ GrabActionKey(Action * aa)
|
|||
{
|
||||
int mod;
|
||||
|
||||
if (!aa->key)
|
||||
if (!aa || !aa->key)
|
||||
return;
|
||||
|
||||
mod = (aa->anymodifier) ? AnyModifier : aa->modifiers;
|
||||
|
|
|
@ -856,6 +856,7 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py)
|
|||
RectBox *fixed, *ret, newrect;
|
||||
|
||||
fixed = NULL;
|
||||
*px = *py = 0;
|
||||
|
||||
EwinListGetAll(&num);
|
||||
if (num <= 1)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2010 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -693,8 +693,11 @@ ButtonsConfigLoad(FILE * fs)
|
|||
ontop, flags, minw, maxw, minh, maxh,
|
||||
xo, yo, xa, xr, ya, yr, xsr, xsa, ysr, ysa,
|
||||
simg, desk, sticky);
|
||||
bt->default_show = show;
|
||||
bt->internal = internal;
|
||||
if (bt)
|
||||
{
|
||||
bt->default_show = show;
|
||||
bt->internal = internal;
|
||||
}
|
||||
}
|
||||
else if (pbt)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2011 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -199,6 +199,9 @@ ClientIpcReply(void *data, const char *str)
|
|||
{
|
||||
Client *c = (Client *) data;
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
if (!str)
|
||||
{
|
||||
/* Don't send empty replies (ack's) if we ever have replied to this
|
||||
|
|
|
@ -1756,9 +1756,8 @@ _ContainersConfigLoad(FILE * fs)
|
|||
char s[FILEPATH_LEN_MAX];
|
||||
char s2[FILEPATH_LEN_MAX];
|
||||
int i1, i2;
|
||||
Container *ct, ct_dummy;
|
||||
Container *ct = NULL;
|
||||
|
||||
ct = &ct_dummy;
|
||||
while (fgets(s, sizeof(s), fs))
|
||||
{
|
||||
i1 = ConfigParseline1(s, s2, NULL, NULL);
|
||||
|
@ -1769,18 +1768,25 @@ _ContainersConfigLoad(FILE * fs)
|
|||
err = -1;
|
||||
if (i2 != CONFIG_OPEN)
|
||||
goto done;
|
||||
break;
|
||||
continue;
|
||||
case CONFIG_CLOSE:
|
||||
ct = &ct_dummy;
|
||||
ct = NULL;
|
||||
err = 0;
|
||||
break;
|
||||
|
||||
continue;
|
||||
case CONFIG_CLASSNAME: /* __NAME %s */
|
||||
ct = ContainerFind(s2);
|
||||
if (ct)
|
||||
EwinHide(ct->ewin);
|
||||
ct = ContainerCreate(s2);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* ct needed */
|
||||
if (!ct)
|
||||
break;
|
||||
|
||||
switch (i1)
|
||||
{
|
||||
case TEXT_ORIENTATION: /* __ORIENTATION [ __HORIZONTAL | __VERTICAL ] */
|
||||
ct->orientation = i2;
|
||||
break;
|
||||
|
|
|
@ -1034,16 +1034,12 @@ DialogRealizeItem(Dialog * d, DItem * di)
|
|||
int i, r, c, x, y;
|
||||
int *col_size, *row_size;
|
||||
|
||||
col_size = EMALLOC(int, cols);
|
||||
row_size = EMALLOC(int, rows);
|
||||
col_size = ECALLOC(int, cols);
|
||||
row_size = ECALLOC(int, rows);
|
||||
|
||||
if (!col_size || !row_size)
|
||||
goto bail_out;
|
||||
|
||||
row_size[0] = 0;
|
||||
for (i = 0; i < cols; i++)
|
||||
col_size[i] = 0;
|
||||
|
||||
r = c = 0;
|
||||
for (i = 0; i < di->item.table.num_items; i++)
|
||||
{
|
||||
|
|
35
src/groups.c
35
src/groups.c
|
@ -222,9 +222,12 @@ EwinGetGroups(const EWin * ewin, int *num)
|
|||
static Group **
|
||||
ListWinGroups(const EWin * ewin, char group_select, int *num)
|
||||
{
|
||||
Group **groups = NULL;
|
||||
Group **groups2 = NULL;
|
||||
int i, j, killed = 0;
|
||||
Group **groups;
|
||||
Group **groups2;
|
||||
int i, j, n, killed;
|
||||
|
||||
groups = NULL;
|
||||
*num = 0;
|
||||
|
||||
switch (group_select)
|
||||
{
|
||||
|
@ -239,8 +242,8 @@ ListWinGroups(const EWin * ewin, char group_select, int *num)
|
|||
groups2 = GroupsGetList(num);
|
||||
if (!groups2)
|
||||
break;
|
||||
|
||||
for (i = 0; i < (*num); i++)
|
||||
n = *num;
|
||||
for (i = killed = 0; i < n; i++)
|
||||
{
|
||||
for (j = 0; j < ewin->num_groups; j++)
|
||||
{
|
||||
|
@ -251,14 +254,16 @@ ListWinGroups(const EWin * ewin, char group_select, int *num)
|
|||
}
|
||||
}
|
||||
}
|
||||
groups = EMALLOC(Group *, *num - killed);
|
||||
if (groups)
|
||||
if (n - killed > 0)
|
||||
{
|
||||
j = 0;
|
||||
for (i = 0; i < (*num); i++)
|
||||
if (groups2[i])
|
||||
groups[j++] = groups2[i];
|
||||
(*num) -= killed;
|
||||
groups = EMALLOC(Group *, n - killed);
|
||||
if (groups)
|
||||
{
|
||||
for (i = j = 0; i < n; i++)
|
||||
if (groups2[i])
|
||||
groups[j++] = groups2[i];
|
||||
*num = n - killed;
|
||||
}
|
||||
}
|
||||
Efree(groups2);
|
||||
break;
|
||||
|
@ -673,6 +678,8 @@ _DlgFillGroupChoose(Dialog * d, DItem * table, void *data)
|
|||
|
||||
num_groups = tmp_group_num;
|
||||
group_member_strings = GetWinGroupMemberNames(tmp_groups, num_groups);
|
||||
if (!group_member_strings)
|
||||
return; /* Silence clang - It should not be possible to go here */
|
||||
|
||||
radio = di = DialogAddItem(table, DITEM_RADIOBUTTON);
|
||||
DialogItemSetColSpan(di, 2);
|
||||
|
@ -710,7 +717,7 @@ static void
|
|||
ChooseGroupDialog(EWin * ewin, const char *message, char group_select,
|
||||
int action)
|
||||
{
|
||||
int num_groups;
|
||||
int num_groups = 0;
|
||||
|
||||
if (!ewin)
|
||||
return;
|
||||
|
@ -831,6 +838,8 @@ _DlgFillGroups(Dialog * d, DItem * table, void *data)
|
|||
|
||||
group_member_strings =
|
||||
GetWinGroupMemberNames(ewin->groups, ewin->num_groups);
|
||||
if (!group_member_strings)
|
||||
return; /* Silence clang - It should not be possible to go here */
|
||||
|
||||
radio = di = DialogAddItem(table, DITEM_RADIOBUTTON);
|
||||
DialogItemSetColSpan(di, 2);
|
||||
|
|
54
src/iclass.c
54
src/iclass.c
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2010 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -176,6 +176,8 @@ ImagestateColorsSetGray(ImageState * is,
|
|||
unsigned int hihi, unsigned int hi,
|
||||
unsigned int bg, unsigned int lo, unsigned int lolo)
|
||||
{
|
||||
if (!is)
|
||||
return;
|
||||
COLOR32_FROM_RGB(is->hihi, hihi, hihi, hihi);
|
||||
COLOR32_FROM_RGB(is->hi, hi, hi, hi);
|
||||
COLOR32_FROM_RGB(is->bg, bg, bg, bg);
|
||||
|
@ -200,6 +202,24 @@ ImagestateCreate(const char *file)
|
|||
return is;
|
||||
}
|
||||
|
||||
static ImageState *
|
||||
ImagestateCreateX(unsigned int hihi, unsigned int hi,
|
||||
unsigned int lo, unsigned int lolo,
|
||||
unsigned int bg_r, unsigned int bg_g, unsigned int bg_b)
|
||||
{
|
||||
ImageState *is;
|
||||
|
||||
is = ImagestateCreate(NULL);
|
||||
if (!is)
|
||||
return NULL;
|
||||
|
||||
ImagestateColorsSetGray(is, hihi, hi, 0, lo, lolo);
|
||||
COLOR32_FROM_RGB(is->bg, bg_r, bg_g, bg_b);
|
||||
is->bevelstyle = BEVEL_AMIGA;
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
static void
|
||||
ImagestateDestroy(ImageState * is)
|
||||
{
|
||||
|
@ -1330,32 +1350,12 @@ ImageclassGetFallback(void)
|
|||
if (!ic)
|
||||
return ic;
|
||||
|
||||
ic->norm.normal = ImagestateCreate(NULL);
|
||||
ImagestateColorsSetGray(ic->norm.normal, 255, 255, 160, 0, 0);
|
||||
ic->norm.normal->bevelstyle = BEVEL_AMIGA;
|
||||
|
||||
ic->norm.hilited = ImagestateCreate(NULL);
|
||||
ImagestateColorsSetGray(ic->norm.hilited, 255, 255, 192, 0, 0);
|
||||
ic->norm.hilited->bevelstyle = BEVEL_AMIGA;
|
||||
|
||||
ic->norm.clicked = ImagestateCreate(NULL);
|
||||
ImagestateColorsSetGray(ic->norm.clicked, 0, 0, 192, 255, 255);
|
||||
ic->norm.clicked->bevelstyle = BEVEL_AMIGA;
|
||||
|
||||
ic->active.normal = ImagestateCreate(NULL);
|
||||
ImagestateColorsSetGray(ic->active.normal, 255, 255, 0, 0, 0);
|
||||
COLOR32_FROM_RGB(ic->active.normal->bg, 180, 140, 160);
|
||||
ic->active.normal->bevelstyle = BEVEL_AMIGA;
|
||||
|
||||
ic->active.hilited = ImagestateCreate(NULL);
|
||||
ImagestateColorsSetGray(ic->active.hilited, 255, 255, 0, 0, 0);
|
||||
COLOR32_FROM_RGB(ic->active.hilited->bg, 230, 190, 210);
|
||||
ic->active.hilited->bevelstyle = BEVEL_AMIGA;
|
||||
|
||||
ic->active.clicked = ImagestateCreate(NULL);
|
||||
ImagestateColorsSetGray(ic->active.clicked, 0, 0, 0, 255, 255);
|
||||
COLOR32_FROM_RGB(ic->active.clicked->bg, 230, 190, 210);
|
||||
ic->active.clicked->bevelstyle = BEVEL_AMIGA;
|
||||
ic->norm.normal = ImagestateCreateX(255, 255, 0, 0, 160, 160, 160);
|
||||
ic->norm.hilited = ImagestateCreateX(255, 255, 0, 0, 192, 192, 192);
|
||||
ic->norm.clicked = ImagestateCreateX(0, 0, 255, 255, 192, 192, 192);
|
||||
ic->active.normal = ImagestateCreateX(255, 255, 0, 0, 180, 140, 160);
|
||||
ic->active.hilited = ImagestateCreateX(255, 255, 0, 0, 230, 190, 210);
|
||||
ic->active.clicked = ImagestateCreateX(0, 0, 255, 255, 230, 190, 210);
|
||||
|
||||
ic->padding.left = 4;
|
||||
ic->padding.right = 4;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2010 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -78,11 +78,11 @@ ThemePathName(const char *path)
|
|||
return Estrdup(p + 1); /* Regular path */
|
||||
|
||||
/* <path>/<themename>/e16 */
|
||||
s = strdup(path);
|
||||
s = Estrdup(path);
|
||||
s[p - path] = '\0';
|
||||
p = strrchr(s, '/');
|
||||
if (!p)
|
||||
return Estrdup(path); /* Should not happen */
|
||||
return s; /* Should not happen */
|
||||
p++;
|
||||
memmove(s, p, strlen(p) + 1);
|
||||
return s;
|
||||
|
|
|
@ -49,6 +49,7 @@ _user_init(void)
|
|||
ss = getenv("TMPDIR");
|
||||
if (ss)
|
||||
usr_home = ss;
|
||||
return;
|
||||
}
|
||||
|
||||
ss = Estrdup(pwd->pw_name);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2011 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -169,7 +169,7 @@ WarpFocusWinShow(WarpFocusWin * fw)
|
|||
Esnprintf(ss, sizeof(ss), "[%d] ", EoGetDeskNum(ewin));
|
||||
}
|
||||
Esnprintf(s, sizeof(s), fmt, ss, EwinGetTitle(ewin));
|
||||
wi->txt = strdup(s);
|
||||
wi->txt = Estrdup(s);
|
||||
TextSize(fw->tc, 0, 0, 0, wi->txt, &ww, &hh, 17);
|
||||
if (ww > w)
|
||||
w = ww;
|
||||
|
@ -369,7 +369,7 @@ WarpFocus(int delta)
|
|||
warpFocusIndex = 0;
|
||||
}
|
||||
|
||||
if (!warplist)
|
||||
if (!warplist || warplist_num <= 0)
|
||||
return;
|
||||
|
||||
warpFocusIndex = (warpFocusIndex + warplist_num + delta) % warplist_num;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2005-2009 Kim Woelders
|
||||
* Copyright (C) 2005-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -281,7 +281,7 @@ WindowMatchConfigLoad(FILE * fs)
|
|||
return err;
|
||||
}
|
||||
|
||||
static WindowMatch *
|
||||
static void
|
||||
WindowMatchDecode(const char *line)
|
||||
{
|
||||
char match[32], value[1024], op[32];
|
||||
|
@ -292,10 +292,10 @@ WindowMatchDecode(const char *line)
|
|||
match[0] = value[0] = op[0] = '\0';
|
||||
num = sscanf(line, "%32s %1024s %32s %n", match, value, op, &w1);
|
||||
if (num < 3)
|
||||
return NULL;
|
||||
return;
|
||||
args = line + w1;
|
||||
if (*args == '\0')
|
||||
return NULL;
|
||||
return;
|
||||
|
||||
err = 0;
|
||||
|
||||
|
@ -309,7 +309,7 @@ WindowMatchDecode(const char *line)
|
|||
|
||||
wm = WindowMatchCreate(NULL);
|
||||
if (!wm)
|
||||
return NULL;
|
||||
return;
|
||||
|
||||
wm->match = num;
|
||||
|
||||
|
@ -408,7 +408,6 @@ WindowMatchDecode(const char *line)
|
|||
{
|
||||
ecore_list_append(wm_list, ecore_list_node_remove(wm_list, wm));
|
||||
}
|
||||
return wm;
|
||||
}
|
||||
|
||||
static char *
|
||||
|
|
Loading…
Reference in New Issue