gst: Use G_TYPE_INVALID instead of 0 for GTypes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3226>
This commit is contained in:
Sebastian Dröge 2022-10-19 13:28:06 +03:00 committed by GStreamer Marge Bot
parent f0598767f0
commit 3ceee904dc
6 changed files with 12 additions and 11 deletions

View file

@ -270,7 +270,7 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
GST_INFO ("getting device provider \"%s\"", GST_OBJECT_NAME (factory));
if (factory->type == 0)
if (factory->type == G_TYPE_INVALID)
goto no_type;
device_provider = g_atomic_pointer_get (&newfactory->provider);

View file

@ -488,7 +488,7 @@ gst_element_factory_create_with_properties (GstElementFactory * factory,
GST_INFO ("creating element \"%s\"", GST_OBJECT_NAME (factory));
if (factory->type == 0)
if (factory->type == G_TYPE_INVALID)
goto no_type;
element = (GstElement *) g_object_new_with_properties (factory->type, n,
@ -574,7 +574,7 @@ gst_element_factory_create_valist (GstElementFactory * factory,
(factory)));
g_return_val_if_fail (newfactory != NULL, NULL);
g_return_val_if_fail (newfactory->type != 0, NULL);
g_return_val_if_fail (newfactory->type != G_TYPE_INVALID, NULL);
factory = newfactory;

View file

@ -136,7 +136,7 @@ gst_meta_api_type_register (const gchar * api, const gchar ** tags)
GST_CAT_DEBUG (GST_CAT_META, "register API \"%s\"", api);
type = g_pointer_type_register_static (api);
if (type != 0) {
if (type != G_TYPE_INVALID) {
gint i;
for (i = 0; tags[i]; i++) {
@ -391,7 +391,7 @@ gst_meta_register (GType api, const gchar * impl, gsize size,
* that this fails because it was already registered. Don't warn,
* glib did this for us already. */
type = g_pointer_type_register_static (impl);
if (type == 0)
if (type == G_TYPE_INVALID)
return NULL;
info = (GstMetaInfo *) g_slice_new (GstMetaInfoImpl);

View file

@ -703,8 +703,9 @@ gst_plugin_feature_type_name_filter (GstPluginFeature * feature,
{
g_assert (GST_IS_PLUGIN_FEATURE (feature));
return ((data->type == 0 || data->type == G_OBJECT_TYPE (feature)) &&
(data->name == NULL || !strcmp (data->name, GST_OBJECT_NAME (feature))));
return ((data->type == G_TYPE_INVALID
|| data->type == G_OBJECT_TYPE (feature)) && (data->name == NULL
|| !strcmp (data->name, GST_OBJECT_NAME (feature))));
}
/* returns TRUE if the list was changed

View file

@ -509,7 +509,7 @@ gst_tag_register (const gchar * name, GstTagFlag flag, GType type,
g_return_if_fail (name != NULL);
g_return_if_fail (nick != NULL);
g_return_if_fail (blurb != NULL);
g_return_if_fail (type != 0 && type != GST_TYPE_LIST);
g_return_if_fail (type != G_TYPE_INVALID && type != GST_TYPE_LIST);
gst_tag_register_static (g_intern_string (name), flag, type,
g_intern_string (nick), g_intern_string (blurb), func);
@ -540,7 +540,7 @@ gst_tag_register_static (const gchar * name, GstTagFlag flag, GType type,
g_return_if_fail (name != NULL);
g_return_if_fail (nick != NULL);
g_return_if_fail (blurb != NULL);
g_return_if_fail (type != 0 && type != GST_TYPE_LIST);
g_return_if_fail (type != G_TYPE_INVALID && type != GST_TYPE_LIST);
info = gst_tag_lookup (name);

View file

@ -7792,12 +7792,12 @@ try_as_flags_string:
if (end != NULL) {
gchar *class_name = g_strndup (set_class, end - set_class);
GType flags_type = g_type_from_name (class_name);
if (flags_type == 0) {
if (flags_type == G_TYPE_INVALID) {
GST_TRACE ("Looking for dynamic type %s", class_name);
gst_dynamic_type_factory_load (class_name);
}
if (flags_type != 0) {
if (flags_type != G_TYPE_INVALID) {
flags_klass = g_type_class_ref (flags_type);
GST_TRACE ("Going to parse %s as %s", s, class_name);
}