Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
917a4a8e
Commit
917a4a8e
authored
May 28, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: reinterpret_casts between unsigned char* and char*
Solution: use char* from the beginning
parent
0a43c66a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
udp_engine.cpp
src/udp_engine.cpp
+10
-10
udp_engine.hpp
src/udp_engine.hpp
+2
-2
No files found.
src/udp_engine.cpp
View file @
917a4a8e
...
...
@@ -362,8 +362,8 @@ void zmq::udp_engine_t::out_event ()
msg_t
body_msg
;
rc
=
_session
->
pull_msg
(
&
body_msg
);
size_t
group_size
=
group_msg
.
size
();
size_t
body_size
=
body_msg
.
size
();
const
size_t
group_size
=
group_msg
.
size
();
const
size_t
body_size
=
body_msg
.
size
();
size_t
size
;
if
(
_options
.
raw_socket
)
{
...
...
@@ -400,12 +400,11 @@ void zmq::udp_engine_t::out_event ()
errno_assert
(
rc
==
0
);
#ifdef ZMQ_HAVE_WINDOWS
rc
=
sendto
(
_fd
,
reinterpret_cast
<
const
char
*>
(
_out_buffer
),
static_cast
<
int
>
(
size
),
0
,
_out_address
,
rc
=
sendto
(
_fd
,
_out_buffer
,
static_cast
<
int
>
(
size
),
0
,
_out_address
,
static_cast
<
int
>
(
_out_address_len
));
wsa_assert
(
rc
!=
SOCKET_ERROR
);
#elif defined ZMQ_HAVE_VXWORKS
rc
=
sendto
(
_fd
,
(
caddr_t
)
_out_buffer
,
size
,
0
,
rc
=
sendto
(
_fd
,
reinterpret_cast
<
caddr_t
>
(
_out_buffer
)
,
size
,
0
,
(
sockaddr
*
)
_out_address
,
(
int
)
_out_address_len
);
errno_assert
(
rc
!=
-
1
);
#else
...
...
@@ -440,7 +439,7 @@ void zmq::udp_engine_t::in_event ()
socklen_t
in_addrlen
=
sizeof
(
sockaddr_storage
);
#ifdef ZMQ_HAVE_WINDOWS
int
nbytes
=
recvfrom
(
_fd
,
reinterpret_cast
<
char
*>
(
_in_buffer
)
,
MAX_UDP_MSG
,
0
,
recvfrom
(
_fd
,
_in_buffer
,
MAX_UDP_MSG
,
0
,
reinterpret_cast
<
sockaddr
*>
(
&
in_address
),
&
in_addrlen
);
const
int
last_error
=
WSAGetLastError
();
if
(
nbytes
==
SOCKET_ERROR
)
{
...
...
@@ -449,7 +448,7 @@ void zmq::udp_engine_t::in_event ()
return
;
}
#elif defined ZMQ_HAVE_VXWORKS
int
nbytes
=
recvfrom
(
_fd
,
(
char
*
)
_in_buffer
,
MAX_UDP_MSG
,
0
,
int
nbytes
=
recvfrom
(
_fd
,
_in_buffer
,
MAX_UDP_MSG
,
0
,
(
sockaddr
*
)
&
in_address
,
(
int
*
)
&
in_addrlen
);
if
(
nbytes
==
-
1
)
{
errno_assert
(
errno
!=
EBADF
&&
errno
!=
EFAULT
&&
errno
!=
ENOMEM
...
...
@@ -483,9 +482,10 @@ void zmq::udp_engine_t::in_event ()
body_size
=
nbytes
;
body_offset
=
0
;
}
else
{
const
char
*
group_buffer
=
reinterpret_cast
<
const
char
*>
(
_in_buffer
)
+
1
;
int
group_size
=
_in_buffer
[
0
];
// TODO in out_event, the group size is an *unsigned* char. what is
// the maximum value?
const
char
*
group_buffer
=
_in_buffer
+
1
;
const
int
group_size
=
_in_buffer
[
0
];
rc
=
msg
.
init_size
(
group_size
);
errno_assert
(
rc
==
0
);
...
...
src/udp_engine.hpp
View file @
917a4a8e
...
...
@@ -62,8 +62,8 @@ class udp_engine_t : public io_object_t, public i_engine
const
struct
sockaddr
*
_out_address
;
socklen_t
_out_address_len
;
unsigned
char
_out_buffer
[
MAX_UDP_MSG
];
unsigned
char
_in_buffer
[
MAX_UDP_MSG
];
char
_out_buffer
[
MAX_UDP_MSG
];
char
_in_buffer
[
MAX_UDP_MSG
];
bool
_send_enabled
;
bool
_recv_enabled
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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