mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Bugfix for PR#1196
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f136a3225e
commit
79c3e2d004
1 changed files with 5 additions and 8 deletions
13
ext/dl/ptr.c
13
ext/dl/ptr.c
|
@ -340,18 +340,14 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
|
|||
case 'D':
|
||||
n = data->size / sizeof(double);
|
||||
break;
|
||||
case 'S': case 'P':
|
||||
case 'P': case 'p':
|
||||
n = data->size / sizeof(void*);
|
||||
break;
|
||||
case 'S': case 's':
|
||||
for (n=0; ((void**)(data->ptr))[n]; n++) {};
|
||||
break;
|
||||
default:
|
||||
if (t == 'p' || t == 's') {
|
||||
int i;
|
||||
for (i=0; ((void**)(data->ptr))[i]; i++) {};
|
||||
n = i;
|
||||
}
|
||||
else{
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -376,6 +372,7 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
|
|||
break;
|
||||
case 'D':
|
||||
rb_ary_push(ary, rb_float_new(((double*)(data->ptr))[i]));
|
||||
break;
|
||||
case 'F':
|
||||
rb_ary_push(ary, rb_float_new(((float*)(data->ptr))[i]));
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue