From 4cef5c79b72bffe4757af6f2e3c5dbc89733dc63 Mon Sep 17 00:00:00 2001 From: Kazuki Nishikawa Date: Fri, 1 Aug 2025 12:12:22 +0900 Subject: [PATCH 1/2] fix frozen string warnings --- lib/xz.rb | 4 ++-- lib/xz/stream_reader.rb | 2 +- lib/xz/stream_writer.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 From 2f1e4febdf32787a5fbc115d74801c270d542348 Mon Sep 17 00:00:00 2001 From: Kazuki Nishikawa Date: Fri, 1 Aug 2025 14:30:57 +0900 Subject: [PATCH 2/2] add fiddle as a runtime dependency ``` warning: fiddle was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0. ``` fiddle gem drops ruby <2.5 support at v1.1.0 So specifies the version of fiddle gem as `~> 1.0.9` --- ruby-xz.gemspec | 1 + 1 file changed, 1 insertion(+) 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'