Skip to content

Commit

Permalink
Merge pull request #411 from kleisauke/use-int-for-gboolean
Browse files Browse the repository at this point in the history
Ensure correct FFI function definitions for `gboolean` parameters
  • Loading branch information
jcupitt authored Feb 6, 2025
2 parents b773f31 + ff74ca6 commit 0003ec7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions lib/vips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions lib/vips/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 0003ec7

Please sign in to comment.