[MacRuby-devel] [MacRuby] #769: String::ord with packed array in MacRuby

MacRuby ruby-noreply at macosforge.org
Wed Jun 30 16:47:54 PDT 2010


#769: String::ord with packed array in MacRuby
---------------------------------+------------------------------------------
 Reporter:  babs.devs@…          |       Owner:  lsansonetti@…                                  
     Type:  defect               |      Status:  new                                            
 Priority:  blocker              |   Milestone:  MacRuby 0.7                                    
Component:  MacRuby              |    Keywords:  binary, pack, ord, ordinal, String, String::ord
---------------------------------+------------------------------------------
 When attempting to get the ordinal from a character of an array packed to
 a binary string, MacRuby returns inconsistent values, and sometimes seg.
 faults.

 {{{
 sha1 = ["94f389bf5d9af4511597d035e69d1be9510b50c7"].pack("H*")
 sha1[0].ord
 #Macirb has returned:
 #  63, 96, 65428(most often), 65535, and seg. faults
 #Irb returns: 148

 foo = ['bar'].pack('H*')
 foo[1].ord
 #Macirb:65456 Irb:176

 "cat"[0].ord
 #Works as expected
 }}}

 Tested with Ruby 1.9.1 and Macruby 6/23/10 nightly.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/769>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list