rxgen: Don't use size_t in struct rx_opaque with XDR 15/12115/5
authorChas Williams <3chas3@gmail.com>
Mon, 23 Nov 2015 19:15:08 +0000 (14:15 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 21 Mar 2016 03:14:00 +0000 (23:14 -0400)
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>

src/rxgen/rpc_cout.c

index 30ec519..a15b627 100644 (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");
+    }
+
 }