Fix size_t incorrectly assigned to int
The function control_msg_serialize() returns a size_t.
This commit is contained in:
parent
8dbb1676b7
commit
94eff0a4bb
2 changed files with 14 additions and 14 deletions
|
@ -60,12 +60,12 @@ static bool
|
|||
process_msg(struct controller *controller,
|
||||
const struct control_msg *msg) {
|
||||
static unsigned char serialized_msg[CONTROL_MSG_MAX_SIZE];
|
||||
int length = control_msg_serialize(msg, serialized_msg);
|
||||
size_t length = control_msg_serialize(msg, serialized_msg);
|
||||
if (!length) {
|
||||
return false;
|
||||
}
|
||||
int w = net_send_all(controller->control_socket, serialized_msg, length);
|
||||
return w == length;
|
||||
return (size_t) w == length;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -17,7 +17,7 @@ static void test_serialize_inject_keycode(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 14);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -39,7 +39,7 @@ static void test_serialize_inject_text(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 18);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -59,7 +59,7 @@ static void test_serialize_inject_text_long(void) {
|
|||
msg.inject_text.text = text;
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 5 + CONTROL_MSG_INJECT_TEXT_MAX_LENGTH);
|
||||
|
||||
unsigned char expected[5 + CONTROL_MSG_INJECT_TEXT_MAX_LENGTH];
|
||||
|
@ -95,7 +95,7 @@ static void test_serialize_inject_touch_event(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 28);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -130,7 +130,7 @@ static void test_serialize_inject_scroll_event(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 21);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -149,7 +149,7 @@ static void test_serialize_back_or_screen_on(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 1);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -164,7 +164,7 @@ static void test_serialize_expand_notification_panel(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 1);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -179,7 +179,7 @@ static void test_serialize_collapse_notification_panel(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 1);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -194,7 +194,7 @@ static void test_serialize_get_clipboard(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 1);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -213,7 +213,7 @@ static void test_serialize_set_clipboard(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 19);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -234,7 +234,7 @@ static void test_serialize_set_screen_power_mode(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 2);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
@ -250,7 +250,7 @@ static void test_serialize_rotate_device(void) {
|
|||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
size_t size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 1);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
|
|
Loading…
Reference in a new issue