From 9823c576229f74fe4c308b5164149873e0fddbaf Mon Sep 17 00:00:00 2001 From: Chas Williams <3chas3@gmail.com> Date: Mon, 23 Nov 2015 14:15:08 -0500 Subject: [PATCH] rxgen: Don't use size_t in struct rx_opaque with XDR OpenAFS's XDR doesn't support size_t at this time. For now, use a temporary stack variable to avoid 32/64-bit issues and copy back the returned value upon success. Change-Id: Ia3dd8abd665a19e04aa611f940728d088a8f87b7 Reviewed-on: https://gerrit.openafs.org/12115 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- src/rxgen/rpc_cout.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/rxgen/rpc_cout.c b/src/rxgen/rpc_cout.c index 30ec519e15..a15b627ba4 100644 --- a/src/rxgen/rpc_cout.c +++ b/src/rxgen/rpc_cout.c @@ -275,6 +275,14 @@ print_ifstat(int indent, char *prefix, char *type, relation rel, char *amax, alt = "string"; } else if (streq(type, "opaque")) { alt = "bytes"; + tabify(fout, indent); + f_print(fout, "{\n"); + ++indent; + tabify(fout, indent); + f_print(fout, "u_int __len = (u_int) "); + f_print(fout, "*("); + print_ifarg_len(objname, name); + f_print(fout, ");\n"); } if (streq(type, "string")) { print_ifopen(indent, alt); @@ -289,7 +297,11 @@ print_ifstat(int indent, char *prefix, char *type, relation rel, char *amax, } print_ifarg_val(objname, name); f_print(fout, ", "); - print_ifarg_len(objname, name); + if (streq(type, "opaque")) { + f_print(fout, "&__len"); + } else { + print_ifarg_len(objname, name); + } } print_ifarg(amax); if (!alt) { @@ -302,6 +314,17 @@ print_ifstat(int indent, char *prefix, char *type, relation rel, char *amax, break; } print_ifclose(indent); + if (rel == REL_ARRAY && streq(type, "opaque")) { + tabify(fout, indent); + f_print(fout, "*("); + print_ifarg_len(objname, name); + f_print(fout, ")"); + f_print(fout, " = __len;\n"); + --indent; + tabify(fout, indent); + f_print(fout, "}\n"); + } + }