svn commit: samba r5350 - in branches/SAMBA_4_0/source/scripting/swig: .

tpot at samba.org tpot at samba.org
Sat Feb 12 00:53:32 GMT 2005


Author: tpot
Date: 2005-02-12 00:53:32 +0000 (Sat, 12 Feb 2005)
New Revision: 5350

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5350

Log:
Implement an input typemap for NTSTATUS.

Modified:
   branches/SAMBA_4_0/source/scripting/swig/samba.i


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/samba.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/samba.i	2005-02-12 00:51:31 UTC (rev 5349)
+++ branches/SAMBA_4_0/source/scripting/swig/samba.i	2005-02-12 00:53:32 UTC (rev 5350)
@@ -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));
 }



More information about the samba-cvs mailing list