From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57523 invoked by alias); 15 Apr 2019 12:22:58 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 57487 invoked by uid 9078); 15 Apr 2019 12:22:58 -0000 Date: Mon, 15 Apr 2019 12:22:00 -0000 Message-ID: <20190415122258.57485.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix definition of write() to use const char * for the type of the buffer X-Act-Checkin: newlib-cygwin X-Git-Author: Jozef Lawrynowicz X-Git-Refname: refs/heads/master X-Git-Oldrev: 204efa6bbac2b355c65818100414c3ce2cda2a9e X-Git-Newrev: a2e81650d159d539d078194fa88f297b4fde77e5 X-SW-Source: 2019-q2/txt/msg00005.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a2e81650d159d539d078194fa88f297b4fde77e5 commit a2e81650d159d539d078194fa88f297b4fde77e5 Author: Jozef Lawrynowicz Date: Fri Apr 12 11:49:11 2019 +0100 Fix definition of write() to use const char * for the type of the buffer Diff: --- libgloss/msp430/write.c | 9 +++++---- 1 file 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 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; }