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
d767909b
Commit
d767909b
authored
May 27, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: old C-style casts used
Solution: replace by static_cast/reinterpret_cast
parent
e3c73d98
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
26 deletions
+32
-26
epoll.cpp
src/epoll.cpp
+10
-9
ipc_address.cpp
src/ipc_address.cpp
+3
-3
ipc_connecter.cpp
src/ipc_connecter.cpp
+2
-1
ipc_listener.cpp
src/ipc_listener.cpp
+4
-3
random.cpp
src/random.cpp
+1
-1
socket_poller.cpp
src/socket_poller.cpp
+1
-1
tcp.cpp
src/tcp.cpp
+4
-3
tcp_listener.cpp
src/tcp_listener.cpp
+3
-2
udp_engine.cpp
src/udp_engine.cpp
+3
-2
zmq.cpp
src/zmq.cpp
+1
-1
No files found.
src/epoll.cpp
View file @
d767909b
...
...
@@ -108,7 +108,7 @@ zmq::epoll_t::handle_t zmq::epoll_t::add_fd (fd_t fd_, i_poll_events *events_)
void
zmq
::
epoll_t
::
rm_fd
(
handle_t
handle_
)
{
check_thread
();
poll_entry_t
*
pe
=
(
poll_entry_t
*
)
handle_
;
poll_entry_t
*
pe
=
static_cast
<
poll_entry_t
*>
(
handle_
)
;
int
rc
=
epoll_ctl
(
_epoll_fd
,
EPOLL_CTL_DEL
,
pe
->
fd
,
&
pe
->
ev
);
errno_assert
(
rc
!=
-
1
);
pe
->
fd
=
retired_fd
;
...
...
@@ -123,7 +123,7 @@ void zmq::epoll_t::rm_fd (handle_t handle_)
void
zmq
::
epoll_t
::
set_pollin
(
handle_t
handle_
)
{
check_thread
();
poll_entry_t
*
pe
=
(
poll_entry_t
*
)
handle_
;
poll_entry_t
*
pe
=
static_cast
<
poll_entry_t
*>
(
handle_
)
;
pe
->
ev
.
events
|=
EPOLLIN
;
int
rc
=
epoll_ctl
(
_epoll_fd
,
EPOLL_CTL_MOD
,
pe
->
fd
,
&
pe
->
ev
);
errno_assert
(
rc
!=
-
1
);
...
...
@@ -132,8 +132,8 @@ void zmq::epoll_t::set_pollin (handle_t handle_)
void
zmq
::
epoll_t
::
reset_pollin
(
handle_t
handle_
)
{
check_thread
();
poll_entry_t
*
pe
=
(
poll_entry_t
*
)
handle_
;
pe
->
ev
.
events
&=
~
(
(
short
)
EPOLLIN
);
poll_entry_t
*
pe
=
static_cast
<
poll_entry_t
*>
(
handle_
)
;
pe
->
ev
.
events
&=
~
(
static_cast
<
short
>
(
EPOLLIN
)
);
int
rc
=
epoll_ctl
(
_epoll_fd
,
EPOLL_CTL_MOD
,
pe
->
fd
,
&
pe
->
ev
);
errno_assert
(
rc
!=
-
1
);
}
...
...
@@ -141,7 +141,7 @@ void zmq::epoll_t::reset_pollin (handle_t handle_)
void
zmq
::
epoll_t
::
set_pollout
(
handle_t
handle_
)
{
check_thread
();
poll_entry_t
*
pe
=
(
poll_entry_t
*
)
handle_
;
poll_entry_t
*
pe
=
static_cast
<
poll_entry_t
*>
(
handle_
)
;
pe
->
ev
.
events
|=
EPOLLOUT
;
int
rc
=
epoll_ctl
(
_epoll_fd
,
EPOLL_CTL_MOD
,
pe
->
fd
,
&
pe
->
ev
);
errno_assert
(
rc
!=
-
1
);
...
...
@@ -150,8 +150,8 @@ void zmq::epoll_t::set_pollout (handle_t handle_)
void
zmq
::
epoll_t
::
reset_pollout
(
handle_t
handle_
)
{
check_thread
();
poll_entry_t
*
pe
=
(
poll_entry_t
*
)
handle_
;
pe
->
ev
.
events
&=
~
(
(
short
)
EPOLLOUT
);
poll_entry_t
*
pe
=
static_cast
<
poll_entry_t
*>
(
handle_
)
;
pe
->
ev
.
events
&=
~
(
static_cast
<
short
>
(
EPOLLOUT
)
);
int
rc
=
epoll_ctl
(
_epoll_fd
,
EPOLL_CTL_MOD
,
pe
->
fd
,
&
pe
->
ev
);
errno_assert
(
rc
!=
-
1
);
}
...
...
@@ -172,7 +172,7 @@ void zmq::epoll_t::loop ()
while
(
true
)
{
// Execute any due timers.
int
timeout
=
(
int
)
execute_timers
(
);
int
timeout
=
static_cast
<
int
>
(
execute_timers
()
);
if
(
get_load
()
==
0
)
{
if
(
timeout
==
0
)
...
...
@@ -191,7 +191,8 @@ void zmq::epoll_t::loop ()
}
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
poll_entry_t
*
pe
=
((
poll_entry_t
*
)
ev_buf
[
i
].
data
.
ptr
);
poll_entry_t
*
pe
=
(
static_cast
<
poll_entry_t
*>
(
ev_buf
[
i
].
data
.
ptr
));
if
(
pe
->
fd
==
retired_fd
)
continue
;
...
...
src/ipc_address.cpp
View file @
d767909b
...
...
@@ -100,9 +100,9 @@ const sockaddr *zmq::ipc_address_t::addr () const
socklen_t
zmq
::
ipc_address_t
::
addrlen
()
const
{
if
(
!
address
.
sun_path
[
0
]
&&
address
.
sun_path
[
1
])
return
(
socklen_t
)
strlen
(
address
.
sun_path
+
1
)
+
sizeof
(
sa_family_t
)
+
1
;
return
(
socklen_t
)
sizeof
address
;
return
static_cast
<
socklen_t
>
(
strlen
(
address
.
sun_path
+
1
)
)
+
sizeof
(
sa_family_t
)
+
1
;
return
static_cast
<
socklen_t
>
(
sizeof
address
)
;
}
#endif
src/ipc_connecter.cpp
View file @
d767909b
...
...
@@ -252,7 +252,8 @@ zmq::fd_t zmq::ipc_connecter_t::connect ()
#else
socklen_t
len
=
sizeof
(
err
);
#endif
int
rc
=
getsockopt
(
s
,
SOL_SOCKET
,
SO_ERROR
,
(
char
*
)
&
err
,
&
len
);
int
rc
=
getsockopt
(
s
,
SOL_SOCKET
,
SO_ERROR
,
reinterpret_cast
<
char
*>
(
&
err
),
&
len
);
if
(
rc
==
-
1
)
{
if
(
errno
==
ENOPROTOOPT
)
errno
=
0
;
...
...
src/ipc_listener.cpp
View file @
d767909b
...
...
@@ -201,13 +201,13 @@ int zmq::ipc_listener_t::get_address (std::string &addr_)
#else
socklen_t
sl
=
sizeof
(
ss
);
#endif
int
rc
=
getsockname
(
s
,
(
sockaddr
*
)
&
ss
,
&
sl
);
int
rc
=
getsockname
(
s
,
reinterpret_cast
<
sockaddr
*>
(
&
ss
)
,
&
sl
);
if
(
rc
!=
0
)
{
addr_
.
clear
();
return
rc
;
}
ipc_address_t
addr
(
(
struct
sockaddr
*
)
&
ss
,
sl
);
ipc_address_t
addr
(
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
)
,
sl
);
return
addr
.
to_string
(
addr_
);
}
...
...
@@ -266,7 +266,8 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
}
// Bind the socket to the file path.
rc
=
bind
(
s
,
(
sockaddr
*
)
address
.
addr
(),
address
.
addrlen
());
rc
=
bind
(
s
,
const_cast
<
sockaddr
*>
(
address
.
addr
()),
address
.
addrlen
());
if
(
rc
!=
0
)
goto
error
;
...
...
src/random.cpp
View file @
d767909b
...
...
@@ -51,7 +51,7 @@ void zmq::seed_random ()
#if defined ZMQ_HAVE_WINDOWS
int
pid
=
static_cast
<
int
>
(
GetCurrentProcessId
());
#else
int
pid
=
(
int
)
getpid
(
);
int
pid
=
static_cast
<
int
>
(
getpid
()
);
#endif
srand
(
static_cast
<
unsigned
int
>
(
clock_t
::
now_us
()
+
pid
));
}
...
...
src/socket_poller.cpp
View file @
d767909b
...
...
@@ -296,7 +296,7 @@ void zmq::socket_poller_t::rebuild ()
if
(
_pollset_size
==
0
)
return
;
_pollfds
=
(
pollfd
*
)
malloc
(
_pollset_size
*
sizeof
(
pollfd
));
_pollfds
=
static_cast
<
pollfd
*>
(
malloc
(
_pollset_size
*
sizeof
(
pollfd
)
));
alloc_assert
(
_pollfds
);
int
item_nbr
=
0
;
...
...
src/tcp.cpp
View file @
d767909b
...
...
@@ -128,8 +128,9 @@ int zmq::tune_tcp_keepalives (fd_t s_,
#else
#ifdef ZMQ_HAVE_SO_KEEPALIVE
if
(
keepalive_
!=
-
1
)
{
int
rc
=
setsockopt
(
s_
,
SOL_SOCKET
,
SO_KEEPALIVE
,
(
char
*
)
&
keepalive_
,
sizeof
(
int
));
int
rc
=
setsockopt
(
s_
,
SOL_SOCKET
,
SO_KEEPALIVE
,
reinterpret_cast
<
char
*>
(
&
keepalive_
),
sizeof
(
int
));
tcp_assert_tuning_error
(
s_
,
rc
);
if
(
rc
!=
0
)
return
rc
;
...
...
@@ -292,7 +293,7 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_)
#else
const
ssize_t
rc
=
recv
(
s_
,
(
char
*
)
data_
,
size_
,
0
);
const
ssize_t
rc
=
recv
(
s_
,
static_cast
<
char
*>
(
data_
)
,
size_
,
0
);
// Several errors are OK. When speculative read is being done we may not
// be able to read a single byte from the socket. Also, SIGSTOP issued
...
...
src/tcp_listener.cpp
View file @
d767909b
...
...
@@ -291,7 +291,8 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
socklen_t
ss_len
=
sizeof
(
ss
);
#endif
#if defined ZMQ_HAVE_SOCK_CLOEXEC && defined HAVE_ACCEPT4
fd_t
sock
=
::
accept4
(
_s
,
(
struct
sockaddr
*
)
&
ss
,
&
ss_len
,
SOCK_CLOEXEC
);
fd_t
sock
=
::
accept4
(
_s
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
),
&
ss_len
,
SOCK_CLOEXEC
);
#else
fd_t
sock
=
::
accept
(
_s
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
),
&
ss_len
);
...
...
@@ -318,7 +319,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
for
(
options_t
::
tcp_accept_filters_t
::
size_type
i
=
0
;
i
!=
options
.
tcp_accept_filters
.
size
();
++
i
)
{
if
(
options
.
tcp_accept_filters
[
i
].
match_address
(
(
struct
sockaddr
*
)
&
ss
,
ss_len
))
{
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
)
,
ss_len
))
{
matched
=
true
;
break
;
}
...
...
src/udp_engine.cpp
View file @
d767909b
...
...
@@ -457,8 +457,9 @@ void zmq::udp_engine_t::in_event ()
return
;
}
#else
int
nbytes
=
recvfrom
(
_fd
,
_in_buffer
,
MAX_UDP_MSG
,
0
,
(
sockaddr
*
)
&
in_address
,
&
in_addrlen
);
int
nbytes
=
recvfrom
(
_fd
,
_in_buffer
,
MAX_UDP_MSG
,
0
,
reinterpret_cast
<
sockaddr
*>
(
&
in_address
),
&
in_addrlen
);
if
(
nbytes
==
-
1
)
{
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
errno_assert
(
errno
!=
EBADF
&&
errno
!=
EFAULT
&&
errno
!=
ENOMEM
...
...
src/zmq.cpp
View file @
d767909b
...
...
@@ -831,7 +831,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
pollfd
*
pollfds
=
spollfds
;
if
(
nitems_
>
ZMQ_POLLITEMS_DFLT
)
{
pollfds
=
(
pollfd
*
)
malloc
(
nitems_
*
sizeof
(
pollfd
));
pollfds
=
static_cast
<
pollfd
*>
(
malloc
(
nitems_
*
sizeof
(
pollfd
)
));
alloc_assert
(
pollfds
);
}
...
...
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