diff options
author | Tim Potter <tpot@samba.org> | 2004-10-15 07:17:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:54 -0500 |
commit | dc2df2530fc729e5fa858fdab3c4355e27ece310 (patch) | |
tree | d4b930aac7dce227b6099ee521a31b96cf08cd73 /source4/build | |
parent | 83928ac670bb17d4a1a8204d52468e5cca7c03d6 (diff) | |
download | samba-dc2df2530fc729e5fa858fdab3c4355e27ece310.tar.gz samba-dc2df2530fc729e5fa858fdab3c4355e27ece310.tar.bz2 samba-dc2df2530fc729e5fa858fdab3c4355e27ece310.zip |
r2986: Add correct value to dict when generating wrapper for functions that
return WERROR values.
Clean up WERROR vs NTSTATUS handling a bit.
(This used to be commit e6756e3ee0af3e7e98f6deaf9dc83af9aac1b586)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/pidl/swig.pm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm index e9b2d220b8..3694cfdec9 100644 --- a/source4/build/pidl/swig.pm +++ b/source4/build/pidl/swig.pm @@ -341,7 +341,11 @@ sub ParseFunction($) $result .= ");\n\n"; - $result .= "\tPyDict_SetItemString(temp, \"result\", resultobj);\n"; + if ($fn->{RETURN_TYPE} eq "NTSTATUS") { + $result .= "\tPyDict_SetItemString(temp, \"result\", resultobj);\n"; + } else { + $result .= "\tPyDict_SetItemString(temp, \"result\", PyLong_FromLong(W_ERROR_V(arg3->out.result)));\n"; + } $result .= "\tresultobj = temp;\n"; $result .= "\ttalloc_free(mem_ctx);\n"; @@ -350,7 +354,7 @@ sub ParseFunction($) # Function definitions $result .= "%rename($fn->{NAME}) dcerpc_$fn->{NAME};\n"; - $result .= "$fn->{RETURN_TYPE} dcerpc_$fn->{NAME}(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $fn->{NAME} *r);\n\n"; + $result .= "NTSTATUS dcerpc_$fn->{NAME}(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $fn->{NAME} *r);\n\n"; return $result; } @@ -443,6 +447,19 @@ sub ParseStruct($) $result .= "\treturn obj;\n"; $result .= "}\n"; + # Generate function to convert DATA_BLOB to Python dict + + if (util::has_property($s, "public")) { + $result .= "/* Convert DATA_BLOB to python dict of struct $s->{NAME} */\n\n"; + + $result .= "NTSTATUS DATA_BLOB_to_python_$s->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, PyObject **obj)\n"; + $result .= "{\n"; + $result .= "\tstruct $s->{NAME} s;\n"; + $result .= "\tNTSTATUS result = ndr_pull_struct_blob(blob, mem_ctx, &s, ndr_pull_$s->{NAME});\n\n"; + $result .= "\treturn NT_STATUS_OK;\n"; + $result .= "}\n"; + } + $result .= "\n%}\n\n"; return $result; |