This fixes bug #1297.
#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
#endif
+#ifndef G_SOURCE_FUNC
+#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f)) /* Since 2.58. */
+#endif
+
+#define SR_RECEIVE_DATA_CALLBACK(f) \
+ ((sr_receive_data_callback) (void (*)(void)) (f))
+
/**
* Read a 8 bits unsigned integer out of memory.
* @param x a pointer to the input memory
#include "vxi.h"
#include <memory.h> /* for memset */
+#define SR_XDRPROC_CALLBACK(f) ((xdrproc_t) (void (*)(void)) (f))
+
/* Default timeout can be changed using clnt_control() */
static struct timeval TIMEOUT = { 25, 0 };
memset((char *)&clnt_res, 0, sizeof(clnt_res));
if (clnt_call (clnt, destroy_intr_chan,
- (xdrproc_t) xdr_void, (caddr_t) argp,
+ SR_XDRPROC_CALLBACK(xdr_void), (caddr_t) argp,
(xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res,
TIMEOUT) != RPC_SUCCESS) {
return (NULL);
memset((char *)&clnt_res, 0, sizeof(clnt_res));
if (clnt_call (clnt, device_intr_srq,
(xdrproc_t) xdr_Device_SrqParms, (caddr_t) argp,
- (xdrproc_t) xdr_void, (caddr_t) &clnt_res,
+ SR_XDRPROC_CALLBACK(xdr_void), (caddr_t) &clnt_res,
TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
sr_err("Callback not set, cannot dispatch event.");
return G_SOURCE_REMOVE;
}
- keep = (*(sr_receive_data_callback)callback)
+ keep = (*SR_RECEIVE_DATA_CALLBACK(callback))
(fsource->pollfd.fd, revents, user_data);
if (fsource->timeout_us >= 0 && G_LIKELY(keep)
if (!source)
return SR_ERR;
- g_source_set_callback(source, (GSourceFunc)cb, cb_data, NULL);
+ g_source_set_callback(source, G_SOURCE_FUNC(cb), cb_data, NULL);
ret = sr_session_source_add_internal(session, key, source);
g_source_unref(source);
sr_err("Callback not set, cannot dispatch event.");
return G_SOURCE_REMOVE;
}
- keep = (*(sr_receive_data_callback)callback)(-1, revents, user_data);
+ keep = (*SR_RECEIVE_DATA_CALLBACK(callback))(-1, revents, user_data);
if (G_LIKELY(keep) && G_LIKELY(!g_source_is_destroyed(source))) {
if (usource->timeout_us >= 0)
if (!source)
return SR_ERR;
- g_source_set_callback(source, (GSourceFunc)cb, cb_data, NULL);
+ g_source_set_callback(source, G_SOURCE_FUNC(cb), cb_data, NULL);
ret = sr_session_source_add_internal(session, ctx->libusb_ctx, source);
g_source_unref(source);