mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-29 12:18:04 +01:00
Problem: use of C-style casts
Solution: use static_cast/reinterpret_cast instead
This commit is contained in:
committed by
Simon Giesecke
parent
a83c57d0bb
commit
cd954e207d
@@ -190,10 +190,10 @@ static int get_monitor_event (void *monitor_, int *value_, char **address_)
|
||||
return -1; // Interruped, presumably
|
||||
TEST_ASSERT_TRUE (zmq_msg_more (&msg));
|
||||
|
||||
uint8_t *data = (uint8_t *) zmq_msg_data (&msg);
|
||||
uint16_t event = *(uint16_t *) (data);
|
||||
uint8_t *data = static_cast<uint8_t *> (zmq_msg_data (&msg));
|
||||
uint16_t event = *reinterpret_cast<uint16_t *> (data);
|
||||
if (value_)
|
||||
*value_ = *(uint32_t *) (data + 2);
|
||||
*value_ = *reinterpret_cast<uint32_t *> (data + 2);
|
||||
zmq_msg_close (&msg);
|
||||
|
||||
// Second frame in message contains event address
|
||||
@@ -203,9 +203,9 @@ static int get_monitor_event (void *monitor_, int *value_, char **address_)
|
||||
TEST_ASSERT_FALSE (zmq_msg_more (&msg));
|
||||
|
||||
if (address_) {
|
||||
uint8_t *data = (uint8_t *) zmq_msg_data (&msg);
|
||||
uint8_t *data = static_cast<uint8_t *> (zmq_msg_data (&msg));
|
||||
size_t size = zmq_msg_size (&msg);
|
||||
*address_ = (char *) malloc (size + 1);
|
||||
*address_ = static_cast<char *> (malloc (size + 1));
|
||||
memcpy (*address_, data, size);
|
||||
*address_[size] = 0;
|
||||
}
|
||||
@@ -302,7 +302,8 @@ void test_vanilla_socket ()
|
||||
#endif
|
||||
|
||||
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
rc = connect (s, (struct sockaddr *) &ip4addr, sizeof (ip4addr));
|
||||
rc = connect (s, reinterpret_cast<struct sockaddr *> (&ip4addr),
|
||||
sizeof (ip4addr));
|
||||
TEST_ASSERT_GREATER_THAN (-1, rc);
|
||||
// send anonymous ZMTP/1.0 greeting
|
||||
send (s, "\x01\x00", 2, 0);
|
||||
|
||||
Reference in New Issue
Block a user