diff options
Diffstat (limited to 'pr/src/io/prmapopt.c')
-rw-r--r-- | pr/src/io/prmapopt.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/pr/src/io/prmapopt.c b/pr/src/io/prmapopt.c index 262b00bb..b6653e4b 100644 --- a/pr/src/io/prmapopt.c +++ b/pr/src/io/prmapopt.c @@ -65,7 +65,7 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat struct linger linger; length = sizeof(linger); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char *) &linger, &length); + fd, level, name, (char *) &linger, &length); if (PR_SUCCESS == rv) { PR_ASSERT(sizeof(linger) == length); @@ -89,9 +89,10 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat #endif length = sizeof(value); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char*)&value, &length); - if (PR_SUCCESS == rv) + fd, level, name, (char*)&value, &length); + if (PR_SUCCESS == rv) { data->value.reuse_addr = (0 == value) ? PR_FALSE : PR_TRUE; + } break; } case PR_SockOpt_McastLoopback: @@ -103,9 +104,10 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat #endif length = sizeof(bool); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char*)&bool, &length); - if (PR_SUCCESS == rv) + fd, level, name, (char*)&bool, &length); + if (PR_SUCCESS == rv) { data->value.mcast_loopback = (0 == bool) ? PR_FALSE : PR_TRUE; + } break; } case PR_SockOpt_RecvBufferSize: @@ -115,9 +117,10 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat PRIntn value; length = sizeof(value); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char*)&value, &length); - if (PR_SUCCESS == rv) + fd, level, name, (char*)&value, &length); + if (PR_SUCCESS == rv) { data->value.recv_buffer_size = value; + } break; } case PR_SockOpt_IpTimeToLive: @@ -126,7 +129,7 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat /* These options should really be an int (or PRIntn). */ length = sizeof(PRUintn); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char*)&data->value.ip_ttl, &length); + fd, level, name, (char*)&data->value.ip_ttl, &length); break; } case PR_SockOpt_McastTimeToLive: @@ -138,9 +141,10 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat #endif length = sizeof(ttl); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char*)&ttl, &length); - if (PR_SUCCESS == rv) + fd, level, name, (char*)&ttl, &length); + if (PR_SUCCESS == rv) { data->value.mcast_ttl = ttl; + } break; } #ifdef IP_ADD_MEMBERSHIP @@ -150,7 +154,7 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat struct ip_mreq mreq; length = sizeof(mreq); rv = _PR_MD_GETSOCKOPT( - fd, level, name, (char*)&mreq, &length); + fd, level, name, (char*)&mreq, &length); if (PR_SUCCESS == rv) { data->value.add_member.mcaddr.inet.ip = @@ -166,8 +170,8 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat /* This option is a struct in_addr. */ length = sizeof(data->value.mcast_if.inet.ip); rv = _PR_MD_GETSOCKOPT( - fd, level, name, - (char*)&data->value.mcast_if.inet.ip, &length); + fd, level, name, + (char*)&data->value.mcast_if.inet.ip, &length); break; } default: @@ -191,7 +195,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt { #ifdef WINNT PR_ASSERT((fd->secret->md.io_model_committed == PR_FALSE) - || (fd->secret->nonblocking == data->value.non_blocking)); + || (fd->secret->nonblocking == data->value.non_blocking)); if (fd->secret->md.io_model_committed && (fd->secret->nonblocking != data->value.non_blocking)) { @@ -220,7 +224,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt linger.l_onoff = data->value.linger.polarity; linger.l_linger = PR_IntervalToSeconds(data->value.linger.linger); rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&linger, sizeof(linger)); + fd, level, name, (char*)&linger, sizeof(linger)); break; } case PR_SockOpt_Reuseaddr: @@ -236,7 +240,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt #endif value = (data->value.reuse_addr) ? 1 : 0; rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&value, sizeof(value)); + fd, level, name, (char*)&value, sizeof(value)); break; } case PR_SockOpt_McastLoopback: @@ -248,7 +252,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt #endif bool = data->value.mcast_loopback ? 1 : 0; rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&bool, sizeof(bool)); + fd, level, name, (char*)&bool, sizeof(bool)); break; } case PR_SockOpt_RecvBufferSize: @@ -257,7 +261,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt { PRIntn value = data->value.recv_buffer_size; rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&value, sizeof(value)); + fd, level, name, (char*)&value, sizeof(value)); break; } case PR_SockOpt_IpTimeToLive: @@ -265,7 +269,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt { /* These options should really be an int (or PRIntn). */ rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&data->value.ip_ttl, sizeof(PRUintn)); + fd, level, name, (char*)&data->value.ip_ttl, sizeof(PRUintn)); break; } case PR_SockOpt_McastTimeToLive: @@ -277,7 +281,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt #endif ttl = data->value.mcast_ttl; rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&ttl, sizeof(ttl)); + fd, level, name, (char*)&ttl, sizeof(ttl)); break; } #ifdef IP_ADD_MEMBERSHIP @@ -290,7 +294,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt mreq.imr_interface.s_addr = data->value.add_member.ifaddr.inet.ip; rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&mreq, sizeof(mreq)); + fd, level, name, (char*)&mreq, sizeof(mreq)); break; } #endif /* IP_ADD_MEMBERSHIP */ @@ -298,8 +302,8 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt { /* This option is a struct in_addr. */ rv = _PR_MD_SETSOCKOPT( - fd, level, name, (char*)&data->value.mcast_if.inet.ip, - sizeof(data->value.mcast_if.inet.ip)); + fd, level, name, (char*)&data->value.mcast_if.inet.ip, + sizeof(data->value.mcast_if.inet.ip)); break; } default: @@ -431,7 +435,7 @@ PRStatus _PR_MapOptionName( }; if ((optname < PR_SockOpt_Linger) - || (optname >= PR_SockOpt_Last)) + || (optname >= PR_SockOpt_Last)) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return PR_FAILURE; |