Fix compiler warnings related to -Wcast-function-type.
This fixes bug #1297.
This commit is contained in:
parent
4c5ac0cf5b
commit
6cfc6c5c7a
|
@ -56,6 +56,13 @@ struct zip_stat;
|
||||||
#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
|
#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
|
||||||
#endif
|
#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.
|
* Read a 8 bits unsigned integer out of memory.
|
||||||
* @param x a pointer to the input memory
|
* @param x a pointer to the input memory
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "vxi.h"
|
#include "vxi.h"
|
||||||
#include <memory.h> /* for memset */
|
#include <memory.h> /* for memset */
|
||||||
|
|
||||||
|
#define SR_XDRPROC_CALLBACK(f) ((xdrproc_t) (void (*)(void)) (f))
|
||||||
|
|
||||||
/* Default timeout can be changed using clnt_control() */
|
/* Default timeout can be changed using clnt_control() */
|
||||||
static struct timeval TIMEOUT = { 25, 0 };
|
static struct timeval TIMEOUT = { 25, 0 };
|
||||||
|
|
||||||
|
@ -242,7 +244,7 @@ destroy_intr_chan_1(void *argp, CLIENT *clnt)
|
||||||
|
|
||||||
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
if (clnt_call (clnt, destroy_intr_chan,
|
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,
|
(xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res,
|
||||||
TIMEOUT) != RPC_SUCCESS) {
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -258,7 +260,7 @@ device_intr_srq_1(Device_SrqParms *argp, CLIENT *clnt)
|
||||||
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
if (clnt_call (clnt, device_intr_srq,
|
if (clnt_call (clnt, device_intr_srq,
|
||||||
(xdrproc_t) xdr_Device_SrqParms, (caddr_t) argp,
|
(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) {
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ static gboolean fd_source_dispatch(GSource *source,
|
||||||
sr_err("Callback not set, cannot dispatch event.");
|
sr_err("Callback not set, cannot dispatch event.");
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
keep = (*(sr_receive_data_callback)callback)
|
keep = (*SR_RECEIVE_DATA_CALLBACK(callback))
|
||||||
(fsource->pollfd.fd, revents, user_data);
|
(fsource->pollfd.fd, revents, user_data);
|
||||||
|
|
||||||
if (fsource->timeout_us >= 0 && G_LIKELY(keep)
|
if (fsource->timeout_us >= 0 && G_LIKELY(keep)
|
||||||
|
@ -1237,7 +1237,7 @@ SR_PRIV int sr_session_fd_source_add(struct sr_session *session,
|
||||||
if (!source)
|
if (!source)
|
||||||
return SR_ERR;
|
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);
|
ret = sr_session_source_add_internal(session, key, source);
|
||||||
g_source_unref(source);
|
g_source_unref(source);
|
||||||
|
|
|
@ -138,7 +138,7 @@ static gboolean usb_source_dispatch(GSource *source,
|
||||||
sr_err("Callback not set, cannot dispatch event.");
|
sr_err("Callback not set, cannot dispatch event.");
|
||||||
return G_SOURCE_REMOVE;
|
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 (G_LIKELY(keep) && G_LIKELY(!g_source_is_destroyed(source))) {
|
||||||
if (usource->timeout_us >= 0)
|
if (usource->timeout_us >= 0)
|
||||||
|
@ -455,7 +455,7 @@ SR_PRIV int usb_source_add(struct sr_session *session, struct sr_context *ctx,
|
||||||
if (!source)
|
if (!source)
|
||||||
return SR_ERR;
|
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);
|
ret = sr_session_source_add_internal(session, ctx->libusb_ctx, source);
|
||||||
g_source_unref(source);
|
g_source_unref(source);
|
||||||
|
|
Loading…
Reference in New Issue