From 7e877072bd7ad52dad43abd85545571d79e7c45c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 29 Jan 2005 05:04:23 +0000 Subject: r5094: Use builtin swig types for converting between fixed width integer types. (This used to be commit f2a1b237bcc824bd3e84da69f472ffb3c9055d00) --- source4/scripting/swig/samba.i | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'source4/scripting/swig/samba.i') diff --git a/source4/scripting/swig/samba.i b/source4/scripting/swig/samba.i index a989a468b9..6cdf424095 100644 --- a/source4/scripting/swig/samba.i +++ b/source4/scripting/swig/samba.i @@ -24,17 +24,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -%typemap(in) uint32 { - if (!PyInt_Check($input) && !PyLong_Check($input)) { - PyErr_SetString(PyExc_TypeError, "integer expected"); - return NULL; - } - $1 = (uint32_t)PyLong_AsLong($input); -} - -%typemap(out) uint32 { - $result = PyLong_FromLong($1); -} +%apply unsigned char { uint8_t }; +%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(out) NTSTATUS { $result = PyLong_FromLong(NT_STATUS_V($1)); -- cgit