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,19 +340,15 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
|
||||||
case 'D':
|
case 'D':
|
||||||
n = data->size / sizeof(double);
|
n = data->size / sizeof(double);
|
||||||
break;
|
break;
|
||||||
case 'S': case 'P':
|
case 'P': case 'p':
|
||||||
n = data->size / sizeof(void*);
|
n = data->size / sizeof(void*);
|
||||||
break;
|
break;
|
||||||
|
case 'S': case 's':
|
||||||
|
for (n=0; ((void**)(data->ptr))[n]; n++) {};
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (t == 'p' || t == 's') {
|
|
||||||
int i;
|
|
||||||
for (i=0; ((void**)(data->ptr))[i]; i++) {};
|
|
||||||
n = i;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rb_bug("rb_dlptr_to_array");
|
rb_bug("rb_dlptr_to_array");
|
||||||
|
@ -376,6 +372,7 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
rb_ary_push(ary, rb_float_new(((double*)(data->ptr))[i]));
|
rb_ary_push(ary, rb_float_new(((double*)(data->ptr))[i]));
|
||||||
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
rb_ary_push(ary, rb_float_new(((float*)(data->ptr))[i]));
|
rb_ary_push(ary, rb_float_new(((float*)(data->ptr))[i]));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue