pidl: Fix unsigned integer comparison warning
authorAndreas Schneider <asn@samba.org>
Wed, 12 Dec 2018 19:58:23 +0000 (20:58 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 13 Dec 2018 04:00:20 +0000 (05:00 +0100)
bin/default/librpc/gen_ndr/py_wkssvc.c:27344:33: warning:
comparison of integer expressions of different signedness: ‘long int’
and ‘long long unsigned int’ [-Wsign-compare] <--[gcc]
    if (test_var < 0 || test_var > uint_max) {
                                 ^

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Dec 13 05:00:20 CET 2018 on sn-devel-144

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

index 01dda41..1ef64db 100644 (file)
@@ -1726,7 +1726,7 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
                $self->indent;
                $self->pidl("long test_var;");
                $self->pidl("test_var = PyInt_AsLong($cvar);");
-               $self->pidl("if (test_var < 0 || test_var > uint_max) {");
+               $self->pidl("if (test_var < 0 || (unsigned long long)test_var > uint_max) {");
                $self->indent;
                $self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s or %s within range 0 - %llu, got %ld\",\\");
                $self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);");