I would like to remove the following warning from the code of an old library I am working on:
Image.c:171:22: warning: assignment from incompatible pointer type [enabled by default]
   image->f.get_pixel = get_pixel1;
I shortend the code in the following text to make it easier to read!
Now, I think get_pixel1 is a function pointer to this function:
#define READ_BIT(image, x, y)   \
    (image->data[(y * image->bytes_per_line) + (x >> 3) ] & (1 << (x & 7)))
static unsigned long
get_pixel1(XImage *image, unsigned int x, unsigned int y)
{
    return READ_BIT(image, x, y) != 0;
}
While f.get_pixel is defined in here:
typedef struct _XImage {
    int width, height;      /* size of image */
    /* snip */
    struct funcs {      /* image manipulation routines */
    struct _XImage *(*create_image)( /*snip*/ );
    /* snip */
    unsigned long (*get_pixel)  (struct _XImage *, int, int);
    /* snip */
    } f;
} XImage;
My question is what do I have to cast here to remove the warning in the question's title:
    image->f.get_pixel = (?????)get_pixel1;
Or is there something additional to do except the cast?
 
     
    