summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRyan Long <ryan.long@oarcorp.com>2021-06-08 11:03:53 -0400
committerJoel Sherrill <joel@rtems.org>2021-06-09 11:52:24 -0500
commit4127a6c056df34623c5ab8cb9043c6d16e9dcb8b (patch)
tree1392b9f1b0c058fcb7f513e02465a228e3e1fb44 /cpukit
parent8299b79d66a9f8e4be5131597bb56484c314e70f (diff)
downloadrtems-4127a6c056df34623c5ab8cb9043c6d16e9dcb8b.tar.bz2
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'.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libmisc/shell/main_edit.c16
1 files 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;