From 4127a6c056df34623c5ab8cb9043c6d16e9dcb8b Mon Sep 17 00:00:00 2001 From: Ryan Long Date: Tue, 8 Jun 2021 11:03:53 -0400 Subject: main_edit.c: get rid of malloc warning A warning was present when building RTEMS that stated that the argument for malloc() exceeded the maximum object size. To get rid of this, I changed many places where 'int' was being used to 'size_t'. --- cpukit/libmisc/shell/main_edit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index 8ac7eeea5b..ed1371f7fa 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -684,7 +684,7 @@ static void moveto(struct editor *ed, int pos, int center) { // Text selection // -static int get_selection(struct editor *ed, int *start, int *end) { +static int get_selection(struct editor *ed, size_t *start, size_t *end) { if (ed->anchor == -1) { *start = *end = -1; return 0; @@ -705,7 +705,7 @@ static int get_selection(struct editor *ed, int *start, int *end) { } static int get_selected_text(struct editor *ed, char *buffer, int size) { - int selstart, selend, len; + size_t selstart, selend, len; if (!get_selection(ed, &selstart, &selend)) return 0; len = selend - selstart; @@ -726,7 +726,7 @@ static void update_selection(struct editor *ed, int select) { } static int erase_selection(struct editor *ed) { - int selstart, selend; + size_t selstart, selend; if (!get_selection(ed, &selstart, &selend)) return 0; moveto(ed, selstart, 0); @@ -1086,7 +1086,7 @@ static void display_line(struct editor *ed, int pos, int fullline) { int maxcol = ed->env->cols + margin; unsigned char *bufptr = ed->env->linebuf; unsigned char *p = text_ptr(ed, pos); - int selstart, selend, ch; + size_t selstart, selend, ch; char *s; (void) get_selection(ed, &selstart, &selend); @@ -1545,9 +1545,9 @@ static void del(struct editor *ed) { } static void indent(struct editor *ed, unsigned char *indentation) { - int start, end, i, lines, toplines, newline, ch; + size_t start, end, i, lines, toplines, newline, ch; unsigned char *buffer, *p; - int buflen; + size_t buflen; int width = strlen((const char*) indentation); int pos = ed->linepos + ed->col; @@ -1602,7 +1602,7 @@ static void indent(struct editor *ed, unsigned char *indentation) { } static void unindent(struct editor *ed, unsigned char *indentation) { - int start, end, i, newline, ch, shrinkage, topofs; + size_t start, end, i, newline, ch, shrinkage, topofs; unsigned char *buffer, *p; int width = strlen((const char*) indentation); int pos = ed->linepos + ed->col; @@ -1686,7 +1686,7 @@ static void redo(struct editor *ed) { // static void copy_selection(struct editor *ed) { - int selstart, selend; + size_t selstart, selend; if (!get_selection(ed, &selstart, &selend)) return; ed->env->clipsize = selend - selstart; -- cgit v1.2.3