[pygobject] Revert "Fix array termination and size calculation"
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Revert "Fix array termination and size calculation"
- Date: Wed, 2 Nov 2011 13:57:53 +0000 (UTC)
commit cfda820e8d9604c5ef2ad1161c22b20080d5daf4
Author: Tomeu Vizoso <tomeu vizoso collabora com>
Date: Wed Nov 2 14:54:21 2011 +0100
Revert "Fix array termination and size calculation"
This reverts commit eef35b2df8023ffff2d195ee16c084f5cfcb6ba3.
gi/pygi-marshal-from-py.c | 6 +-----
gi/pygi-marshal-to-py.c | 8 +-------
2 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index 3b3109c..0a94ffe 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -794,11 +794,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);
- 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. */
- array_->data[length] = '\0';
- }
+
goto array_success;
}
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
index 67c21cb..984e7c1 100644
--- a/gi/pygi-marshal-to-py.c
+++ b/gi/pygi-marshal-to-py.c
@@ -266,8 +266,6 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
array_ = arg->v_pointer;
- g_assert(array_ != NULL);
-
/* GArrays make it easier to iterate over arrays
* with different element sizes but requires that
* we allocate a GArray if the argument was a C array
@@ -277,11 +275,7 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
if (seq_cache->fixed_size >= 0) {
len = seq_cache->fixed_size;
} else if (seq_cache->is_zero_terminated) {
- if(seq_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8) {
- len = strlen (arg->v_pointer);
- } else {
- len = g_strv_length ((gchar **)arg->v_pointer);
- }
+ len = g_strv_length ((gchar **)arg->v_pointer);
} else {
GIArgument *len_arg = state->args[seq_cache->len_arg_index];
len = len_arg->v_long;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]