Revision: 472 http://trac.macosforge.org/projects/ruby/changeset/472 Author: lsansonetti@apple.com Date: 2008-08-22 01:47:56 -0700 (Fri, 22 Aug 2008) Log Message: ----------- fix for #63 Modified Paths: -------------- MacRuby/trunk/objc.m Modified: MacRuby/trunk/objc.m =================================================================== --- MacRuby/trunk/objc.m 2008-08-22 06:59:26 UTC (rev 471) +++ MacRuby/trunk/objc.m 2008-08-22 08:47:56 UTC (rev 472) @@ -899,6 +899,21 @@ switch (*octype) { case _C_ID: + { + id obj = *(id *)ocval; + if (obj == NULL) { + *rbval = Qnil; + } + else if (*(Class *)obj == (Class)rb_cFixnum) { + *rbval = LONG2FIX(RFIXNUM(obj)->value); + } + else { + *rbval = *(VALUE *)ocval; + } + ok = true; + break; + } + case _C_CLASS: *rbval = *(void **)ocval == NULL ? Qnil : *(VALUE *)ocval; ok = true; @@ -1113,10 +1128,12 @@ @catch (id e) { rb_objc_exc_raise(e); } - if (buf[0] == '@' || buf[0] == '#') - return ffi_ret == NULL ? Qnil : (VALUE)ffi_ret; - else - return Qnil; + if (buf[0] == '@' || buf[0] == '#') { + VALUE retval; + rb_objc_ocval_to_rbval(&ffi_ret, buf, &retval); + return retval; + } + return Qnil; } }