Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit acf9f4d

Browse filesBrowse files
committed
Remove DecryptedIo#buffer and use @buffer directly.
No need for an accessor method for this; it just obfuscates things.
1 parent 0f180d7 commit acf9f4d
Copy full SHA for acf9f4d

File tree

Expand file treeCollapse file tree

1 file changed

+5
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-8
lines changed
Open diff view settings
Collapse file

‎lib/zip/crypto/decrypted_io.rb‎

Copy file name to clipboardExpand all lines: lib/zip/crypto/decrypted_io.rb
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,27 @@ def initialize(io, decrypter, compressed_size)
88
@io = io
99
@decrypter = decrypter
1010
@bytes_remaining = compressed_size
11+
@buffer = +''
1112
end
1213

1314
def read(length = nil, outbuf = +'')
1415
return (length.nil? || length.zero? ? '' : nil) if eof?
1516

16-
while length.nil? || (buffer.bytesize < length)
17+
while length.nil? || (@buffer.bytesize < length)
1718
break if input_finished?
1819

19-
buffer << produce_input
20+
@buffer << produce_input
2021
end
2122

2223
@decrypter.check_integrity!(@io) if input_finished?
2324

24-
outbuf.replace(buffer.slice!(0...(length || buffer.bytesize)))
25+
outbuf.replace(@buffer.slice!(0...(length || @buffer.bytesize)))
2526
end
2627

2728
private
2829

2930
def eof?
30-
buffer.empty? && input_finished?
31-
end
32-
33-
def buffer
34-
@buffer ||= +''
31+
@buffer.empty? && input_finished?
3532
end
3633

3734
def input_finished?

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.