dtappbuilder: Coverity fixes mostly related to uninitialised variables

This commit is contained in:
Peter Howkins
2018-05-01 19:02:14 +01:00
parent 48b97a4c41
commit ad373101d6
18 changed files with 75 additions and 62 deletions

View File

@@ -722,7 +722,7 @@ ab_update_stat_region(
static Widget obj_size = NULL;
static Widget curs_pos = NULL;
static Widget cur_module = NULL;
Widget widget;
Widget widget = NULL;
String nullstr = " ";
switch(type)

View File

@@ -2139,7 +2139,7 @@ abobj_set_pattern_type(
)
{
ABObj subObj;
unsigned char value;
unsigned char value = 0;
AB_FILE_TYPE_MASK old_fmtype = obj_get_file_type_mask(obj);
if (old_fmtype != fmtype)

View File

@@ -1567,11 +1567,11 @@ create_obj_menu_dir(
{
DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
PropOptionsSetting option_setting;
PropOptionsSetting option_setting = NULL;
Widget label = NULL,
optionbox,
menu,
changebar,
optionbox = NULL,
menu = NULL,
changebar = NULL,
*item = NULL;
int item_values = 0,
*item_val = NULL,
@@ -3090,15 +3090,15 @@ change_opp_attach_type(
int offset = 0,
position = 0;
ABObj attach_obj = NULL;
AB_COMPASS_POINT opp_dir;
AB_COMPASS_POINT opp_dir = AB_CP_UNDEF;
ATTCH_ED_ATTACH_TYPE opp_attach_type;
PropOptionsSetting opp_attach_type_setting,
opp_objlist_setting;
PropFieldSetting opp_offset_setting,
opp_position_setting;
Widget opp_objlist_w,
opp_offset_w,
opp_position_w;
PropOptionsSetting opp_attach_type_setting = NULL,
opp_objlist_setting = NULL;
PropFieldSetting opp_offset_setting = NULL,
opp_position_setting = NULL;
Widget opp_objlist_w = NULL,
opp_offset_w = NULL,
opp_position_w = NULL;
BOOL set_opp_attach = FALSE;
/*
@@ -3279,10 +3279,10 @@ attach_obj_changed(
DtbAttchEdAttchEdDialogInfo attch_ed_cgen
= &dtb_attch_ed_attch_ed_dialog;
AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
PropFieldSetting offset_setting,
PropFieldSetting offset_setting = NULL,
position_setting;
PropOptionsSetting objlist_setting,
attach_type_setting;
PropOptionsSetting objlist_setting = NULL,
attach_type_setting = NULL;
AB_COMPASS_POINT dir = (AB_COMPASS_POINT)client_data;
ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
ABObj attach_obj = NULL;
@@ -3323,6 +3323,9 @@ attach_obj_changed(
position_setting = &(ats->bottom_attach_position);
objlist_setting = &(ats->bottom_attach_obj);
break;
default:
return;
}

View File

@@ -1751,7 +1751,7 @@ destroy_browser_ui_handles(
)
{
BrowserUiObjects *ui;
DtbBrwsMainwindowInfo instance;
DtbBrwsMainwindowInfo instance = NULL;
if (!b)
return;
@@ -1811,8 +1811,7 @@ destroy_browser_ui_handles(
/*
* Free the ip structure
*/
if (instance)
free(instance);
free(instance);
}

View File

@@ -1121,7 +1121,7 @@ select_connection(
{
XmListCallbackStruct *list_cl = (XmListCallbackStruct *)call_data;
ABObj *obj_list = (ABObj *)NULL;
ABObj cur_action;
ABObj cur_action = NULL;
AB_ACTION_INFO *cur_info;
if (list_cl->reason != XmCR_BROWSE_SELECT)
@@ -1353,19 +1353,20 @@ get_cur_when(
{
Widget label_wid = XmOptionButtonGadget(when_menu);
XmString xm_when_label = (XmString)NULL;
char *when_label;
char *when_label = NULL;
register int i;
XtVaGetValues(label_wid, XmNlabelString, &xm_when_label, NULL);
if (xm_when_label != NULL)
if (xm_when_label != NULL) {
when_label = objxm_xmstr_to_str(xm_when_label);
for (i = 0; i < ConnP_num_conn_whens; i++)
if (!strcmp(when_label, ConnP_conn_whens[i].label))
{
XtFree(when_label);
return((int)ConnP_conn_whens[i].when_type);
for (i = 0; i < ConnP_num_conn_whens; i++) {
if (!strcmp(when_label, ConnP_conn_whens[i].label)) {
XtFree(when_label);
return((int)ConnP_conn_whens[i].when_type);
}
}
}
/*
* Should never happen
@@ -1381,19 +1382,20 @@ get_cur_act(
{
Widget label_wid = XmOptionButtonGadget(action_menu);
XmString xm_act_label = (XmString)NULL;
char *act_label;
char *act_label = NULL;
register int i;
XtVaGetValues(label_wid, XmNlabelString, &xm_act_label, NULL);
if (xm_act_label != NULL)
if (xm_act_label != NULL) {
act_label = objxm_xmstr_to_str(xm_act_label);
for (i = 0; i < ConnP_num_conn_acts; i++)
if (!strcmp(act_label, ConnP_conn_acts[i].label))
{
XtFree(act_label);
return(ConnP_conn_acts[i].act_type);
for (i = 0; i < ConnP_num_conn_acts; i++) {
if (!strcmp(act_label, ConnP_conn_acts[i].label)) {
XtFree(act_label);
return(ConnP_conn_acts[i].act_type);
}
}
}
/*
* Should never happen
@@ -3870,17 +3872,20 @@ get_cur_func_type(void)
{
Widget label_wid = XmOptionButtonGadget(action_type_opmenu);
XmString xm_act_label = (XmString)NULL;
char *act_label;
char *act_label = NULL;
register int i;
AB_FUNC_TYPE func_type = AB_FUNC_UNDEF;
XtVaGetValues(label_wid, XmNlabelString, &xm_act_label, NULL);
if (xm_act_label != NULL)
act_label = objxm_xmstr_to_str(xm_act_label);
if (xm_act_label != NULL) {
act_label = objxm_xmstr_to_str(xm_act_label);
for (i = 0; i < ACTION_TYPE_NUM_VALUES; i++)
if (!strcmp(act_label, action_type_labels[i]))
break;
for (i = 0; i < ACTION_TYPE_NUM_VALUES; i++) {
if (!strcmp(act_label, action_type_labels[i])) {
break;
}
}
}
switch (i)
{

View File

@@ -1925,7 +1925,7 @@ msgEdP_show_msgCB(
ABObj project = obj_get_project(mes->current_obj);
STRING str = (STRING) NULL;
DTB_BUTTON default_btn = DTB_NONE;
unsigned char dialogType;
unsigned char dialogType = 0;
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/

View File

@@ -427,7 +427,7 @@ drawp_prop_load(
)
{
PropDrawpSettingsRec *pds = &(prop_drawp_settings_rec[type]);
AB_SCROLLBAR_POLICY sb_policy;
AB_SCROLLBAR_POLICY sb_policy = AB_SCROLLBAR_UNDEF;
BOOL load_all = (loadkey & LoadAll);
if (obj == NULL)

View File

@@ -525,7 +525,7 @@ prop_load_obj(
{
PalItemInfo *palitem;
PalItemInfo *viz_palitem;
Widget dialog;
Widget dialog = NULL;
PropStateInfo *pstate;
STRING modname = NULL;
@@ -3819,7 +3819,7 @@ close_propsCB(
)
{
AB_PROP_TYPE type = (AB_PROP_TYPE)client_data;
DTB_MODAL_ANSWER answer;
DTB_MODAL_ANSWER answer = DTB_ANSWER_NONE;
PalItemInfo *palitem = NULL;
PropStateInfo *pstate;
WidgetList shell_child;

View File

@@ -679,7 +679,7 @@ prop_item_change(
)
{
ABObj current_obj;
STRING newlabel, basename, graphic_path;
STRING newlabel = NULL, basename = NULL, graphic_path;
BOOL label_type_chg = False;
AB_LABEL_TYPE new_label_type;
XmString xmitem;
@@ -902,7 +902,7 @@ prop_item_insert(
*new_iobj_list;
int num_items;
int select_pos;
int pos;
int pos = 0;
int i, j;
XtVaGetValues(pis->item_list,

View File

@@ -530,7 +530,7 @@ ui_build_menu(
)
{
Widget menu,
cascade,
cascade = NULL,
widget;
Arg args[4];
int i;
@@ -1647,7 +1647,7 @@ ui_obj_set_label_string(
Widget parent = objxm_get_widget(p_obj);
AB_ITEM_TYPE itype = (AB_ITEM_TYPE)obj_get_subtype(obj);
int pos;
int num_items;
int num_items = 0;
XmString xmitem;
if (parent != NULL)