Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Errors compiling on HP-UX with HP's compiler



I must be using gcc more often than not to have just run across this.
HP's compiler, I think rightly, refuses to do arithmetic on these two
void pointers.  Does gcc treat them as char * for that purpose?
The casts can obviously be done without.

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.251
diff -u -r1.251 utils.c
--- Src/utils.c 6 Dec 2010 19:34:33 -0000       1.251
+++ Src/utils.c 20 Dec 2010 03:41:01 -0000
@@ -2272,12 +2272,12 @@

 /**/
 mod_export ssize_t
-read_loop(int fd, void *buf, size_t len)
+read_loop(int fd, char *buf, size_t len)
 {
     ssize_t got = len;

     while (1) {
-       ssize_t ret = read(fd, buf, len);
+       ssize_t ret = read(fd, (void *) buf, len);
        if (ret == len)
            break;
        if (ret <= 0) {
@@ -2298,12 +2298,12 @@

 /**/
 mod_export ssize_t
-write_loop(int fd, const void *buf, size_t len)
+write_loop(int fd, const char *buf, size_t len)
 {
     ssize_t wrote = len;

     while (1) {
-       ssize_t ret = write(fd, buf, len);
+       ssize_t ret = write(fd, (void *) buf, len);
        if (ret == len)
            break;
        if (ret < 0) {
@@ -2407,7 +2407,7 @@
        zbeep();
     }
     if (c >= 0)
-       write_loop(SHTTY, &c, 1);
+       write_loop(SHTTY, (char *) &c, 1);
     if (nl)
        write_loop(SHTTY, "\n", 1);



Messages sorted by: Reverse Date, Date, Thread, Author