ruby-vips 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13cfcbea0e56ad3823bf1da4e035884d934253c729d74da5f54c77e87e949c5a
4
- data.tar.gz: ebd97fa16da17c0f932bccb49d21d5b1dcaa024e32ace5c3335f093b2043efea
3
+ metadata.gz: faf388c9ee4f7b130b34c0a30954da1d9efd08b09799befe88d676bca7c79f64
4
+ data.tar.gz: 015463ac062367c72195e8349669c8ed80123c81cb88710951130d030b6a4018
5
5
  SHA512:
6
- metadata.gz: a7ff0c920fa2ccfe60e9b1762fce6efaa94413f5a68453156eaa7cad6a63cdbab3639ecc525c52cb11578684bc02e9868b7643ab4bc89a8f23905c7dae0b06c1
7
- data.tar.gz: c258fc41dca1d105aa4617bac9a3092a8ea3ce7a2bf41f0ad37aac1baa3ebcdce9a3353a4be014b9748e8e141ca15916b67f789cb1fab76c8a5647832aa2efd0
6
+ metadata.gz: e05333180a545ecae8a7aa4da0a0fa1382e2b8e0233338b2e818cfcaa7de6e2a14c9be0d6f11510393ffb4343e5ad84a7100ba665c158546fd8dfcb71e83462e
7
+ data.tar.gz: b4edb03ea9b62fd30c41fc51bb9cfb94214b4929e83df24c62742de63f7dbff1d13220e57a234da8592816f33e09f0122a9a60c790c9d459b236e655c7691467
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -20,7 +20,7 @@ jobs:
20
20
 
21
21
  steps:
22
22
  - name: Checkout code
23
- uses: actions/checkout@v2
23
+ uses: actions/checkout@v4
24
24
 
25
25
  - name: Set up Ruby
26
26
  uses: ruby/setup-ruby@v1
@@ -38,7 +38,6 @@ jobs:
38
38
  matrix:
39
39
  os-version: [ 'ubuntu-20.04' ]
40
40
  ruby-version:
41
- - '2.0'
42
41
  - '2.1'
43
42
  - '2.2'
44
43
  - '2.3'
@@ -56,7 +55,7 @@ jobs:
56
55
 
57
56
  steps:
58
57
  - name: Checkout code
59
- uses: actions/checkout@v3
58
+ uses: actions/checkout@v4
60
59
 
61
60
  - name: Set up Ruby
62
61
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## Version 2.2.1 (2023-02-21)
6
+
7
+ * add `Vips.block_untrusted` method to block all untrusted operations. Only for libvips >= 8.13. [Docs](https://www.libvips.org/API/current/libvips-vips.html#vips-block-untrusted-set). [#382](https://github.com/libvips/ruby-vips/pull/382) [aglushkov](https://github.com/aglushkov)
8
+ * add `Vips.block` method to block specific operation. Only for libvips >= 8.13. [Docs](https://www.libvips.org/API/current/VipsOperation.html#vips-operation-block-set). [#382](https://github.com/libvips/ruby-vips/pull/382) [aglushkov](https://github.com/aglushkov)
9
+ * `new_from_source` keeps a ref to the source object [taylorthurlow]
10
+ * some fixes to object references system
11
+
5
12
  ## Version 2.2.0 (2023-10-18)
6
13
 
7
14
  * add `draw_point!` [jcupitt]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.2.1
data/lib/vips/image.rb CHANGED
@@ -458,7 +458,14 @@ module Vips
458
458
  loader = Vips.vips_foreign_find_load_source source
459
459
  raise Vips::Error if loader.nil?
460
460
 
461
- Vips::Operation.call loader, [source], opts, option_string
461
+ result = Vips::Operation.call loader, [source], opts, option_string
462
+
463
+ # keep a secret ref to the source object ... the libvips loader will
464
+ # keep a ref to the C source object, but we need the ruby wrapper object
465
+ # to stay alive too
466
+ result.references << source
467
+
468
+ result
462
469
  end
463
470
 
464
471
  def self.matrix_from_array width, height, array
@@ -49,10 +49,10 @@ module Vips
49
49
 
50
50
  def initialize name
51
51
  name = name.to_s if name.is_a? Symbol
52
- ptr = Vips.vips_interpolate_new name
53
- raise Vips::Error if ptr.nil?
52
+ pointer = Vips.vips_interpolate_new name
53
+ raise Vips::Error if pointer.nil?
54
54
 
55
- super ptr
55
+ super(pointer)
56
56
  end
57
57
  end
58
58
  end
@@ -58,7 +58,7 @@ module Vips
58
58
  # See also the comment on set_type! before changing this.
59
59
  pointer = copy_image.ptr
60
60
  ::GObject.g_object_ref pointer
61
- super pointer
61
+ super(pointer)
62
62
 
63
63
  # and save the copy ready for when we finish mutating
64
64
  @image = copy_image
@@ -218,7 +218,7 @@ module Vips
218
218
  raise Vips::Error if value.null?
219
219
  end
220
220
 
221
- super value
221
+ super(value)
222
222
  end
223
223
 
224
224
  def build
@@ -283,7 +283,7 @@ module Vips
283
283
  value = value.map { |x| Operation.imageize match_image, x }
284
284
  end
285
285
 
286
- super name, value
286
+ super(name, value)
287
287
  end
288
288
 
289
289
  public
@@ -440,14 +440,12 @@ module Vips
440
440
  end
441
441
  end
442
442
 
443
- # collect a list of all input references here
444
- references = Set.new
443
+ # dedupe all input references here
444
+ deduped_references = Set.new
445
445
 
446
446
  add_reference = lambda do |x|
447
447
  if x.is_a?(Vips::Image)
448
- x.references.each do |i|
449
- references << i
450
- end
448
+ deduped_references.merge x.references
451
449
  end
452
450
  false
453
451
  end
@@ -482,20 +480,27 @@ module Vips
482
480
 
483
481
  op = op.build
484
482
 
483
+ # we need an array of references for output objects
484
+ references = deduped_references.to_a
485
+
485
486
  # attach all input refs to output x
486
487
  set_reference = lambda do |x|
488
+ # stop early if there are no refs to attach
489
+ return true if references == []
490
+
487
491
  if x.is_a? Vips::Image
488
- x.references += references
492
+ references.each { |i| x.references << i }
489
493
  end
494
+
490
495
  false
491
496
  end
492
497
 
493
498
  # get all required results
494
499
  result = []
495
500
  required_output.each do |details|
496
- value = details[:arg_name]
501
+ value = op.get(details[:arg_name])
497
502
  flat_find value, &set_reference
498
- result << op.get(value)
503
+ result << value
499
504
  end
500
505
 
501
506
  # fetch all optional ones
data/lib/vips/region.rb CHANGED
@@ -44,10 +44,10 @@ module Vips
44
44
  end
45
45
 
46
46
  def initialize(name)
47
- ptr = Vips.vips_region_new name
48
- raise Vips::Error if ptr.null?
47
+ pointer = Vips.vips_region_new name
48
+ raise Vips::Error if pointer.null?
49
49
 
50
- super ptr
50
+ super(pointer)
51
51
  end
52
52
 
53
53
  def width
@@ -47,7 +47,7 @@ module Vips
47
47
  pointer = Vips.vips_source_custom_new
48
48
  raise Vips::Error if pointer.null?
49
49
 
50
- super pointer
50
+ super(pointer)
51
51
  end
52
52
 
53
53
  # The block is executed to read data from the source. The interface is
@@ -47,7 +47,7 @@ module Vips
47
47
  pointer = Vips.vips_target_custom_new
48
48
  raise Vips::Error if pointer.null?
49
49
 
50
- super pointer
50
+ super(pointer)
51
51
  end
52
52
 
53
53
  # The block is executed to write data to the source. The interface is
data/lib/vips/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vips
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
data/lib/vips.rb CHANGED
@@ -779,6 +779,31 @@ module Vips
779
779
  major > x || (major == x && minor >= y)
780
780
  end
781
781
 
782
+ if at_least_libvips?(8, 13)
783
+ attach_function :vips_block_untrusted_set, [:bool], :void
784
+ attach_function :vips_operation_block_set, %i[string bool], :void
785
+
786
+ # Block/unblock all untrusted operations from running.
787
+ # Use `vips -l` at the command-line to see the class hierarchy and which operations are marked as untrusted.
788
+ def self.block_untrusted(enabled)
789
+ vips_block_untrusted_set(enabled)
790
+ end
791
+
792
+ # Block/unblock all operations in the libvips class hierarchy at specified *operation_name* and below.
793
+ #
794
+ # For example this will block all loaders except JPEG
795
+ #
796
+ # Vips.block("VipsForeignLoad", true);
797
+ # Vips.block("VipsForeignLoadJpeg", false)
798
+ #
799
+ # Use `vips -l` at the command-line to see the class hierarchy.
800
+ # This call does nothing if the named operation is not found.
801
+ #
802
+ def self.block(operation_name, enabled)
803
+ vips_operation_block_set(operation_name, enabled)
804
+ end
805
+ end
806
+
782
807
  # Get a list of all supported file suffixes.
783
808
  #
784
809
  # @return [[String]] array of supported suffixes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Cupitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -113,6 +113,7 @@ extra_rdoc_files:
113
113
  - TODO
114
114
  files:
115
115
  - ".github/ISSUE_TEMPLATE/bug_report.md"
116
+ - ".github/dependabot.yml"
116
117
  - ".github/workflows/test.yml"
117
118
  - ".gitignore"
118
119
  - ".standard.yml"