Commit ed4a4b89 authored by unknown's avatar unknown

correct some warnings with const char*

parent da023c7b
...@@ -1629,17 +1629,17 @@ rl_set_keymap_from_edit_mode () ...@@ -1629,17 +1629,17 @@ rl_set_keymap_from_edit_mode ()
} }
char * const char *
rl_get_keymap_name_from_edit_mode () rl_get_keymap_name_from_edit_mode ()
{ {
if (rl_editing_mode == emacs_mode) if (rl_editing_mode == emacs_mode)
return (char*)"emacs"; return "emacs";
#if defined (VI_MODE) #if defined (VI_MODE)
else if (rl_editing_mode == vi_mode) else if (rl_editing_mode == vi_mode)
return (char*)"vi"; return "vi";
#endif /* VI_MODE */ #endif /* VI_MODE */
else else
return (char*)"nope"; return "nope";
} }
/* **************************************************************** */ /* **************************************************************** */
......
...@@ -121,7 +121,7 @@ int _rl_suppress_redisplay = 0; ...@@ -121,7 +121,7 @@ int _rl_suppress_redisplay = 0;
/* The stuff that gets printed out before the actual text of the line. /* The stuff that gets printed out before the actual text of the line.
This is usually pointing to rl_prompt. */ This is usually pointing to rl_prompt. */
char *rl_display_prompt = (char *)NULL; const char *rl_display_prompt = (char *)NULL;
/* Pseudo-global variables declared here. */ /* Pseudo-global variables declared here. */
/* The visible cursor position. If you print some text, adjust this. */ /* The visible cursor position. If you print some text, adjust this. */
...@@ -382,7 +382,7 @@ rl_redisplay () ...@@ -382,7 +382,7 @@ rl_redisplay ()
register char *line; register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum; int c_pos, inv_botlin, lb_botlin, lb_linenum;
int newlines, lpos, temp; int newlines, lpos, temp;
char *prompt_this_line; const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
wchar_t wc; wchar_t wc;
size_t wc_bytes; size_t wc_bytes;
...@@ -395,7 +395,7 @@ rl_redisplay () ...@@ -395,7 +395,7 @@ rl_redisplay ()
return; return;
if (!rl_display_prompt) if (!rl_display_prompt)
rl_display_prompt = (char*)""; rl_display_prompt = "";
if (invisible_line == 0) if (invisible_line == 0)
{ {
...@@ -1760,7 +1760,7 @@ rl_reset_line_state () ...@@ -1760,7 +1760,7 @@ rl_reset_line_state ()
{ {
rl_on_new_line (); rl_on_new_line ();
rl_display_prompt = (char*)(rl_prompt ? rl_prompt : ""); rl_display_prompt = rl_prompt ? rl_prompt : "";
forced_display = 1; forced_display = 1;
return 0; return 0;
} }
...@@ -1999,7 +1999,8 @@ static void ...@@ -1999,7 +1999,8 @@ static void
redraw_prompt (t) redraw_prompt (t)
char *t; char *t;
{ {
char *oldp, *oldl, *oldlprefix; const char *oldp;
char *oldl, *oldlprefix;
int oldlen, oldlast, oldplen, oldninvis; int oldlen, oldlast, oldplen, oldninvis;
/* Geez, I should make this a struct. */ /* Geez, I should make this a struct. */
......
...@@ -85,14 +85,14 @@ char history_comment_char = '\0'; ...@@ -85,14 +85,14 @@ char history_comment_char = '\0';
/* The list of characters which inhibit the expansion of text if found /* The list of characters which inhibit the expansion of text if found
immediately following history_expansion_char. */ immediately following history_expansion_char. */
char *history_no_expand_chars = (char*)" \t\n\r="; const char *history_no_expand_chars = " \t\n\r=";
/* If set to a non-zero value, single quotes inhibit history expansion. /* If set to a non-zero value, single quotes inhibit history expansion.
The default is 0. */ The default is 0. */
int history_quotes_inhibit_expansion = 0; int history_quotes_inhibit_expansion = 0;
/* Used to split words by history_tokenize_internal. */ /* Used to split words by history_tokenize_internal. */
char *history_word_delimiters = (char*)HISTORY_WORD_DELIMITERS; const char *history_word_delimiters = HISTORY_WORD_DELIMITERS;
/* If set, this points to a function that is called to verify that a /* If set, this points to a function that is called to verify that a
particular history expansion should be performed. */ particular history expansion should be performed. */
......
...@@ -225,9 +225,9 @@ extern int history_length; ...@@ -225,9 +225,9 @@ extern int history_length;
extern int history_max_entries; extern int history_max_entries;
extern char history_expansion_char; extern char history_expansion_char;
extern char history_subst_char; extern char history_subst_char;
extern char *history_word_delimiters; extern const char *history_word_delimiters;
extern char history_comment_char; extern char history_comment_char;
extern char *history_no_expand_chars; extern const char *history_no_expand_chars;
extern char *history_search_delimiter_chars; extern char *history_search_delimiter_chars;
extern int history_quotes_inhibit_expansion; extern int history_quotes_inhibit_expansion;
......
...@@ -70,7 +70,7 @@ static char *prev_line_found; ...@@ -70,7 +70,7 @@ static char *prev_line_found;
static char *last_isearch_string; static char *last_isearch_string;
static int last_isearch_string_len; static int last_isearch_string_len;
static char default_isearch_terminators[] = "\033\012"; static const char *default_isearch_terminators = "\033\012";
/* Search backwards through the history looking for a string which is typed /* Search backwards through the history looking for a string which is typed
interactively. Start with the current line. */ interactively. Start with the current line. */
...@@ -186,7 +186,7 @@ rl_search_history (direction, invoking_key) ...@@ -186,7 +186,7 @@ rl_search_history (direction, invoking_key)
/* The list of characters which terminate the search, but are not /* The list of characters which terminate the search, but are not
subsequently executed. If the variable isearch-terminators has subsequently executed. If the variable isearch-terminators has
been set, we use that value, otherwise we use ESC and C-J. */ been set, we use that value, otherwise we use ESC and C-J. */
char *isearch_terminators; const char *isearch_terminators;
RL_SETSTATE(RL_STATE_ISEARCH); RL_SETSTATE(RL_STATE_ISEARCH);
orig_point = rl_point; orig_point = rl_point;
......
...@@ -329,7 +329,7 @@ extern void rl_set_keymap PARAMS((Keymap)); ...@@ -329,7 +329,7 @@ extern void rl_set_keymap PARAMS((Keymap));
extern Keymap rl_get_keymap PARAMS((void)); extern Keymap rl_get_keymap PARAMS((void));
/* Undocumented; used internally only. */ /* Undocumented; used internally only. */
extern void rl_set_keymap_from_edit_mode PARAMS((void)); extern void rl_set_keymap_from_edit_mode PARAMS((void));
extern char *rl_get_keymap_name_from_edit_mode PARAMS((void)); extern const char *rl_get_keymap_name_from_edit_mode PARAMS((void));
/* Functions for manipulating the funmap, which maps command names to functions. */ /* Functions for manipulating the funmap, which maps command names to functions. */
extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *)); extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *));
...@@ -390,7 +390,7 @@ extern void rl_resize_terminal PARAMS((void)); ...@@ -390,7 +390,7 @@ extern void rl_resize_terminal PARAMS((void));
extern void rl_set_screen_size PARAMS((int, int)); extern void rl_set_screen_size PARAMS((int, int));
extern void rl_get_screen_size PARAMS((int *, int *)); extern void rl_get_screen_size PARAMS((int *, int *));
extern char *rl_get_termcap PARAMS((const char *)); extern const char *rl_get_termcap PARAMS((const char *));
/* Functions for character input. */ /* Functions for character input. */
extern int rl_stuff_char PARAMS((int)); extern int rl_stuff_char PARAMS((int));
......
...@@ -230,7 +230,7 @@ extern int _rl_page_completions; ...@@ -230,7 +230,7 @@ extern int _rl_page_completions;
extern int _rl_vis_botlin; extern int _rl_vis_botlin;
extern int _rl_last_c_pos; extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay; extern int _rl_suppress_redisplay;
extern char *rl_display_prompt; extern const char *rl_display_prompt;
/* isearch.c */ /* isearch.c */
extern char *_rl_isearch_terminators; extern char *_rl_isearch_terminators;
...@@ -261,16 +261,16 @@ extern procenv_t readline_top_level; ...@@ -261,16 +261,16 @@ extern procenv_t readline_top_level;
/* terminal.c */ /* terminal.c */
extern int _rl_enable_keypad; extern int _rl_enable_keypad;
extern int _rl_enable_meta; extern int _rl_enable_meta;
extern char *_rl_term_clreol; extern const char *_rl_term_clreol;
extern char *_rl_term_clrpag; extern const char *_rl_term_clrpag;
extern char *_rl_term_im; extern const char *_rl_term_im;
extern char *_rl_term_ic; extern const char *_rl_term_ic;
extern char *_rl_term_ei; extern const char *_rl_term_ei;
extern char *_rl_term_DC; extern const char *_rl_term_DC;
extern char *_rl_term_up; extern const char *_rl_term_up;
extern char *_rl_term_dc; extern const char *_rl_term_dc;
extern char *_rl_term_cr; extern const char *_rl_term_cr;
extern char *_rl_term_IC; extern const char *_rl_term_IC;
extern int _rl_screenheight; extern int _rl_screenheight;
extern int _rl_screenwidth; extern int _rl_screenwidth;
extern int _rl_screenchars; extern int _rl_screenchars;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#endif #endif
extern char PC; extern char PC;
extern char *UP, *BC; extern const char *UP, *BC;
extern short ospeed; extern short ospeed;
......
...@@ -84,40 +84,41 @@ static int tcap_initialized; ...@@ -84,40 +84,41 @@ static int tcap_initialized;
# if defined (__EMX__) || defined (NEED_EXTERN_PC) # if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern extern
# endif /* __EMX__ || NEED_EXTERN_PC */ # endif /* __EMX__ || NEED_EXTERN_PC */
char PC, *BC, *UP; const char PC;
const char *BC, *UP;
#endif /* __linux__ */ #endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */ /* Some strings to control terminal actions. These are output by tputs (). */
char *_rl_term_clreol; const char *_rl_term_clreol;
char *_rl_term_clrpag; const char *_rl_term_clrpag;
char *_rl_term_cr; const char *_rl_term_cr;
char *_rl_term_backspace; const char *_rl_term_backspace;
char *_rl_term_goto; const char *_rl_term_goto;
char *_rl_term_pc; const char *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */ /* Non-zero if we determine that the terminal can do character insertion. */
int _rl_terminal_can_insert = 0; int _rl_terminal_can_insert = 0;
/* How to insert characters. */ /* How to insert characters. */
char *_rl_term_im; const char *_rl_term_im;
char *_rl_term_ei; const char *_rl_term_ei;
char *_rl_term_ic; const char *_rl_term_ic;
char *_rl_term_ip; const char *_rl_term_ip;
char *_rl_term_IC; const char *_rl_term_IC;
/* How to delete characters. */ /* How to delete characters. */
char *_rl_term_dc; const char *_rl_term_dc;
char *_rl_term_DC; const char *_rl_term_DC;
#if defined (HACK_TERMCAP_MOTION) #if defined (HACK_TERMCAP_MOTION)
char *_rl_term_forward_char; char *_rl_term_forward_char;
#endif /* HACK_TERMCAP_MOTION */ #endif /* HACK_TERMCAP_MOTION */
/* How to go up a line. */ /* How to go up a line. */
char *_rl_term_up; const char *_rl_term_up;
/* A visible bell; char if the terminal can be made to flash the screen. */ /* A visible bell; char if the terminal can be made to flash the screen. */
static char *_rl_visible_bell; static const char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */ /* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap; int _rl_term_autowrap;
...@@ -127,30 +128,30 @@ static int term_has_meta; ...@@ -127,30 +128,30 @@ static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this /* The sequences to write to turn on and off the meta key, if this
terminal has one. */ terminal has one. */
static char *_rl_term_mm; static const char *_rl_term_mm;
static char *_rl_term_mo; static const char *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */ /* The key sequences output by the arrow keys, if this terminal has any. */
static char *_rl_term_ku; static const char *_rl_term_ku;
static char *_rl_term_kd; static const char *_rl_term_kd;
static char *_rl_term_kr; static const char *_rl_term_kr;
static char *_rl_term_kl; static const char *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */ /* How to initialize and reset the arrow keys, if this terminal has any. */
static char *_rl_term_ks; static const char *_rl_term_ks;
static char *_rl_term_ke; static const char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */ /* The key sequences sent by the Home and End keys, if any. */
static char *_rl_term_kh; static const char *_rl_term_kh;
static char *_rl_term_kH; static const char *_rl_term_kH;
static char *_rl_term_at7; /* @7 */ static const char *_rl_term_at7; /* @7 */
/* Insert key */ /* Insert key */
static char *_rl_term_kI; static const char *_rl_term_kI;
/* Cursor control */ /* Cursor control */
static char *_rl_term_vs; /* very visible */ static const char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */ static const char *_rl_term_ve; /* normal */
static void bind_termcap_arrow_keys PARAMS((Keymap)); static void bind_termcap_arrow_keys PARAMS((Keymap));
...@@ -296,7 +297,7 @@ rl_resize_terminal () ...@@ -296,7 +297,7 @@ rl_resize_terminal ()
struct _tc_string { struct _tc_string {
const char *tc_var; const char *tc_var;
char **tc_value; const char **tc_value;
}; };
/* This should be kept sorted, just in case we decide to change the /* This should be kept sorted, just in case we decide to change the
...@@ -416,7 +417,7 @@ _rl_init_terminal_io (terminal_name) ...@@ -416,7 +417,7 @@ _rl_init_terminal_io (terminal_name)
/* Everything below here is used by the redisplay code (tputs). */ /* Everything below here is used by the redisplay code (tputs). */
_rl_screenchars = _rl_screenwidth * _rl_screenheight; _rl_screenchars = _rl_screenwidth * _rl_screenheight;
_rl_term_cr = (char*)"\r"; _rl_term_cr = "\r";
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL; _rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL; _rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL; _rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
...@@ -433,8 +434,8 @@ _rl_init_terminal_io (terminal_name) ...@@ -433,8 +434,8 @@ _rl_init_terminal_io (terminal_name)
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */ change that later... */
PC = '\0'; PC = '\0';
BC = _rl_term_backspace = (char*)"\b"; BC = (char*)(_rl_term_backspace = "\b");
UP = _rl_term_up; UP = (char*)_rl_term_up;
return 0; return 0;
} }
...@@ -444,11 +445,11 @@ _rl_init_terminal_io (terminal_name) ...@@ -444,11 +445,11 @@ _rl_init_terminal_io (terminal_name)
/* Set up the variables that the termcap library expects the application /* Set up the variables that the termcap library expects the application
to provide. */ to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0; PC = _rl_term_pc ? *_rl_term_pc : 0;
BC = _rl_term_backspace; BC = (char*)_rl_term_backspace;
UP = _rl_term_up; UP = (char*)_rl_term_up;
if (!_rl_term_cr) if (!_rl_term_cr)
_rl_term_cr = (char*)"\r"; _rl_term_cr = "\r";
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn"); _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
...@@ -500,7 +501,7 @@ bind_termcap_arrow_keys (map) ...@@ -500,7 +501,7 @@ bind_termcap_arrow_keys (map)
_rl_keymap = xkeymap; _rl_keymap = xkeymap;
} }
char * const char *
rl_get_termcap (cap) rl_get_termcap (cap)
const char *cap; const char *cap;
{ {
......
...@@ -1132,11 +1132,11 @@ int ...@@ -1132,11 +1132,11 @@ int
rl_insert_comment (count, key) rl_insert_comment (count, key)
int count __attribute__((unused)), key; int count __attribute__((unused)), key;
{ {
char *rl_comment_text; const char *rl_comment_text;
int rl_comment_len; int rl_comment_len;
rl_beg_of_line (1, key); rl_beg_of_line (1, key);
rl_comment_text = (char*)(_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT); rl_comment_text = _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT;
if (rl_explicit_arg == 0) if (rl_explicit_arg == 0)
rl_insert_text (rl_comment_text); rl_insert_text (rl_comment_text);
......
...@@ -190,7 +190,7 @@ tilde_expand (string) ...@@ -190,7 +190,7 @@ tilde_expand (string)
int result_size, result_index; int result_size, result_index;
result_index = result_size = 0; result_index = result_size = 0;
if ((result = (char*)strchr(string, '~'))) if ((result = strchr(string, '~')))
result = (char *)xmalloc (result_size = (strlen (string) + 16)); result = (char *)xmalloc (result_size = (strlen (string) + 16));
else else
result = (char *)xmalloc (result_size = (strlen (string) + 1)); result = (char *)xmalloc (result_size = (strlen (string) + 1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment