take-cheeze / mruby-marshal

mruby implementation of cruby marshaling.
12 stars 9 forks source link

One showstopper, three changes I need to compile under linux #3

Closed asfluido closed 9 years ago

asfluido commented 9 years ago

Hello. This patch fixes a bug (the lack of a break statement at line 245 of marshal.cpp) and contains three more changes that I needed to apply in order to include this gem in a recent version of mruby on linux.

The addition of the '-fpermissive' compiler option is due to the appearance of a compilation error of the form

error: passing 'const mrb_value' as 'this' argument of 'mrb_value& mrb_value::operator=(const mrb_value&)' discards qualifiers

referring to line 536 of marshal.cpp. Being not a friend at all of c++, I have no idea about the proper way to fix this error.

asfluido commented 9 years ago

A further patch is included, that permits to me to recover a complex object (a hash containing several hashes and arrays). Without that patch, recovering crashed with this error:

mruby: /data/code/motri/mruby/mruby-marshal/src/marshal.cpp:407: mrb_value {anonymous}::read_context::marshal(): Assertion `id < (((struct RArray*)((objects).value.p))->len)' failed.

Since there is c++ in the middle, I am trying patches in a blind-like fashion. I really hope someone will rewrite this gem in C...