Skip to content

Commit

Permalink
Revert uint32_t casting for htonl
Browse files Browse the repository at this point in the history
  • Loading branch information
weinrank committed Jun 28, 2019
1 parent 967b6f9 commit 1ceeca9
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions programs/discard_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context);
}
free(data);
Expand Down Expand Up @@ -218,7 +218,7 @@ main(int argc, char *argv[])
rcv_info.rcv_sid,
rcv_info.rcv_ssn,
rcv_info.rcv_tsn,
(uint32_t) ntohl(rcv_info.rcv_ppid),
ntohl(rcv_info.rcv_ppid),
rcv_info.rcv_context,
(flags & MSG_EOR) ? 1 : 0);
} else {
Expand Down
2 changes: 1 addition & 1 deletion programs/discard_server_upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ handle_upcall(struct socket *sock, void *data, int flgs)
rn.recvv_rcvinfo.rcv_sid,
rn.recvv_rcvinfo.rcv_ssn,
rn.recvv_rcvinfo.rcv_tsn,
(uint32_t) ntohl(rn.recvv_rcvinfo.rcv_ppid),
ntohl(rn.recvv_rcvinfo.rcv_ppid),
rn.recvv_rcvinfo.rcv_context);
}
}
Expand Down
4 changes: 2 additions & 2 deletions programs/echo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context);
if (flags & MSG_EOR) {
struct sctp_sndinfo snd_info;
Expand Down Expand Up @@ -233,7 +233,7 @@ main(int argc, char *argv[])
rcv_info.rcv_sid,
rcv_info.rcv_ssn,
rcv_info.rcv_tsn,
(uint32_t) ntohl(rcv_info.rcv_ppid),
ntohl(rcv_info.rcv_ppid),
rcv_info.rcv_context,
(flags & MSG_EOR) ? 1 : 0);
if (flags & MSG_EOR) {
Expand Down
2 changes: 1 addition & 1 deletion programs/echo_server_upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ handle_upcall(struct socket *sock, void *data, int flgs)
rn.recvv_rcvinfo.rcv_sid,
rn.recvv_rcvinfo.rcv_ssn,
rn.recvv_rcvinfo.rcv_tsn,
(uint32_t)ntohl(rn.recvv_rcvinfo.rcv_ppid),
ntohl(rn.recvv_rcvinfo.rcv_ppid),
rn.recvv_rcvinfo.rcv_context);
if (flags & MSG_EOR) {
struct sctp_sndinfo snd_info;
Expand Down
2 changes: 1 addition & 1 deletion programs/ekr_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context);
}
free(data);
Expand Down
2 changes: 1 addition & 1 deletion programs/ekr_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context,
flags);
}
Expand Down
4 changes: 2 additions & 2 deletions programs/ekr_loop_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ handle_packets(void *arg)
usrsctp_conninput(fdp, buffer, (size_t)length, 0);
} else {
fprintf(stderr, "Wrong CRC32c: expected %08x received %08x\n",
(uint32_t) ntohl(computed_crc32c), (uint32_t) ntohl(received_crc32c));
ntohl(computed_crc32c), ntohl(received_crc32c));
}
} else {
fprintf(stderr, "Packet too short: length %zu", (size_t)length);
Expand Down Expand Up @@ -161,7 +161,7 @@ receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context,
flags);
}
Expand Down
2 changes: 1 addition & 1 deletion programs/ekr_loop_upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ handle_upcall(struct socket *sock, void *data, int flgs)
rn.recvv_rcvinfo.rcv_sid,
rn.recvv_rcvinfo.rcv_ssn,
rn.recvv_rcvinfo.rcv_tsn,
(uint32_t) ntohl(rn.recvv_rcvinfo.rcv_ppid),
ntohl(rn.recvv_rcvinfo.rcv_ppid),
rn.recvv_rcvinfo.rcv_context,
flags);
}
Expand Down
2 changes: 1 addition & 1 deletion programs/ekr_peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context);
}
free(data);
Expand Down
2 changes: 1 addition & 1 deletion programs/ekr_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ receive_cb(struct socket *s, union sctp_sockstore addr, void *data,
rcv.rcv_sid,
rcv.rcv_ssn,
rcv.rcv_tsn,
(uint32_t) ntohl(rcv.rcv_ppid),
ntohl(rcv.rcv_ppid),
rcv.rcv_context);
}
free(data);
Expand Down
2 changes: 1 addition & 1 deletion programs/programs_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ handle_send_failed_event(struct sctp_send_failed_event *ssfe)
printf("(flags = %x) ", ssfe->ssfe_flags);
}
printf("message with PPID = %u, SID = %u, flags: 0x%04x due to error = 0x%08x",
(uint32_t) ntohl(ssfe->ssfe_info.snd_ppid), ssfe->ssfe_info.snd_sid,
ntohl(ssfe->ssfe_info.snd_ppid), ssfe->ssfe_info.snd_sid,
ssfe->ssfe_info.snd_flags, ssfe->ssfe_error);
n = ssfe->ssfe_length - sizeof(struct sctp_send_failed_event);
for (i = 0; i < n; i++) {
Expand Down
4 changes: 2 additions & 2 deletions programs/rtcweb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,8 +1119,8 @@ handle_send_failed_event(struct sctp_send_failed_event *ssfe)
if (ssfe->ssfe_flags & ~(SCTP_DATA_SENT | SCTP_DATA_UNSENT)) {
printf("(flags = %x) ", ssfe->ssfe_flags);
}
printf("message with PPID = %u, SID = %d, flags: 0x%04x due to error = 0x%08x",
(uint32_t) ntohl(ssfe->ssfe_info.snd_ppid), ssfe->ssfe_info.snd_sid,
printf("message with PPID = %u, SID = %u, flags: 0x%04x due to error = 0x%08x",
ntohl(ssfe->ssfe_info.snd_ppid), ssfe->ssfe_info.snd_sid,
ssfe->ssfe_info.snd_flags, ssfe->ssfe_error);
n = ssfe->ssfe_length - sizeof(struct sctp_send_failed_event);
for (i = 0; i < n; i++) {
Expand Down
4 changes: 2 additions & 2 deletions usrsctplib/user_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3138,14 +3138,14 @@ sctp_userspace_ip_output(int *result, struct mbuf *o_pak,
if ((!use_udp_tunneling) && (SCTP_BASE_VAR(userspace_rawsctp) != -1)) {
if (WSASendTo(SCTP_BASE_VAR(userspace_rawsctp), (LPWSABUF) send_iovec, iovcnt, &win_sent_len, win_msg_hdr.dwFlags, win_msg_hdr.name, (int) win_msg_hdr.namelen, NULL, NULL) != 0) {
*result = WSAGetLastError();
} else if ((int) win_sent_len != send_len) {
} else if ((int)win_sent_len != send_len) {
*result = WSAGetLastError();
}
}
if ((use_udp_tunneling) && (SCTP_BASE_VAR(userspace_udpsctp) != -1)) {
if (WSASendTo(SCTP_BASE_VAR(userspace_udpsctp), (LPWSABUF) send_iovec, iovcnt, &win_sent_len, win_msg_hdr.dwFlags, win_msg_hdr.name, (int) win_msg_hdr.namelen, NULL, NULL) != 0) {
*result = WSAGetLastError();
} else if ((int) win_sent_len != send_len) {
} else if ((int)win_sent_len != send_len) {
*result = WSAGetLastError();
}
}
Expand Down

0 comments on commit 1ceeca9

Please sign in to comment.