[Xcb] [PATCH:xcb-util] Make sure wm_class name strings are null-terminated

Vincent Torri vtorri at univ-evry.fr
Tue Jun 15 08:57:28 PDT 2010



On Tue, 15 Jun 2010, Arnaud Fontaine wrote:

>>>>>> Alan Coopersmith <alan.coopersmith at oracle.com> writes:
>
>    > I don't think an assert is  a good idea - my program shouldn't die
>    > because someone else's had a bug, but I was considering submitting
>    > a patch that checked the  results were null terminated and if not,
>    > discarded  them as an error.  If  I did that, should  there be any
>    > diagnostic that this happened?  fprintf(stderr, ...) in the middle
>    > of a  X library seems so  ugly, despite the huge amount  of crap I
>    > get on stderr from most gtk applications.
>
> The assert() was indeed  not a good idea ;). Why not  just `return 0'? I
> know  it's far from  being ideal,  but, after  all, the  function should
> simply `return 0'  if something wrong happened, no  (like reply type not
> being a STRING...)

returning a value (described in the doc is better. I don't like the 
fprintf solution at all. It's up to the user of the lib to display 
something, not the lib

Vincent


More information about the Xcb mailing list