harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r694187 - in /harmony/enhanced/classlib/trunk/modules: luni/src/main/native/luni/windows/OSNetworkSystemWin32.c portlib/src/main/native/port/windows/hysock.c
Date Thu, 11 Sep 2008 09:15:25 GMT
Author: tellison
Date: Thu Sep 11 02:15:23 2008
New Revision: 694187

URL: http://svn.apache.org/viewvc?rev=694187&view=rev
Log:
Fix bogus computation of 'size' value found by HARMONY-5976 ([classlib] Results of static
analysis).
The 'size' is ignored by Windows socket select() API anyway, so just pass in a constant.
Updating the comment in the Windows implementation of the portlib function to show the parameter
is ignored.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hysock.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=694187&r1=694186&r2=694187&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
Thu Sep 11 02:15:23 2008
@@ -41,7 +41,6 @@
   PORT_ACCESS_FROM_ENV (env);
   hytimeval_struct timeP;	
   I_32 result =	0;		
-  I_32 size = 0;		
   jobject gotFD;		
   hyfdset_t fdset_read,fdset_write;
   hysocket_t hysocketP;		
@@ -63,18 +62,14 @@
 
 	  if (!hysock_socketIsValid (hysocketP)){
       		continue;
-    	  }
+      }
 	 if (hysocketP->flags &	SOCKET_IPV4_OPEN_MASK)
 	 {
 		FD_SET (hysocketP->ipv4, &fdset_read->handle);
-		if (0 >	(size -	hysocketP->ipv4))
-			size = hysocketP->ipv4;	
 	 }
 	 if (hysocketP->flags &	SOCKET_IPV6_OPEN_MASK)
 	 {
 		FD_SET (hysocketP->ipv6, &fdset_read->handle);
-		if (0 >	(size -	hysocketP->ipv6))
-			size = hysocketP->ipv6;	
 	 }
 	}
   for (val = 0; val<countWriteC; val++){
@@ -88,34 +83,21 @@
 	 if (hysocketP->flags &	SOCKET_IPV4_OPEN_MASK)
 	 {
 		FD_SET (hysocketP->ipv4, &fdset_write->handle);	
-		if (0 >	(size -	hysocketP->ipv4))
-			size = hysocketP->ipv4;	
 	 }
 	 if (hysocketP->flags &	SOCKET_IPV6_OPEN_MASK)
 	 {
 		FD_SET (hysocketP->ipv6, &fdset_write->handle);	
-		if (0 >	(size -	hysocketP->ipv6))
-			size = hysocketP->ipv6;	
 	 }
 	}
-  /* the size is the max_fd + 1	*/
-  size =size + 1;
 
-  if (0	> size)	
-    {
-      result = HYPORT_ERROR_SOCKET_FDSET_SIZEBAD;
-    }
-  else
-    {
-      /* only set when timeout >= 0 (non-block)*/
-      if (0 <= timeout){      	
-		hysock_timeval_init ( time_sec, time_msec, &timeP);
-		result = hysock_select (size, fdset_read, fdset_write, NULL,&timeP);
-      }	
-      else{        
-		result = hysock_select (size, fdset_read, fdset_write, NULL,NULL);
-      }	
-    }
+  /* only set when timeout >= 0 (non-block)*/
+  if (0 <= timeout){      	
+     hysock_timeval_init ( time_sec, time_msec, &timeP);
+     result = hysock_select (0, fdset_read, fdset_write, NULL, &timeP);
+  }	
+  else{        
+     result = hysock_select (0, fdset_read, fdset_write, NULL,NULL);
+  }	
     
   if (0	< result){
 	  /*output the reslut to a int array*/
@@ -183,7 +165,7 @@
   hytimeval_struct timeP;
   hyfdset_t fdset_read;
   I_32 result = 0;
-  I_32 size = 0;
+
   if (0 <= uSecTime)
     hysock_timeval_init (0, uSecTime, &timeP);
 
@@ -192,17 +174,15 @@
   if (hysocketP->flags & SOCKET_IPV4_OPEN_MASK)
     {
       FD_SET (hysocketP->ipv4, &fdset_read->handle);
-      size =hysocketP->ipv4 + 1;
     }
   if (hysocketP->flags & SOCKET_IPV6_OPEN_MASK)
     {
       FD_SET (hysocketP->ipv6, &fdset_read->handle);
-      size =hysocketP->ipv6 + 1;
     }
   if (0 <= uSecTime)
-    result = hysock_select (size, fdset_read, NULL, NULL,&timeP);  
+    result = hysock_select (0, fdset_read, NULL, NULL,&timeP);  
   else
-    result = hysock_select (size, fdset_read, NULL, NULL,NULL);  
+    result = hysock_select (0, fdset_read, NULL, NULL,NULL);  
   hymem_free_memory(fdset_read);
   return result;
 }

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hysock.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hysock.c?rev=694187&r1=694186&r2=694187&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hysock.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hysock.c
Thu Sep 11 02:15:23 2008
@@ -2597,7 +2597,7 @@
  * \arg null, block indefinitely for a ready descriptor
  *
  * @param[in] portLibrary The port library.
- * @param[in] nfds Maximum number of file descriptors to be tested.
+ * @param[in] nfds Maximum number of file descriptors to be tested.  Ignored by Windows Socket
API.
  * @param[in] readfds Tthe set of descriptors to be checked if ready for read operations.
  * @param[in] writefds The set of descriptors to be checked if ready for write operations.
  * @param[in] exceptfds The set of descriptors to be checked for exceptional conditions.



Mime
View raw message