[pygobject/pygobject-3-4] Fix marshalling of GByteArrays
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-4] Fix marshalling of GByteArrays
- Date: Mon, 12 Nov 2012 07:02:33 +0000 (UTC)
commit 6b296031e58e07758138242b5b53dda61c0c5976
Author: Martin Pitt <martinpitt gnome org>
Date: Fri Nov 9 16:02:00 2012 +0100
Fix marshalling of GByteArrays
In _pygi_marshal_from_py_array(), set the array length after copying the data
in the GI_TYPE_TAG_UINT8 case (which applies for GByteArrays), otherwise it
will always come out as zero length.
Cherry-picked from trunk commit b800a69. Do not cherry-pick the test case
updates as those tests do not yet exist in the 3.4 branch.
gi/pygi-marshal-from-py.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index d0e96db..c20e023 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -930,6 +930,7 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state,
if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8 &&
PYGLIB_PyBytes_Check (py_arg)) {
memcpy(array_->data, PYGLIB_PyBytes_AsString (py_arg), length);
+ array_->len = length;
if (sequence_cache->is_zero_terminated) {
/* If array_ has been created with zero_termination, space for the
* terminator is properly allocated, so we're not off-by-one here. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]