diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-04-05 21:36:54 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-04-05 22:18:46 +0200 |
commit | 80f7e8ead55ee85a364c98db64c21d70a34d1dc1 (patch) | |
tree | d8c6d909ada1c0c4c85533a0d1687d0ccdffb17e /src | |
parent | 516a793375424ea2bbdc891bf0c917a8f7b388a1 (diff) | |
download | calcurse-80f7e8ead55ee85a364c98db64c21d70a34d1dc1.zip |
Mark localized string literals constant
Translated strings returned by gettext() are statically allocated and
shouldn't be modified.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/apoint.c | 14 | ||||
-rw-r--r-- | src/args.c | 4 | ||||
-rw-r--r-- | src/calcurse.c | 2 | ||||
-rw-r--r-- | src/calendar.c | 4 | ||||
-rw-r--r-- | src/custom.c | 22 | ||||
-rw-r--r-- | src/day.c | 36 | ||||
-rw-r--r-- | src/io.c | 44 | ||||
-rw-r--r-- | src/keys.c | 2 | ||||
-rw-r--r-- | src/notify.c | 12 | ||||
-rw-r--r-- | src/recur.c | 20 | ||||
-rw-r--r-- | src/todo.c | 12 | ||||
-rw-r--r-- | src/utils.c | 6 |
12 files changed, 89 insertions, 89 deletions
diff --git a/src/apoint.c b/src/apoint.c index 6808738..98e8e5e 100644 --- a/src/apoint.c +++ b/src/apoint.c @@ -155,16 +155,16 @@ apoint_add (void) { #define LTIME 6 #define LDUR 12 - char *mesg_1 = + const char *mesg_1 = _("Enter start time ([hh:mm]), leave blank for an all-day event : "); - char *mesg_2 = + const char *mesg_2 = _("Enter end time ([hh:mm]) or duration ([+hh:mm], [+xxxdxxhxxm] or [+mm]) : "); - char *mesg_3 = _("Enter description :"); - char *format_message_1 = + const char *mesg_3 = _("Enter description :"); + const char *format_message_1 = _("You entered an invalid start time, should be [hh:mm]"); - char *format_message_2 = + const char *format_message_2 = _("Invalid end time/duration, should be [hh:mm], [+hh:mm], [+xxxdxxhxxm] or [+mm]"); - char *enter_str = _("Press [Enter] to continue"); + const char *enter_str = _("Press [Enter] to continue"); int Id = 1; char item_time[LDUR] = ""; char item_mesg[BUFSIZ] = ""; @@ -265,7 +265,7 @@ void apoint_delete (unsigned *nb_events, unsigned *nb_apoints) { char *choices = "[y/n] "; - char *del_app_str = _("Do you really want to delete this item ?"); + const char *del_app_str = _("Do you really want to delete this item ?"); long date; int nb_items = *nb_apoints + *nb_events; int to_be_removed = 0; @@ -205,8 +205,8 @@ todo_arg (int priority, const char *format, regex_t *regex) llist_item_t *i; int title = 1; char *titlestr; - char *all_todos_title = _("to do:\n"); - char *completed_title = _("completed tasks:\n"); + const char *all_todos_title = _("to do:\n"); + const char *completed_title = _("completed tasks:\n"); titlestr = priority == 0 ? completed_title : all_todos_title; diff --git a/src/calcurse.c b/src/calcurse.c index ca239fb..d3b1d03 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -68,7 +68,7 @@ main (int argc, char **argv) int non_interactive; int no_data_file = 1; int cut_item = 0; - char *quit_message = _("Do you really want to quit ?"); + const char *quit_message = _("Do you really want to quit ?"); char choices[] = "[y/n] "; int count; diff --git a/src/calendar.c b/src/calendar.c index 197291b..7ef7f0f 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -628,10 +628,10 @@ calendar_change_day (int datefmt) char outstr[BUFSIZ]; int dday, dmonth, dyear; int wrong_day = 1; - char *mesg_line1 = + const char *mesg_line1 = _("The day you entered is not valid " "(should be between 01/01/1902 and 12/31/2037)"); - char *mesg_line2 = _("Press [ENTER] to continue"); + const char *mesg_line2 = _("Press [ENTER] to continue"); char *request_date = "Enter the day to go to [ENTER for today] : %s"; while (wrong_day) diff --git a/src/custom.c b/src/custom.c index dd0bd62..e347850 100644 --- a/src/custom.c +++ b/src/custom.c @@ -216,7 +216,7 @@ custom_layout_config (void) struct window conf_win; int ch, mark, cursor, need_reset; const char *label = _("layout configuration"); - char *help_text = + const char *help_text = _("With this configuration menu, one can choose where panels will be\n" "displayed inside calcurse screen. \n" "It is possible to choose between eight different configurations.\n" @@ -303,7 +303,7 @@ custom_sidebar_config (void) struct binding *bindings[] = { &inc, &dec, &help, &quit }; - char *help_text = + const char *help_text = _("This configuration screen is used to change the width of the side bar.\n" "The side bar is the part of the screen which contains two panels:\n" "the calendar and, depending on the chosen layout, either the todo list\n" @@ -431,9 +431,9 @@ display_color_config (struct window *cwin, int *mark_fore, int *mark_back, #define CURSOR (32 | A_REVERSE) #define MARK 88 - char *fore_txt = _("Foreground"); - char *back_txt = _("Background"); - char *default_txt = _("(terminal's default)"); + const char *fore_txt = _("Foreground"); + const char *back_txt = _("Background"); + const char *default_txt = _("(terminal's default)"); char *bar = " "; char *box = "[ ]"; const unsigned Y = 3; @@ -746,16 +746,16 @@ void custom_general_config (void) { struct scrollwin cwin; - char *number_str = + const char *number_str = _("Enter an option number to change its value"); - char *keys = + const char *keys = _("(Press '^P' or '^N' to move up or down, 'Q' to quit)"); - char *output_datefmt_str = + const char *output_datefmt_str = _("Enter the date format (see 'man 3 strftime' for possible formats) "); - char *input_datefmt_str = + const char *input_datefmt_str = _("Enter the date format (1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd " "(4)yyyy-mm-dd"); - char *periodic_save_str = + const char *periodic_save_str = _("Enter the delay, in minutes, between automatic saves (0 to disable) "); int ch; char *buf; @@ -1098,7 +1098,7 @@ custom_keys_config (void) void custom_config_main (void) { - char *no_color_support = + const char *no_color_support = _("Sorry, colors are not supported by your terminal\n" "(Press [ENTER] to continue)"); int ch; @@ -577,9 +577,9 @@ static int day_edit_time (int time, unsigned *new_hour, unsigned *new_minute) { char *timestr = date_sec2date_str (time, "%H:%M"); - char *msg_time = _("Enter the new time ([hh:mm]) : "); - char *enter_str = _("Press [Enter] to continue"); - char *fmt_msg = _("You entered an invalid time, should be [hh:mm]"); + const char *msg_time = _("Enter the new time ([hh:mm]) : "); + const char *enter_str = _("Press [Enter] to continue"); + const char *fmt_msg = _("You entered an invalid time, should be [hh:mm]"); for (;;) { @@ -607,9 +607,9 @@ static int day_edit_duration (int start, int dur, unsigned *new_duration) { char *timestr = date_sec2date_str (start + dur, "%H:%M"); - char *msg_time = _("Enter the new time ([hh:mm]) or duration ([+hh:mm]): "); - char *enter_str = _("Press [Enter] to continue"); - char *fmt_msg = _("You entered an invalid time, should be [hh:mm]"); + const char *msg_time = _("Enter the new time ([hh:mm]) or duration ([+hh:mm]): "); + const char *enter_str = _("Press [Enter] to continue"); + const char *fmt_msg = _("You entered an invalid time, should be [hh:mm]"); long newtime; unsigned hr, mn; @@ -652,8 +652,8 @@ update_start_time (long *start, long *dur) long newtime; unsigned hr, mn; int valid_date; - char *msg_wrong_time = _("Invalid time: start time must be before end time!"); - char *msg_enter = _("Press [Enter] to continue"); + const char *msg_wrong_time = _("Invalid time: start time must be before end time!"); + const char *msg_enter = _("Press [Enter] to continue"); do { @@ -699,15 +699,15 @@ update_rept (struct rpt **rpt, const long start) long newuntil; char outstr[BUFSIZ]; char *typstr, *freqstr, *timstr; - char *msg_rpt_type = _("Enter the new repetition type: (D)aily, (W)eekly, " + const char *msg_rpt_type = _("Enter the new repetition type: (D)aily, (W)eekly, " "(M)onthly, (Y)early"); - char *msg_rpt_ans = _("[D/W/M/Y] "); - char *msg_wrong_freq = _("The frequence you entered is not valid."); - char *msg_wrong_time = _("Invalid time: start time must be before end time!"); - char *msg_wrong_date = _("The entered date is not valid."); + const char *msg_rpt_ans = _("[D/W/M/Y] "); + const char *msg_wrong_freq = _("The frequence you entered is not valid."); + const char *msg_wrong_time = _("Invalid time: start time must be before end time!"); + const char *msg_wrong_date = _("The entered date is not valid."); char *msg_fmts = "Possible formats are [%s] or '0' for an endless repetetition"; - char *msg_enter = _("Press [Enter] to continue"); + const char *msg_enter = _("Press [Enter] to continue"); do { @@ -925,14 +925,14 @@ int day_erase_item (long date, int item_number, enum eraseflg flag) { struct day_item *p; - char *erase_warning = + const char *erase_warning = _("This item is recurrent. " "Delete (a)ll occurences or just this (o)ne ?"); - char *note_warning = + const char *note_warning = _("This item has a note attached to it. " "Delete (i)tem or just its (n)ote ?"); - char *note_choice = _("[i/n] "); - char *erase_choice = _("[a/o] "); + const char *note_choice = _("[i/n] "); + const char *erase_choice = _("[a/o] "); int ch, ans; unsigned delete_whole; @@ -89,10 +89,10 @@ progress_bar (progress_bar_t type, int progress) #define NBEXPORTED 3 #define LABELENGTH 15 int i, step, steps; - char *mesg_sav = _("Saving..."); - char *mesg_load = _("Loading..."); - char *mesg_export = _("Exporting..."); - char *error_msg = _("Internal error while displaying progress bar"); + const char *mesg_sav = _("Saving..."); + const char *mesg_load = _("Loading..."); + const char *mesg_export = _("Exporting..."); + const char *error_msg = _("Internal error while displaying progress bar"); char *barchar = "|"; char *file[NBFILES] = { "[ conf ]", @@ -154,10 +154,10 @@ get_export_stream (enum export_type type) FILE *stream; int cancel; char *home, *stream_name; - char *question = _("Choose the file used to export calcurse data:"); - char *wrong_name = + const char *question = _("Choose the file used to export calcurse data:"); + const char *wrong_name = _("The file cannot be accessed, please enter another file name."); - char *press_enter = _("Press [ENTER] to continue."); + const char *press_enter = _("Press [ENTER] to continue."); const char *file_ext[IO_EXPORT_NBTYPES] = {"ical", "txt"}; stream = NULL; @@ -428,9 +428,9 @@ io_save_keys (void) void io_save_cal (enum save_display display) { - char *access_pb = _("Problems accessing data file ..."); - char *save_success = _("The data files were successfully saved"); - char *enter = _("Press [ENTER] to continue"); + const char *access_pb = _("Problems accessing data file ..."); + const char *save_success = _("The data files were successfully saved"); + const char *enter = _("Press [ENTER] to continue"); int show_bar; if (read_only) @@ -794,7 +794,7 @@ io_load_keys (char *pager) line++; if (skipped > MAX_ERRORS) { - char *too_many = + const char *too_many = _("\nToo many errors while reading configuration file!\n" "Please backup your keys file, remove it from directory, " "and launch calcurse again.\n"); @@ -876,7 +876,7 @@ io_load_keys (char *pager) file_close (log->fd, __FILE_POS__); if (skipped > 0) { - char *view_log = + const char *view_log = _("There were some errors when loading keys file, see log file ?"); io_log_display (log, view_log, pager); @@ -990,10 +990,10 @@ io_check_data_files (void) void io_startup_screen (unsigned show_dialogs, int no_data_file) { - char *welcome_mesg = + const char *welcome_mesg = _("Welcome to Calcurse. Missing data files were created."); - char *data_mesg = _("Data files found. Data will be loaded now."); - char *enter = _("Press [ENTER] to continue"); + const char *data_mesg = _("Data files found. Data will be loaded now."); + const char *enter = _("Press [ENTER] to continue"); if (no_data_file != 0) { @@ -1012,8 +1012,8 @@ void io_export_data (enum export_type type) { FILE *stream; - char *success = _("The data were successfully exported"); - char *enter = _("Press [ENTER] to continue"); + const char *success = _("The data were successfully exported"); + const char *enter = _("Press [ENTER] to continue"); if (type < IO_EXPORT_ICAL || type >= IO_EXPORT_NBTYPES) EXIT (_("unknown export type")); @@ -1076,10 +1076,10 @@ get_import_stream (enum export_type type) { FILE *stream; char *stream_name; - char *ask_fname = _("Enter the file name to import data from:"); - char *wrong_file = + const char *ask_fname = _("Enter the file name to import data from:"); + const char *wrong_file = _("The file cannot be accessed, please enter another file name."); - char *press_enter = _("Press [ENTER] to continue."); + const char *press_enter = _("Press [ENTER] to continue."); int cancel; stream = NULL; @@ -1115,7 +1115,7 @@ get_import_stream (enum export_type type) void io_import_data (enum import_type type, char *stream_name) { - char *proc_report = _("Import process report: %04d lines read "); + const char *proc_report = _("Import process report: %04d lines read "); char stats_str[4][BUFSIZ]; FILE *stream = NULL; struct io_file *log; @@ -1195,7 +1195,7 @@ io_import_data (enum import_type type, char *stream_name) file_close (log->fd, __FILE_POS__); if (stats.skipped > 0) { - char *view_log = _("Some items could not be imported, see log file ?"); + const char *view_log = _("Some items could not be imported, see log file ?"); io_log_display (log, view_log, conf.pager); } @@ -103,7 +103,7 @@ static struct keydef_s keydef[NBKEYS] = { static void dump_intro (FILE *fd) { - char *intro = + const char *intro = _("#\n" "# Calcurse keys configuration file\n#\n" "# This file sets the keybindings used by Calcurse.\n" diff --git a/src/notify.c b/src/notify.c index 5ec461e..70b5419 100644 --- a/src/notify.c +++ b/src/notify.c @@ -714,17 +714,17 @@ notify_config_bar (void) { struct scrollwin cwin; char *buf; - char *number_str = + const char *number_str = _("Enter an option number to change its value"); - char *keys = + const char *keys = _("(Press '^P' or '^N' to move up or down, 'Q' to quit)"); - char *date_str = + const char *date_str = _("Enter the date format (see 'man 3 strftime' for possible formats) "); - char *time_str = + const char *time_str = _("Enter the time format (see 'man 3 strftime' for possible formats) "); - char *count_str = + const char *count_str = _("Enter the number of seconds (0 not to be warned before an appointment)"); - char *cmd_str = _("Enter the notification command "); + const char *cmd_str = _("Enter the notification command "); int ch; clear (); diff --git a/src/recur.c b/src/recur.c index 7457dbb..e1be22a 100644 --- a/src/recur.c +++ b/src/recur.c @@ -874,19 +874,19 @@ recur_repeat_item (void) struct date until_date; char outstr[BUFSIZ]; char user_input[BUFSIZ] = ""; - char *mesg_type_1 = + const char *mesg_type_1 = _("Enter the repetition type: (D)aily, (W)eekly, (M)onthly, (Y)early"); - char *mesg_type_2 = _("[D/W/M/Y] "); - char *mesg_freq_1 = _("Enter the repetition frequence:"); - char *mesg_wrong_freq = _("The frequence you entered is not valid."); - char *mesg_until_1 = + const char *mesg_type_2 = _("[D/W/M/Y] "); + const char *mesg_freq_1 = _("Enter the repetition frequence:"); + const char *mesg_wrong_freq = _("The frequence you entered is not valid."); + const char *mesg_until_1 = _("Enter the ending date: [%s] or '0' for an endless repetition"); - char *mesg_wrong_1 = _("The entered date is not valid."); - char *mesg_wrong_2 = + const char *mesg_wrong_1 = _("The entered date is not valid."); + const char *mesg_wrong_2 = _("Possible formats are [%s] or '0' for an endless repetition"); - char *wrong_type_1 = _("This item is already a repeated one."); - char *wrong_type_2 = _("Press [ENTER] to continue."); - char *mesg_older = + const char *wrong_type_1 = _("This item is already a repeated one."); + const char *wrong_type_2 = _("Press [ENTER] to continue."); + const char *mesg_older = _("Sorry, the date you entered is older than the item start time."); int type = 0, freq = 0; int item_nb; @@ -134,8 +134,8 @@ void todo_new_item (void) { int ch = 0; - char *mesg = _("Enter the new ToDo item : "); - char *mesg_id = _("Enter the ToDo priority [1 (highest) - 9 (lowest)] :"); + const char *mesg = _("Enter the new ToDo item : "); + const char *mesg_id = _("Enter the ToDo priority [1 (highest) - 9 (lowest)] :"); char todo_input[BUFSIZ] = ""; status_mesg (mesg, ""); @@ -243,11 +243,11 @@ void todo_delete (void) { char *choices = "[y/n] "; - char *del_todo_str = _("Do you really want to delete this task ?"); - char *erase_warning = + const char *del_todo_str = _("Do you really want to delete this task ?"); + const char *erase_warning = _("This item has a note attached to it. " "Delete (t)odo or just its (n)ote ?"); - char *erase_choice = _("[t/n] "); + const char *erase_choice = _("[t/n] "); int answer, has_note; if (conf.confirm_delete) @@ -364,7 +364,7 @@ void todo_edit_item (void) { struct todo *i; - char *mesg = _("Enter the new ToDo description :"); + const char *mesg = _("Enter the new ToDo description :"); status_mesg (mesg, ""); i = todo_get_item (hilt); diff --git a/src/utils.c b/src/utils.c index e58125e..763d49b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -105,8 +105,8 @@ void fatalbox (const char *errmsg) { WINDOW *errwin; - char *label = _("/!\\ INTERNAL ERROR /!\\"); - char *reportmsg = _("Please report the following bug:"); + const char *label = _("/!\\ INTERNAL ERROR /!\\"); + const char *reportmsg = _("Please report the following bug:"); const int WINROW = 10; const int WINCOL = col - 2; const int MSGLEN = WINCOL - 2; @@ -188,7 +188,7 @@ WINDOW * popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg, int hint) { - char *any_key = _("Press any key to continue..."); + const char *any_key = _("Press any key to continue..."); char label[BUFSIZ]; WINDOW *popup_win; const int MSGXPOS = 5; |