Bug 1003929: Remove some useless declarations in netwerk/sctp found by scan-build, the LLVM/Clang static analyzer. r=mcmanus
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -710,17 +710,19 @@ DataChannelConnection::SctpDtlsOutput(vo
// SCTP has an option for Apple, on IP connections only, to release at least
// one of the locks before calling a packet output routine; with changes to
// the underlying SCTP stack this might remove the need to use an async proxy.
if (0 /*peer->IsSTSThread()*/) {
res = peer->SendPacket(static_cast<unsigned char *>(buffer), length, false);
} else {
unsigned char *data = new unsigned char[length];
memcpy(data, buffer, length);
- res = -1;
+ // Commented out since we have to Dispatch SendPacket to avoid deadlock"
+ // res = -1;
+
// XXX It might be worthwhile to add an assertion against the thread
// somehow getting into the DataChannel/SCTP code again, as
// DISPATCH_SYNC is not fully blocking. This may be tricky, as it
// needs to be a per-thread check, not a global.
peer->mSTS->Dispatch(WrapRunnable(
nsRefPtr<DataChannelConnection>(peer),
&DataChannelConnection::SendPacket, data, length, true),
NS_DISPATCH_NORMAL);
--- a/netwerk/sctp/src/netinet/sctp_pcb.c
+++ b/netwerk/sctp/src/netinet/sctp_pcb.c
@@ -3166,17 +3166,16 @@ sctp_inpcb_bind(struct socket *so, struc
#ifdef SCTP_MVRF
int i;
#endif
uint16_t lport;
int error;
uint32_t vrf_id;
lport = 0;
- error = 0;
bindall = 1;
inp = (struct sctp_inpcb *)so->so_pcb;
#if defined(INET) || (defined(INET6) && defined(__APPLE__)) || defined(__FreeBSD__) || defined(__APPLE__)
ip_inp = (struct inpcb *)so->so_pcb;
#endif
#ifdef SCTP_DEBUG
if (addr) {
SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port: %d\n",
--- a/netwerk/sctp/src/netinet/sctp_sha1.c
+++ b/netwerk/sctp/src/netinet/sctp_sha1.c
@@ -201,17 +201,16 @@ sctp_sha1_update(struct sctp_sha1_contex
while (number_left > 0) {
left_to_fill = sizeof(ctx->sha_block) - ctx->how_many_in_block;
if (left_to_fill > number_left) {
/* can only partially fill up this one */
memcpy(&ctx->sha_block[ctx->how_many_in_block],
ptr, number_left);
ctx->how_many_in_block += number_left;
ctx->running_total += number_left;
- number_left = 0;
break;
} else {
/* block is now full, process it */
memcpy(&ctx->sha_block[ctx->how_many_in_block],
ptr, left_to_fill);
sctp_sha1_process_a_block(ctx,
(unsigned int *)ctx->sha_block);
number_left -= left_to_fill;
--- a/netwerk/sctp/src/user_socket.c
+++ b/netwerk/sctp/src/user_socket.c
@@ -2777,17 +2777,16 @@ sctp_userspace_ip_output(int *result, st
WSABUF winbuf;
#else
struct iovec send_iovec[MAXLEN_MBUF_CHAIN];
struct msghdr msg_hdr;
#endif
int use_udp_tunneling;
*result = 0;
- send_count = 0;
m = SCTP_HEADER_TO_CHAIN(o_pak);
m_orig = m;
len = sizeof(struct ip);
if (SCTP_BUF_LEN(m) < len) {
if ((m = m_pullup(m, len)) == 0) {
SCTP_PRINTF("Can not get the IP header in the first mbuf.\n");
@@ -2933,17 +2932,16 @@ void sctp_userspace_ip6_output(int *resu
WSABUF winbuf;
#else
struct iovec send_iovec[MAXLEN_MBUF_CHAIN];
struct msghdr msg_hdr;
#endif
int use_udp_tunneling;
*result = 0;
- send_count = 0;
m = SCTP_HEADER_TO_CHAIN(o_pak);
m_orig = m;
len = sizeof(struct ip6_hdr);
if (SCTP_BUF_LEN(m) < len) {
if ((m = m_pullup(m, len)) == 0) {