Commit 406fa8f1 authored by Daniel Willmann's avatar Daniel Willmann
Browse files

Fix signed/unsigned warnings for SCTP_EVENTS workaround

parent c6335653
......@@ -72,17 +72,17 @@
namespace SCTPasp__PortType {
/* is any of the bytes from offset .. u8_size in 'u8' non-zero? return offset or -1 if all zero */
static int byte_nonzero(const uint8_t *u8, unsigned int offset, unsigned int u8_size)
/* is any of the bytes from offset .. u8_size in 'u8' non-zero? return offset or u8_size if all zero */
static unsigned int byte_nonzero(const uint8_t *u8, unsigned int offset, unsigned int u8_size)
{
int j;
unsigned int j;
for (j = offset; j < u8_size; j++) {
if (u8[j] != 0)
return j;
break;
}
return -1;
return j;
}
static int sctp_sockopt_event_subscribe_size = 0;
static unsigned int sctp_sockopt_event_subscribe_size = 0;
static int determine_sctp_sockopt_event_subscribe_size(void)
{
uint8_t buf[256];
......@@ -118,7 +118,7 @@ static int determine_sctp_sockopt_event_subscribe_size(void)
static int sctp_setsockopt_events_linux_workaround(int fd, const struct sctp_event_subscribe *event)
{
const unsigned int compiletime_size = sizeof(*event);
int rc;
unsigned int rc;
if (determine_sctp_sockopt_event_subscribe_size() < 0) {
TTCN_warning("Cannot determine SCTP_EVENTS socket option size");
return -1;
......@@ -139,7 +139,7 @@ static int sctp_setsockopt_events_linux_workaround(int fd, const struct sctp_eve
* truncated portion */
rc = byte_nonzero((const uint8_t *)event, sctp_sockopt_event_subscribe_size,
compiletime_size);
if (rc >= 0) {
if (rc != compiletime_size) {
TTCN_warning("Kernel only supports sctp_event_subscribe of %u bytes, "
"but caller tried to enable more modern event at offset %u",
sctp_sockopt_event_subscribe_size, rc);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment