diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2019-04-12 11:49:11 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-04-15 14:21:59 +0200 |
commit | a2e81650d159d539d078194fa88f297b4fde77e5 (patch) | |
tree | 4c631f31cc0b52b9d0172a986a96993e2fd2fc4d /libgloss/msp430 | |
parent | 204efa6bbac2b355c65818100414c3ce2cda2a9e (diff) | |
download | newlib-a2e81650d159d539d078194fa88f297b4fde77e5.zip newlib-a2e81650d159d539d078194fa88f297b4fde77e5.tar.gz newlib-a2e81650d159d539d078194fa88f297b4fde77e5.tar.bz2 |
Fix definition of write() to use const char * for the type of the buffer
Diffstat (limited to 'libgloss/msp430')
-rw-r--r-- | libgloss/msp430/write.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libgloss/msp430/write.c b/libgloss/msp430/write.c index 3a5a9f8..3e1086c 100644 --- a/libgloss/msp430/write.c +++ b/libgloss/msp430/write.c @@ -16,7 +16,7 @@ #include "cio.h" static int -write_chunk (int fd, char *buf, int len) +write_chunk (int fd, const char *buf, int len) { __CIOBUF__.length[0] = len; __CIOBUF__.length[1] = len >> 8; @@ -35,10 +35,11 @@ write_chunk (int fd, char *buf, int len) #include <stdio.h> int -write (int fd, char *buf, int len) +write (int fd, const char *buf, int len) { int rv = 0; int c; + int i = 0; #if 0 if (fd == 2) fprintf (stderr, "%.*s", buf, len); @@ -48,12 +49,12 @@ write (int fd, char *buf, int len) while (len > 0) { int l = (len > CIO_BUF_SIZE) ? CIO_BUF_SIZE : len; - c = write_chunk (fd, buf, l); + c = write_chunk (fd, buf + i, l); if (c < 0) return c; rv += l; len -= l; - buf += l; + i += l; } return rv; } |