mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-24 19:36:52 +03:00
make the verbatim and escape sequence input routines use size_t's to
hold lengths, and use a properly cast nrealloc() instead of an uncast realloc() in the former git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1717 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
45108343c8
commit
805547fed0
12
ChangeLog
12
ChangeLog
@ -14,6 +14,10 @@ CVS code -
|
||||
- nano.c:
|
||||
do_delete()
|
||||
- Tweak for efficiency. (David Benbennick)
|
||||
do_verbatim_kbinput()
|
||||
- Use size_t's instead of ints for the get_verbatim_kbinput()
|
||||
call and the loop that ungetch()es its returned int*,
|
||||
respectively. (DLR)
|
||||
- proto.h:
|
||||
- Remove unused add_marked_sameline() prototype. (DLR)
|
||||
- rcfile.c:
|
||||
@ -39,6 +43,14 @@ CVS code -
|
||||
- Refactor the output in the DEBUG #ifdef. It didn't work
|
||||
properly ever since this function was changed to use an int*
|
||||
instead of a char*. (DLR)
|
||||
- Change kbinput_len from an int* to a size_t*, since it should
|
||||
never be negative. (DLR)
|
||||
- When reading characters from input, properly reallocate
|
||||
verbatim_kbinput via (int*)nrealloc() instead of an uncast
|
||||
realloc(). (DLR)
|
||||
get_escape_seq_kbinput()
|
||||
- Change escape_seq_len from an int to a size_t, since it should
|
||||
never be negative. (DLR)
|
||||
edit_refresh()
|
||||
- Remove apparently unneeded leaveok() calls. (David Benbennick)
|
||||
- nano.texi:
|
||||
|
@ -998,8 +998,8 @@ void do_char(char ch)
|
||||
int do_verbatim_input(void)
|
||||
{
|
||||
int *verbatim_kbinput; /* Used to hold verbatim input. */
|
||||
int verbatim_len; /* Length of verbatim input. */
|
||||
int i;
|
||||
size_t verbatim_len; /* Length of verbatim input. */
|
||||
size_t i;
|
||||
|
||||
statusbar(_("Verbatim input"));
|
||||
verbatim_kbinput = get_verbatim_kbinput(edit, &verbatim_len, 1);
|
||||
|
@ -452,12 +452,12 @@ int check_wildcard_match(const char *text, const char *pattern);
|
||||
|
||||
/* Public functions in winio.c */
|
||||
int get_kbinput(WINDOW *win, int *meta_key);
|
||||
int *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, int
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len, int
|
||||
allow_ascii);
|
||||
int get_ignored_kbinput(WINDOW *win);
|
||||
int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key);
|
||||
int get_ascii_kbinput(WINDOW *win, int kbinput);
|
||||
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, int
|
||||
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||
escape_seq_len);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, int shortcut);
|
||||
|
@ -65,7 +65,7 @@ int get_kbinput(WINDOW *win, int *meta_key)
|
||||
/* Read in a string of input characters (e.g. an escape sequence)
|
||||
* verbatim, and return the length of the string in kbinput_len. Assume
|
||||
* nodelay(win) is FALSE. */
|
||||
int *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, int
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len, int
|
||||
allow_ascii)
|
||||
{
|
||||
int kbinput, *verbatim_kbinput;
|
||||
@ -101,7 +101,7 @@ int *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, int
|
||||
#endif
|
||||
while ((kbinput = wgetch(win)) != ERR) {
|
||||
(*kbinput_len)++;
|
||||
verbatim_kbinput = realloc(verbatim_kbinput, *kbinput_len * sizeof(int));
|
||||
verbatim_kbinput = (int *)nrealloc(verbatim_kbinput, *kbinput_len * sizeof(int));
|
||||
verbatim_kbinput[*kbinput_len - 1] = kbinput;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_verbatim_kbinput(): kbinput = %d\n", kbinput);
|
||||
@ -196,7 +196,8 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key)
|
||||
* Hemel. */
|
||||
case '[':
|
||||
{
|
||||
int old_kbinput = kbinput, *escape_seq, escape_seq_len;
|
||||
int old_kbinput = kbinput, *escape_seq;
|
||||
size_t escape_seq_len;
|
||||
nodelay(win, TRUE);
|
||||
kbinput = wgetch(win);
|
||||
switch (kbinput) {
|
||||
@ -371,7 +372,7 @@ int get_ascii_kbinput(WINDOW *win, int kbinput)
|
||||
* omitted. (Same as above.)
|
||||
* - The Hurd console has no escape sequences for F11, F12, F13, or
|
||||
* F14. */
|
||||
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, int
|
||||
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||
escape_seq_len)
|
||||
{
|
||||
int kbinput = ERR;
|
||||
|
Loading…
Reference in New Issue
Block a user