diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-13 07:09:56 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-13 07:09:56 +0200 |
commit | a33f6f851bd57b0dde4a8119981e10bea9af25e5 (patch) | |
tree | 0c28800556521f5f110bbcedfed1e6e4563ea233 /lib/efl/ecore_getopt.rb | |
parent | d5bc890cabde613368dde50a3953df6c909a9d0c (diff) | |
download | ffi-efl-a33f6f851bd57b0dde4a8119981e10bea9af25e5.zip ffi-efl-a33f6f851bd57b0dde4a8119981e10bea9af25e5.tar.gz |
bugfix ecore_getopt store :string
Diffstat (limited to 'lib/efl/ecore_getopt.rb')
-rw-r--r-- | lib/efl/ecore_getopt.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/efl/ecore_getopt.rb b/lib/efl/ecore_getopt.rb index dfe9275..75aa888 100644 --- a/lib/efl/ecore_getopt.rb +++ b/lib/efl/ecore_getopt.rb @@ -118,7 +118,7 @@ module Efl # @refs = [] # to prevent FFI::MemoryPointer.from_string from beeing GC'ed end def p_from_string r - return r if r==FFI::Pointer::NULL + return FFI::Pointer::NULL if r.nil? FFI::MemoryPointer.from_string r end private :p_from_string @@ -138,6 +138,10 @@ module Efl p = FFI::MemoryPointer.new :pointer p.write_pointer FFI::Pointer::NULL r = @values[skey] = [ ptype, p ] + when :string + p = FFI::MemoryPointer.new :pointer + p.write_pointer FFI::Pointer::NULL + r = @values[skey] = [ ptype, p ] else p = FFI::MemoryPointer.new ptype p.send 'write_'+ptype.to_s, val unless val.nil? @@ -157,6 +161,9 @@ module Efl when :choice p = ptr.read_pointer ( p==FFI::Pointer::NULL ? nil : p.read_string ) + when :string + p = ptr.read_pointer + (p==FFI::Pointer::NULL ? nil : p.read_string ) when :pointer p = ptr.read_pointer ( p==FFI::Pointer::NULL ? nil : p ) @@ -198,7 +205,7 @@ module Efl st = d[:action_param][:store] st[:type] = v[0] st[:arg_req] = v[1] - st[:def][v[2]] = (v[2]==:str ? p_from_string(v[3]) : v[3] ) unless v[3].nil? + st[:def][v[2]] = (v[2]==:strv ? p_from_string(v[3]) : v[3] ) unless v[3].nil? when :store_const d[:action_param][:store_const] = v when :choices @@ -212,6 +219,7 @@ module Efl @ecore_values_st = Native::EcoreGetoptValue.new FFI::MemoryPointer.new Native::EcoreGetoptValue, @values_order.length, false @values_order.each_with_index do |k,i| vtype, vpointer, *sub_type = @values[k] + vpointer.write_pointer @ecore_getopt_st.desc_ptr(i)[:action_param][:store][:def][:strv] if vtype==:string etype, vfield, pfield = @types[vtype] @ecore_values_st.value_ptr(i)[pfield] = vpointer end |