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
47dcd84f
Commit
47dcd84f
authored
May 28, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: C-style casts
Solution: replace by reinterpret_casts or avoid entirely
parent
917a4a8e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
mechanism.cpp
src/mechanism.cpp
+5
-3
options.cpp
src/options.cpp
+10
-10
No files found.
src/mechanism.cpp
View file @
47dcd84f
...
...
@@ -65,7 +65,7 @@ void zmq::mechanism_t::set_user_id (const void *data_, size_t size_)
_user_id
.
set
(
static_cast
<
const
unsigned
char
*>
(
data_
),
size_
);
zap_properties
.
ZMQ_MAP_INSERT_OR_EMPLACE
(
std
::
string
(
ZMQ_MSG_PROPERTY_USER_ID
),
std
::
string
(
(
char
*
)
data_
,
size_
));
std
::
string
(
reinterpret_cast
<
const
char
*>
(
data_
)
,
size_
));
}
const
zmq
::
blob_t
&
zmq
::
mechanism_t
::
get_user_id
()
const
...
...
@@ -238,7 +238,8 @@ int zmq::mechanism_t::parse_metadata (const unsigned char *ptr_,
if
(
bytes_left
<
name_length
)
break
;
const
std
::
string
name
=
std
::
string
((
char
*
)
ptr_
,
name_length
);
const
std
::
string
name
=
std
::
string
(
reinterpret_cast
<
const
char
*>
(
ptr_
),
name_length
);
ptr_
+=
name_length
;
bytes_left
-=
name_length
;
if
(
bytes_left
<
value_len_size
)
...
...
@@ -269,7 +270,8 @@ int zmq::mechanism_t::parse_metadata (const unsigned char *ptr_,
}
(
zap_flag_
?
zap_properties
:
zmtp_properties
)
.
ZMQ_MAP_INSERT_OR_EMPLACE
(
name
,
std
::
string
((
char
*
)
value
,
value_length
));
name
,
std
::
string
(
reinterpret_cast
<
const
char
*>
(
value
),
value_length
));
}
if
(
bytes_left
>
0
)
{
errno
=
EPROTO
;
...
...
src/options.cpp
View file @
47dcd84f
...
...
@@ -263,7 +263,8 @@ int zmq::options_t::set_curve_key (uint8_t *destination_,
return
0
;
case
CURVE_KEYSIZE_Z85
+
1
:
if
(
zmq_z85_decode
(
destination_
,
(
char
*
)
optval_
))
{
if
(
zmq_z85_decode
(
destination_
,
reinterpret_cast
<
const
char
*>
(
optval_
)))
{
mechanism
=
ZMQ_CURVE
;
return
0
;
}
...
...
@@ -271,7 +272,8 @@ int zmq::options_t::set_curve_key (uint8_t *destination_,
case
CURVE_KEYSIZE_Z85
:
char
z85_key
[
CURVE_KEYSIZE_Z85
+
1
];
memcpy
(
z85_key
,
(
char
*
)
optval_
,
optvallen_
);
memcpy
(
z85_key
,
reinterpret_cast
<
const
char
*>
(
optval_
),
optvallen_
);
z85_key
[
CURVE_KEYSIZE_Z85
]
=
0
;
if
(
zmq_z85_decode
(
destination_
,
z85_key
))
{
mechanism
=
ZMQ_CURVE
;
...
...
@@ -719,15 +721,14 @@ int zmq::options_t::setsockopt (int option_,
case
ZMQ_METADATA
:
if
(
optvallen_
>
0
&&
!
is_int
)
{
std
::
string
s
((
char
*
)
optval_
);
size_t
pos
=
0
;
std
::
string
key
,
val
,
delimiter
=
":"
;
pos
=
s
.
find
(
delimiter
);
const
std
::
string
s
(
reinterpret_cast
<
const
char
*>
(
optval_
));
const
size_t
pos
=
s
.
find
(
":"
);
if
(
pos
!=
std
::
string
::
npos
&&
pos
!=
0
&&
pos
!=
s
.
length
()
-
1
)
{
key
=
s
.
substr
(
0
,
pos
);
if
(
key
.
compare
(
0
,
2
,
"X-"
)
==
0
&&
key
.
length
()
<
256
)
{
val
=
s
.
substr
(
pos
+
1
,
s
.
length
());
std
::
string
key
=
s
.
substr
(
0
,
pos
);
if
(
key
.
compare
(
0
,
2
,
"X-"
)
==
0
&&
key
.
length
()
<=
UCHAR_MAX
)
{
std
::
string
val
=
s
.
substr
(
pos
+
1
,
s
.
length
());
app_metadata
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
key
,
val
));
return
0
;
...
...
@@ -736,7 +737,6 @@ int zmq::options_t::setsockopt (int option_,
}
errno
=
EINVAL
;
return
-
1
;
break
;
case
ZMQ_MULTICAST_LOOP
:
return
do_setsockopt_int_as_bool_relaxed
(
optval_
,
optvallen_
,
...
...
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