[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 05/06: Prefer static_cast when possible.

noreply at xfce.org noreply at xfce.org
Tue Jan 14 11:43:58 CET 2020


This is an automated email from the git hooks/post-receive script.

g   o   t   t   c   o   d   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 5719872a18688cd15216d106941f7b4547397a62
Author: Graeme Gott <graeme at gottcode.org>
Date:   Sat Jan 11 19:56:57 2020 -0500

    Prefer static_cast when possible.
---
 panel-plugin/applications-page.h    |   6 +-
 panel-plugin/launcher-icon-view.cpp |   4 +-
 panel-plugin/launcher.cpp           |   6 +-
 panel-plugin/page.h                 |   6 +-
 panel-plugin/slot.h                 | 112 +++++++++++++++---------------------
 5 files changed, 56 insertions(+), 78 deletions(-)

diff --git a/panel-plugin/applications-page.h b/panel-plugin/applications-page.h
index faba045..b68579d 100644
--- a/panel-plugin/applications-page.h
+++ b/panel-plugin/applications-page.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2015, 2017, 2018 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2015, 2017, 2018, 2020 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -56,13 +56,13 @@ private:
 
 	static void load_garcon_menu_slot(GTask* task, gpointer, gpointer task_data, GCancellable*)
 	{
-		reinterpret_cast<ApplicationsPage*>(task_data)->load_garcon_menu();
+		static_cast<ApplicationsPage*>(task_data)->load_garcon_menu();
 		g_task_return_boolean(task, true);
 	}
 
 	static void load_contents_slot(GObject*, GAsyncResult*, gpointer user_data)
 	{
-		reinterpret_cast<ApplicationsPage*>(user_data)->load_contents();
+		static_cast<ApplicationsPage*>(user_data)->load_contents();
 	}
 
 private:
diff --git a/panel-plugin/launcher-icon-view.cpp b/panel-plugin/launcher-icon-view.cpp
index 5896a1f..1b3a8a0 100644
--- a/panel-plugin/launcher-icon-view.cpp
+++ b/panel-plugin/launcher-icon-view.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2019, 2020 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -94,7 +94,7 @@ GtkTreePath* LauncherIconView::get_selected_path() const
 	GList* selection = gtk_icon_view_get_selected_items(m_view);
 	if (selection != NULL)
 	{
-		path = gtk_tree_path_copy(reinterpret_cast<GtkTreePath*>(selection->data));
+		path = gtk_tree_path_copy(static_cast<GtkTreePath*>(selection->data));
 	}
 	g_list_free_full(selection, (GDestroyNotify)gtk_tree_path_free);
 	return path;
diff --git a/panel-plugin/launcher.cpp b/panel-plugin/launcher.cpp
index 57f22a9..8aa8af1 100644
--- a/panel-plugin/launcher.cpp
+++ b/panel-plugin/launcher.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014, 2015, 2016, 2019 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2014, 2015, 2016, 2019, 2020 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -154,7 +154,7 @@ Launcher::Launcher(GarconMenuItem* item) :
 	GList* keywords = garcon_menu_item_get_keywords(m_item);
 	for (GList* i = keywords; i != NULL; i = i->next)
 	{
-		const gchar* keyword = reinterpret_cast<gchar*>(i->data);
+		const gchar* keyword = static_cast<gchar*>(i->data);
 		if (!exo_str_is_empty(keyword) && g_utf8_validate(keyword, -1, NULL))
 		{
 			m_search_keywords.push_back(normalize(keyword));
@@ -174,7 +174,7 @@ Launcher::Launcher(GarconMenuItem* item) :
 	GList* actions = garcon_menu_item_get_actions(m_item);
 	for (GList* i = actions; i != NULL; i = i->next)
 	{
-		GarconMenuItemAction* action = garcon_menu_item_get_action(m_item, reinterpret_cast<gchar*>(i->data));
+		GarconMenuItemAction* action = garcon_menu_item_get_action(m_item, static_cast<gchar*>(i->data));
 		if (action)
 		{
 			m_actions.push_back(new DesktopAction(action));
diff --git a/panel-plugin/page.h b/panel-plugin/page.h
index 7cd22dc..7c5ab8a 100644
--- a/panel-plugin/page.h
+++ b/panel-plugin/page.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2017, 2018, 2019 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2017, 2018, 2019, 2020 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -82,12 +82,12 @@ private:
 
 	static void item_activated_slot(GtkIconView*, GtkTreePath* path, gpointer user_data)
 	{
-		reinterpret_cast<Page*>(user_data)->launcher_activated(path);
+		static_cast<Page*>(user_data)->launcher_activated(path);
 	}
 
 	static void row_activated_slot(GtkTreeView*, GtkTreePath* path, GtkTreeViewColumn*, gpointer user_data)
 	{
-		reinterpret_cast<Page*>(user_data)->launcher_activated(path);
+		static_cast<Page*>(user_data)->launcher_activated(path);
 	}
 
 private:
diff --git a/panel-plugin/slot.h b/panel-plugin/slot.h
index a30a177..ad51eeb 100644
--- a/panel-plugin/slot.h
+++ b/panel-plugin/slot.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2016 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2016, 2020 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -40,22 +40,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1 a1, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)(a1);
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -77,22 +75,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)();
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -116,22 +112,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1 a1, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)(a1, slot->m_bound1);
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member, bound1),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -153,22 +147,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1 a1, A2 a2, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)(a1, a2);
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -190,22 +182,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1, A2, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)();
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -227,22 +217,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1 a1, A2 a2, A3 a3, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)(a1, a2, a3);
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,A3,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -264,22 +252,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1, A2, A3, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)();
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,A3,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -301,22 +287,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1 a1, A2 a2, A3 a3, A4 a4, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)(a1, a2, a3, a4);
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,A3,A4,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -338,22 +322,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1, A2, A3, A4, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)();
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,A3,A4,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -375,22 +357,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)(a1, a2, a3, a4, a5);
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,A3,A4,A5,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 
@@ -412,22 +392,20 @@ gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(
 
 		static R invoke(A1, A2, A3, A4, A5, gpointer user_data)
 		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
+			Slot* slot = static_cast<Slot*>(user_data);
 			return (slot->m_instance->*slot->m_member)();
 		}
 
 		static void destroy(gpointer data, GClosure*)
 		{
-			delete reinterpret_cast<Slot*>(data);
+			delete static_cast<Slot*>(data);
 		}
 	};
-	R (*invoke_slot)(A1,A2,A3,A4,A5,gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
 
 	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
+			G_CALLBACK(&Slot::invoke),
 			new Slot(obj, member),
-			destroy_slot,
+			&Slot::destroy,
 			after ? G_CONNECT_AFTER : GConnectFlags(0));
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list