Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mspack_create_oab_decompressor #2

Open
retorquere opened this issue Apr 14, 2018 · 0 comments
Open

mspack_create_oab_decompressor #2

retorquere opened this issue Apr 14, 2018 · 0 comments

Comments

@retorquere
Copy link

I need to unpack an OAB file using the python equivalent of the ruby code below. Can someone help me along to get this going?

require 'libmspack'

module LibMsPack
  attach_function :mspack_create_oab_decompressor, [ :pointer ], :pointer
  attach_function :mspack_destroy_oab_decompressor, [ :pointer ], :void

  class OABDecompressor < FFI::Struct
    layout :decompress, callback([:pointer, :string, :string], :int),
           :decompress_incremental, callback([:pointer, :string, :string, :string], :int)
  end

  def LibMsPack.oab_decompress(source, target)
    dec = LibMsPack.mspack_create_oab_decompressor(nil)
    msoab = LibMsPack::OABDecompressor.new(dec)
    msoab[:decompress].call(dec, source, target)
    LibMsPack.mspack_destroy_oab_decompressor(dec)
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant