Fix mruby bindings #197

Open
pulsejet wants to merge 5 commits from pulsejet/mrb into master
1 changed files with 7 additions and 4 deletions
Showing only changes of commit 8b216995cc - Show all commits

View File

@ -28,6 +28,7 @@
#include <mruby/data.h> #include <mruby/data.h>
#include <mruby/variable.h> #include <mruby/variable.h>
#include <mruby/class.h> #include <mruby/class.h>
#include <mruby/string.h>
#include <stdio.h> #include <stdio.h>
@ -352,11 +353,13 @@ inline mrb_value
objectLoad(mrb_state *mrb, mrb_value self, const mrb_data_type &type) objectLoad(mrb_state *mrb, mrb_value self, const mrb_data_type &type)
{ {
RClass *klass = mrb_class_ptr(self); RClass *klass = mrb_class_ptr(self);
char *data;
int data_len;
mrb_get_args(mrb, "s", &data, &data_len);
C *c = C::deserialize(data, data_len); mrb_value data;
mrb_get_args(mrb, "S", &data);
int data_len = mrb_string_value_len(mrb, data);
C *c = C::deserialize(RSTRING_PTR(data), data_len);
RData *obj = mrb_data_object_alloc(mrb, klass, c, &type); RData *obj = mrb_data_object_alloc(mrb, klass, c, &type);
mrb_value obj_value = mrb_obj_value(obj); mrb_value obj_value = mrb_obj_value(obj);