[fix] fix unused variables and type conversions

This commit is contained in:
dijunkun
2024-11-26 17:31:37 +08:00
parent 1e58abdfdd
commit 0caa243006
4 changed files with 13 additions and 8 deletions

View File

@@ -88,7 +88,8 @@ int Render::ControlBar() {
RemoteAction remote_action;
remote_action.type = ControlType::audio_capture;
remote_action.a = audio_capture_button_pressed_;
SendData(peer_, (const char*)&remote_action, sizeof(remote_action));
SendDataFrame(peer_, (const char*)&remote_action,
sizeof(remote_action));
}
}
if (!audio_capture_button_pressed_) {

View File

@@ -62,7 +62,7 @@ int Render::ProcessMouseEvent(SDL_Event &event) {
if (control_bar_hovered_) {
remote_action.m.flag = MouseFlag::move;
}
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
SendDataFrame(peer_, (const char *)&remote_action, sizeof(remote_action));
} else if (SDL_MOUSEBUTTONUP == event.type) {
remote_action.type = ControlType::mouse;
if (SDL_BUTTON_LEFT == event.button.button) {
@@ -73,11 +73,11 @@ int Render::ProcessMouseEvent(SDL_Event &event) {
if (control_bar_hovered_) {
remote_action.m.flag = MouseFlag::move;
}
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
SendDataFrame(peer_, (const char *)&remote_action, sizeof(remote_action));
} else if (SDL_MOUSEMOTION == event.type) {
remote_action.type = ControlType::mouse;
remote_action.m.flag = MouseFlag::move;
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
SendDataFrame(peer_, (const char *)&remote_action, sizeof(remote_action));
}
return 0;
@@ -93,7 +93,7 @@ int Render::SendKeyEvent(int key_code, bool is_down) {
}
remote_action.k.key_value = key_code;
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
SendDataFrame(peer_, (const char *)&remote_action, sizeof(remote_action));
return 0;
}
@@ -282,8 +282,8 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char *user_id,
remote_action.type = ControlType::host_infomation;
memcpy(&remote_action.i.host_name, host_name.data(), host_name.size());
remote_action.i.host_name_size = host_name.size();
int ret = SendData(render->peer_, (const char *)&remote_action,
sizeof(remote_action));
int ret = SendDataFrame(render->peer_, (const char *)&remote_action,
sizeof(remote_action));
if (0 == ret) {
render->hostname_sent_ = true;
}