tir, 09 02 2010 kl. 12:55 +0100, skrev Olaf Till:
> Seemingly your glibc is more strict than the version on my
> system.

Okay. How about the attached brain-dead patch? It doesn't actually deal
with the situation when we don't read/write the correct number of bytes,
but at least it makes the compiler shut up (if that is a good thing or
not is debatable).

> These warnings are from separate code I didn't write and which
> my functions in "parallel" do not depend on. Since its former
> maintainer is not active, I'm willing to keep this code compatible
> with the evolving Octave (although I tend not to adapt it to the
> development branch),

The code currently doesn't work with the development version of Octave
as 'octave_env::getcwd' has been renamed into
'octave_env::get_current_directory'. I guess we need some configure
check for this. Are there any autoconf magicians on the list the could
come up with such a check? (We need the same check in the 'java'
package)

Søren
Index: sclose.cc
===================================================================
--- sclose.cc	(revision 6919)
+++ sclose.cc	(working copy)
@@ -80,9 +80,9 @@
 	      
 	      if(pollfd[k].revents&POLLIN){
 		pid=getpid();
-		read(pollfd[k].fd,&nl,sizeof(int));
+		const size_t bytes_read = read(pollfd[k].fd,&nl,sizeof(int));
 		error_code=ntohl(nl);
-		write(pollfd[k].fd,&nl,sizeof(int));
+		const size_t bytes_written = write(pollfd[k].fd,&nl,sizeof(int));
 		error("error occurred in %s\n\tsee %s:/tmp/octave_error-%s_%5d.log for detail",hehe->h_name,hehe->h_name,hehe->h_name,pid );
 	      }
 	      if(pollfd[k].revents&POLLERR){
Index: connect.cc
===================================================================
--- connect.cc	(revision 6919)
+++ connect.cc	(working copy)
@@ -50,6 +50,7 @@
 {
 
   int sock=0,col=0,row=0,i,j,len;
+  size_t bytes_read, bytes_written;
   double *sock_v=0;
   if (args.length () == 1)
     {
@@ -114,11 +115,11 @@
 
 	pid=getpid();
 	nl=htonl(num_nodes);
-	write(sock,&nl,sizeof(int));
+	bytes_written = write(sock,&nl,sizeof(int));
 	nl=htonl(i);
-	write(sock,&nl,sizeof(int));
+	bytes_written = write(sock,&nl,sizeof(int));
 	nl=htonl(pid);
-	write(sock,&nl,sizeof(int));
+	bytes_written = write(sock,&nl,sizeof(int));
 
 	host=(char *)calloc(128,sizeof(char));
 	for(j=0;j<row;j++){
@@ -130,16 +131,16 @@
 	    *pt='\0';
 	  len=strlen(host)+1;
 	  nl=htonl(len);
-	  write(sock,&nl,sizeof(int));
-	  write(sock,host,len);
+	  bytes_written = write(sock,&nl,sizeof(int));
+	  bytes_written = write(sock,host,len);
 	}
 	free(host);
 	int comm_len;
        	std::string directory = octave_env::getcwd ();
 	comm_len=directory.length();
 	nl=htonl(comm_len);
-	write(sock,&nl,sizeof(int));
-	write(sock,directory.c_str(),comm_len);
+	bytes_written = write(sock,&nl,sizeof(int));
+	bytes_written = write(sock,directory.c_str(),comm_len);
       }      
       usleep(100);
 
@@ -196,7 +197,7 @@
 	  int len=0,result=0;;
 	  //send pppid
 	  nl=htonl(pid);
-	  write(sock,&nl,sizeof(int));
+	  bytes_written = write(sock,&nl,sizeof(int));
 	  //send name size
 	  strncpy(myname,cm.data(),col);
 	  pt=strchr(myname,' ');
@@ -206,16 +207,16 @@
 	    *pt='\0';
 	  len=strlen(myname);
 	  nl=htonl(len);
-	  write(sock,&nl,sizeof(int));
+	  bytes_written = (sock,&nl,sizeof(int));
 	  //send name
-	  write(sock,myname,len+1);
+	  bytes_written = write(sock,myname,len+1);
 	  //recv result code
-	  read(sock,&nl,sizeof(int));
+	  const size_t bytes_read1 = read(sock,&nl,sizeof(int));
 	  result=ntohl(nl);
 	  if(result==0){
 	    sock_v[i]=sock;
 	    //recv endian
-	    read(sock,&nl,sizeof(int));
+	    const size_t bytes_read1 = read(sock,&nl,sizeof(int));
 	    sock_v[i+2*row]=ntohl(nl);
 	    //send endian
 #if defined (__BYTE_ORDER)
@@ -225,7 +226,7 @@
 #else
 #  error "can not determine the byte order"
 #endif
-	    write(sock,&nl,sizeof(int));
+	    bytes_written = write(sock,&nl,sizeof(int));
 	    break;
 	  }else{
 	    close(sock);
@@ -238,7 +239,7 @@
 
       char lf='\n';
       for(i=1;i<row;i++){
-	write((int)sock_v[i+row],&lf,sizeof(char));
+	bytes_written = write((int)sock_v[i+row],&lf,sizeof(char));
 	//	cout << i+row <<endl;
       }
     }
------------------------------------------------------------------------------
Download Intel&reg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to