Module: Archive::C

Extended by:
FFI::Library
Defined in:
lib/ffi_libarchive/api.rb

Constant Summary collapse

EOF =

region Error Codes

1
OK =
0
RETRY =
-10
WARN =
-20
FAILED =
-25
FATAL =
-30
# endregion
DATA_BUFFER_SIZE =

endregion

2**16

Class Method Summary collapse

Class Method Details

.archive_write_set_compression(archive, compression) ⇒ Integer

Parameters:

  • archive (FFI::Pointer)

Returns:

  • (Integer)


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/ffi_libarchive/api.rb', line 125

def self.archive_write_set_compression(archive, compression)
  return archive_write_set_compression_program(archive, compression) if compression.is_a?(String)
  return archive_write_add_filter(archive, compression) if respond_to?(:archive_write_add_filter)

  # :nocov:
  case compression
  when COMPRESSION_BZIP2
    archive_write_set_compression_bzip2 archive
  when COMPRESSION_GZIP
    archive_write_set_compression_gzip archive
  when COMPRESSION_LZIP
    archive_write_set_compression_lzip archive
  when COMPRESSION_LZMA
    archive_write_set_compression_lzma archive
  when COMPRESSION_XZ
    archive_write_set_compression_xz archive
  when COMPRESSION_COMPRESS
    archive_write_set_compression_compress archive
  when COMPRESSION_NONE
    archive_write_set_compression_none archive
  else
    raise "Unknown compression type: #{compression}"
  end
  # :nocov:
end

.attach_function_maybe(*args) ⇒ Object



7
8
9
10
# File 'lib/ffi_libarchive/api.rb', line 7

def self.attach_function_maybe(*args)
  attach_function(*args)
rescue FFI::NotFoundError # rubocop:disable all
end