[MacRuby-devel] [MacRuby] #738: A character string cannot be taken out of the variable made by Pointer.new('c').

MacRuby ruby-noreply at macosforge.org
Sat Jun 5 21:11:56 PDT 2010


#738: A character string cannot be taken out of the variable made by
Pointer.new('c').
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 {{{
 $ cat test_js.rb
 framework "JavaScriptCore"

 string = JSStringCreateWithUTF8CString("hello")
 size = JSStringGetMaximumUTF8CStringSize(string)
 buffer = Pointer.new('c')
 JSStringGetUTF8CString(string, buffer, size)

 puts buffer[0] # expect "hello"
 }}}

 {{{
 $ macruby test_js.rb
 104
 }}}

 I was expecting the display as "hello".
 But a decimal number of the first character is only displayed.

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



More information about the MacRuby-devel mailing list