harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r666325 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
Date Tue, 10 Jun 2008 21:06:58 GMT
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;
   }
 
   /**



Mime
View raw message