You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2008/06/10 23:06:58 UTC

svn commit: r666325 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c

Author: hindessm
Date: Tue Jun 10 14:06:58 2008
New Revision: 666325

URL: http://svn.apache.org/viewvc?rev=666325&view=rev
Log:
Fix two compiler warnings and make the code slightly more efficient.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=666325&r1=666324&r2=666325&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Tue Jun 10 14:06:58 2008
@@ -467,12 +467,12 @@
    jint count)
 {
   PORT_ACCESS_FROM_ENV(env);
-  hysocket_t socketP;
   jbyte *message = (jbyte *) address;
   I_32 result = 0, sent = 0;
 
   if (sent < count) {
-    socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+    hysocket_t socketP =
+        getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
     if (!hysock_socketIsValid(socketP)) {
       throwJavaNetSocketException(env,
                                   sent ==0 ?
@@ -480,16 +480,16 @@
                                     HYPORT_ERROR_SOCKET_INTERRUPTED);
       return (jint) 0;
     }
-  }
 
-  while (sent < count) {
-    result =
-      hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
-                   HYSOCK_NOFLAGS);
-    if (result < 0) {
-      break;
+    while (sent < count) {
+      result =
+        hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
+                     HYSOCK_NOFLAGS);
+      if (result < 0) {
+        break;
+      }
+      sent += result;
     }
-    sent += result;
   }
 
   /**