On May 19, "Mike Hunter" wrote:

> On May 19, "Roger Weeks" wrote:
> 
> > Greetings -
> > 
> > I'm attempting to compile flow-tools on a fedora core 4 test (yes, I  
> > know it's a test release.  it's a long story) and I get the following  
> > from make:
> > 
> > Making all in lib
> > make[1]: Entering directory `/var/netflow/installs/flow-tools-0.68/lib'
> > make  all-am
> > make[2]: Entering directory `/var/netflow/installs/flow-tools-0.68/lib'
> > source='ftio.c' object='ftio.o' libtool=no \
> > depfile='.deps/ftio.Po' tmpdepfile='.deps/ftio.TPo' \
> > depmode=gcc3 /bin/sh ../depcomp \
> > gcc -I. -I./lib -I. -I. -I.    -g -Wall -g -Wall -c `test -f 'ftio.c'  
> > || echo './'`ftio.c
> > ftio.c: In function 'readn':
> > ftio.c:2270: error: invalid lvalue in assignment
> > ftio.c: In function 'writen':
> > ftio.c:2295: error: invalid lvalue in assignment
> > make[2]: *** [ftio.o] Error 1
> > make[2]: Leaving directory `/var/netflow/installs/flow-tools-0.68/lib'
> > make[1]: *** [all] Error 2
> > make[1]: Leaving directory `/var/netflow/installs/flow-tools-0.68/lib'
> > make: *** [all-recursive] Error 1
> > 
> > I get the same results from 0.66 or 0.68 compiles.
> > This is gcc verison 4.0.0.
> > 
> > Can anyone tell me if this is even possible?
> 
> The line in question is:
> 
> (char*)ptr += nread;
> 
> Try changing it to this:
> 
> ptr = (void*)( ((char*)ptr) + nread);
> 
> Same story for the other line.
> 
> I don't have access to gcc4 so I can't test it.

Roger and I worked a bunch of these out and came up with a patch (attached).

Mike
diff -u -r ./lib/ftchash.c ./lib/ftchash.c
--- ./lib/ftchash.c     Thu May 19 10:15:21 2005
+++ ./lib/ftchash.c     Thu May 19 10:18:31 2005
@@ -326,7 +326,7 @@
       (char*)ftch->traverse_chunk->base+ftch->traverse_chunk->next) {
 
       ret = ftch->traverse_rec;
-      (char*)ftch->traverse_rec += ftch->d_size;
+      ftch->traverse_rec = (void*)( ((char*)ftch->traverse_rec) + 
ftch->d_size);
       return ret;
 
     } else {
diff -u -r ./lib/ftio.c ./lib/ftio.c
--- ./lib/ftio.c        Thu May 19 10:15:21 2005
+++ ./lib/ftio.c        Thu May 19 10:18:44 2005
@@ -2267,7 +2267,7 @@
         break;
 
       nleft -= nread;
-      (char*)ptr += nread;
+      ptr = (void*)( ((char*)ptr) + nread);
   }
   return (nbytes - nleft);
 } /* readn */
@@ -2292,7 +2292,7 @@
       return(nwritten); /* error */
 
     nleft -= nwritten;
-    (char*)ptr += nwritten;
+    ptr = (void*)( ((char*)ptr) + nwritten);
   }
   return(nbytes - nleft);
 } /* writen */
diff -u -r ./lib/fttlv.c ./lib/fttlv.c
--- ./lib/fttlv.c       Thu May 19 10:15:21 2005
+++ ./lib/fttlv.c       Thu May 19 10:18:55 2005
@@ -68,10 +68,10 @@
   }
 
   bcopy(&t, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&len, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&v, buf, 4);
 
@@ -107,10 +107,10 @@
   }
 
   bcopy(&t, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&len, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&v, buf, 2);
 
@@ -145,10 +145,10 @@
   }
 
   bcopy(&t, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&len, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&v, buf, 1);
 
@@ -183,10 +183,10 @@
   }
 
   bcopy(&t, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&len, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(v, buf, len);
 
@@ -230,16 +230,16 @@
     return -1;
 
   bcopy(&t, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&len, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&ip, buf, 4);
-  (char*)buf += 4;
+  buf = (void*)( ((char*)buf) + 4);
 
   bcopy(&ifIndex, buf, 2);
-  (char*)buf += 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(name, buf, n);
 
@@ -287,19 +287,19 @@
   }
 
   bcopy(&t, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&len, buf, 2);
-  (char*)buf+= 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(&ip, buf, 4);
-  (char*)buf += 4;
+  buf = (void*)( ((char*)buf) + 4);
 
   bcopy(&entries, buf, 2);
-  (char*)buf += 2;
+  buf = (void*)( ((char*)buf) + 2);
 
   bcopy(ifIndex_list, buf, esize);
-  (char*)buf += esize;
+  buf = (void*)( ((char*)buf) + esize);
 
   bcopy(name, buf, n);
 
_______________________________________________
Flow-tools mailing list
[EMAIL PROTECTED]
http://mailman.splintered.net/mailman/listinfo/flow-tools

Reply via email to