more bug fixes
[IRC.git] / Robust / src / Runtime / socket.c
index f06476bde29886a98770790881e00a9602bd5392..7ced4ce3775162f95e16ef702c90360cf6893359 100644 (file)
@@ -43,8 +43,8 @@ int CALL24(___Socket______nativeConnect____I__AR_B_I, int ___fd___, int ___port_
 #endif
 
   {
-  int flag = 1;
-  setsockopt(___fd___, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(flag));
+    int flag = 1;
+    setsockopt(___fd___, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(flag));
   }
   if (rc<0) goto error;
 
@@ -67,7 +67,7 @@ error:
 
 #ifdef TASK
 #ifdef D___Socket______nativeBindFD____I
-int CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ * ___this___, int ___fd___) {
+void CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ * ___this___, int ___fd___) {
 #ifdef MULTICORE
 #else
   if (RuntimeHashcontainskey(fdtoobject, ___fd___))
@@ -75,7 +75,6 @@ int CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ *
   RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___));
   addreadfd(___fd___);
 #endif
-  return 0;
 }
 #endif
 #endif
@@ -160,36 +159,36 @@ struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct A
   h=gethostbyname(str);
   free(str);
 
-       if (h != NULL) {
-               for (n=0; h->h_addr_list[n]; n++) /* do nothing */ ;
+  if (h != NULL) {
+    for (n=0; h->h_addr_list[n]; n++) /* do nothing */;
 
 #ifdef PRECISE_GC
-  arraybytearray=allocate_newarray(___params___,BYTEARRAYARRAYTYPE,n);
+    arraybytearray=allocate_newarray(___params___,BYTEARRAYARRAYTYPE,n);
 #else
-  arraybytearray=allocate_newarray(BYTEARRAYARRAYTYPE,n);
+    arraybytearray=allocate_newarray(BYTEARRAYARRAYTYPE,n);
 #endif
-  for(i=0; i<n; i++) {
-    struct ArrayObject *bytearray;
+    for(i=0; i<n; i++) {
+      struct ArrayObject *bytearray;
 #ifdef PRECISE_GC
-    {
-      INTPTR ptrarray[]={1, (INTPTR) ___params___, (INTPTR)arraybytearray};
-      bytearray=allocate_newarray(&ptrarray,BYTEARRAYTYPE,h->h_length);
-      arraybytearray=(struct ArrayObject *) ptrarray[2];
-    }
+      {
+        INTPTR ptrarray[]={1, (INTPTR) ___params___, (INTPTR)arraybytearray};
+        bytearray=allocate_newarray(&ptrarray,BYTEARRAYTYPE,h->h_length);
+        arraybytearray=(struct ArrayObject *) ptrarray[2];
+      }
 #else
-    bytearray=allocate_newarray(BYTEARRAYTYPE,h->h_length);
+      bytearray=allocate_newarray(BYTEARRAYTYPE,h->h_length);
 #endif
-    ((void **)&((&arraybytearray->___length___)[1]))[i]=bytearray;
-    {
-      int ha=ntohl(*(int *)h->h_addr_list[i]);
-      (&bytearray->___length___)[1]=ha;
+      ((void **)&((&arraybytearray->___length___)[1]))[i]=bytearray;
+      {
+        int ha=ntohl(*(int *)h->h_addr_list[i]);
+        (&bytearray->___length___)[1]=ha;
+      }
     }
-  }
 
-  return arraybytearray;
-       } else {
-               return NULL;
-       }
+    return arraybytearray;
+  } else {
+    return NULL;
+  }
 #endif
 }
 #endif
@@ -368,7 +367,7 @@ void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, str
     while(length>0) {
       bytewritten=write(fd, &charstr[offset], length);
       if (bytewritten==-1&&errno!=EAGAIN)
-       break;
+        break;
       length-=bytewritten;
       offset+=bytewritten;
     }