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 <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Chas Williams 2015-11-23 14:15:08 -05:00 committed by Benjamin Kaduk
parent 5aa6d4a26a
commit 9823c57622

View File

@ -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");
}
}