Re: gstreamer: structure: Don't print warning on NULL strings or pointers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer: structure: Don't print warning on NULL strings or pointers

Nicolas Dufresne-5
Le jeudi 06 avril 2017 à 23:25 +0000, Olivier Crête a écrit :

> Module: gstreamer
> Branch: master
> Commit: 0b9eb621b69b06df350ba25cb3a07ad9d23aef88
> URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=0b
> 9eb621b69b06df350ba25cb3a07ad9d23aef88
>
> Author: Olivier Crête <[hidden email]>
> Date:   Wed Mar  8 12:09:45 2017 -0500
>
> structure: Don't print warning on NULL strings or pointers
>
> Putting NULL for those is a valid serialization for the NULL value.
I think this warning was on purpose because you will not be able to
serialize it later. I would opt on a revert and further discussion
about this one.

>
> ---
>
>  gst/gststructure.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/gst/gststructure.c b/gst/gststructure.c
> index 5be496bfb..8596c2bce 100644
> --- a/gst/gststructure.c
> +++ b/gst/gststructure.c
> @@ -1823,9 +1823,12 @@ priv_gst_structure_append_to_gstring (const
> GstStructure * structure,
>        g_string_append (s, t);
>        g_free (t);
>      } else {
> -      GST_WARNING ("No value transform to serialize field '%s' of
> type '%s'",
> -          g_quark_to_string (field->name),
> -          _priv_gst_value_gtype_to_abbr (type));
> +      if (!G_TYPE_CHECK_VALUE_TYPE (&field->value, G_TYPE_STRING) &&
> +          !(G_TYPE_CHECK_VALUE_TYPE (&field->value, G_TYPE_POINTER)
> &&
> +              g_value_get_pointer (&field->value) == NULL))
> +        GST_WARNING ("No value transform to serialize field '%s' of
> type '%s'",
> +            g_quark_to_string (field->name),
> +            _priv_gst_value_gtype_to_abbr (type));
>        g_string_append (s, "NULL");
>      }
>    }
>
> _______________________________________________
> gstreamer-commits mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-commits
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer: structure: Don't print warning on NULL strings or pointers

Olivier Crête-3
Hi,

Deserializing later also works in reproducing a NULL (a 0). NULL is the right value in those two specific cases.

Olivier

On April 6, 2017 8:32:06 PM EDT, Nicolas Dufresne <[hidden email]> wrote:

>Le jeudi 06 avril 2017 à 23:25 +0000, Olivier Crête a écrit :
>> Module: gstreamer
>> Branch: master
>> Commit: 0b9eb621b69b06df350ba25cb3a07ad9d23aef88
>> URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=0b
>> 9eb621b69b06df350ba25cb3a07ad9d23aef88
>>
>> Author: Olivier Crête <[hidden email]>
>> Date:   Wed Mar  8 12:09:45 2017 -0500
>>
>> structure: Don't print warning on NULL strings or pointers
>>
>> Putting NULL for those is a valid serialization for the NULL value.
>
>I think this warning was on purpose because you will not be able to
>serialize it later. I would opt on a revert and further discussion
>about this one.
>
>>
>> ---
>>
>>  gst/gststructure.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/gst/gststructure.c b/gst/gststructure.c
>> index 5be496bfb..8596c2bce 100644
>> --- a/gst/gststructure.c
>> +++ b/gst/gststructure.c
>> @@ -1823,9 +1823,12 @@ priv_gst_structure_append_to_gstring (const
>> GstStructure * structure,
>>        g_string_append (s, t);
>>        g_free (t);
>>      } else {
>> -      GST_WARNING ("No value transform to serialize field '%s' of
>> type '%s'",
>> -          g_quark_to_string (field->name),
>> -          _priv_gst_value_gtype_to_abbr (type));
>> +      if (!G_TYPE_CHECK_VALUE_TYPE (&field->value, G_TYPE_STRING) &&
>> +          !(G_TYPE_CHECK_VALUE_TYPE (&field->value, G_TYPE_POINTER)
>> &&
>> +              g_value_get_pointer (&field->value) == NULL))
>> +        GST_WARNING ("No value transform to serialize field '%s' of
>> type '%s'",
>> +            g_quark_to_string (field->name),
>> +            _priv_gst_value_gtype_to_abbr (type));
>>        g_string_append (s, "NULL");
>>      }
>>    }
>>
>> _______________________________________________
>> gstreamer-commits mailing list
>> [hidden email]
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-commits

--
Olivier Crête
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel