From 604b380203912c6ba126596d1c0a67bc7a5f6cd0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 8 Aug 2011 14:00:31 +0200 Subject: pidl:Samba4/Python: PyArg_ParseTuple with "s#" returns 'int' instead of 'size_t' If we pass variable references we don't get implicit casting! metze --- pidl/lib/Parse/Pidl/Samba4/Python.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pidl') diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index db2d79d2f6..1622e71efb 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -276,9 +276,14 @@ sub PythonStruct($$$$$$) $self->indent; $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);"); $self->pidl("DATA_BLOB blob;"); + $self->pidl("int blob_length = 0;"); $self->pidl("enum ndr_err_code err;"); - $self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", &blob.data, &blob.length))"); - $self->pidl("\treturn NULL;"); + $self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", &blob.data, &blob_length)) {"); + $self->indent; + $self->pidl("return NULL;"); + $self->deindent; + $self->pidl("}"); + $self->pidl("blob.length = blob_length;"); $self->pidl(""); $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);"); $self->pidl("if (err != NDR_ERR_SUCCESS) {"); -- cgit