1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtwm: Resolve coverity warnings related to uninitialised variables and missing return statements

This commit is contained in:
Peter Howkins 2018-05-01 20:45:55 +01:00
parent ad373101d6
commit fa29d3776e
13 changed files with 30 additions and 16 deletions

View file

@ -973,7 +973,7 @@ SwitchRenameCB (Widget w,
SwitchData * switch_data; SwitchData * switch_data;
Boolean valid; Boolean valid;
int current_switch; int current_switch = 0;
int i; int i;
int ac; int ac;

View file

@ -1219,7 +1219,7 @@ ProcessRecord (DtDtsDbField * fields,
int i, j; int i, j;
int entry; int entry;
int keyword_count; int keyword_count = 0;
char ** field_keywords; char ** field_keywords;
@ -2318,6 +2318,7 @@ AddControlActionList (ControlData * control_data)
{ {
/* DtDTS_DA_ACTION_LIST */ /* DtDTS_DA_ACTION_LIST */
case 0: case 0:
free(act_list); /* Remove any previous loop run through */
act_list = (char *) strdup(attr_list[i]->value); act_list = (char *) strdup(attr_list[i]->value);
break; break;

View file

@ -137,7 +137,7 @@ DeleteWorkspaceCB (Widget w,
{ {
long delete_workspace = (long) client_data; long delete_workspace = (long) client_data;
SwitchData * switch_data; SwitchData * switch_data = NULL;
int i; int i;
@ -152,9 +152,12 @@ DeleteWorkspaceCB (Widget w,
break; break;
} }
} }
_DtWsmDeleteWorkspace (panel.shell, if(switch_data)
switch_data->atom_names[delete_workspace]); {
_DtWsmDeleteWorkspace (panel.shell,
switch_data->atom_names[delete_workspace]);
}
} }

View file

@ -2004,7 +2004,7 @@ SwitchCreate (BoxData * box_data)
int switch_count = 1; int switch_count = 1;
Atom * atom_names; Atom * atom_names;
Atom current_workspace_atom; Atom current_workspace_atom;
int current_workspace; int current_workspace = 0;
Widget switch_button; Widget switch_button;
@ -3186,7 +3186,7 @@ AddSubpanel (ControlData * control_data)
{ {
ElementValue * element_values; ElementValue * element_values;
SubpanelData * subpanel_data; SubpanelData * subpanel_data = NULL;
BoxData * box_data = (BoxData *)control_data->parent_data; BoxData * box_data = (BoxData *)control_data->parent_data;
DtWmHints vHints; DtWmHints vHints;
@ -3259,7 +3259,9 @@ AddSubpanel (ControlData * control_data)
box_data->subpanel_count++; box_data->subpanel_count++;
SubpanelCreate (control_data, subpanel_data); if(subpanel_data) {
SubpanelCreate (control_data, subpanel_data);
}
XtSetArg (al[0], XmNimageName, post_arrow_image); XtSetArg (al[0], XmNimageName, post_arrow_image);

View file

@ -441,9 +441,12 @@ ProcessBackdropResources(
pch = NULL; pch = NULL;
} }
free (pchImageName); /* temporary string */ free (pchImageName); /* temporary string */
pchImageName = NULL;
free (pchL); /* temporary string */ free (pchL); /* temporary string */
} }
} }
free (pchImageName);
} }

View file

@ -566,9 +566,9 @@ void GenerateFrameDisplayLists (ClientData *pcd)
int insideBevel, inset, diffBevel; int insideBevel, inset, diffBevel;
unsigned int nTitleBevel, sTitleBevel, eTitleBevel, wTitleBevel; unsigned int nTitleBevel, sTitleBevel, eTitleBevel, wTitleBevel;
unsigned int meTitleBevel, inWidth; unsigned int meTitleBevel, inWidth;
int x, y, xAdj, yAdj; int x, y, xAdj = 0, yAdj = 0;
unsigned int width, height; unsigned int width, height;
RList *prlTop, *prlBot; RList *prlTop = NULL, *prlBot = NULL;
int jX, jY; int jX, jY;
unsigned int jW, jH; unsigned int jW, jH;

View file

@ -2569,7 +2569,7 @@ void HandleCColormapNotify (ClientData *pCD, XColormapEvent *colorEvent)
void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent) void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent)
{ {
unsigned int newState; unsigned int newState = WITHDRAWN_STATE;
/* /*
* Process the client message event based on the message_type. * Process the client message event based on the message_type.

View file

@ -610,6 +610,9 @@ PushRecallGetData (char * client_name)
for (i = 0; i < panel.push_recall_count; i++) for (i = 0; i < panel.push_recall_count; i++)
if (strcmp (client_name, push_recall_list[i].pchResName) == 0) if (strcmp (client_name, push_recall_list[i].pchResName) == 0)
return (i); return (i);
/* Should never get here */
return 0;
} }

View file

@ -2285,7 +2285,7 @@ F_Push_Recall (String args, ClientData *pCD, XEvent *event)
if (!bWaiting) if (!bWaiting)
{ {
long clientTimeout; long clientTimeout = 0;
Arg al[5]; Arg al[5];
int ac; int ac;
WmPanelistObject pPanelist; WmPanelistObject pPanelist;

View file

@ -2044,6 +2044,8 @@ RestoreHelpDialogs(
XrmDestroyDatabase(db); XrmDestroyDatabase(db);
} }
#endif /* NO_DT */ #endif /* NO_DT */
return True;
} /* END OF FUNCTION RestoreHelpDialogs */ } /* END OF FUNCTION RestoreHelpDialogs */
/*************************************<->************************************* /*************************************<->*************************************

View file

@ -2887,7 +2887,7 @@ void PackIconBox (IconBoxData *pIBD, Boolean packVert, Boolean packHorz, int pas
int ix1, ix2; int ix1, ix2;
int count; int count;
int newX, newY; int newX, newY;
ClientData *pCD_tmp, *pMyCD; ClientData *pCD_tmp = NULL, *pMyCD;
int hasActiveText = 1; int hasActiveText = 1;
Arg args[4]; Arg args[4];
Dimension majorDimension, minorDimension; Dimension majorDimension, minorDimension;

View file

@ -688,7 +688,7 @@ Boolean HandleResizeKeyPress (ClientData *pcd, XEvent *pev)
{ {
KeySym keysym; KeySym keysym;
Boolean control; Boolean control;
int warpX, warpY, currentX, currentY, newX, newY; int warpX, warpY, currentX = 0, currentY = 0, newX, newY;
int junk, keyMult; int junk, keyMult;
Window junk_win; Window junk_win;
XEvent KeyEvent; XEvent KeyEvent;

View file

@ -485,7 +485,7 @@ getClientWorkspaces(ClientData *pCD)
/* Easy but slow way to do this would be to use XGetAtomName(). */ /* Easy but slow way to do this would be to use XGetAtomName(). */
/* To avoid XServer round trips (and to weed out invalid WS names) */ /* To avoid XServer round trips (and to weed out invalid WS names) */
/* we look through workspaces attached to this screen for ID matches. */ /* we look through workspaces attached to this screen for ID matches. */
char *cwsP, *tmpP, *wsNameP; char *cwsP = NULL, *tmpP, *wsNameP;
int pLen = 0; int pLen = 0;
int i; int i;