rmagick 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

data/ext/RMagick/rmutil.c CHANGED
@@ -22,6 +22,9 @@ static VALUE rescue_not_str(VALUE, VALUE ATTRIBUTE_UNUSED) ATTRIBUTE_NORETURN;
22
22
  static void handle_exception(ExceptionInfo *, Image *, ErrorRetention);
23
23
 
24
24
 
25
+ DEFINE_GVL_STUB5(CloneImage, const Image *, const size_t, const size_t, const MagickBooleanType, ExceptionInfo *);
26
+
27
+
25
28
  /**
26
29
  * ImageMagick safe version of malloc.
27
30
  *
@@ -269,7 +272,7 @@ rm_check_destroyed(VALUE obj)
269
272
  {
270
273
  Image *image;
271
274
 
272
- Data_Get_Struct(obj, Image, image);
275
+ TypedData_Get_Struct(obj, Image, &rm_image_data_type, image);
273
276
  if (!image)
274
277
  {
275
278
  rb_raise(Class_DestroyedImageError, "destroyed image");
@@ -780,7 +783,7 @@ rm_write_temp_image(Image *image, char *temp_name, size_t temp_name_l)
780
783
  snprintf(temp_name, temp_name_l, "mpri:%d", id);
781
784
 
782
785
  // Omit "mpri:" from filename to form the key
783
- okay = SetImageRegistry(ImageRegistryType, temp_name+5, image, exception);
786
+ okay = (MagickBooleanType)SetImageRegistry(ImageRegistryType, temp_name+5, image, exception);
784
787
  CHECK_EXCEPTION();
785
788
  DestroyExceptionInfo(exception);
786
789
  if (!okay)
@@ -1518,7 +1521,8 @@ rm_clone_image(Image *image)
1518
1521
  ExceptionInfo *exception;
1519
1522
 
1520
1523
  exception = AcquireExceptionInfo();
1521
- clone = CloneImage(image, 0, 0, MagickTrue, exception);
1524
+ GVL_STRUCT_TYPE(CloneImage) args = { image, 0, 0, MagickTrue, exception };
1525
+ clone = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CloneImage), &args);
1522
1526
  if (!clone)
1523
1527
  {
1524
1528
  rb_raise(rb_eNoMemError, "not enough memory to continue");
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Magick
2
- VERSION = '5.0.0'
4
+ VERSION = '5.1.0'
3
5
  MIN_RUBY_VERSION = '2.3.0'
4
6
  MIN_IM_VERSION = '6.7.7'
5
7
  end
data/lib/rmagick.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rmagick_internal.rb'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # $Id: RMagick.rb,v 1.84 2009/09/15 22:08:41 rmagick Exp $
2
4
  #==============================================================================
3
5
  # Copyright (C) 2009 by Timothy P. Hunter
@@ -23,7 +25,6 @@ require 'observer'
23
25
  require 'RMagick2.so'
24
26
 
25
27
  module Magick
26
- @formats = nil
27
28
  IMAGEMAGICK_VERSION = Magick::Magick_version.split[1].split('-').first
28
29
 
29
30
  class << self
@@ -51,13 +52,13 @@ module Magick
51
52
  # => {"3FR"=>" r-+", "3G2"=>" r-+", "3GP"=>" r-+", "A"=>"*rw+",
52
53
  # ...
53
54
  def formats
54
- @formats ||= init_formats
55
+ formats = init_formats
55
56
 
56
57
  if block_given?
57
- @formats.each { |k, v| yield k, v }
58
+ formats.each { |k, v| yield k, v }
58
59
  self
59
60
  else
60
- @formats
61
+ formats
61
62
  end
62
63
  end
63
64
  end
@@ -75,7 +76,7 @@ module Magick
75
76
  MinimumGeometry = GeometryValue.new(:MinimumGeometry, 6).freeze
76
77
 
77
78
  class Geometry
78
- FLAGS = ['', '%', '!', '<', '>', '@', '^']
79
+ FLAGS = ['', '%', '!', '<', '>', '@', '^'].freeze
79
80
  RFLAGS = {
80
81
  '%' => PercentGeometry,
81
82
  '!' => AspectGeometry,
@@ -83,7 +84,7 @@ module Magick
83
84
  '>' => GreaterGeometry,
84
85
  '@' => AreaGeometry,
85
86
  '^' => MinimumGeometry
86
- }
87
+ }.freeze
87
88
 
88
89
  attr_accessor :width, :height, :x, :y, :flag
89
90
 
@@ -139,7 +140,7 @@ module Magick
139
140
 
140
141
  # Convert object to a geometry string
141
142
  def to_s
142
- str = ''
143
+ str = String.new
143
144
  if @width > 0
144
145
  fmt = @width.truncate == @width ? '%d' : '%.2f'
145
146
  str << sprintf(fmt, @width)
@@ -770,12 +771,6 @@ module Magick
770
771
  module Post_ObjectData_Descriptor
771
772
  Confirmed_ObjectData_Size = '9:10'
772
773
  end
773
-
774
- # Make all constants above immutable
775
- constants.each do |record|
776
- rec = const_get(record)
777
- rec.constants.each { |ds| rec.const_get(ds).freeze }
778
- end
779
774
  end # module Magick::IPTC
780
775
 
781
776
  # Ruby-level Magick::Image methods
data/rmagick.gemspec CHANGED
@@ -24,6 +24,8 @@ Gem::Specification.new do |s|
24
24
  s.required_ruby_version = ">= #{Magick::MIN_RUBY_VERSION}"
25
25
  s.requirements << "ImageMagick #{Magick::MIN_IM_VERSION} or later"
26
26
 
27
+ s.add_runtime_dependency 'pkg-config', '~> 1.4'
28
+
27
29
  s.add_development_dependency 'pry', '~> 0.14'
28
30
  s.add_development_dependency 'rake-compiler', '~> 1.0'
29
31
  s.add_development_dependency 'rspec', '~> 3.8'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmagick
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Hunter
@@ -11,8 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-10-06 00:00:00.000000000 Z
14
+ date: 2022-11-14 00:00:00.000000000 Z
15
15
  dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: pkg-config
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.4'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.4'
16
30
  - !ruby/object:Gem::Dependency
17
31
  name: pry
18
32
  requirement: !ruby/object:Gem::Requirement
@@ -172,6 +186,7 @@ files:
172
186
  - ext/RMagick/extconf.rb
173
187
  - ext/RMagick/rmagick.c
174
188
  - ext/RMagick/rmagick.h
189
+ - ext/RMagick/rmagick_gvl.h
175
190
  - ext/RMagick/rmdraw.c
176
191
  - ext/RMagick/rmenum.c
177
192
  - ext/RMagick/rmfill.c