unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mike Gran <spk121@yahoo.com>
Subject: srfi-4.c: arithmetic on void pointers
Date: Sun, 5 Mar 2006 17:26:05 -0800 (PST)	[thread overview]
Message-ID: <20060306012605.69652.qmail@web32511.mail.mud.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

Hi,

In srfi-4.c, pointer arithmetic on void pointers is done.  This is a
GNU C extension, and I think it is not C99. For non-GCC C, you might
consider a cast to (char *) or something.

The flag -Wpointer-arith catches this in GCC.

Attached is the diff to 1.8.0

Thanks, 

Mike Gran

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[-- Attachment #2: 3143918226-srfi-4.c.patch --]
[-- Type: application/octet-stream, Size: 1182 bytes --]

--- srfi-4.c.0	2006-02-27 17:21:58.000000000 -0800
+++ srfi-4.c	2006-02-27 17:45:07.000000000 -0800
@@ -899,7 +899,7 @@
 	      size_t to_copy = min (pt->read_end - pt->read_pos,
 				    remaining);
 	      
-	      memcpy (base + off, pt->read_pos, to_copy);
+	      memcpy ((char *)base + off, pt->read_pos, to_copy);
 	      pt->read_pos += to_copy;
 	      remaining -= to_copy;
 	      off += to_copy;
@@ -924,7 +924,7 @@
       int fd = scm_to_int (port_or_fd);
       int n;
 
-      SCM_SYSCALL (n = read (fd, base + off, remaining));
+      SCM_SYSCALL (n = read (fd, (char *)base + off, remaining));
       if (n == -1)
 	SCM_SYSERROR;
       if (n % sz != 0)
@@ -998,13 +998,13 @@
 
   if (SCM_NIMP (port_or_fd))
     {
-      scm_lfwrite (base + off, amount, port_or_fd);
+      scm_lfwrite ((char *)base + off, amount, port_or_fd);
       ans = cend - cstart;
     }
   else /* file descriptor.  */
     {
       int fd = scm_to_int (port_or_fd), n;
-      SCM_SYSCALL (n = write (fd, base + off, amount));
+      SCM_SYSCALL (n = write (fd, (char *)base + off, amount));
       if (n == -1)
 	SCM_SYSERROR;
       if (n % sz != 0)

[-- Attachment #3: Type: text/plain, Size: 137 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile

             reply	other threads:[~2006-03-06  1:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-06  1:26 Mike Gran [this message]
2006-03-11 12:26 ` srfi-4.c: arithmetic on void pointers Neil Jerram

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=20060306012605.69652.qmail@web32511.mail.mud.yahoo.com \
    --to=spk121@yahoo.com \
    --cc=spikegran@earthlink.net \
    /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).