Branch: Tag:

2019-03-18

2019-03-18 22:27:31 by Tobias S. Josefowitz <tobij@tobij.de>

Image: Fix adventurous use of function pointers

Nothing really wrong with it, as long as things go fine, except GCC 8
started warning about type mismatch of function pointers (as well as in
casts) more aggressively than before. To silence this warning, be
slightly less adventurous.

What we do with the lm_spec_burn_alpha function pointer is still a bit
odd though, maybe now even more than before.

165:   LMFUNC(lm_logic_strict_less_or_equal);   LMFUNC(lm_logic_strict_more_or_equal);    - static void lm_spec_burn_alpha(struct layer *ly, -  rgb_group *l, rgb_group *la, -  rgb_group *s, rgb_group *sa, -  rgb_group *d, rgb_group *da, -  int len); + static void lm_spec_burn_alpha_row_func(rgb_group *s, rgb_group *l, +  rgb_group *d, rgb_group *sa, +  rgb_group *la, rgb_group *da, +  int len, double alpha);      struct layer_mode_desc   {
291:    "1-(1-S)*(1-L) applied with alpha, aD=aS"},    {"overlay", lm_overlay, 1, NULL,    "(1-(1-a)*(1-b)-a*b)*a+a*b applied with alpha, aD=aS"}, -  {"burn_alpha", (lm_row_func*)lm_spec_burn_alpha, 1, NULL, +  {"burn_alpha", (lm_row_func*)lm_spec_burn_alpha_row_func, 1, NULL,    "aD=aL+aS applied with alpha, D=L+S;"    " experimental, may change or be removed"},   
2344:    }   }    + /* This function is just a place holder and should not be called. +  * Instead, lm_spec_burn_alpha() is called in case row_func points to +  * this. */ + static void lm_spec_burn_alpha_row_func(rgb_group *UNUSED(s), +  rgb_group *UNUSED(l), +  rgb_group *UNUSED(d), +  rgb_group *UNUSED(sa), +  rgb_group *UNUSED(la), +  rgb_group *UNUSED(da), +  int UNUSED(len), double UNUSED(alpha)) + { +  Pike_fatal("lm_spec_burn_alpha_row_func() called.\n"); + } +    static void lm_spec_burn_alpha(struct layer *ly,    rgb_group *l, rgb_group *la,    rgb_group *s, rgb_group *sa,
2554:    if (len<0) Pike_error("internal error: stroke len < 0\n");    if (!ly->row_func) Pike_error("internal error: row_func=NULL\n");    -  if (ly->row_func==(lm_row_func*)lm_spec_burn_alpha) +  if (ly->row_func==(lm_row_func*)lm_spec_burn_alpha_row_func)    {    lm_spec_burn_alpha(ly,l,la,s,sa,d,da,len);    return;