Skip to content

Commit ff74ca6

Browse files
committed
Ensure correct FFI function definitions for gboolean parameters
`gboolean` is a typedef for `int` in GLib. Resolves: #410.
1 parent b773f31 commit ff74ca6

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## master
44

55
* fix `Image#add_alpha()` with libvips 8.16 [kleisauke]
6+
* fix FFI function definitions for `gboolean` parameters [kleisauke]
67

78
## Version 2.2.2 (2024-07-17)
89

lib/vips.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,13 +810,13 @@ def self.at_least_libvips?(x, y)
810810
end
811811

812812
if at_least_libvips?(8, 13)
813-
attach_function :vips_block_untrusted_set, [:bool], :void
814-
attach_function :vips_operation_block_set, %i[string bool], :void
813+
attach_function :vips_block_untrusted_set, [:int], :void
814+
attach_function :vips_operation_block_set, [:string, :int], :void
815815

816816
# Block/unblock all untrusted operations from running.
817817
# Use `vips -l` at the command-line to see the class hierarchy and which operations are marked as untrusted.
818-
def self.block_untrusted(enabled)
819-
vips_block_untrusted_set(enabled)
818+
def self.block_untrusted(state)
819+
vips_block_untrusted_set(state ? 1 : 0)
820820
end
821821

822822
# Block/unblock all operations in the libvips class hierarchy at specified *operation_name* and below.
@@ -829,8 +829,8 @@ def self.block_untrusted(enabled)
829829
# Use `vips -l` at the command-line to see the class hierarchy.
830830
# This call does nothing if the named operation is not found.
831831
#
832-
def self.block(operation_name, enabled)
833-
vips_operation_block_set(operation_name, enabled)
832+
def self.block(operation_name, state)
833+
vips_operation_block_set(operation_name, state ? 1 : 0)
834834
end
835835
end
836836

lib/vips/image.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ module Vips
1414

1515
attach_function :vips_image_copy_memory, [:pointer], :pointer
1616

17-
attach_function :vips_image_set_progress, [:pointer, :bool], :void
18-
attach_function :vips_image_set_kill, [:pointer, :bool], :void
17+
attach_function :vips_image_set_progress, [:pointer, :int], :void
18+
attach_function :vips_image_set_kill, [:pointer, :int], :void
1919

2020
attach_function :vips_filename_get_filename, [:string], :pointer
2121
attach_function :vips_filename_get_options, [:string], :pointer
@@ -716,7 +716,7 @@ def write_to_memory
716716
# @see Object#signal_connect
717717
# @param state [Boolean] progress signalling state
718718
def set_progress state
719-
Vips.vips_image_set_progress self, state
719+
Vips.vips_image_set_progress(self, state ? 1 : 0)
720720
end
721721

722722
# Kill computation of this time.
@@ -727,7 +727,7 @@ def set_progress state
727727
# @see Object#signal_connect
728728
# @param kill [Boolean] stop computation
729729
def set_kill kill
730-
Vips.vips_image_set_kill self, kill
730+
Vips.vips_image_set_kill(self, kill ? 1 : 0)
731731
end
732732

733733
# Get the `GType` of a metadata field. The result is 0 if no such field

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy