mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/lib/openssl/buffering.rb (Buffering#initialize):
should set @eof and @rbuffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6645b92826
commit
9f19f36ed5
2 changed files with 11 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Mar 7 14:13:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* ext/openssl/lib/openssl/buffering.rb (Buffering#initialize):
|
||||||
|
should set @eof and @rbuffer.
|
||||||
|
|
||||||
Mon Mar 7 10:28:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Mar 7 10:28:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* object.c (inspect_obj): unintended space removal.
|
* object.c (inspect_obj): unintended space removal.
|
||||||
|
|
|
@ -20,6 +20,8 @@ module Buffering
|
||||||
BLOCK_SIZE = 1024*16
|
BLOCK_SIZE = 1024*16
|
||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
|
@eof = false
|
||||||
|
@rbuffer = ""
|
||||||
@sync = @io.sync
|
@sync = @io.sync
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +31,6 @@ module Buffering
|
||||||
private
|
private
|
||||||
|
|
||||||
def fill_rbuff
|
def fill_rbuff
|
||||||
@rbuffer = "" unless defined? @rbuffer
|
|
||||||
begin
|
begin
|
||||||
@rbuffer << self.sysread(BLOCK_SIZE)
|
@rbuffer << self.sysread(BLOCK_SIZE)
|
||||||
rescue Errno::EAGAIN
|
rescue Errno::EAGAIN
|
||||||
|
@ -40,7 +41,7 @@ module Buffering
|
||||||
end
|
end
|
||||||
|
|
||||||
def consume_rbuff(size=nil)
|
def consume_rbuff(size=nil)
|
||||||
if @rbuffer.size == 0
|
if @rbuffer.empty?
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
size = @rbuffer.size unless size
|
size = @rbuffer.size unless size
|
||||||
|
@ -61,8 +62,6 @@ module Buffering
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
fill_rbuff unless defined? @rbuffer
|
|
||||||
@eof ||= nil
|
|
||||||
until @eof
|
until @eof
|
||||||
break if size && size <= @rbuffer.size
|
break if size && size <= @rbuffer.size
|
||||||
fill_rbuff
|
fill_rbuff
|
||||||
|
@ -84,7 +83,7 @@ module Buffering
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if !defined?(@rbuffer) || @rbuffer.size == 0
|
if @rbuffer.empty?
|
||||||
begin
|
begin
|
||||||
return sysread(maxlen, buf)
|
return sysread(maxlen, buf)
|
||||||
rescue Errno::EAGAIN
|
rescue Errno::EAGAIN
|
||||||
|
@ -101,9 +100,7 @@ module Buffering
|
||||||
end
|
end
|
||||||
|
|
||||||
def gets(eol=$/)
|
def gets(eol=$/)
|
||||||
fill_rbuff unless defined? @rbuffer
|
|
||||||
idx = @rbuffer.index(eol)
|
idx = @rbuffer.index(eol)
|
||||||
@eof ||= nil
|
|
||||||
until @eof
|
until @eof
|
||||||
break if idx
|
break if idx
|
||||||
fill_rbuff
|
fill_rbuff
|
||||||
|
@ -158,9 +155,8 @@ module Buffering
|
||||||
end
|
end
|
||||||
|
|
||||||
def eof?
|
def eof?
|
||||||
@eof ||= nil
|
fill_rbuff if !@eof && @rbuffer.empty?
|
||||||
fill_rbuff if !@eof && (!defined?(@rbuffer) || @rbuffer.size == 0)
|
@eof && @rbuffer.empty?
|
||||||
@eof && @rbuffer.size == 0
|
|
||||||
end
|
end
|
||||||
alias eof eof?
|
alias eof eof?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue