1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

pidl/python: also add a ndr_PyLong_FromLongLong() for symnetric reasons

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11429

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Stefan Metzmacher 2015-09-01 10:30:49 +02:00
parent d1416d65a3
commit e6fbeb8606

View File

@ -1280,7 +1280,7 @@ sub ConvertScalarToPython($$$)
$ctypename = expandAlias($ctypename);
if ($ctypename =~ /^(int64|dlong)$/) {
return "($cvar > LONG_MAX || $cvar < LONG_MIN) ? PyLong_FromLongLong($cvar) : PyInt_FromLong($cvar)";
return "ndr_PyLong_FromLongLong($cvar)";
}
if ($ctypename =~ /^(uint64|hyper|NTTIME_hyper|NTTIME|NTTIME_1sec|udlong|udlongr|uid_t|gid_t)$/) {
@ -1535,6 +1535,15 @@ static inline long long ndr_sizeof2intmax(size_t var_size)
return 0;
}
static inline PyObject *ndr_PyLong_FromLongLong(long long v)
{
if (v > LONG_MAX || v < LONG_MIN) {
return PyLong_FromLongLong(v);
} else {
return PyInt_FromLong(v);
}
}
static inline PyObject *ndr_PyLong_FromUnsignedLongLong(unsigned long long v)
{
if (v > LONG_MAX) {