diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bb5fd7..7c09392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## master * fix `Image#add_alpha()` with libvips 8.16 [kleisauke] +* fix FFI function definitions for `gboolean` parameters [kleisauke] ## Version 2.2.2 (2024-07-17) diff --git a/lib/vips.rb b/lib/vips.rb index 92af2e2..aed3f1a 100644 --- a/lib/vips.rb +++ b/lib/vips.rb @@ -810,13 +810,13 @@ def self.at_least_libvips?(x, y) end if at_least_libvips?(8, 13) - attach_function :vips_block_untrusted_set, [:bool], :void - attach_function :vips_operation_block_set, %i[string bool], :void + attach_function :vips_block_untrusted_set, [:int], :void + attach_function :vips_operation_block_set, [:string, :int], :void # Block/unblock all untrusted operations from running. # Use `vips -l` at the command-line to see the class hierarchy and which operations are marked as untrusted. - def self.block_untrusted(enabled) - vips_block_untrusted_set(enabled) + def self.block_untrusted(state) + vips_block_untrusted_set(state ? 1 : 0) end # Block/unblock all operations in the libvips class hierarchy at specified *operation_name* and below. @@ -829,8 +829,8 @@ def self.block_untrusted(enabled) # Use `vips -l` at the command-line to see the class hierarchy. # This call does nothing if the named operation is not found. # - def self.block(operation_name, enabled) - vips_operation_block_set(operation_name, enabled) + def self.block(operation_name, state) + vips_operation_block_set(operation_name, state ? 1 : 0) end end diff --git a/lib/vips/image.rb b/lib/vips/image.rb index e777d47..ea8b1af 100644 --- a/lib/vips/image.rb +++ b/lib/vips/image.rb @@ -14,8 +14,8 @@ module Vips attach_function :vips_image_copy_memory, [:pointer], :pointer - attach_function :vips_image_set_progress, [:pointer, :bool], :void - attach_function :vips_image_set_kill, [:pointer, :bool], :void + attach_function :vips_image_set_progress, [:pointer, :int], :void + attach_function :vips_image_set_kill, [:pointer, :int], :void attach_function :vips_filename_get_filename, [:string], :pointer attach_function :vips_filename_get_options, [:string], :pointer @@ -716,7 +716,7 @@ def write_to_memory # @see Object#signal_connect # @param state [Boolean] progress signalling state def set_progress state - Vips.vips_image_set_progress self, state + Vips.vips_image_set_progress(self, state ? 1 : 0) end # Kill computation of this time. @@ -727,7 +727,7 @@ def set_progress state # @see Object#signal_connect # @param kill [Boolean] stop computation def set_kill kill - Vips.vips_image_set_kill self, kill + Vips.vips_image_set_kill(self, kill ? 1 : 0) end # Get the `GType` of a metadata field. The result is 0 if no such field