From 46efd4d31b9a73255ea7960eb16c1ec53dfe6478 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 22 Sep 2004 02:39:38 +0000 Subject: r2486: Use correct type checks when checking 64-bit quantities (int64, uint64, NTTIME and HYPER_T). Also use the correct conversion routines when creating 64 bit objects. (This used to be commit f09fee92395e89c768e221728d5b0114d78f59fe) --- source4/scripting/swig/dcerpc.i | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/source4/scripting/swig/dcerpc.i b/source4/scripting/swig/dcerpc.i index 9677d4e62d..08b47d6329 100644 --- a/source4/scripting/swig/dcerpc.i +++ b/source4/scripting/swig/dcerpc.i @@ -118,17 +118,17 @@ int64 int64_from_python(PyObject *obj, char *name) return 0; } - if (!PyInt_Check(obj)) { - PyErr_Format(PyExc_TypeError, "Expecting int value for %s", name); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "Expecting long value for %s", name); return 0; } - return (int64)PyLong_AsLong(obj); + return (int64)PyLong_AsLongLong(obj); } PyObject *int64_to_python(int64 obj) { - return PyLong_FromLong(obj); + return PyLong_FromLongLong(obj); } uint64 uint64_from_python(PyObject *obj, char *name) @@ -138,17 +138,17 @@ uint64 uint64_from_python(PyObject *obj, char *name) return 0; } - if (!PyInt_Check(obj)) { - PyErr_Format(PyExc_TypeError, "Expecting int value for %s", name); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "Expecting long value for %s", name); return 0; } - return (uint64)PyLong_AsLong(obj); + return (uint64)PyLong_AsUnsignedLongLong(obj); } PyObject *uint64_to_python(uint64 obj) { - return PyLong_FromLong(obj); + return PyLong_FromUnsignedLongLong(obj); } NTTIME NTTIME_from_python(PyObject *obj, char *name) @@ -158,17 +158,17 @@ NTTIME NTTIME_from_python(PyObject *obj, char *name) return 0; } - if (!PyInt_Check(obj)) { - PyErr_Format(PyExc_TypeError, "Expecting integer value for %s", name); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "Expecting long value for %s", name); return 0; } - return (NTTIME)PyLong_AsLong(obj); + return (NTTIME)PyLong_AsUnsignedLongLong(obj); } PyObject *NTTIME_to_python(NTTIME obj) { - return PyLong_FromLong(obj); + return PyLong_FromUnsignedLongLong(obj); } HYPER_T HYPER_T_from_python(PyObject *obj, char *name) @@ -178,17 +178,17 @@ HYPER_T HYPER_T_from_python(PyObject *obj, char *name) return 0; } - if (!PyInt_Check(obj)) { - PyErr_Format(PyExc_TypeError, "Expecting integer value for %s", name); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "Expecting long value for %s", name); return 0; } - return (HYPER_T)PyLong_AsLong(obj); + return (HYPER_T)PyLong_AsUnsignedLongLong(obj); } PyObject *HYPER_T_to_python(HYPER_T obj) { - return PyLong_FromLong(obj); + return PyLong_FromUnsignedLongLong(obj); } /* Conversion functions for types that we don't want generated automatically. -- cgit