summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorDylam De La Torre <DyXel04@gmail.com>2021-11-16 20:38:14 +0100
committerGitHub <noreply@github.com>2021-11-16 19:38:14 +0000
commit9d21df8e1bca9ccfa1bcfcde3bc8f35473866166 (patch)
tree5d2ea9d83bd779f325c1c48728fc9ac5832cdc5e /components
parent108002248c0739078302e00d5ca224a44b93ea56 (diff)
downloadabaddon-portaudio-9d21df8e1bca9ccfa1bcfcde3bc8f35473866166.tar.gz
abaddon-portaudio-9d21df8e1bca9ccfa1bcfcde3bc8f35473866166.zip
Fix warnings shown by GCC (#47)
* fix all warnings shown by GCC
Diffstat (limited to 'components')
-rw-r--r--components/cellrendererpixbufanimation.cpp1
-rw-r--r--components/channels.cpp19
-rw-r--r--components/chatinputindicator.cpp2
-rw-r--r--components/chatmessage.cpp2
-rw-r--r--components/completer.cpp12
-rw-r--r--components/friendslist.cpp8
6 files changed, 17 insertions, 27 deletions
diff --git a/components/cellrendererpixbufanimation.cpp b/components/cellrendererpixbufanimation.cpp
index 1f49402..2658967 100644
--- a/components/cellrendererpixbufanimation.cpp
+++ b/components/cellrendererpixbufanimation.cpp
@@ -61,7 +61,6 @@ void CellRendererPixbufAnimation::render_vfunc(const Cairo::RefPtr<Cairo::Contex
Gtk::CellRendererState flags) {
Gtk::Requisition minimum, natural;
get_preferred_size(widget, minimum, natural);
- auto alloc = widget.get_allocation();
int xpad, ypad;
get_padding(xpad, ypad);
int pix_x = cell_area.get_x() + xpad;
diff --git a/components/channels.cpp b/components/channels.cpp
index 621d7dc..b4769d9 100644
--- a/components/channels.cpp
+++ b/components/channels.cpp
@@ -16,8 +16,8 @@ ChannelList::ChannelList()
, m_menu_guild_leave("_Leave", true)
, m_menu_category_copy_id("_Copy ID", true)
, m_menu_channel_copy_id("_Copy ID", true)
- , m_menu_dm_close("") // changes depending on if group or not
, m_menu_dm_copy_id("_Copy ID", true)
+ , m_menu_dm_close("") // changes depending on if group or not
, m_menu_thread_copy_id("_Copy ID", true)
, m_menu_thread_leave("_Leave", true)
, m_menu_thread_archive("_Archive", true)
@@ -167,7 +167,6 @@ void ChannelList::UpdateListing() {
m_model->clear();
auto &discord = Abaddon::Get().GetDiscordClient();
- auto &img = Abaddon::Get().GetImageManager();
const auto guild_ids = discord.GetUserSortedGuilds();
int sortnum = 0;
@@ -185,10 +184,7 @@ void ChannelList::UpdateListing() {
}
void ChannelList::UpdateNewGuild(const GuildData &guild) {
- auto &img = Abaddon::Get().GetImageManager();
-
- auto iter = AddGuild(guild);
-
+ AddGuild(guild);
// update sort order
int sortnum = 0;
for (const auto guild_id : Abaddon::Get().GetDiscordClient().GetUserSortedGuilds()) {
@@ -561,7 +557,7 @@ void ChannelList::UpdateChannelCategory(const ChannelData &channel) {
}
Gtk::TreeModel::iterator ChannelList::GetIteratorForGuildFromID(Snowflake id) {
- for (const auto child : m_model->children()) {
+ for (const auto &child : m_model->children()) {
if (child[m_columns.m_id] == id)
return child;
}
@@ -570,14 +566,14 @@ Gtk::TreeModel::iterator ChannelList::GetIteratorForGuildFromID(Snowflake id) {
Gtk::TreeModel::iterator ChannelList::GetIteratorForChannelFromID(Snowflake id) {
std::queue<Gtk::TreeModel::iterator> queue;
- for (const auto child : m_model->children())
- for (const auto child2 : child.children())
+ for (const auto &child : m_model->children())
+ for (const auto &child2 : child.children())
queue.push(child2);
while (!queue.empty()) {
auto item = queue.front();
if ((*item)[m_columns.m_id] == id) return item;
- for (const auto child : item->children())
+ for (const auto &child : item->children())
queue.push(child);
queue.pop();
}
@@ -1052,9 +1048,6 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_category(Gtk::Wi
}
void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr<Cairo::Context> &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) {
- int available_xpad = background_area.get_width();
- int available_ypad = background_area.get_height();
-
// todo: figure out how Gtk::Arrow is rendered because i like it better :^)
constexpr static int len = 5;
int x1, y1, x2, y2, x3, y3;
diff --git a/components/chatinputindicator.cpp b/components/chatinputindicator.cpp
index 8b05c71..acc2aa6 100644
--- a/components/chatinputindicator.cpp
+++ b/components/chatinputindicator.cpp
@@ -112,7 +112,7 @@ void ChatInputIndicator::ComputeTypingString() {
SetTypingString(typers[0].Username + " and " + typers[1].Username + " are typing...");
} else if (typers.size() > 2 && typers.size() <= MaxUsersInIndicator) {
Glib::ustring str;
- for (int i = 0; i < typers.size() - 1; i++)
+ for (size_t i = 0; i < typers.size() - 1; i++)
str += typers[i].Username + ", ";
SetTypingString(str + "and " + typers[typers.size() - 1].Username + " are typing...");
} else { // size() > MaxUsersInIndicator
diff --git a/components/chatmessage.cpp b/components/chatmessage.cpp
index 759443f..4408f62 100644
--- a/components/chatmessage.cpp
+++ b/components/chatmessage.cpp
@@ -308,8 +308,6 @@ Gtk::Widget *ChatMessageItemContainer::CreateEmbedComponent(const EmbedData &emb
constexpr static int AuthorIconSize = 20;
if (embed.Author->ProxyIconURL.has_value()) {
- auto &img = Abaddon::Get().GetImageManager();
-
auto *author_img = Gtk::manage(new LazyImage(*embed.Author->ProxyIconURL, AuthorIconSize, AuthorIconSize));
author_img->set_halign(Gtk::ALIGN_START);
author_img->set_valign(Gtk::ALIGN_START);
diff --git a/components/completer.cpp b/components/completer.cpp
index bf0c8ee..258acb8 100644
--- a/components/completer.cpp
+++ b/components/completer.cpp
@@ -47,7 +47,7 @@ bool Completer::ProcessKeyPress(GdkEventKey *e) {
switch (e->keyval) {
case GDK_KEY_Down: {
if (m_entries.size() == 0) return true;
- const int index = m_list.get_selected_row()->get_index();
+ const auto index = static_cast<size_t>(m_list.get_selected_row()->get_index());
if (index >= m_entries.size() - 1) return true;
m_list.select_row(*m_entries[index + 1]);
ScrollListBoxToSelected(m_list);
@@ -55,7 +55,7 @@ bool Completer::ProcessKeyPress(GdkEventKey *e) {
return true;
case GDK_KEY_Up: {
if (m_entries.size() == 0) return true;
- const int index = m_list.get_selected_row()->get_index();
+ const auto index = static_cast<size_t>(m_list.get_selected_row()->get_index());
if (index == 0) return true;
m_list.select_row(*m_entries[index - 1]);
ScrollListBoxToSelected(m_list);
@@ -169,7 +169,7 @@ void Completer::CompleteEmojis(const Glib::ustring &term) {
const auto guild = discord.GetGuild(*channel->GuildID);
if (guild.has_value() && guild->Emojis.has_value())
- for (const auto tmp : *guild->Emojis) {
+ for (const auto &tmp : *guild->Emojis) {
const auto emoji = *discord.GetEmoji(tmp.ID);
if (emoji.IsAnimated.has_value() && *emoji.IsAnimated) continue;
if (emoji.IsAvailable.has_value() && !*emoji.IsAvailable) continue;
@@ -186,7 +186,7 @@ void Completer::CompleteEmojis(const Glib::ustring &term) {
for (const auto guild_id : discord.GetGuilds()) {
const auto guild = discord.GetGuild(guild_id);
if (!guild.has_value()) continue;
- for (const auto tmp : *guild->Emojis) {
+ for (const auto &tmp : *guild->Emojis) {
const auto emoji = *discord.GetEmoji(tmp.ID);
const bool is_animated = emoji.IsAnimated.has_value() && *emoji.IsAnimated;
if (emoji.IsAvailable.has_value() && !*emoji.IsAvailable) continue;
@@ -330,8 +330,8 @@ Glib::ustring Completer::GetTerm() {
}
CompleterEntry::CompleterEntry(const Glib::ustring &completion, int index)
- : m_index(index)
- , m_completion(completion)
+ : m_completion(completion)
+ , m_index(index)
, m_box(Gtk::ORIENTATION_HORIZONTAL) {
set_halign(Gtk::ALIGN_START);
get_style_context()->add_class("completer-entry");
diff --git a/components/friendslist.cpp b/components/friendslist.cpp
index 6541b0c..ec78b57 100644
--- a/components/friendslist.cpp
+++ b/components/friendslist.cpp
@@ -185,9 +185,9 @@ bool FriendsList::ListFilterFunc(Gtk::ListBoxRow *row_) {
FriendsListAddComponent::FriendsListAddComponent()
: Gtk::Box(Gtk::ORIENTATION_VERTICAL)
, m_label("Add a Friend", Gtk::ALIGN_START)
- , m_box(Gtk::ORIENTATION_HORIZONTAL)
+ , m_status("", Gtk::ALIGN_START)
, m_add("Add")
- , m_status("", Gtk::ALIGN_START) {
+ , m_box(Gtk::ORIENTATION_HORIZONTAL) {
m_box.add(m_entry);
m_box.add(m_add);
m_box.add(m_status);
@@ -241,9 +241,9 @@ bool FriendsListAddComponent::OnKeyPress(GdkEventKey *e) {
}
FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData &data)
- : Name(data.Username + "#" + data.Discriminator)
+ : ID(data.ID)
, Type(type)
- , ID(data.ID)
+ , Name(data.Username + "#" + data.Discriminator)
, Status(Abaddon::Get().GetDiscordClient().GetUserStatus(data.ID))
, m_accept("Accept") {
auto *ev = Gtk::manage(new Gtk::EventBox);