Treat uid_t, git_t as 64 bit in Pidl Python bindings
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 18 Jun 2015 00:38:22 +0000 (12:38 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 Jul 2015 05:19:49 +0000 (07:19 +0200)
This follows their treatment in librpc/ndr/ndr_basic.c.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul  7 07:19:49 CEST 2015 on sn-devel-104

pidl/lib/Parse/Pidl/Samba4/Python.pm

index 0f54944..ff68e7a 100644 (file)
@@ -972,7 +972,9 @@ sub ConvertObjectFromPythonData($$$$$$;$)
                return;
        }
        if ($actual_ctype->{TYPE} eq "SCALAR" ) {
-               if (expandAlias($actual_ctype->{NAME}) =~ /^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+               if (expandAlias($actual_ctype->{NAME}) =~ /^(u?int64|hyper|dlong|udlong|udlongr
+                                                           |NTTIME_hyper|NTTIME|NTTIME_1sec
+                                                           |uid_t|gid_t)$/x) {
                        $self->pidl("if (PyLong_Check($cvar)) {");
                        $self->indent;
                        $self->pidl("$target = PyLong_AsLongLong($cvar);");
@@ -990,7 +992,7 @@ sub ConvertObjectFromPythonData($$$$$$;$)
                        $self->pidl("}");
                        return;
                }
-               if (expandAlias($actual_ctype->{NAME}) =~ /^(char|u?int[0-9]*|time_t|uid_t|gid_t)$/) {
+               if (expandAlias($actual_ctype->{NAME}) =~ /^(char|u?int[0-9]*|time_t)$/) {
                        $self->pidl("PY_CHECK_TYPE(&PyInt_Type, $cvar, $fail);");
                        $self->pidl("$target = PyInt_AsLong($cvar);");
                        return;
@@ -1203,11 +1205,11 @@ sub ConvertScalarToPython($$$)
                return "PyLong_FromLongLong($cvar)";
        }
 
-       if ($ctypename =~ /^(uint64|hyper|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+       if ($ctypename =~ /^(uint64|hyper|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec|uid_t|gid_t)$/) {
                return "PyLong_FromUnsignedLongLong($cvar)";
        }
 
-       if ($ctypename =~ /^(char|u?int[0-9]*|time_t|uid_t|gid_t)$/) {
+       if ($ctypename =~ /^(char|u?int[0-9]*|time_t)$/) {
                return "PyInt_FromLong($cvar)";
        }