[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
Sun Jun 6 19:31:46 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:  closed               
 Priority:  blocker               |    Milestone:                       
Component:  MacRuby               |   Resolution:  invalid              
 Keywords:                        |  
----------------------------------+-----------------------------------------
Changes (by lsansonetti@…):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 You're creating a Pointer of only one character here, but asking
 JSStringGetUTF8CString() to fill it up with more space. You're lucky that
 it's not crashing :) You probably want Pointer.new('c', size) instead.
 Also, buffer[0] will return you the first character, not the whole string.
 Let us know if you still have an issue.

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



More information about the MacRuby-devel mailing list