use @+ operator instead of #dup to get unfrozen string

This commit is contained in:
taichi 2020-02-05 11:40:56 +09:00
parent 3bc85ccdec
commit b326d17438
5 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ module Zip
end
def buffer
@buffer ||= ''.dup
@buffer ||= +''
end
def input_finished?

View File

@ -615,7 +615,7 @@ module Zip
get_input_stream do |is|
bytes_written = 0
warned = false
buf = ''.dup
buf = +''
while (buf = is.sysread(::Zip::Decompressor::CHUNK_SIZE, buf))
os << buf
bytes_written += buf.bytesize

View File

@ -26,7 +26,7 @@ module Zip
end
def create_unknown_item
s = ''.dup
s = +''
class << s
alias_method :to_c_dir_bin, :to_s
alias_method :to_local_bin, :to_s

View File

@ -402,7 +402,7 @@ module Zip
# Creates a directory
def mkdir(entryName, permissionInt = 0o755)
raise Errno::EEXIST, "File exists - #{entryName}" if find_entry(entryName)
entryName = entryName.dup.to_s
entryName = +entryName.to_s
entryName << '/' unless entryName.end_with?('/')
@entry_set << ::Zip::StreamableDirectory.new(@name, entryName, nil, permissionInt)
end

View File

@ -3,7 +3,7 @@ module Zip
def initialize(*args)
super
@buffer = ''.dup
@buffer = +''
@zlib_inflater = ::Zlib::Inflate.new(-Zlib::MAX_WBITS)
end