On Sat, 9 Jun 2012 at 17:05:58 +0100, Carlos R. Mafra wrote:
> On Thu, 7 Jun 2012 at 23:45:02 +0200, Rodolfo García Peñas wrote:
>
> > Subject: [PATCH 03/10] New functions in icon.c
> >
> > This patch creates some functions:
> >
>
>
> > +
> > +static RImage *get_wwindow_image_from_wmhints(WWindow *wwin, WIcon *icon)
> > +{
> > + RImage *image;
> > +
> > + if (wwin->wm_hints &&
> > + (wwin->wm_hints->flags & IconPixmapHint) &&
> > + wwin->wm_hints->icon_pixmap != None) {
> > + image =
> > RCreateImageFromDrawable(icon->core->screen_ptr->rcontext,
> > + wwin->wm_hints->icon_pixmap,
> > + (wwin->wm_hints->flags &
> > IconMaskHint)
> > + ? wwin->wm_hints->icon_mask :
> > None);
> > + }
> > + return image;
> > +}
>
> This function does not seem right - 'image' will be a random pointer if
> the conditions are false. You should initialize it to NULL.
And while at that, you should probably just use a temporary variable
XWMHints *hints = wwin->wm_hints;
to make that mess a bit more readable:
+ if (hints && (hints->flags & IconPixmapHint) && hints->icon_pixmap !=
None) {
+ image =
RCreateImageFromDrawable(icon->core->screen_ptr->rcontext,
+ hints->icon_pixmap,
+ (hints->flags & IconMaskHint)
+ ? hints->icon_mask : None);
+ }
+ return image;
--
To unsubscribe, send mail to [email protected].