[ruby/openssl] Refactor buffer usage to only use append_as_bytes
https://github.com/ruby/openssl/commit/28f2901c48
This commit is contained in:
parent
2f5d31d38a
commit
4f79485889
@ -37,8 +37,8 @@ module OpenSSL::Buffering
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :concat, :append_as_bytes
|
undef_method :concat
|
||||||
alias_method :<<, :append_as_bytes
|
undef_method :<<
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -73,7 +73,7 @@ module OpenSSL::Buffering
|
|||||||
|
|
||||||
def fill_rbuff
|
def fill_rbuff
|
||||||
begin
|
begin
|
||||||
@rbuffer << self.sysread(BLOCK_SIZE)
|
@rbuffer.append_as_bytes(self.sysread(BLOCK_SIZE))
|
||||||
rescue Errno::EAGAIN
|
rescue Errno::EAGAIN
|
||||||
retry
|
retry
|
||||||
rescue EOFError
|
rescue EOFError
|
||||||
@ -450,10 +450,10 @@ module OpenSSL::Buffering
|
|||||||
def puts(*args)
|
def puts(*args)
|
||||||
s = Buffer.new
|
s = Buffer.new
|
||||||
if args.empty?
|
if args.empty?
|
||||||
s << "\n"
|
s.append_as_bytes("\n")
|
||||||
end
|
end
|
||||||
args.each{|arg|
|
args.each{|arg|
|
||||||
s << arg.to_s
|
s.append_as_bytes(arg.to_s)
|
||||||
s.sub!(/(?<!\n)\z/, "\n")
|
s.sub!(/(?<!\n)\z/, "\n")
|
||||||
}
|
}
|
||||||
do_write(s)
|
do_write(s)
|
||||||
@ -467,7 +467,7 @@ module OpenSSL::Buffering
|
|||||||
|
|
||||||
def print(*args)
|
def print(*args)
|
||||||
s = Buffer.new
|
s = Buffer.new
|
||||||
args.each{ |arg| s << arg.to_s }
|
args.each{ |arg| s.append_as_bytes(arg.to_s) }
|
||||||
do_write(s)
|
do_write(s)
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,7 @@ class OpenSSL::TestBuffering < OpenSSL::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def syswrite(str)
|
def syswrite(str)
|
||||||
@io << str
|
@io.append_as_bytes(str)
|
||||||
str.size
|
str.size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user