From c7a762bc748c63049d237de176167a13d1b8b0de Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 17 Oct 2004 00:27:40 +0000 Subject: r3009: Fix up unmarshall functions to return Python dict instead of a NTSTATUS. We can now unmarshall a single printer returned from an EnumPrinters. (This used to be commit 89da7a9196d40699881f12c9a5fe62301aafd4cf) --- source4/build/pidl/swig.pm | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'source4/build') diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm index b75891df17..df63548d41 100644 --- a/source4/build/pidl/swig.pm +++ b/source4/build/pidl/swig.pm @@ -468,7 +468,10 @@ sub ParseStruct($) $result .= "/* Convert a Python string to a struct $s->{NAME} python dict */\n\n"; $result .= "NTSTATUS unmarshall_$s->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct $s->{NAME} *s)\n"; $result .= "{\n"; - $result .= "\treturn ndr_pull_struct_blob(blob, mem_ctx, s, ndr_pull_$s->{NAME});\n"; + $result .= "\tstruct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx);\n"; + $result .= "\tNTSTATUS result;\n\n"; + $result .= "\tresult = ndr_pull_struct_blob(blob, mem_ctx, s, ndr_pull_$s->{NAME});\n"; + $result .= "\treturn result;\n"; $result .= "}\n\n"; } @@ -482,7 +485,7 @@ sub ParseStruct($) $result .= "%typemap(argout) struct $s->{NAME} * {\n"; $result .= "\tTALLOC_CTX *mem_ctx = talloc_init(\"typemap(argout) $s->{NAME}\");\n\n"; - $result .= "\tresultobj = $s->{NAME}_ptr_to_python(mem_ctx, \$1);\n"; + $result .= "\t\$result = $s->{NAME}_ptr_to_python(mem_ctx, \$1);\n"; $result .= "}\n\n"; $result .= "NTSTATUS unmarshall_$s->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct $s->{NAME} *EMPTY);\n\n"; @@ -574,7 +577,7 @@ sub ParseUnion($) $result .= "\t\treturn;\n"; $result .= "\t}\n\n"; } - $result .= "}\n"; + $result .= "}\n\n"; # Generate function to convert union pointer to Python dict @@ -604,21 +607,7 @@ sub ParseUnion($) $result .= "}\n\n"; - # Generate function to convert DATA_BLOB to Python dict - - if (util::has_property($u->{DATA}, "public")) { - $result .= "/* Convert a Python string to a struct $u->{NAME} python dict */\n\n"; - $result .= "NTSTATUS unmarshall_$u->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, union $u->{NAME} *u)\n"; - $result .= "{\n"; - $result .= "\treturn NT_STATUS_OK;\n"; - $result .= "}\n\n"; - } - - $result .= "\n%}\n\n"; - - if (util::has_property($u->{DATA}, "public")) { - $result .= "NTSTATUS unmarshall_$u->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, union $u->{NAME} *EMPTY);\n\n"; - } + $result .= "%}\n\n"; return $result; } -- cgit