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
440be28d
Commit
440be28d
authored
May 18, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: unnecessary non-const variables
Solution: add const
parent
d6952ded
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
17 deletions
+23
-17
socks.cpp
src/socks.cpp
+4
-4
stream_engine.cpp
src/stream_engine.cpp
+4
-2
tcp_connecter.cpp
src/tcp_connecter.cpp
+1
-1
udp_engine.cpp
src/udp_engine.cpp
+7
-5
xpub.cpp
src/xpub.cpp
+2
-1
zap_client.cpp
src/zap_client.cpp
+1
-1
zmq.cpp
src/zmq.cpp
+4
-3
No files found.
src/socks.cpp
View file @
440be28d
...
...
@@ -166,14 +166,14 @@ void zmq::socks_request_encoder_t::encode (const socks_request_t &req)
const
int
rc
=
getaddrinfo
(
req
.
hostname
.
c_str
(),
NULL
,
&
hints
,
&
res
);
if
(
rc
==
0
&&
res
->
ai_family
==
AF_INET
)
{
struct
sockaddr_in
*
sockaddr_in
=
reinterpret_cast
<
struct
sockaddr_in
*>
(
res
->
ai_addr
);
const
struct
sockaddr_in
*
sockaddr_in
=
reinterpret_cast
<
const
struct
sockaddr_in
*>
(
res
->
ai_addr
);
*
ptr
++
=
0x01
;
memcpy
(
ptr
,
&
sockaddr_in
->
sin_addr
,
4
);
ptr
+=
4
;
}
else
if
(
rc
==
0
&&
res
->
ai_family
==
AF_INET6
)
{
struct
sockaddr_in6
*
sockaddr_in6
=
reinterpret_cast
<
struct
sockaddr_in6
*>
(
res
->
ai_addr
);
const
struct
sockaddr_in6
*
sockaddr_in6
=
reinterpret_cast
<
const
struct
sockaddr_in6
*>
(
res
->
ai_addr
);
*
ptr
++
=
0x04
;
memcpy
(
ptr
,
&
sockaddr_in6
->
sin6_addr
,
16
);
ptr
+=
16
;
...
...
src/stream_engine.cpp
View file @
440be28d
...
...
@@ -1110,12 +1110,14 @@ int zmq::stream_engine_t::process_heartbeat_message (msg_t *msg_)
int
zmq
::
stream_engine_t
::
process_command_message
(
msg_t
*
msg_
)
{
uint8_t
cmd_name_size
=
*
(
static_cast
<
uint8_t
*>
(
msg_
->
data
()));
const
uint8_t
cmd_name_size
=
*
(
static_cast
<
const
uint8_t
*>
(
msg_
->
data
()));
// Malformed command
if
(
msg_
->
size
()
<
cmd_name_size
+
sizeof
(
cmd_name_size
))
return
-
1
;
uint8_t
*
cmd_name
=
(
static_cast
<
uint8_t
*>
(
msg_
->
data
()))
+
1
;
const
uint8_t
*
cmd_name
=
(
static_cast
<
const
uint8_t
*>
(
msg_
->
data
()))
+
1
;
if
(
cmd_name_size
==
4
&&
(
memcmp
(
cmd_name
,
"PING"
,
cmd_name_size
)
==
0
||
memcmp
(
cmd_name
,
"PONG"
,
cmd_name_size
)
==
0
))
...
...
src/tcp_connecter.cpp
View file @
440be28d
...
...
@@ -262,7 +262,7 @@ int zmq::tcp_connecter_t::open ()
return
-
1
;
}
zmq_assert
(
addr
->
resolved
.
tcp_addr
!=
NULL
);
tcp_address_t
*
const
tcp_addr
=
addr
->
resolved
.
tcp_addr
;
const
tcp_address_t
*
const
tcp_addr
=
addr
->
resolved
.
tcp_addr
;
// Create the socket.
s
=
open_socket
(
tcp_addr
->
family
(),
SOCK_STREAM
,
IPPROTO_TCP
);
...
...
src/udp_engine.cpp
View file @
440be28d
...
...
@@ -285,14 +285,15 @@ void zmq::udp_engine_t::terminate ()
void
zmq
::
udp_engine_t
::
sockaddr_to_msg
(
zmq
::
msg_t
*
msg
,
sockaddr_in
*
addr
)
{
c
har
*
name
=
inet_ntoa
(
addr
->
sin_addr
);
c
onst
char
*
const
name
=
inet_ntoa
(
addr
->
sin_addr
);
char
port
[
6
];
sprintf
(
port
,
"%d"
,
static_cast
<
int
>
(
ntohs
(
addr
->
sin_port
)));
int
size
=
static_cast
<
int
>
(
strlen
(
name
))
+
static_cast
<
int
>
(
strlen
(
port
))
+
1
+
1
;
// Colon + NULL
int
rc
=
msg
->
init_size
(
size
);
const
int
size
=
static_cast
<
int
>
(
strlen
(
name
))
+
static_cast
<
int
>
(
strlen
(
port
))
+
1
+
1
;
// Colon + NULL
const
int
rc
=
msg
->
init_size
(
size
);
errno_assert
(
rc
==
0
);
msg
->
set_flags
(
msg_t
::
more
);
char
*
address
=
static_cast
<
char
*>
(
msg
->
data
());
...
...
@@ -472,7 +473,8 @@ void zmq::udp_engine_t::in_event ()
body_size
=
nbytes
;
body_offset
=
0
;
}
else
{
char
*
group_buffer
=
reinterpret_cast
<
char
*>
(
in_buffer
)
+
1
;
const
char
*
group_buffer
=
reinterpret_cast
<
const
char
*>
(
in_buffer
)
+
1
;
int
group_size
=
in_buffer
[
0
];
rc
=
msg
.
init_size
(
group_size
);
...
...
src/xpub.cpp
View file @
440be28d
...
...
@@ -89,7 +89,8 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
msg_t
sub
;
while
(
pipe_
->
read
(
&
sub
))
{
// Apply the subscription to the trie
unsigned
char
*
const
data
=
static_cast
<
unsigned
char
*>
(
sub
.
data
());
const
unsigned
char
*
const
data
=
static_cast
<
const
unsigned
char
*>
(
sub
.
data
());
const
size_t
size
=
sub
.
size
();
metadata_t
*
metadata
=
sub
.
metadata
();
if
(
size
>
0
&&
(
*
data
==
0
||
*
data
==
1
))
{
...
...
src/zap_client.cpp
View file @
440be28d
...
...
@@ -186,7 +186,7 @@ int zap_client_t::receive_and_process_zap_reply ()
}
// Status code frame, only 200, 300, 400 and 500 are valid status codes
c
har
*
status_code_data
=
static_cast
<
char
*>
(
msg
[
3
].
data
());
c
onst
char
*
status_code_data
=
static_cast
<
const
char
*>
(
msg
[
3
].
data
());
if
(
msg
[
3
].
size
()
!=
3
||
status_code_data
[
0
]
<
'2'
||
status_code_data
[
0
]
>
'5'
||
status_code_data
[
1
]
!=
'0'
||
status_code_data
[
2
]
!=
'0'
)
{
...
...
src/zmq.cpp
View file @
440be28d
...
...
@@ -545,7 +545,7 @@ int zmq_recviov (void *s_, iovec *a_, size_t *count_, int flags_)
memcpy
(
a_
[
i
].
iov_base
,
static_cast
<
char
*>
(
zmq_msg_data
(
&
msg
)),
a_
[
i
].
iov_len
);
// Assume zmq_socket ZMQ_RVCMORE is properly set.
zmq
::
msg_t
*
p_msg
=
reinterpret_cast
<
zmq
::
msg_t
*>
(
&
msg
);
const
zmq
::
msg_t
*
p_msg
=
reinterpret_cast
<
const
zmq
::
msg_t
*>
(
&
msg
);
recvmore
=
p_msg
->
flags
()
&
zmq
::
msg_t
::
more
;
rc
=
zmq_msg_close
(
&
msg
);
errno_assert
(
rc
==
0
);
...
...
@@ -678,7 +678,8 @@ const char *zmq_msg_group (zmq_msg_t *msg_)
const
char
*
zmq_msg_gets
(
const
zmq_msg_t
*
msg_
,
const
char
*
property_
)
{
zmq
::
metadata_t
*
metadata
=
((
zmq
::
msg_t
*
)
msg_
)
->
metadata
();
const
zmq
::
metadata_t
*
metadata
=
reinterpret_cast
<
const
zmq
::
msg_t
*>
(
msg_
)
->
metadata
();
const
char
*
value
=
NULL
;
if
(
metadata
)
value
=
metadata
->
get
(
std
::
string
(
property_
));
...
...
@@ -1355,7 +1356,7 @@ int zmq_socket_get_peer_state (void *s_,
const
void
*
routing_id_
,
size_t
routing_id_size_
)
{
zmq
::
socket_base_t
*
s
=
as_socket_base_t
(
s_
);
const
zmq
::
socket_base_t
*
const
s
=
as_socket_base_t
(
s_
);
if
(
!
s
)
return
-
1
;
...
...
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