diff options
| author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-22 14:29:20 +0000 |
|---|---|---|
| committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-22 14:29:20 +0000 |
| commit | 80fcc2aea7970eed8669d4690cdfecca5c7807b5 (patch) | |
| tree | 4e8c91777a8996573aa8ab6655ec23bed61d58b0 | |
| parent | d5c5f6762e0e1aa7245404853e07bee6b906f782 (diff) | |
| download | ruby-80fcc2aea7970eed8669d4690cdfecca5c7807b5.tar.gz ruby-80fcc2aea7970eed8669d4690cdfecca5c7807b5.tar.xz ruby-80fcc2aea7970eed8669d4690cdfecca5c7807b5.zip | |
Bugfix for PR#1196
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ext/dl/ptr.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c index 1eb0b8273..32f78c4de 100644 --- a/ext/dl/ptr.c +++ b/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; |
