WindowServer: Fix compiler warnings.

This commit is contained in:
Andreas Kling 2019-06-22 14:48:52 +02:00
parent 3f0f7caa45
commit 0deade2883
Notes: sideshowbarker 2024-07-19 13:31:20 +09:00
5 changed files with 12 additions and 10 deletions

View file

@ -82,11 +82,11 @@ void WSClientConnection::post_message(const WSAPI_ServerMessage& message, const
struct iovec iov[2];
int iov_count = 1;
iov[0].iov_base = (void*)&message;
iov[0].iov_base = const_cast<WSAPI_ServerMessage*>(&message);
iov[0].iov_len = sizeof(message);
if (!extra_data.is_empty()) {
iov[1].iov_base = (void*)extra_data.data();
iov[1].iov_base = const_cast<byte*>(extra_data.data());
iov[1].iov_len = extra_data.size();
++iov_count;
}
@ -110,7 +110,7 @@ void WSClientConnection::post_message(const WSAPI_ServerMessage& message, const
}
}
ASSERT(nwritten == sizeof(message) + extra_data.size());
ASSERT(nwritten == (int)(sizeof(message) + extra_data.size()));
}
void WSClientConnection::notify_about_new_screen_rect(const Rect& rect)

View file

@ -103,14 +103,14 @@ void WSEventLoop::drain_keyboard()
static Vector<Rect, 32> get_rects(const WSAPI_ClientMessage& message, const ByteBuffer& extra_data)
{
Vector<Rect, 32> rects;
if (message.rect_count > (WSAPI_ClientMessage::max_inline_rect_count + extra_data.size() / sizeof(WSAPI_Rect))) {
if (message.rect_count > (int)(WSAPI_ClientMessage::max_inline_rect_count + extra_data.size() / sizeof(WSAPI_Rect))) {
return {};
}
for (int i = 0; i < min(WSAPI_ClientMessage::max_inline_rect_count, message.rect_count); ++i)
rects.append(message.rects[i]);
if (!extra_data.is_empty()) {
auto* extra_rects = reinterpret_cast<const WSAPI_Rect*>(extra_data.data());
for (int i = 0; i < (extra_data.size() / sizeof(WSAPI_Rect)); ++i)
for (int i = 0; i < (int)(extra_data.size() / sizeof(WSAPI_Rect)); ++i)
rects.append(extra_rects[i]);
}
return rects;
@ -378,8 +378,10 @@ void WSEventLoop::drain_client(WSClientConnection& client)
extra_data = ByteBuffer::create_uninitialized(message.extra_size);
// FIXME: We should allow this to time out. Maybe use a socket timeout?
int extra_nread = read(client.fd(), extra_data.data(), extra_data.size());
if (extra_nread != message.extra_size) {
if (extra_nread != (int)message.extra_size) {
dbgprintf("extra_nread(%d) != extra_size(%d)\n", extra_nread, extra_data.size());
if (extra_nread < 0)
perror("read");
return client.did_misbehave();
}
}

View file

@ -234,7 +234,7 @@ void WSWindow::event(CEvent& event)
server_message.wm.is_active = changed_event.is_active();
server_message.wm.is_minimized = changed_event.is_minimized();
server_message.wm.window_type = to_api(changed_event.window_type());
ASSERT(changed_event.title().length() < sizeof(server_message.text));
ASSERT(changed_event.title().length() < (int)sizeof(server_message.text));
memcpy(server_message.text, changed_event.title().characters(), changed_event.title().length());
server_message.text_length = changed_event.title().length();
server_message.wm.rect = changed_event.rect();
@ -246,7 +246,7 @@ void WSWindow::event(CEvent& event)
server_message.type = WSAPI_ServerMessage::Type::WM_WindowIconChanged;
server_message.wm.client_id = changed_event.client_id();
server_message.wm.window_id = changed_event.window_id();
ASSERT(changed_event.icon_path().length() < sizeof(server_message.text));
ASSERT(changed_event.icon_path().length() < (int)sizeof(server_message.text));
memcpy(server_message.text, changed_event.icon_path().characters(), changed_event.icon_path().length());
server_message.text_length = changed_event.icon_path().length();
break;

View file

@ -66,7 +66,7 @@ WSWindowManager::WSWindowManager()
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 300, "Shutdown..."));
m_system_menu->on_item_activation = [this, apps](WSMenuItem& item) {
if (item.identifier() >= 1 && item.identifier() <= 1 + apps.size() - 1) {
if (item.identifier() >= 1 && item.identifier() <= 1u + apps.size() - 1) {
if (fork() == 0) {
const auto& bin = apps[item.identifier() - 1].binary_name;
execl(bin, bin, nullptr);

View file

@ -215,7 +215,7 @@ private:
CElapsedTimer m_middle_click_clock;
};
DoubleClickInfo m_double_click_info;
unsigned int m_double_click_speed;
int m_double_click_speed { 0 };
WeakPtr<WSWindow> m_active_window;
WeakPtr<WSWindow> m_hovered_window;