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
406c423c
Commit
406c423c
authored
Dec 25, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: C-style casts used
Solution: use static_cast instead
parent
78961eea
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
17 deletions
+24
-17
array.hpp
src/array.hpp
+12
-6
ip_resolver.cpp
src/ip_resolver.cpp
+1
-1
mechanism.cpp
src/mechanism.cpp
+2
-1
thread.cpp
src/thread.cpp
+1
-1
v2_decoder.cpp
src/v2_decoder.cpp
+2
-2
ws_decoder.cpp
src/ws_decoder.cpp
+2
-2
xpub.cpp
src/xpub.cpp
+1
-1
yqueue.hpp
src/yqueue.hpp
+1
-1
zmq.cpp
src/zmq.cpp
+1
-1
zmq_utils.cpp
src/zmq_utils.cpp
+1
-1
No files found.
src/array.hpp
View file @
406c423c
...
...
@@ -89,20 +89,23 @@ template <typename T, int ID = 0> class array_t
inline
void
push_back
(
T
*
item_
)
{
if
(
item_
)
((
item_t
*
)
item_
)
->
set_array_index
((
int
)
_items
.
size
());
static_cast
<
item_t
*>
(
item_
)
->
set_array_index
(
static_cast
<
int
>
(
_items
.
size
()));
_items
.
push_back
(
item_
);
}
inline
void
erase
(
T
*
item_
)
{
erase
(
((
item_t
*
)
item_
)
->
get_array_index
());
erase
(
static_cast
<
item_t
*>
(
item_
)
->
get_array_index
());
}
inline
void
erase
(
size_type
index_
)
{
if
(
_items
.
empty
())
return
;
((
item_t
*
)
_items
.
back
())
->
set_array_index
((
int
)
index_
);
static_cast
<
item_t
*>
(
_items
.
back
())
->
set_array_index
(
static_cast
<
int
>
(
index_
));
_items
[
index_
]
=
_items
.
back
();
_items
.
pop_back
();
}
...
...
@@ -110,9 +113,11 @@ template <typename T, int ID = 0> class array_t
inline
void
swap
(
size_type
index1_
,
size_type
index2_
)
{
if
(
_items
[
index1_
])
((
item_t
*
)
_items
[
index1_
])
->
set_array_index
((
int
)
index2_
);
static_cast
<
item_t
*>
(
_items
[
index1_
])
->
set_array_index
(
static_cast
<
int
>
(
index2_
));
if
(
_items
[
index2_
])
((
item_t
*
)
_items
[
index2_
])
->
set_array_index
((
int
)
index1_
);
static_cast
<
item_t
*>
(
_items
[
index2_
])
->
set_array_index
(
static_cast
<
int
>
(
index1_
));
std
::
swap
(
_items
[
index1_
],
_items
[
index2_
]);
}
...
...
@@ -120,7 +125,8 @@ template <typename T, int ID = 0> class array_t
static
inline
size_type
index
(
T
*
item_
)
{
return
(
size_type
)
((
item_t
*
)
item_
)
->
get_array_index
();
return
static_cast
<
size_type
>
(
static_cast
<
item_t
*>
(
item_
)
->
get_array_index
());
}
private
:
...
...
src/ip_resolver.cpp
View file @
406c423c
...
...
@@ -388,7 +388,7 @@ int zmq::ip_resolver_t::resolve_getaddrinfo (ip_addr_t *ip_addr_,
// Use the first result.
zmq_assert
(
res
!=
NULL
);
zmq_assert
(
(
size_t
)
res
->
ai_addrlen
<=
sizeof
(
*
ip_addr_
));
zmq_assert
(
static_cast
<
size_t
>
(
res
->
ai_addrlen
)
<=
sizeof
(
*
ip_addr_
));
memcpy
(
ip_addr_
,
res
->
ai_addr
,
res
->
ai_addrlen
);
// Cleanup getaddrinfo after copying the possibly referenced result.
...
...
src/mechanism.cpp
View file @
406c423c
...
...
@@ -110,7 +110,8 @@ const char *zmq::mechanism_t::socket_type_string (int socket_type_)
#endif
};
static
const
size_t
names_count
=
sizeof
(
names
)
/
sizeof
(
names
[
0
]);
zmq_assert
(
socket_type_
>=
0
&&
socket_type_
<
(
int
)
names_count
);
zmq_assert
(
socket_type_
>=
0
&&
socket_type_
<
static_cast
<
int
>
(
names_count
));
return
names
[
socket_type_
];
}
...
...
src/thread.cpp
View file @
406c423c
...
...
@@ -50,7 +50,7 @@ static DWORD thread_routine (LPVOID arg_)
static
unsigned
int
__stdcall
thread_routine
(
void
*
arg_
)
#endif
{
zmq
::
thread_t
*
self
=
(
zmq
::
thread_t
*
)
arg_
;
zmq
::
thread_t
*
self
=
static_cast
<
zmq
::
thread_t
*>
(
arg_
)
;
self
->
applyThreadName
();
self
->
_tfn
(
self
->
_arg
);
return
0
;
...
...
src/v2_decoder.cpp
View file @
406c423c
...
...
@@ -115,8 +115,8 @@ int zmq::v2_decoder_t::size_ready (uint64_t msg_size_,
shared_message_memory_allocator
&
allocator
=
get_allocator
();
if
(
unlikely
(
!
_zero_copy
||
msg_size_
>
(
size_t
)
(
allocator
.
data
()
+
allocator
.
size
()
-
read_pos_
)))
{
||
msg_size_
>
static_cast
<
size_t
>
(
allocator
.
data
()
+
allocator
.
size
()
-
read_pos_
)))
{
// a new message has started, but the size would exceed the pre-allocated arena
// this happens every time when a message does not fit completely into the buffer
rc
=
_in_progress
.
init_size
(
static_cast
<
size_t
>
(
msg_size_
));
...
...
src/ws_decoder.cpp
View file @
406c423c
...
...
@@ -213,8 +213,8 @@ int zmq::ws_decoder_t::size_ready (unsigned char const *read_pos_)
shared_message_memory_allocator
&
allocator
=
get_allocator
();
if
(
unlikely
(
!
_zero_copy
||
_size
>
(
size_t
)
(
allocator
.
data
()
+
allocator
.
size
()
-
read_pos_
)))
{
||
_size
>
static_cast
<
size_t
>
(
allocator
.
data
()
+
allocator
.
size
()
-
read_pos_
)))
{
// a new message has started, but the size would exceed the pre-allocated arena
// this happens every time when a message does not fit completely into the buffer
rc
=
_in_progress
.
init_size
(
static_cast
<
size_t
>
(
_size
));
...
...
src/xpub.cpp
View file @
406c423c
...
...
@@ -270,7 +270,7 @@ void zmq::xpub_t::xpipe_terminated (pipe_t *pipe_)
// Remove pipe without actually sending the message as it was taken
// care of by the manual call above. subscriptions is the real mtrie,
// so the pipe must be removed from there or it will be left over.
_subscriptions
.
rm
(
pipe_
,
stub
,
(
void
*
)
NULL
,
false
);
_subscriptions
.
rm
(
pipe_
,
stub
,
static_cast
<
void
*>
(
NULL
)
,
false
);
}
else
{
// Remove the pipe from the trie. If there are topics that nobody
// is interested in anymore, send corresponding unsubscriptions
...
...
src/yqueue.hpp
View file @
406c423c
...
...
@@ -187,7 +187,7 @@ template <typename T, int N> class yqueue_t
return
(
chunk_t
*
)
pv
;
return
NULL
;
#else
return
(
chunk_t
*
)
malloc
(
sizeof
(
chunk_t
));
return
static_cast
<
chunk_t
*>
(
malloc
(
sizeof
(
chunk_t
)
));
#endif
}
...
...
src/zmq.cpp
View file @
406c423c
...
...
@@ -259,7 +259,7 @@ void *zmq_socket (void *ctx_, int type_)
}
zmq
::
ctx_t
*
ctx
=
static_cast
<
zmq
::
ctx_t
*>
(
ctx_
);
zmq
::
socket_base_t
*
s
=
ctx
->
create_socket
(
type_
);
return
(
void
*
)
s
;
return
static_cast
<
void
*>
(
s
)
;
}
int
zmq_close
(
void
*
s_
)
...
...
src/zmq_utils.cpp
View file @
406c423c
...
...
@@ -63,7 +63,7 @@ void *zmq_stopwatch_start ()
uint64_t
*
watch
=
static_cast
<
uint64_t
*>
(
malloc
(
sizeof
(
uint64_t
)));
alloc_assert
(
watch
);
*
watch
=
zmq
::
clock_t
::
now_us
();
return
(
void
*
)
watch
;
return
static_cast
<
void
*>
(
watch
)
;
}
unsigned
long
zmq_stopwatch_intermediate
(
void
*
watch_
)
...
...
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