svn commit: samba r5242 - in
branches/SAMBA_4_0/source/scripting/swig: .
tpot at samba.org
tpot at samba.org
Sun Feb 6 00:34:45 GMT 2005
Author: tpot
Date: 2005-02-06 00:34:44 +0000 (Sun, 06 Feb 2005)
New Revision: 5242
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5242
Log:
Check that argument is an integer or a long for uint32_t input
typemap.
The uint32_t output typemap must return a Python long as an unsigned
uint32_t cannot be fully represented by a Python int.
Likewise for the NTSTATUS typemap.
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-06 00:18:46 UTC (rev 5241)
+++ branches/SAMBA_4_0/source/scripting/swig/samba.i 2005-02-06 00:34:44 UTC (rev 5242)
@@ -28,11 +28,24 @@
%apply char { int8_t };
%apply unsigned int { uint16_t };
%apply int { int16_t };
-%apply unsigned long { uint32_t };
-%apply long { int32_t };
%apply unsigned long long { uint64_t };
%apply long long { int64_t };
+%typemap(in) uint32_t {
+ if (PyLong_Check($input))
+ $1 = PyLong_AsUnsignedLong($input);
+ else if (PyInt_Check($input))
+ $1 = PyInt_AsLong($input);
+ else {
+ PyErr_SetString(PyExc_TypeError,"Expected a long or an int");
+ return NULL;
+ }
+}
+
+%typemap(out) uint32_t {
+ $result = PyLong_FromUnsignedLong($1);
+}
+
%typemap(out) NTSTATUS {
- $result = PyLong_FromLong(NT_STATUS_V($1));
+ $result = PyLong_FromUnsignedLong(NT_STATUS_V($1));
}
More information about the samba-cvs
mailing list