Merge commit r32895 from trunk:

* ext/fiddle/conversions.c (generic_to_value): ffi_arg and ffi_sarg
      should be used to handle shorter return value. fix [Bug #3861]
      [ruby-core:32504]
    * ext/fiddle/closure.c (callback): ditto
    * ext/fiddle/conversions.h (fiddle_generic): ditto
    * ext/fiddle/conversions.c (value_to_generic): char, short and int
      are strictly distinguished on big-endian CPU, e.g. sparc64.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ngoto 2011-08-21 02:35:12 +00:00
parent aef5decf8b
commit 01db73f6c2
4 changed files with 30 additions and 5 deletions

View file

@ -110,14 +110,13 @@ callback(ffi_cif *cif, void *resp, void **args, void *ctx)
*(long *)resp = NUM2LONG(ret);
break;
case TYPE_CHAR:
*(char *)resp = NUM2INT(ret);
case TYPE_SHORT:
case TYPE_INT:
*(ffi_sarg *)resp = NUM2INT(ret);
break;
case TYPE_VOIDP:
*(void **)resp = NUM2PTR(ret);
break;
case TYPE_INT:
*(int *)resp = NUM2INT(ret);
break;
case TYPE_DOUBLE:
*(double *)resp = NUM2DBL(ret);
break;