Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* clean up scanner comments

  • Loading branch information...
commit 747dceb06d1355451aea96ebaf5cc07321928fb6 1 parent cd8c609
Hiroshi Nakamura authored
18 lib/pgp/packet/sigsubpacket/packet.rb
@@ -102,18 +102,24 @@ def self.load(port)
102 102 packet
103 103 end
104 104
105   - def self.scan(port, io = STDOUT)
  105 + def self.scan(port, io)
106 106 length = load_length_new(port)
107 107 type = load_type(port)
108 108 critical = (type & T_CRITICAL).nonzero?
109 109 type &= ~T_CRITICAL
110 110 critlabel = critical ? "Critical" : "Non-critical"
111   - io.puts "#{critlabel} Sub: #{typelabel(type)}(#{type})(#{length - 1} bytes)\n"
112   - if !TAG_SCANNER.key?(type) and critical
  111 + io.puts "#{critlabel} Sub: #{typelabel(type)}(#{type})(#{length - 1} bytes)"
  112 + if TAG_SCANNER.key?(type)
  113 + io.indent(4) do
  114 + TAG_SCANNER[type].call(io, port, length - 1)
  115 + end
  116 + elsif critical
113 117 raise "Not supported: #{type}"
114   - end
115   - io.indent(4) do
116   - TAG_SCANNER[type].call(io, port, length - 1)
  118 + else
  119 + io.indent(4) do
  120 + io.puts "(unknown sub packet)"
  121 + end
  122 + port.read(length - 1)
117 123 end
118 124 end
119 125
2  lib/pgp/packet/sigsubpacket/preferredcompressionalgorithm.rb
@@ -18,7 +18,7 @@ def initialize
18 18 def scan(io)
19 19 super
20 20 @algorithm.each do |algo|
21   - io.puts CompressionAlgorithm.label(algo)
  21 + io.puts "#{CompressionAlgorithm.label(algo)}(#{algo})"
22 22 end
23 23 end
24 24
2  lib/pgp/packet/sigsubpacket/preferredhashalgorithm.rb
@@ -18,7 +18,7 @@ def initialize
18 18 def scan(io)
19 19 super
20 20 @algorithm.each do |algo|
21   - io.puts HashAlgorithm.label(algo)
  21 + io.puts "#{HashAlgorithm.label(algo)}(#{algo})"
22 22 end
23 23 end
24 24
2  lib/pgp/packet/sigsubpacket/preferredskeyalgorithm.rb
@@ -18,7 +18,7 @@ def initialize
18 18 def scan(io)
19 19 super
20 20 @algorithm.each do |algo|
21   - io.puts SKeyAlgorithm.label(algo)
  21 + io.puts "#{SKeyAlgorithm.label(algo)}(#{algo})"
22 22 end
23 23 end
24 24

0 comments on commit 747dceb

Please sign in to comment.
Something went wrong with that request. Please try again.