Skip to content

Commit

Permalink
* clean up scanner comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nahi committed Oct 30, 2004
1 parent cd8c609 commit 747dceb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
18 changes: 12 additions & 6 deletions lib/pgp/packet/sigsubpacket/packet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,24 @@ def self.load(port)
packet
end

def self.scan(port, io = STDOUT)
def self.scan(port, io)
length = load_length_new(port)
type = load_type(port)
critical = (type & T_CRITICAL).nonzero?
type &= ~T_CRITICAL
critlabel = critical ? "Critical" : "Non-critical"
io.puts "#{critlabel} Sub: #{typelabel(type)}(#{type})(#{length - 1} bytes)\n"
if !TAG_SCANNER.key?(type) and critical
io.puts "#{critlabel} Sub: #{typelabel(type)}(#{type})(#{length - 1} bytes)"
if TAG_SCANNER.key?(type)
io.indent(4) do
TAG_SCANNER[type].call(io, port, length - 1)
end
elsif critical
raise "Not supported: #{type}"
end
io.indent(4) do
TAG_SCANNER[type].call(io, port, length - 1)
else
io.indent(4) do
io.puts "(unknown sub packet)"
end
port.read(length - 1)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize
def scan(io)
super
@algorithm.each do |algo|
io.puts CompressionAlgorithm.label(algo)
io.puts "#{CompressionAlgorithm.label(algo)}(#{algo})"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pgp/packet/sigsubpacket/preferredhashalgorithm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize
def scan(io)
super
@algorithm.each do |algo|
io.puts HashAlgorithm.label(algo)
io.puts "#{HashAlgorithm.label(algo)}(#{algo})"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pgp/packet/sigsubpacket/preferredskeyalgorithm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize
def scan(io)
super
@algorithm.each do |algo|
io.puts SKeyAlgorithm.label(algo)
io.puts "#{SKeyAlgorithm.label(algo)}(#{algo})"
end
end

Expand Down

0 comments on commit 747dceb

Please sign in to comment.