public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Fix definition of write() to use const char * for the type of the buffer
Date: Mon, 15 Apr 2019 12:22:00 -0000	[thread overview]
Message-ID: <20190415122258.57485.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a2e81650d159d539d078194fa88f297b4fde77e5

commit a2e81650d159d539d078194fa88f297b4fde77e5
Author: Jozef Lawrynowicz <jozef.l@mittosystems.com>
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 <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;
 }


                 reply	other threads:[~2019-04-15 12:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190415122258.57485.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).