unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* srfi-4.c: arithmetic on void pointers
@ 2006-03-06  1:26 Mike Gran
  2006-03-11 12:26 ` Neil Jerram
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Gran @ 2006-03-06  1:26 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: srfi-4.c: arithmetic on void pointers
  2006-03-06  1:26 srfi-4.c: arithmetic on void pointers Mike Gran
@ 2006-03-11 12:26 ` Neil Jerram
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Jerram @ 2006-03-11 12:26 UTC (permalink / raw)
  Cc: bug-guile

Mike Gran <spk121@yahoo.com> writes:

> 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.

Thanks.  I changed the declarations from void* to char*, as I think
that's a little neater than your patch.

       Neil



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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-11 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-06  1:26 srfi-4.c: arithmetic on void pointers Mike Gran
2006-03-11 12:26 ` Neil Jerram

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).