pidl:Python: make use of NDR_ERR_CODE_IS_SUCCESS()
authorStefan Metzmacher <metze@samba.org>
Mon, 12 Sep 2016 13:12:24 +0000 (15:12 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 26 Oct 2016 09:20:18 +0000 (11:20 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
pidl/lib/Parse/Pidl/Samba4/Python.pm

index b2b8720..fabdca7 100644 (file)
@@ -280,7 +280,7 @@ sub PythonStruct($$$$$$)
                $self->deindent;
                $self->pidl("}");
                $self->pidl("err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_$name);");
-               $self->pidl("if (err != NDR_ERR_SUCCESS) {");
+               $self->pidl("if (!NDR_ERR_CODE_IS_SUCCESS(err)) {");
                $self->indent;
                $self->pidl("TALLOC_FREE(tmp_ctx);");
                $self->pidl("PyErr_SetNdrError(err);");
@@ -333,7 +333,7 @@ sub PythonStruct($$$$$$)
                $self->pidl("err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
                $self->deindent;
                $self->pidl("}");
-               $self->pidl("if (err != NDR_ERR_SUCCESS) {");
+               $self->pidl("if (!NDR_ERR_CODE_IS_SUCCESS(err)) {");
                $self->indent;
                $self->pidl("PyErr_SetNdrError(err);");
                $self->pidl("return NULL;");