Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse Titan
titan.TestPorts.SCTPasp
Commits
406fa8f1
Commit
406fa8f1
authored
Jan 11, 2022
by
Daniel Willmann
Browse files
Fix signed/unsigned warnings for SCTP_EVENTS workaround
parent
c6335653
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/SCTPasp_PT.cc
View file @
406fa8f1
...
...
@@ -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
)
re
turn
j
;
b
re
ak
;
}
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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment