From fedc591dfc09a27470a77e301ce7e85e2dafdef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sun, 14 Oct 2012 10:52:02 +0000 Subject: [PATCH] [INTERPRETER] * BUG: Implicit array conversion now correctly preserves dimensions. git-svn-id: svn://localhost/gambas/trunk@5237 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbx/gbx_c_array.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main/gbx/gbx_c_array.c b/main/gbx/gbx_c_array.c index f7d7c42bb..4ebfe4043 100644 --- a/main/gbx/gbx_c_array.c +++ b/main/gbx/gbx_c_array.c @@ -99,7 +99,7 @@ static int get_dim(CARRAY *_object) { int d; - if (LIKELY(THIS->dim == NULL)) + if (THIS->dim == NULL) return 1; else { @@ -114,7 +114,7 @@ static int get_dim(CARRAY *_object) static int get_bound(CARRAY *_object, int d) { - if (LIKELY(THIS->dim == NULL)) + if (THIS->dim == NULL) return THIS->count; else { @@ -1407,6 +1407,7 @@ static bool _convert(CARRAY *src, CLASS *class, VALUE *conv) int i; void *data; VALUE temp; + int dim; if (!src || !TYPE_is_pure_object((TYPE)class)) return TRUE; @@ -1435,6 +1436,14 @@ static bool _convert(CARRAY *src, CLASS *class, VALUE *conv) } END_ERROR + dim = get_dim(src); + if (dim > 1) + { + ALLOC(&array->dim, dim * sizeof(int), "_convert"); + for (i = 0; i < dim; i++) + array->dim[i] = src->dim[i]; + } + conv->_object.object = array; return FALSE; }