From 79c3e2d004c40449e987c1fb78602b7f3a93bd6a Mon Sep 17 00:00:00 2001 From: ttate Date: Wed, 22 Oct 2003 14:29:20 +0000 Subject: [PATCH] Bugfix for PR#1196 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/ptr.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c index 1eb0b82730..32f78c4de5 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;