Bugzilla bug 276170: fixed unused variable addrp on some platforms. NSPRPUB_PRE_4_2_CLIENT_BRANCH
authorwtchang%redhat.com
Tue, 04 Jan 2005 21:29:17 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 3240 863632e76acfdb80cab9c1e98ca004468eb5f360
parent 3239 7580499d4332ec53c07af1fdf3d1564291747903
child 3241 0636bcfe59d5521bfa6f56e1896ec7450416378b
child 3242 d08d98088d93df09351bddc50f2eae650dc3627e
child 3244 fd650ce6daa29e2012e1f12d16554b67c0f32f78
push idunknown
push userunknown
push dateunknown
bugs276170
Bugzilla bug 276170: fixed unused variable addrp on some platforms. Fixed the bug that addr rather than addrp was used. r=timeless,darin. Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
pr/src/pthreads/ptio.c
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -1577,33 +1577,28 @@ static PRStatus pt_Connect(
 #endif
 	}
 #endif
 
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
-    rv = connect(fd->secret->md.osfd, (struct sockaddr*)&addrCopy, addr_len);
-#else
+    addrp = &addrCopy;
+#endif
     rv = connect(fd->secret->md.osfd, (struct sockaddr*)addrp, addr_len);
-#endif
     syserrno = errno;
     if ((-1 == rv) && (EINPROGRESS == syserrno) && (!fd->secret->nonblocking))
     {
         if (PR_INTERVAL_NO_WAIT == timeout) syserrno = ETIMEDOUT;
         else
         {
             pt_Continuation op;
             op.arg1.osfd = fd->secret->md.osfd;
-#ifdef _PR_HAVE_SOCKADDR_LEN
-            op.arg2.buffer = (void*)&addrCopy;
-#else
-            op.arg2.buffer = (void*)addr;
-#endif
+            op.arg2.buffer = (void*)addrp;
             op.arg3.amount = addr_len;
             op.timeout = timeout;
             op.function = pt_connect_cont;
             op.event = POLLOUT | POLLPRI;
             rv = pt_Continue(&op);
             syserrno = op.syserrno;
         }
     }
@@ -1772,20 +1767,19 @@ static PRStatus pt_Bind(PRFileDesc *fd, 
 	}
 #endif
 
     addr_len = PR_NETADDR_SIZE(addr);
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
-    rv = bind(fd->secret->md.osfd, (struct sockaddr*)&addrCopy, addr_len);
-#else
+    addrp = &addrCopy;
+#endif
     rv = bind(fd->secret->md.osfd, (struct sockaddr*)addrp, addr_len);
-#endif
 
     if (rv == -1) {
         pt_MapError(_PR_MD_MAP_BIND_ERROR, errno);
         return PR_FAILURE;
     }
     return PR_SUCCESS;
 }  /* pt_Bind */
 
@@ -2012,43 +2006,36 @@ static PRInt32 pt_SendTo(
 	}
 #endif
 
     addr_len = PR_NETADDR_SIZE(addr);
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
-    bytes = sendto(
-        fd->secret->md.osfd, buf, amount, flags,
-        (struct sockaddr*)&addrCopy, addr_len);
-#else
+    addrp = &addrCopy;
+#endif
     bytes = sendto(
         fd->secret->md.osfd, buf, amount, flags,
         (struct sockaddr*)addrp, addr_len);
-#endif
     syserrno = errno;
     if ( (bytes == -1) && (syserrno == EWOULDBLOCK || syserrno == EAGAIN)
         && (!fd->secret->nonblocking) )
     {
         if (PR_INTERVAL_NO_WAIT == timeout) syserrno = ETIMEDOUT;
         else fNeedContinue = PR_TRUE;
     }
     if (fNeedContinue == PR_TRUE)
     {
         pt_Continuation op;
         op.arg1.osfd = fd->secret->md.osfd;
         op.arg2.buffer = (void*)buf;
         op.arg3.amount = amount;
         op.arg4.flags = flags;
-#ifdef _PR_HAVE_SOCKADDR_LEN
-        op.arg5.addr = (PRNetAddr*)&addrCopy;
-#else
-        op.arg5.addr = (PRNetAddr*)addr;
-#endif
+        op.arg5.addr = (PRNetAddr*)addrp;
         op.timeout = timeout;
         op.result.code = 0;  /* initialize the number sent */
         op.function = pt_sendto_cont;
         op.event = POLLOUT | POLLPRI;
         bytes = pt_Continue(&op);
         syserrno = op.syserrno;
     }
     if (bytes < 0)