Re: [gst-devel] Re: error handling in GStreamer
- From: in7y118 public uni-hamburg de
- To: gnome-desktop-devel <desktop-devel-list gnome org>, GStreamer developers mailinglist <gstreamer-devel lists sourceforge net>
- Subject: Re: [gst-devel] Re: error handling in GStreamer
- Date: Tue, 23 Sep 2003 17:39:36 +0200
Quoting Ronald Bultje <rbultje ronald bitfreak net>:
> I'd love to have a reference to the original element as well, so I
> prefer gst_element_error (GstElement *element, GstErrorCategory cat,
> gchar *user_error, gchar *developer_error);.
>
I'm sure he only forgot that.
> Also, can you make a macro for this please? I'd *hate* to see each
> plugin using "gst_element_gerror (GST_ELEMENT (el), GST_ERROR_BLABLA,
> g_strdup_printf("%s", "eek"), g_strdup_printf ("%d", state)); when you
> could also use gst_element_merror (el, GST_ERROR_BLABLA, ("%s, "eek"),
> ("%d", state));, so that the macro is defined as:
>
> #define gst_element_merror(el, cat, str, dbg) \
> gst_element_gerror (GST_ELEMENT (el), (cat), \
> g_strdup_printf (str), \
> g_strdup_printf (dbg));
>
> or whatever macro obfuscation is needed to make this work as it's meant
> to.
>
This is a big problem we've run into and that we have not yet found a good fix
for.
In your gst_element_merror macro, both "str" and "dbg" are a variable number of
arguments. And I don't know a way to tell the compiler that x number of
arguemnts belong to "str" while the rest belongs to "dbg".
That's why we even use this stupid strdup_printf approach. What we want if that
is possible is a way to write it like that:
gst_element_gerror (element, GST_ERROR_DEVICE,
_("Could not read from file %s"), element->filename,
"Error mmaping %s: %s", element->filename, g_strerror (errno));
which would then construct two strings out of this: "Could not read from file
foo" and "Error mmaping foo: insufficent permissions"
If there exists some portable varargs voodoo to make such a thing work (with
vprintf functions, most probably), please speak up.
Benjamin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]