Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2019-04-12 13:49:11 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-04-15 15:21:59 +0300
commita2e81650d159d539d078194fa88f297b4fde77e5 (patch)
tree4c631f31cc0b52b9d0172a986a96993e2fd2fc4d /libgloss/msp430
parent204efa6bbac2b355c65818100414c3ce2cda2a9e (diff)
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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libgloss/msp430/write.c b/libgloss/msp430/write.c
index 3a5a9f810..3e1086c00 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;
}