diff options
author | Tim Potter <tpot@samba.org> | 2004-09-22 02:39:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:57 -0500 |
commit | 46efd4d31b9a73255ea7960eb16c1ec53dfe6478 (patch) | |
tree | a6d8018735504698b4e73a6f94cda15a219063b7 | |
parent | 4b09c0e5d9619fea420da80022829682e028ea57 (diff) | |
download | samba-46efd4d31b9a73255ea7960eb16c1ec53dfe6478.tar.gz samba-46efd4d31b9a73255ea7960eb16c1ec53dfe6478.tar.bz2 samba-46efd4d31b9a73255ea7960eb16c1ec53dfe6478.zip |
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)
-rw-r--r-- | source4/scripting/swig/dcerpc.i | 32 |
1 files 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. |