diff --git a/lib/xz.rb b/lib/xz.rb index afbef46..e3b7295 100644 --- a/lib/xz.rb +++ b/lib/xz.rb @@ -202,7 +202,7 @@ def decompress_stream(io, memory_limit: LibLZMA::UINT64_MAX, flags: [:tell_unsup LZMAError.raise_if_necessary(res) - res = "" + res = +"" res.encode!(Encoding::BINARY) if block_given? res = lzma_code(io, stream) do |chunk| @@ -310,7 +310,7 @@ def compress_stream(io, level: 6, check: :crc64, extreme: false, &block) LZMAError.raise_if_necessary(res) - res = "" + res = +"" res.encode!(Encoding::BINARY) if block_given? res = lzma_code(io, stream, &block) diff --git a/lib/xz/stream_reader.rb b/lib/xz/stream_reader.rb index 37c3594..567bf8d 100644 --- a/lib/xz/stream_reader.rb +++ b/lib/xz/stream_reader.rb @@ -212,7 +212,7 @@ def read(length = nil, outbuf = String.new) # The user's request is in decompressed bytes, so it doesn't matter # how much is actually read from the compressed file. if @delegate_io.eof? - data = "" + data = +"" action = XZ::LibLZMA::LZMA_FINISH else data = @delegate_io.read(XZ::CHUNK_SIZE) diff --git a/lib/xz/stream_writer.rb b/lib/xz/stream_writer.rb index ba9a884..c382e6b 100644 --- a/lib/xz/stream_writer.rb +++ b/lib/xz/stream_writer.rb @@ -235,7 +235,7 @@ def write(*args) # Like superclass' method, but also ensures liblzma flushes all # compressed data to the delegate IO. def finish - lzma_code("", XZ::LibLZMA::LZMA_FINISH) { |compressed| @delegate_io.write(compressed) } + lzma_code(+"", XZ::LibLZMA::LZMA_FINISH) { |compressed| @delegate_io.write(compressed) } super end diff --git a/ruby-xz.gemspec b/ruby-xz.gemspec index 48991f4..d8e18be 100644 --- a/ruby-xz.gemspec +++ b/ruby-xz.gemspec @@ -60,6 +60,7 @@ GEMSPEC = Gem::Specification.new do |spec| spec.platform = Gem::Platform::RUBY spec.post_install_message = 'Version 1.0.0 of ruby-xz breaks the API. Read HISTORY.rdoc and adapt your code to the new API.' + spec.add_dependency 'fiddle', '~> 1.0.9' spec.add_development_dependency 'minitar', '~> 0.6' spec.add_development_dependency 'minitest', '~> 5.14' spec.add_development_dependency 'rake', '~> 13.0'