Skip to content

Commit 5db93aa

Browse files
committed
Change declaration of function map
Newer compilers complain if funciton is declared w/o arguments, so we redeclare the xdrptoc_t as xdrfn and give it proper arguments Signed-off-by: Simo Sorce <[email protected]>
1 parent 27bdf92 commit 5db93aa

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

rpcgen/gp_xdr.h

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#include "gssrpc/rpc.h"
77

8+
/* Equivalent to xdrptoc_t but with proper arguments so that modern
9+
* compilers do not complain */
10+
typedef int xdrfn(XDR *, void *);
11+
812
#define xdr_u_quad_t gp_xdr_uint64_t
913

1014
bool_t gp_xdr_uint64_t(XDR *xdrs, uint64_t *objp);

src/client/gpm_common.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
676676
gp_rpc_msg msg;
677677
XDR xdr_call_ctx = {0};
678678
XDR xdr_reply_ctx = {0};
679+
xdrfn *arg_fn;
680+
xdrfn *res_fn;
679681
char *send_buffer = NULL;
680682
char *recv_buffer = NULL;
681683
uint32_t send_length;
@@ -726,7 +728,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
726728
}
727729

728730
/* encode data */
729-
xdrok = gpm_xdr_set[proc].arg_fn(&xdr_call_ctx, (char *)arg);
731+
arg_fn = gpm_xdr_set[proc].arg_fn;
732+
xdrok = arg_fn(&xdr_call_ctx, arg);
730733
if (!xdrok) {
731734
ret = EINVAL;
732735
goto done;
@@ -765,7 +768,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
765768
}
766769

767770
/* decode answer */
768-
xdrok = gpm_xdr_set[proc].res_fn(&xdr_reply_ctx, (char *)res);
771+
res_fn = gpm_xdr_set[proc].res_fn;
772+
xdrok = res_fn(&xdr_reply_ctx, res);
769773
if (!xdrok) {
770774
ret = EINVAL;
771775
}

src/gp_rpc_process.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ static int gp_rpc_decode_call(XDR *xdr_call_ctx,
196196
gp_rpc_accept_status *acc,
197197
gp_rpc_reject_status *rej)
198198
{
199+
xdrfn *arg_fn;
199200
bool xdrok;
200201
int ret;
201202

@@ -204,7 +205,8 @@ static int gp_rpc_decode_call(XDR *xdr_call_ctx,
204205
return ret;
205206
}
206207

207-
xdrok = gp_xdr_set[*proc].arg_fn(xdr_call_ctx, (char *)arg);
208+
arg_fn = gp_xdr_set[*proc].arg_fn;
209+
xdrok = arg_fn(xdr_call_ctx, arg);
208210
if (!xdrok) {
209211
*acc = GP_RPC_GARBAGE_ARGS;
210212
return EINVAL;
@@ -283,6 +285,7 @@ static int gp_rpc_encode_reply(XDR *xdr_reply_ctx,
283285
gp_rpc_accept_status acc,
284286
gp_rpc_reject_status rej)
285287
{
288+
xdrfn *res_fn;
286289
bool xdrok;
287290
int ret;
288291

@@ -291,7 +294,8 @@ static int gp_rpc_encode_reply(XDR *xdr_reply_ctx,
291294
return ret;
292295
}
293296

294-
xdrok = gp_xdr_set[proc].res_fn(xdr_reply_ctx, (char *)res);
297+
res_fn = gp_xdr_set[proc].res_fn;
298+
xdrok = res_fn(xdr_reply_ctx, res);
295299

296300
if (!xdrok) {
297301
return gp_rpc_encode_reply_header(xdr_reply_ctx, xid, EINVAL,

0 commit comments

Comments
 (0)