* 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 <roland.illig@gmx.de>
This commit is contained in:
Pavel Roskin 2005-05-10 23:04:32 +00:00
parent e56462d992
commit 071f70d0e9
3 changed files with 20 additions and 15 deletions

View File

@ -1,5 +1,10 @@
2005-05-10 Pavel Roskin <proski@gnu.org> 2005-05-10 Pavel Roskin <proski@gnu.org>
* 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 <roland.illig@gmx.de>
* *.c: Remove duplicate includes. * *.c: Remove duplicate includes.
2005-05-03 Pavel Roskin <proski@gnu.org> 2005-05-03 Pavel Roskin <proski@gnu.org>

View File

@ -37,8 +37,8 @@ struct WEdit {
/* dynamic buffers and cursor position for editor: */ /* dynamic buffers and cursor position for editor: */
long curs1; /* position of the cursor from the beginning of the file. */ long curs1; /* position of the cursor from the beginning of the file. */
long curs2; /* position from the end of the file */ long curs2; /* position from the end of the file */
char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */ unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */ unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
/* search variables */ /* search variables */
long search_start; /* First character to start searching from */ long search_start; /* First character to start searching from */

View File

@ -58,8 +58,8 @@
#define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f) #define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f)
struct selection { struct selection {
char *text; unsigned char * text;
int len; int len;
}; };
/* globals: */ /* globals: */
@ -2716,16 +2716,14 @@ edit_collect_completions (WEdit *edit, long start, int word_len,
int *num) int *num)
{ {
int len, max_len = 0, i, skip; int len, max_len = 0, i, skip;
char *bufpos; unsigned char *bufpos;
/* collect max MAX_WORD_COMPLETIONS completions */ /* collect max MAX_WORD_COMPLETIONS completions */
while (*num < MAX_WORD_COMPLETIONS) { while (*num < MAX_WORD_COMPLETIONS) {
/* get next match */ /* get next match */
start = start =
edit_find (start - 1, (unsigned char *) match_expr, &len, edit_find (start - 1, (unsigned char *) match_expr, &len,
edit->last_byte, edit->last_byte, edit_get_byte, (void *) edit, 0);
edit_get_byte,
(void *) edit, 0);
/* not matched */ /* not matched */
if (start < 0) if (start < 0)
@ -2738,8 +2736,10 @@ edit_collect_completions (WEdit *edit, long start, int word_len,
skip = 0; skip = 0;
for (i = 0; i < *num; i++) { for (i = 0; i < *num; i++) {
if (strncmp if (strncmp
(&compl[i].text[word_len], &bufpos[word_len], ((char *) &compl[i].text[word_len],
max (len, compl[i].len) - word_len) == 0) { (char *) &bufpos[word_len], max (len,
compl[i].len) -
word_len) == 0) {
skip = 1; skip = 1;
break; /* skip it, already added */ 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 */ /* let the user select its preferred completion */
static void 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) struct selection *compl, int num_compl)
{ {
int start_x, start_y, offset, i; int start_x, start_y, offset, i;
char *curr = NULL; char *curr = NULL;
Dlg_head *compl_dlg; Dlg_head *compl_dlg;
WListbox *compl_list; WListbox *compl_list;
int compl_dlg_h; /* completion dialog height */ int compl_dlg_h; /* completion dialog height */
int compl_dlg_w; /* completion dialog width */ int compl_dlg_w; /* completion dialog width */
/* calculate the dialog metrics */ /* calculate the dialog metrics */
compl_dlg_h = num_compl + 2; 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 */ /* fill the listbox with the completions */
for (i = 0; i < num_compl; i++) 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 */ /* pop up the dialog */
run_dlg (compl_dlg); run_dlg (compl_dlg);
@ -2836,7 +2836,7 @@ edit_complete_word_cmd (WEdit *edit)
{ {
int word_len = 0, i, num_compl = 0, max_len; int word_len = 0, i, num_compl = 0, max_len;
long word_start = 0; long word_start = 0;
char *bufpos; unsigned char *bufpos;
char *match_expr; char *match_expr;
struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */ struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */