diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-05-15 13:38:10 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-05-15 13:38:10 -0600 |
commit | 7b4a6b7942db179bd4b152a3f3495f480d84db5d (patch) | |
tree | 90217bbac6199c2ee439c646e604931284500aaf | |
parent | b5eb45a153202d72aeb48de1149e7c74aef979fd (diff) | |
download | alpine-7b4a6b7942db179bd4b152a3f3495f480d84db5d.tar.xz |
* Clear out some gcc warnings, and code improvement. Work in progress.
-rw-r--r-- | alpine/addrbook.c | 12 | ||||
-rw-r--r-- | alpine/adrbkcmd.c | 16 | ||||
-rw-r--r-- | alpine/confscroll.c | 14 | ||||
-rw-r--r-- | alpine/context.c | 2 | ||||
-rw-r--r-- | alpine/folder.c | 10 | ||||
-rw-r--r-- | alpine/keymenu.c | 2 | ||||
-rw-r--r-- | alpine/ldapconf.c | 6 | ||||
-rw-r--r-- | alpine/mailpart.c | 2 | ||||
-rw-r--r-- | alpine/osdep/print.c | 2 | ||||
-rw-r--r-- | alpine/rpdump.c | 6 | ||||
-rw-r--r-- | alpine/rpload.c | 3 | ||||
-rw-r--r-- | alpine/setup.c | 4 | ||||
-rw-r--r-- | alpine/smime.c | 2 | ||||
-rw-r--r-- | alpine/takeaddr.c | 4 | ||||
-rw-r--r-- | alpine/titlebar.c | 2 |
15 files changed, 45 insertions, 42 deletions
diff --git a/alpine/addrbook.c b/alpine/addrbook.c index 2860e885..26f3ad1a 100644 --- a/alpine/addrbook.c +++ b/alpine/addrbook.c @@ -455,7 +455,7 @@ paint_line(int line, long int global_row, int highlight, Pos *start_pos) if(p && *p){ if(highlight){ - char save_char; + char save_char = '\0'; MoveCursor(line, 0); @@ -2044,7 +2044,7 @@ addr_book(AddrBookArg style, char *title, char **error_message) selecting_one_nick, selecting_mult_nicks, checkedn, /* how many are checked */ - def_key, /* default key */ + def_key = 0, /* default key */ warped; /* we warped through hyperspace to a new location in the display list */ long fl, @@ -3348,7 +3348,7 @@ view: /*----- Add new ---------*/ case MC_ADD: - {long old_l_p_p, old_top_ent, old_cur_row; + {long old_l_p_p = 0, old_top_ent = 0, old_cur_row = 0; if(adrbk_check_all_validity_now()){ if(resync_screen(pab, style, checkedn)){ @@ -5497,7 +5497,7 @@ ab_select_text(AdrBk *abook, int narrow) static char *ab_sel_text = "Select based on Nickname, All text, Fullname, Addrs, Comment, or Fcc ? "; HelpType help = NO_HELP; - int type, r; + int type, r = '\0'; char sstring[80+1], prompt[80]; adrbk_cntr_t num, ab_count; char *fmt = "String in \"%s\" to match : "; @@ -6183,8 +6183,8 @@ resync_screen(PerAddrBook *pab, AddrBookArg style, int checkedn) else if(style == AddrBookScreen){ char *savenick = NULL; AdrBk_Entry *abe; - adrbk_cntr_t old_entry_num, new_entry_num; - long old_global_row; + adrbk_cntr_t old_entry_num = 0, new_entry_num; + long old_global_row = 0; current_resynced++; diff --git a/alpine/adrbkcmd.c b/alpine/adrbkcmd.c index 94d9077b..649b31dc 100644 --- a/alpine/adrbkcmd.c +++ b/alpine/adrbkcmd.c @@ -321,7 +321,7 @@ view_abook_entry(struct pine *ps, long int cur_line) so_give(&in_store); if(sargs.proc.data.i != VIEW_ABOOK_NONE){ - long old_l_p_p, old_top_ent, old_cur_row; + long old_l_p_p = 0, old_top_ent = 0, old_cur_row = 0; if(sargs.proc.data.i == VIEW_ABOOK_WARPED){ /* @@ -1684,7 +1684,7 @@ ab_modify_abook_list(int edit, int global, int abook_num, char *def_serv, char * struct headerentry *he; PICO pbf; STORE_S *msgso; - int editor_result, i, how_many_in_list, new_abook_num, num_in_list; + int editor_result, i, how_many_in_list = 0, new_abook_num, num_in_list; int ret = 0; char *server, *folder, *nickname; char *new_item = NULL; @@ -2630,7 +2630,7 @@ convert_to_remote_config(struct pine *ps, int edit_exceptions) char rem_pinerc_prefix[MAILTMPLEN]; char *beg, *end; CONTEXT_S *context; - int abooks, sigs; + int abooks = 0, sigs = 0; if(edit_exceptions){ /* TRANSLATORS: The exceptions command (X) was typed but it doesn't make sense */ @@ -3030,7 +3030,7 @@ int ab_del_abook(long int cur_line, int command_line, char **err) { int abook_num, varnum, delete_data = 0, - num_in_list, how_many_in_list, i, cnt, warn_about_revert = 0; + num_in_list, how_many_in_list = 0, i, cnt, warn_about_revert = 0; char **list, **new_list, **t, **lval; char tmp[200]; PerAddrBook *pab; @@ -4162,7 +4162,7 @@ int ab_export(struct pine *ps, long int cur_line, int command_line, int agg) { int ret = 0, i, retflags = GER_NONE; - int r, orig_errno, failure = 0; + int r, orig_errno = 0, failure = 0; struct variable *vars = ps->vars; char filename[MAXPATH+1], full_filename[MAXPATH+1]; STORE_S *store; @@ -4504,7 +4504,7 @@ int ab_forward(struct pine *ps, long int cur_line, int agg) { AddrScrn_Disp *dl; - AdrBk_Entry *abe; + AdrBk_Entry *abe = NULL; ENVELOPE *outgoing = NULL; BODY *pb, *body = NULL; PART **pp; @@ -6160,7 +6160,7 @@ ab_agg_delete(struct pine *ps, int agg) prompt[sizeof(prompt)-1] = '\0'; ch = want_to(prompt, 'n', 'n', NO_HELP, WT_NORM); if(ch == 'y'){ - adrbk_cntr_t newelnum, flushelnum = NO_NEXT; + adrbk_cntr_t newelnum = NO_NEXT, flushelnum = NO_NEXT; DL_CACHE_S dlc_save, dlc_restart, *dlc; int we_cancel = 0; int top_level_display; @@ -6342,7 +6342,7 @@ ab_agg_delete(struct pine *ps, int agg) int single_entry_delete(AdrBk *abook, long int cur_line, int *warped) { - char ch, *cmd, *dname; + char ch, *cmd = NULL, *dname = NULL; char prompt[200]; int rc; register AddrScrn_Disp *dl; diff --git a/alpine/confscroll.c b/alpine/confscroll.c index 50f578ff..5e2817b5 100644 --- a/alpine/confscroll.c +++ b/alpine/confscroll.c @@ -1555,10 +1555,10 @@ int text_toolit(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags, int look_for_backslash) { char prompt[81], *sval, *tmp, *swap_val, **newval = NULL; - char *pval, **apval, **lval, ***alval; + char *pval = NULL, **apval = NULL, **lval = NULL, ***alval = NULL; char *olddefval = NULL; int rv = 0, skip_to_next = 0, after = 0, i = 4, j, k; - int lowrange, hirange, incr, oeflags, oebufsize; + int lowrange = 0, hirange = 0, incr = 0, oeflags, oebufsize; int numval, repeat_key = 0; int curindex, previndex, nextindex, deefault; HelpType help; @@ -2767,7 +2767,7 @@ radiobutton_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) int rv = 0; NAMEVAL_S *rule = NULL; #ifndef _WINDOWS - int old_uc, old_cs; + int old_uc = 0, old_cs = 0; CONF_S *ctmp; #endif @@ -3059,7 +3059,7 @@ yesno_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) void update_option_screen(struct pine *ps, OPT_SCREEN_S *screen, Pos *cursor_pos) { - int dline, w, save = '\0'; + int dline = 0, w, save = '\0'; CONF_S *top_line, *ctmp; char *value; unsigned got_width; @@ -3182,7 +3182,7 @@ update_option_screen(struct pine *ps, OPT_SCREEN_S *screen, Pos *cursor_pos) value = (ctmp->flags & CF_INHERIT) ? INHERIT : ctmp->value; if(value){ - char *p; + char *p = NULL; int i, j; memset(tmp_20k_buf, '\0', @@ -3845,8 +3845,8 @@ pretty_value(struct pine *ps, CONF_S *cl) char * text_pretty_value(struct pine *ps, CONF_S *cl) { - char tmp[6*MAX_SCREEN_COLS+20], *pvalnorm, **lvalnorm, *pvalexc, **lvalexc; - char *p, *pval, **lval, lastchar = '\0'; + char tmp[6*MAX_SCREEN_COLS+20], *pvalnorm, **lvalnorm, *pvalexc, **lvalexc = NULL; + char *p, *pval = NULL, **lval = NULL, lastchar = '\0'; int editing_except, fixed, uvalset, uvalposlen; unsigned got_width; int comments, except_set, avail_width; diff --git a/alpine/context.c b/alpine/context.c index cccb462a..acf2f4a5 100644 --- a/alpine/context.c +++ b/alpine/context.c @@ -580,7 +580,7 @@ context_config_shuffle(struct pine *ps, CONF_S **cl) int n = 0, cmd, i1, i2, count = 0, insert_num, starting_varmem; int news_problem = 0, deefault = 0; ESCKEY_S ekey[3]; - CONTEXT_S *cur_ctxt, *other_ctxt; + CONTEXT_S *cur_ctxt, *other_ctxt = NULL; char *tmp, **lval, **lval1, **lval2; struct variable *cur_var, *other_var; diff --git a/alpine/folder.c b/alpine/folder.c index c39b80a3..6997759e 100644 --- a/alpine/folder.c +++ b/alpine/folder.c @@ -2169,7 +2169,7 @@ color_test_for_folder(char *color_fore, char *color_back) int use_color_for_folder(FOLDER_S *fp) { - int test1, test2; + int test1 = 0, test2 = 0; if(fp->isdir) test1 = color_test_for_folder(ps_global->VAR_DIRECTORY_FORE_COLOR, ps_global->VAR_DIRECTORY_BACK_COLOR); @@ -4801,8 +4801,8 @@ skip_over_folder_input: *p = '\0'; if(inbox || context->use & CNTXT_INCMNG){ - char **apval; - char ***alval; + char **apval = NULL; + char ***alval = NULL; if(inbox){ apval = APVAL(&ps_global->vars[varnum], which); @@ -5076,7 +5076,7 @@ group_subscription(char *folder, size_t len, CONTEXT_S *cntxt) * find which will cause this to just return. */ if((i = folder_total(FOLDERS(&subscribe_cntxt))) != 0){ - char *f; + char *f = NULL; /* * fake that we've found everything there is to find... @@ -5848,7 +5848,7 @@ delete_folder(CONTEXT_S *context, int index, char *next_folder, size_t len, MAIL if((fp = folder_entry(index, FOLDERS(context))) && strlen(FLDR_NAME(fp)) < len - 1) strncpy(next_folder, FLDR_NAME(fp), len-1); - next_folder[len-1] = '\0'; + next_folder[len-1] = '\0'; } if(!(context->use & CNTXT_INCMNG)){ diff --git a/alpine/keymenu.c b/alpine/keymenu.c index 38d9f46f..b2b69a64 100644 --- a/alpine/keymenu.c +++ b/alpine/keymenu.c @@ -3272,7 +3272,7 @@ output_keymenu(struct key_menu *km, unsigned char *bm, int row, int column) len = strlen(keystr); while(keystr[len-1] == SPACE) len--; - len--; + len--; register_key(j, ufk ? PF1 + fkey - 1 : (k->name[0] == '^') diff --git a/alpine/ldapconf.c b/alpine/ldapconf.c index 902ef2d3..8841f7ce 100644 --- a/alpine/ldapconf.c +++ b/alpine/ldapconf.c @@ -918,12 +918,12 @@ dir_config_add(struct pine *ps, CONF_S **cl) void dir_config_shuffle(struct pine *ps, CONF_S **cl) { - int cnt, rv, current_num, new_num, i, j, deefault; + int cnt, rv, current_num, new_num = 0, i, j, deefault; char **new_list, **lval; char tmp[200]; HelpType help; ESCKEY_S opts[3]; - CONF_S *a, *b; + CONF_S *a = NULL, *b = NULL; int no_ex; no_ex = (ps_global->ew_for_except_vars == Main); @@ -2143,7 +2143,7 @@ dir_config_del(struct pine *ps, CONF_S **cl) CONF_S *cp; char **servers; int move_top = 0, this_one, revert_to_default, - default_there_to_revert_to; + default_there_to_revert_to = 0; /* * Remove one from current list. diff --git a/alpine/mailpart.c b/alpine/mailpart.c index 3261c63a..bd260861 100644 --- a/alpine/mailpart.c +++ b/alpine/mailpart.c @@ -2964,7 +2964,7 @@ display_vcard_att(long int msgno, ATTACH_S *a, int flags) URL_HILITE_S uh; gf_io_t gc, pc; char **lines, **ll, *errstr = NULL, tmp[MAILTMPLEN], *p; - int cmd, indent, begins = 0; + int cmd = MC_RESIZE, indent, begins = 0; lines = detach_vcard_att(ps_global->mail_stream, msgno, a->body, a->number); diff --git a/alpine/osdep/print.c b/alpine/osdep/print.c index 1db00f34..3e5a81f4 100644 --- a/alpine/osdep/print.c +++ b/alpine/osdep/print.c @@ -101,7 +101,7 @@ open_printer(char *desc) char *p, *init, *nick; char aname[100], wname[100]; char *printer; - int done = 0, i, lastprinter, cur_printer = 0; + int done = 0, i, lastprinter = 0, cur_printer = 0; HelpType help; char **list; static ESCKEY_S ekey[] = { diff --git a/alpine/rpdump.c b/alpine/rpdump.c index 525bd14c..7d74d626 100644 --- a/alpine/rpdump.c +++ b/alpine/rpdump.c @@ -766,7 +766,8 @@ opt_enter(string, field_len, prompt, flags) char *p; fputs(prompt, stdout); - fgets(string, field_len, stdin); + if(!fgets(string, field_len, stdin)) + return_v = 1; /* cancel? */ string[field_len-1] = '\0'; if((p = strpbrk(string, "\r\n")) != NULL) *p = '\0'; @@ -804,7 +805,8 @@ wantto(question, dflt, on_ctrl_C) while(!ret){ fprintf(stdout, "%s? [%c]:", question, dflt); - fgets(rep, sizeof(rep), stdin); + if(!fgets(rep, sizeof(rep), stdin)) + *rep = '\0'; if((p = strpbrk(rep, "\r\n")) != NULL) *p = '\0'; switch(*rep){ diff --git a/alpine/rpload.c b/alpine/rpload.c index 56e6ebc6..7890e100 100644 --- a/alpine/rpload.c +++ b/alpine/rpload.c @@ -1004,7 +1004,8 @@ opt_enter(string, field_len, prompt, flags) char *p; fputs(prompt, stdout); - fgets(string, field_len, stdin); + if(!fgets(string, field_len, stdin)) + return_v = 1; /* cancel? */ string[field_len-1] = '\0'; if((p = strpbrk(string, "\r\n")) != NULL) *p = '\0'; diff --git a/alpine/setup.c b/alpine/setup.c index 75e2fc3b..513353ce 100644 --- a/alpine/setup.c +++ b/alpine/setup.c @@ -61,10 +61,10 @@ int to_charsets_text_tool(struct pine *, int, CONF_S **, unsigned); void option_screen(struct pine *ps, int edit_exceptions) { - char tmp[MAXPATH+1], *pval, **lval; + char tmp[MAXPATH+1], *pval = NULL, **lval = NULL; int i, j, ln = 0, readonly_warning = 0, pos; struct variable *vtmp; - CONF_S *ctmpa = NULL, *ctmpb, *first_line = NULL; + CONF_S *ctmpa = NULL, *ctmpb = NULL, *first_line = NULL; FEATURE_S *feature; PINERC_S *prc = NULL; SAVED_CONFIG_S *vsave; diff --git a/alpine/smime.c b/alpine/smime.c index 137860b7..284f173e 100644 --- a/alpine/smime.c +++ b/alpine/smime.c @@ -479,7 +479,7 @@ output_cert_info(X509 *cert, gf_io_t pc) gf_puts(NEWLINE, pc); if((chain = get_chain_for_cert(cert, &error, &len)) != NULL){ - X509 *x; + X509 *x = NULL; X509_NAME_ENTRY *e; int i, offset = 2; char space[256]; diff --git a/alpine/takeaddr.c b/alpine/takeaddr.c index ebb07e3d..fb8e0353 100644 --- a/alpine/takeaddr.c +++ b/alpine/takeaddr.c @@ -1130,7 +1130,7 @@ takeaddr_screen(struct pine *ps, TA_S *ta_list, int how_many_selected, TA_SCREEN_S screen; Pos cursor_pos; char *utf8str; - struct key_menu *km; + struct key_menu *km = NULL; dprint((2, "- takeaddr_screen -\n")); @@ -2069,7 +2069,7 @@ take_without_edit(TA_S *ta_list, int num_in_list, int command_line, TA_STATE_S * #define OURTMPBUFLEN 200 PerAddrBook *pab_dst; SAVE_STATE_S state; /* For saving state of addrbooks temporarily */ - int rc, total_to_copy; + int rc, total_to_copy = 0; int how_many_dups = 0, how_many_to_copy = 0, skip_dups = 0; int ret = 0; int err = 0, need_write = 0, we_cancel = 0; diff --git a/alpine/titlebar.c b/alpine/titlebar.c index c7b76f52..2e2e3032 100644 --- a/alpine/titlebar.c +++ b/alpine/titlebar.c @@ -917,7 +917,7 @@ sort_letter(SortOrder sort) void update_titlebar_message(void) { - long curnum, maxnum, oldnum; + long curnum = 0, maxnum, oldnum = 0; PINETHRD_S *thrd = NULL; COLOR_PAIR *lastc = NULL, *titlecolor; char buf[50]; |