[gs-devel] undefined variable in mem_alpha_map_rgb_alpha_color()

Ralph Giles giles at artifex.com
Wed Sep 25 11:44:09 PDT 2002


I'm just taking a look at the few remaining undefined variable warnings 
in the code. One particularly scary looking one is 
mem_alpha_map_rgb_alpha_color() in gdevabuf.c. The current 
implementation looks like this:

private gx_color_index
mem_alpha_map_rgb_alpha_color(gx_device * dev, gx_color_value r,
                    gx_color_value g, gx_color_value b, gx_color_value 
alpha)
{
     gx_device_memory * const mdev = (gx_device_memory *)dev;
     gx_color_index color;
     gx_color_value cv[3];

     cv[0] = r; cv[1] = g; cv[2] = b;
     gx_forward_map_rgb_color(dev, cv);

     return (color == 0 || color == gx_no_color_index ? color :
             (gx_color_index) (alpha >> (gx_color_value_bits -
                                         mdev->log2_alpha_bits)));
}

As you can see, the gx_color_index 'color' is never set. It looks like 
the return statement never got updated in the devicen code. What's the 
proper fix here? I'd guess just removing the conditional entirely, but 
that's mostly based on probabilistic arguments. :)

  -r




More information about the gs-devel mailing list