From 55006da0436b108f9f56b8736e58eee2777bd361 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 12 Feb 2005 00:53:32 +0000 Subject: r5350: Implement an input typemap for NTSTATUS. (This used to be commit 076ec6008e4dbd130044893f34c3fd7212bf667d) --- source4/scripting/swig/samba.i | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source4/scripting') diff --git a/source4/scripting/swig/samba.i b/source4/scripting/swig/samba.i index db48b3c4ba..c7b8b46e66 100644 --- a/source4/scripting/swig/samba.i +++ b/source4/scripting/swig/samba.i @@ -46,6 +46,17 @@ $result = PyLong_FromUnsignedLong($1); } +%typemap(in) NTSTATUS { + if (PyLong_Check($input)) + $1 = NT_STATUS(PyLong_AsUnsignedLong($input)); + else if (PyInt_Check($input)) + $1 = NT_STATUS(PyInt_AsLong($input)); + else { + PyErr_SetString(PyExc_TypeError, "Expected a long or an int"); + return NULL; + } +} + %typemap(out) NTSTATUS { $result = PyLong_FromUnsignedLong(NT_STATUS_V($1)); } -- cgit