From 071f70d0e981437c15dff47246e018547cc2453b Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 10 May 2005 23:04:32 +0000 Subject: [PATCH] * edit-widget.h: Revert signedness fixes. We need unsigned char for character classification. * editcmd.c: Likewise. Use casts to suppress warnings instead. Thanks to Roland Illig --- edit/ChangeLog | 5 +++++ edit/edit-widget.h | 4 ++-- edit/editcmd.c | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index 6793823b8..a66e9b27b 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,5 +1,10 @@ 2005-05-10 Pavel Roskin + * edit-widget.h: Revert signedness fixes. We need unsigned char + for character classification. + * editcmd.c: Likewise. Use casts to suppress warnings instead. + Thanks to Roland Illig + * *.c: Remove duplicate includes. 2005-05-03 Pavel Roskin diff --git a/edit/edit-widget.h b/edit/edit-widget.h index c74c300f1..c4ecf6648 100644 --- a/edit/edit-widget.h +++ b/edit/edit-widget.h @@ -37,8 +37,8 @@ struct WEdit { /* dynamic buffers and cursor position for editor: */ long curs1; /* position of the cursor from the beginning of the file. */ long curs2; /* position from the end of the file */ - char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */ - char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */ + unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */ + unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */ /* search variables */ long search_start; /* First character to start searching from */ diff --git a/edit/editcmd.c b/edit/editcmd.c index 07847e15f..be1f4780d 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -58,8 +58,8 @@ #define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f) struct selection { - char *text; - int len; + unsigned char * text; + int len; }; /* globals: */ @@ -2716,16 +2716,14 @@ edit_collect_completions (WEdit *edit, long start, int word_len, int *num) { int len, max_len = 0, i, skip; - char *bufpos; + unsigned char *bufpos; /* collect max MAX_WORD_COMPLETIONS completions */ while (*num < MAX_WORD_COMPLETIONS) { /* get next match */ start = edit_find (start - 1, (unsigned char *) match_expr, &len, - edit->last_byte, - edit_get_byte, - (void *) edit, 0); + edit->last_byte, edit_get_byte, (void *) edit, 0); /* not matched */ if (start < 0) @@ -2738,8 +2736,10 @@ edit_collect_completions (WEdit *edit, long start, int word_len, skip = 0; for (i = 0; i < *num; i++) { if (strncmp - (&compl[i].text[word_len], &bufpos[word_len], - max (len, compl[i].len) - word_len) == 0) { + ((char *) &compl[i].text[word_len], + (char *) &bufpos[word_len], max (len, + compl[i].len) - + word_len) == 0) { skip = 1; break; /* skip it, already added */ } @@ -2764,15 +2764,15 @@ edit_collect_completions (WEdit *edit, long start, int word_len, /* let the user select its preferred completion */ static void -edit_completion_dialog (WEdit *edit, int max_len, int word_len, +edit_completion_dialog (WEdit * edit, int max_len, int word_len, struct selection *compl, int num_compl) { int start_x, start_y, offset, i; char *curr = NULL; Dlg_head *compl_dlg; WListbox *compl_list; - int compl_dlg_h; /* completion dialog height */ - int compl_dlg_w; /* completion dialog width */ + int compl_dlg_h; /* completion dialog height */ + int compl_dlg_w; /* completion dialog width */ /* calculate the dialog metrics */ compl_dlg_h = num_compl + 2; @@ -2809,7 +2809,7 @@ edit_completion_dialog (WEdit *edit, int max_len, int word_len, /* fill the listbox with the completions */ for (i = 0; i < num_compl; i++) - listbox_add_item (compl_list, 0, 0, compl[i].text, NULL); + listbox_add_item (compl_list, 0, 0, (char *) compl[i].text, NULL); /* pop up the dialog */ run_dlg (compl_dlg); @@ -2836,7 +2836,7 @@ edit_complete_word_cmd (WEdit *edit) { int word_len = 0, i, num_compl = 0, max_len; long word_start = 0; - char *bufpos; + unsigned char *bufpos; char *match_expr; struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */