diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-08-08 14:00:31 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-08-08 16:45:27 +0200 |
commit | 604b380203912c6ba126596d1c0a67bc7a5f6cd0 (patch) | |
tree | 49b336e7b18916806f67b80f2729fabc6b1562dc /pidl/lib/Parse | |
parent | a5fdf05d6cfb45db319bb33cf6f601a71b2507ed (diff) | |
download | samba-604b380203912c6ba126596d1c0a67bc7a5f6cd0.tar.gz samba-604b380203912c6ba126596d1c0a67bc7a5f6cd0.tar.bz2 samba-604b380203912c6ba126596d1c0a67bc7a5f6cd0.zip |
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
Diffstat (limited to 'pidl/lib/Parse')
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Python.pm | 9 |
1 files changed, 7 insertions, 2 deletions
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) {"); |