[gstreamermm] Harden TypeFind code and avoid compiler warning
- From: Daniel Elstner <daniel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gstreamermm] Harden TypeFind code and avoid compiler warning
- Date: Tue, 6 Oct 2009 12:26:12 +0000 (UTC)
commit 126e039a624b759951cbd6d1179898c37a02b6e8
Author: Daniel Elstner <danielk openismus com>
Date: Tue Oct 6 14:14:45 2009 +0200
Harden TypeFind code and avoid compiler warning
* gstreamer/src/typefind.ccg: Place file-scope declarations into an
anonymous namespace.
(TypeFind_Find_gstreamermm_callback): Remove unused parameter name
to avoid a compiler warning. Use extern "C" calling convention.
(TypeFind_Find_gstreamermm_callback_destroy): Use extern "C" calling
convention.
(TypeFind::register_slot): Use Glib::unwrap() instead of ->gobj()
where appropriate, in order to allow for null RefPtr<> arguments.
ChangeLog | 13 +++++++++++++
gstreamer/src/typefind.ccg | 42 +++++++++++++++++++++++++-----------------
2 files changed, 38 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bc6f5fd..e802119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2009-10-06 Daniel Elstner <danielk openismus com>
+ Harden TypeFind code and avoid compiler warning
+
+ * gstreamer/src/typefind.ccg: Place file-scope declarations into an
+ anonymous namespace.
+ (TypeFind_Find_gstreamermm_callback): Remove unused parameter name
+ to avoid a compiler warning. Use extern "C" calling convention.
+ (TypeFind_Find_gstreamermm_callback_destroy): Use extern "C" calling
+ convention.
+ (TypeFind::register_slot): Use Glib::unwrap() instead of ->gobj()
+ where appropriate, in order to allow for null RefPtr<> arguments.
+
+2009-10-06 Daniel Elstner <danielk openismus com>
+
Comment on TagList code and avoid some warnings
* tools/m4/class_boxedtype_extra.m4 (_END_CLASS_BOXEDTYPE_EXTRA):
diff --git a/gstreamer/src/typefind.ccg b/gstreamer/src/typefind.ccg
index 27b8f7a..a741b95 100644
--- a/gstreamer/src/typefind.ccg
+++ b/gstreamer/src/typefind.ccg
@@ -22,22 +22,27 @@
#include <gstreamermm/caps.h>
#include <gstreamermm/plugin.h>
-static void TypeFind_Find_gstreamermm_callback(GstTypeFind* find, void* data)
+namespace
{
- Gst::TypeFind::SlotFind* the_slot = static_cast<Gst::TypeFind::SlotFind*>(data);
+extern "C"
+{
+
+static void TypeFind_Find_gstreamermm_callback(GstTypeFind*, void* data)
+{
+ Gst::TypeFind::SlotFind& slot_find = *static_cast<Gst::TypeFind::SlotFind*>(data);
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
+#endif
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
- (*the_slot)();
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ slot_find();
}
- catch(...)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ catch (...)
{
Glib::exception_handlers_invoke();
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
+#endif
}
static void TypeFind_Find_gstreamermm_callback_destroy(void* data)
@@ -45,6 +50,9 @@ static void TypeFind_Find_gstreamermm_callback_destroy(void* data)
delete static_cast<Gst::TypeFind::SlotFind*>(data);
}
+} // extern "C"
+} // anonymous namespace
+
namespace Gst
{
@@ -54,9 +62,9 @@ bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
const Glib::RefPtr<const Gst::Caps>& caps)
{
SlotFind* slot_copy = new SlotFind(find_slot);
- return gst_type_find_register(plugin->gobj(), name.c_str(), rank,
+ return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
&TypeFind_Find_gstreamermm_callback,
- const_cast<gchar**>(extensions.data()), caps->gobj(), slot_copy,
+ const_cast<gchar**>(extensions.data()), Glib::unwrap(caps), slot_copy,
&TypeFind_Find_gstreamermm_callback_destroy);
}
@@ -65,8 +73,8 @@ bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
const Glib::RefPtr<const Gst::Caps>& caps)
{
SlotFind* slot_copy = new SlotFind(find_slot);
- return gst_type_find_register(plugin->gobj(), name.c_str(), rank,
- &TypeFind_Find_gstreamermm_callback, 0, caps->gobj(), slot_copy,
+ return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
+ &TypeFind_Find_gstreamermm_callback, 0, Glib::unwrap(caps), slot_copy,
&TypeFind_Find_gstreamermm_callback_destroy);
}
@@ -75,7 +83,7 @@ bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
const Glib::StringArrayHandle& extensions)
{
SlotFind* slot_copy = new SlotFind(find_slot);
- return gst_type_find_register(plugin->gobj(), name.c_str(), rank,
+ return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
&TypeFind_Find_gstreamermm_callback,
const_cast<gchar**>(extensions.data()), 0, slot_copy,
&TypeFind_Find_gstreamermm_callback_destroy);
@@ -85,7 +93,7 @@ bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
const Glib::ustring& name, guint rank, const SlotFind& find_slot)
{
SlotFind* slot_copy = new SlotFind(find_slot);
- return gst_type_find_register(plugin->gobj(), name.c_str(), rank,
+ return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
&TypeFind_Find_gstreamermm_callback, 0, 0, slot_copy,
&TypeFind_Find_gstreamermm_callback_destroy);
}
@@ -97,7 +105,7 @@ bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
SlotFind* slot_copy = new SlotFind(find_slot);
return gst_type_find_register(0, name.c_str(), rank,
&TypeFind_Find_gstreamermm_callback,
- const_cast<gchar**>(extensions.data()), caps->gobj(), slot_copy,
+ const_cast<gchar**>(extensions.data()), Glib::unwrap(caps), slot_copy,
&TypeFind_Find_gstreamermm_callback_destroy);
}
@@ -106,7 +114,7 @@ bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
{
SlotFind* slot_copy = new SlotFind(find_slot);
return gst_type_find_register(0, name.c_str(), rank,
- &TypeFind_Find_gstreamermm_callback, 0, caps->gobj(), slot_copy,
+ &TypeFind_Find_gstreamermm_callback, 0, Glib::unwrap(caps), slot_copy,
&TypeFind_Find_gstreamermm_callback_destroy);
}
@@ -129,4 +137,4 @@ bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
&TypeFind_Find_gstreamermm_callback_destroy);
}
-} //namespace Gst
+} // namespace Gst
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]