From 2767b1f0e9cdb4193f3682ad94bd47de4491e925 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sun, 29 Jul 2007 20:59:09 +0000 Subject: compiler warnings fixed --- src/apoint.c | 8 ++++---- src/calcurse.c | 25 +++++-------------------- src/day.c | 6 +++--- src/io.c | 4 ++-- src/notify.c | 4 ++-- src/recur.c | 22 +++++++++++++++------- src/recur.h | 4 ++-- src/utils.c | 12 ++++++++---- 8 files changed, 41 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/apoint.c b/src/apoint.c index dd3cbac..d949cb9 100755 --- a/src/apoint.c +++ b/src/apoint.c @@ -1,4 +1,4 @@ -/* $calcurse: apoint.c,v 1.13 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: apoint.c,v 1.14 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -92,10 +92,10 @@ apoint_add(int *hilt_app) char *format_message_1 = _("You entered an invalid start time, should be [h:mm] or [hh:mm]"); char *format_message_2 = _("You entered an invalid end time, should be [h:mm] or [hh:mm] or [mm]"); char *enter_str = _("Press [Enter] to continue"); - int Id; + int Id = 1; char item_time[LTIME] = ""; char item_mesg[BUFSIZ] = ""; - long apoint_duration, apoint_start; + long apoint_duration = 0, apoint_start; apoint_llist_node_t *apoint_pointeur; struct event_s *event_pointeur; unsigned heures, minutes; @@ -504,7 +504,7 @@ apoint_switch_notify(int item_num) apoint_llist_node_t *apoint; struct day_item_s *p; long date; - int apoint_nb, n, need_chk_notify; + int apoint_nb = 0, n, need_chk_notify; p = day_get_item(item_num); if (p->type != APPT && p->type != RECUR_APPT) diff --git a/src/calcurse.c b/src/calcurse.c index 2b55538..95edc0f 100755 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -1,4 +1,4 @@ -/* $calcurse: calcurse.c,v 1.51 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: calcurse.c,v 1.52 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -28,33 +28,16 @@ #include #endif /* HAVE_CONFIG_H */ -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include +#include #include "i18n.h" #include "io.h" #include "help.h" -#include "calendar.h" #include "custom.h" #include "utils.h" -#include "vars.h" #include "sigs.h" -#include "wins.h" -#include "apoint.h" #include "day.h" -#include "event.h" -#include "recur.h" #include "todo.h" #include "args.h" #include "notify.h" @@ -146,8 +129,10 @@ main(int argc, char **argv) init_pair(COLR_HIGH, COLOR_BLACK, COLOR_GREEN); init_pair(COLR_CUSTOM, COLOR_RED, background); - } else + } else { colorize = false; + background = COLOR_BLACK; + } vars_init(&conf); wins_init(&win[CALENDAR], &win[APPOINTMENT], &win[TODO], &win[STATUS]); diff --git a/src/day.c b/src/day.c index 0ed71dc..c00c150 100755 --- a/src/day.c +++ b/src/day.c @@ -1,4 +1,4 @@ -/* $calcurse: day.c,v 1.25 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: day.c,v 1.26 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -229,7 +229,7 @@ day_store_recur_apoints(long date) * The number of events and appointments in the current day are also updated. */ static int -day_store_items(long date, int *pnb_events, int *pnb_apoints) +day_store_items(long date, unsigned *pnb_events, unsigned *pnb_apoints) { int pad_length; int nb_events, nb_recur_events; @@ -466,7 +466,7 @@ day_edit_item(int item_num) struct day_item_s *p; struct recur_event_s *re; - struct rpt_s *rpt; + struct rpt_s *rpt = 0L; struct tm *lt; time_t t; date_t new_date; diff --git a/src/io.c b/src/io.c index 376644d..8cb1f10 100755 --- a/src/io.c +++ b/src/io.c @@ -1,4 +1,4 @@ -/* $calcurse: io.c,v 1.18 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: io.c,v 1.19 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -550,7 +550,7 @@ io_load_app(void) time_t t; int id = 0; int freq; - char type, state; + char type, state = 0L; char *error = _("FATAL ERROR in io_load_app: wrong format in the appointment or event\n"); diff --git a/src/notify.c b/src/notify.c index e69317e..86b6745 100755 --- a/src/notify.c +++ b/src/notify.c @@ -1,4 +1,4 @@ -/* $calcurse: notify.c,v 1.16 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: notify.c,v 1.17 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -490,7 +490,7 @@ notify_print_options(WINDOW *win, int col) void notify_config_bar(void) { - WINDOW *conf_win; + WINDOW *conf_win = 0L; char label[BUFSIZ]; char *buf; char *number_str = diff --git a/src/recur.c b/src/recur.c index 52bc44d..ae50bea 100755 --- a/src/recur.c +++ b/src/recur.c @@ -1,4 +1,4 @@ -/* $calcurse: recur.c,v 1.27 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: recur.c,v 1.28 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -117,23 +117,27 @@ struct recur_event_s *recur_event_new(char *mesg, long day, int id, * and the letter to be written in file. */ char -recur_def2char(int define) +recur_def2char(recur_types_t define) { char recur_char; + char *error = _("FATAL ERROR in recur_def2char: unknown recur type\n"); switch (define) { - case 1: + case RECUR_DAILY: recur_char = 'D'; break; - case 2: + case RECUR_WEEKLY: recur_char = 'W'; break; - case 3: + case RECUR_MONTHLY: recur_char = 'M'; break; - case 4: + case RECUR_YEARLY: recur_char = 'Y'; break; + default: + fputs(error, stderr); + exit(EXIT_FAILURE); } return (recur_char); @@ -145,6 +149,7 @@ recur_def2char(int define) */ int recur_char2def(char type){ int recur_def; + char *error = _("FATAL ERROR in recur_char2def: unknown char\n"); switch (type) { case 'D': @@ -159,8 +164,11 @@ int recur_char2def(char type){ case 'Y': recur_def = RECUR_YEARLY; break; + default: + fputs(error, stderr); + exit(EXIT_FAILURE); } - return recur_def; + return (recur_def); } /* Write days for which recurrent items should not be repeated. */ diff --git a/src/recur.h b/src/recur.h index a582ca5..84dae52 100755 --- a/src/recur.h +++ b/src/recur.h @@ -1,4 +1,4 @@ -/* $calcurse: recur.h,v 1.13 2007/07/28 13:11:42 culot Exp $ */ +/* $calcurse: recur.h,v 1.14 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -78,7 +78,7 @@ recur_apoint_llist_node_t *recur_apoint_new(char *, long, long, char, int, int, long, struct days_s *); struct recur_event_s *recur_event_new(char *, long, int, int, int, long, struct days_s *); -char recur_def2char(int); +char recur_def2char(recur_types_t); int recur_char2def(char); recur_apoint_llist_node_t *recur_apoint_scan(FILE *, struct tm, struct tm, char, int, struct tm, struct days_s *, diff --git a/src/utils.c b/src/utils.c index 07a6175..9e18ef7 100755 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $calcurse: utils.c,v 1.33 2007/07/28 13:11:43 culot Exp $ */ +/* $calcurse: utils.c,v 1.34 2007/07/29 20:59:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -743,17 +743,21 @@ void reset_status_page(void) void other_status_page(int panel) { int nb_item, max_page; + char *error = _("FATAL ERROR in other_status_page: unknown panel\n"); switch (panel) { - case 0: + case CALENDAR: nb_item = NB_CAL_CMDS; break; - case 1: + case APPOINTMENT: nb_item = NB_APP_CMDS; break; - case 2: + case TODO: nb_item = NB_TOD_CMDS; break; + default: + fputs(error, stderr); + exit(EXIT_FAILURE); } max_page = ceil( nb_item / (2*CMDS_PER_LINE) ) + 1; if (status_page < max_page) { -- cgit v1.2.3-70-g09d2