8000 Merge branch 'master' of github.com:libvips/ruby-vips · libvips/ruby-vips@70c177f · GitHub
[go: up one dir, main page]

Skip to content

Commit 70c177f

Browse files
committed
Merge branch 'master' of github.com:libvips/ruby-vips
2 parents 5d7c0bc + bcd0c99 commit 70c177f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/vips/image.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,15 @@ def self.new_from_buffer data, option_string, **opts
325325
# @param format [Symbol] band format
326326
# @return [Image] the loaded image
327327
def self.new_from_memory data, width, height, bands, format
328+
size = data.bytesize
329+
328330
# prevent data from being freed with JRuby FFI
329331
if defined?(JRUBY_VERSION) && !data.is_a?(FFI::Pointer)
330332
data = ::FFI::MemoryPointer.new(:char, data.bytesize).write_bytes data
331333
end
332334

333335
format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format
334-
vi = Vips::vips_image_new_from_memory data, data.bytesize, width, height, bands, format_number
336+
vi = Vips::vips_image_new_from_memory data, size, width, height, bands, format_number
335337
raise Vips::Error if vi.null?
336338
image = new(vi)
337339

0 commit comments

Comments
 (0)
0