mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:57:35 +00:00
LibGUI: Fix compiler warnings.
This commit is contained in:
parent
56ae96558b
commit
3f0f7caa45
6 changed files with 21 additions and 13 deletions
|
@ -367,7 +367,11 @@ bool GEventLoop::drain_messages_from_server()
|
||||||
if (message.extra_size) {
|
if (message.extra_size) {
|
||||||
extra_data = ByteBuffer::create_uninitialized(message.extra_size);
|
extra_data = ByteBuffer::create_uninitialized(message.extra_size);
|
||||||
int extra_nread = read(s_windowserver_fd, extra_data.data(), extra_data.size());
|
int extra_nread = read(s_windowserver_fd, extra_data.data(), extra_data.size());
|
||||||
ASSERT(extra_nread == message.extra_size);
|
if (extra_nread < 0) {
|
||||||
|
perror("read");
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
ASSERT((size_t)extra_nread == message.extra_size);
|
||||||
}
|
}
|
||||||
m_unprocessed_bundles.append({ move(message), move(extra_data) });
|
m_unprocessed_bundles.append({ move(message), move(extra_data) });
|
||||||
}
|
}
|
||||||
|
@ -380,17 +384,21 @@ bool GEventLoop::post_message_to_server(const WSAPI_ClientMessage& message, cons
|
||||||
|
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
int iov_count = 1;
|
int iov_count = 1;
|
||||||
iov[0].iov_base = (void*)&message;
|
iov[0].iov_base = const_cast<WSAPI_ClientMessage*>(&message);
|
||||||
iov[0].iov_len = sizeof(message);
|
iov[0].iov_len = sizeof(message);
|
||||||
|
|
||||||
if (!extra_data.is_empty()) {
|
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[1].iov_len = extra_data.size();
|
||||||
++iov_count;
|
++iov_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nwritten = writev(s_windowserver_fd, iov, iov_count);
|
int nwritten = writev(s_windowserver_fd, iov, iov_count);
|
||||||
ASSERT(nwritten == sizeof(message) + extra_data.size());
|
if (nwritten < 0) {
|
||||||
|
perror("writev");
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
ASSERT((size_t)nwritten == sizeof(message) + extra_data.size());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@ struct GFileSystemModel::Node {
|
||||||
GModelIndex index(const GFileSystemModel& model) const
|
GModelIndex index(const GFileSystemModel& model) const
|
||||||
{
|
{
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return model.create_index(0, 0, (void*)this);
|
return model.create_index(0, 0, const_cast<Node*>(this));
|
||||||
for (int row = 0; row < parent->children.size(); ++row) {
|
for (int row = 0; row < parent->children.size(); ++row) {
|
||||||
if (parent->children[row] == this)
|
if (parent->children[row] == this)
|
||||||
return model.create_index(row, 0, (void*)this);
|
return model.create_index(row, 0, const_cast<Node*>(this));
|
||||||
}
|
}
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,7 +626,7 @@ void GWindow::set_icon_path(const StringView& path)
|
||||||
WSAPI_ClientMessage message;
|
WSAPI_ClientMessage message;
|
||||||
message.type = WSAPI_ClientMessage::Type::SetWindowIcon;
|
message.type = WSAPI_ClientMessage::Type::SetWindowIcon;
|
||||||
message.window_id = m_window_id;
|
message.window_id = m_window_id;
|
||||||
ASSERT(path.length() < sizeof(message.text));
|
ASSERT(path.length() < (int)sizeof(message.text));
|
||||||
strcpy(message.text, path.characters());
|
strcpy(message.text, path.characters());
|
||||||
message.text_length = path.length();
|
message.text_length = path.length();
|
||||||
GEventLoop::post_message_to_server(message);
|
GEventLoop::post_message_to_server(message);
|
||||||
|
|
|
@ -170,6 +170,6 @@ private:
|
||||||
bool m_show_titlebar { true };
|
bool m_show_titlebar { true };
|
||||||
bool m_keybind_mode { false };
|
bool m_keybind_mode { false };
|
||||||
String m_entered_keybind;
|
String m_entered_keybind;
|
||||||
size_t m_max_keybind_length { 0 };
|
int m_max_keybind_length { 0 };
|
||||||
HashMap<String, WeakPtr<GWidget>> m_keyboard_activation_targets;
|
HashMap<String, WeakPtr<GWidget>> m_keyboard_activation_targets;
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,7 +107,7 @@ RefPtr<Font> Font::load_from_memory(const byte* data)
|
||||||
|
|
||||||
size_t bytes_per_glyph = sizeof(unsigned) * header.glyph_height;
|
size_t bytes_per_glyph = sizeof(unsigned) * header.glyph_height;
|
||||||
|
|
||||||
auto* rows = (unsigned*)(data + sizeof(FontFileHeader));
|
auto* rows = const_cast<unsigned*>((const unsigned*)(data + sizeof(FontFileHeader)));
|
||||||
byte* widths = nullptr;
|
byte* widths = nullptr;
|
||||||
if (header.is_variable_width)
|
if (header.is_variable_width)
|
||||||
widths = (byte*)(rows) + 256 * bytes_per_glyph;
|
widths = (byte*)(rows) + 256 * bytes_per_glyph;
|
||||||
|
|
|
@ -27,7 +27,7 @@ static_assert(sizeof(PNG_IHDR) == 13);
|
||||||
|
|
||||||
struct Scanline {
|
struct Scanline {
|
||||||
byte filter { 0 };
|
byte filter { 0 };
|
||||||
ByteBuffer data;
|
ByteBuffer data { };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PNGLoadingContext {
|
struct PNGLoadingContext {
|
||||||
|
@ -61,9 +61,9 @@ public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool read(T& value)
|
bool read(T& value)
|
||||||
{
|
{
|
||||||
if (m_size_remaining < sizeof(T))
|
if (m_size_remaining < (int)sizeof(T))
|
||||||
return false;
|
return false;
|
||||||
value = *((NetworkOrdered<T>*)m_data_ptr);
|
value = *((const NetworkOrdered<T>*)m_data_ptr);
|
||||||
m_data_ptr += sizeof(T);
|
m_data_ptr += sizeof(T);
|
||||||
m_size_remaining -= sizeof(T);
|
m_size_remaining -= sizeof(T);
|
||||||
return true;
|
return true;
|
||||||
|
@ -383,7 +383,7 @@ static RefPtr<GraphicsBitmap> load_png_impl(const byte* data, int data_size)
|
||||||
|
|
||||||
static bool process_IHDR(const ByteBuffer& data, PNGLoadingContext& context)
|
static bool process_IHDR(const ByteBuffer& data, PNGLoadingContext& context)
|
||||||
{
|
{
|
||||||
if (data.size() < sizeof(PNG_IHDR))
|
if (data.size() < (int)sizeof(PNG_IHDR))
|
||||||
return false;
|
return false;
|
||||||
auto& ihdr = *(const PNG_IHDR*)data.pointer();
|
auto& ihdr = *(const PNG_IHDR*)data.pointer();
|
||||||
context.width = ihdr.width;
|
context.width = ihdr.width;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue