Module: Rufus::Tokyo::Outlen

Included in:
Cabinet, TyrantTable
Defined in:
lib/rufus/tokyo/outlen.rb

Instance Method Summary collapse

Instance Method Details

#outlen_op(method, *args) ⇒ Object

A wrapper for library returning a string (binary data potentially)



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rufus/tokyo/outlen.rb', line 30

def outlen_op (method, *args)

  args.unshift(@db)

  outlen = FFI::MemoryPointer.new(:int)
  args << outlen

  out = lib.send(method, *args)

  return nil if out.address == 0

  out.get_bytes(0, outlen.get_int(0))

ensure
  outlen.free
  lib.tcfree(out)
  #lib.free(out)
end