summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Meissner <wmeissner@gmail.com>2010-01-27 10:18:11 +1000
committerWayne Meissner <wmeissner@gmail.com>2010-01-27 10:19:50 +1000
commit1898eeb8f7e0d351a7954324e4b5491e3374ef4e (patch)
tree8cbaabe6b397516a62d6a624dc8826e79d5ebb10
parent95c68c1015de6fab4bf3778dbf731678449936d5 (diff)
downloadffi-1898eeb8f7e0d351a7954324e4b5491e3374ef4e.tar.gz
Disable array field setting, except for :char or :uchar
-rw-r--r--ext/ffi_c/StructLayout.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/ffi_c/StructLayout.c b/ext/ffi_c/StructLayout.c
index 2119041..688fe08 100644
--- a/ext/ffi_c/StructLayout.c
+++ b/ext/ffi_c/StructLayout.c
@@ -255,8 +255,9 @@ array_field_put(VALUE self, VALUE pointer, VALUE value)
argv[1] = value;
rb_funcall2(pointer, rb_intern("put_string"), 2, argv);
-
+
} else {
+#ifdef notyet
int count = RARRAY_LEN(value);
int i;
AbstractMemory* memory = MEMORY(pointer);
@@ -300,11 +301,14 @@ array_field_put(VALUE self, VALUE pointer, VALUE value)
}
} else {
- rb_raise(rb_eArgError, "put not supported for arrays of type %s", rb_obj_classname(array->rbComponentType));
+ rb_raise(rb_eNotImpError, "put not supported for arrays of type %s", rb_obj_classname(array->rbComponentType));
}
+#else
+ rb_raise(rb_eNotImpError, "cannot set array field");
+#endif
}
- return self;
+ return value;
}
static VALUE