Array#count in a FFI structure field does not return the number of items.
-------------------------------------------------------------------------

                 Key: JRUBY-5782
                 URL: http://jira.codehaus.org/browse/JRUBY-5782
             Project: JRuby
          Issue Type: Bug
          Components: Extensions
    Affects Versions: JRuby 1.6.1
         Environment: Linux 64bit and Mac OSX 10.6.7
            Reporter: Chung Shin Yee
            Priority: Minor


The following uses array in a FFI structure. The #count should return the 
number of items, but in JRuby, it returns the number of bytes. This is working 
in MRI Ruby 1.9.2, but not JRuby 1.6.1.

$ cat runstruct.rb 
require 'ffi'
class A < FFI::Struct
    layout(:list, [:int, 3])
end

a = A.new
puts "List size = " + a[:list].size.to_s
puts "List count = " + a[:list].count.to_s

$ jruby --1.9 runstruct.rb 
List size = 12
List count = 12

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to