fix clang 10 warnings

the typesystem checks in g_atomic_pointer_compare_and_exchange
seem to trigger some false positives with clang 10

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/584>
This commit is contained in:
Jordan Petridis 2020-08-03 16:26:58 +03:00 committed by GStreamer Merge Bot
parent ed90b5dc55
commit c12c7afd06
6 changed files with 17 additions and 15 deletions

View file

@ -929,7 +929,8 @@ gst_caps_get_features (const GstCaps * caps, guint index)
gst_caps_features_set_parent_refcount (features, &GST_CAPS_REFCOUNT (caps));
storage = gst_caps_get_features_storage_unchecked (caps, index);
if (!g_atomic_pointer_compare_and_exchange (storage, NULL, features)) {
if (!g_atomic_pointer_compare_and_exchange (storage,
(GstCapsFeatures *) NULL, features)) {
/* Someone did the same we just tried in the meantime */
gst_caps_features_set_parent_refcount (features, NULL);
gst_caps_features_free (features);

View file

@ -292,7 +292,8 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
* an device provider at the same moment
*/
oclass = GST_DEVICE_PROVIDER_GET_CLASS (device_provider);
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory)) {
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory,
(GstDeviceProviderFactory *) NULL, factory)) {
gst_object_unref (factory);
} else {
/* This ref will never be dropped as the class is never destroyed */
@ -302,8 +303,8 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
gst_object_ref_sink (device_provider);
/* We use an atomic to make sure we don't create two in parallel */
if (!g_atomic_pointer_compare_and_exchange (&newfactory->provider, NULL,
device_provider)) {
if (!g_atomic_pointer_compare_and_exchange (&newfactory->provider,
(GstDeviceProvider *) NULL, device_provider)) {
gst_object_unref (device_provider);
device_provider = g_atomic_pointer_get (&newfactory->provider);

View file

@ -381,8 +381,8 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
* an element at the same moment
*/
oclass = GST_ELEMENT_GET_CLASS (element);
if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory, NULL,
factory))
if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory,
(GstElementFactory *) NULL, factory))
gst_object_unref (factory);
else
/* This ref will never be dropped as the class is never destroyed */

View file

@ -722,7 +722,7 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
*olddata, *olddata ? (*olddata)->refcount : 0,
newdata, newdata ? newdata->refcount : 0);
olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
olddata_val = (GstMiniObject *) g_atomic_pointer_get ((gpointer *) olddata);
if (G_UNLIKELY (olddata_val == newdata))
return FALSE;
@ -731,7 +731,7 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
gst_mini_object_ref (newdata);
while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
olddata, olddata_val, newdata))) {
olddata, (gpointer) olddata_val, newdata))) {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
if (G_UNLIKELY (olddata_val == newdata))
break;
@ -764,11 +764,11 @@ gst_mini_object_steal (GstMiniObject ** olddata)
*olddata, *olddata ? (*olddata)->refcount : 0);
do {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
olddata_val = (GstMiniObject *) g_atomic_pointer_get ((gpointer *) olddata);
if (olddata_val == NULL)
break;
} while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
olddata, olddata_val, NULL)));
olddata, (gpointer) olddata_val, NULL)));
return olddata_val;
}
@ -800,11 +800,11 @@ gst_mini_object_take (GstMiniObject ** olddata, GstMiniObject * newdata)
newdata, newdata ? newdata->refcount : 0);
do {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
olddata_val = (GstMiniObject *) g_atomic_pointer_get ((gpointer *) olddata);
if (G_UNLIKELY (olddata_val == newdata))
break;
} while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
olddata, olddata_val, newdata)));
olddata, (gpointer) olddata_val, newdata)));
if (olddata_val)
gst_mini_object_unref (olddata_val);

View file

@ -349,7 +349,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj)
newobj ? G_OBJECT (newobj)->ref_count : 0);
#endif
oldptr = g_atomic_pointer_get ((gpointer *) oldobj);
oldptr = (GstObject *) g_atomic_pointer_get ((gpointer *) oldobj);
if (G_UNLIKELY (oldptr == newobj))
return FALSE;
@ -358,7 +358,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj)
gst_object_ref (newobj);
while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
oldobj, oldptr, newobj))) {
oldobj, (gpointer) oldptr, newobj))) {
oldptr = g_atomic_pointer_get ((gpointer *) oldobj);
if (G_UNLIKELY (oldptr == newobj))
break;

View file

@ -603,7 +603,7 @@ gst_structure_take (GstStructure ** oldstr_ptr, GstStructure * newstr)
return FALSE;
}
} while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
oldstr_ptr, oldstr, newstr)));
oldstr_ptr, (gpointer) oldstr, newstr)));
if (oldstr)
gst_structure_free (oldstr);