From f2a1b237bcc824bd3e84da69f472ffb3c9055d00 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 29 Jan 2005 05:04:23 +0000 Subject: [PATCH] r5094: Use builtin swig types for converting between fixed width integer types. --- source/scripting/swig/samba.i | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/source/scripting/swig/samba.i b/source/scripting/swig/samba.i index a989a468b9c..6cdf4240956 100644 --- a/source/scripting/swig/samba.i +++ b/source/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));