1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
|
# File 'lib/resolv.rb', line 1613
def get_unpack(template)
len = 0
template.each_byte {|byte|
byte = "%c" % byte
case byte
when ?c, ?C
len += 1
when ?n
len += 2
when ?N
len += 4
else
raise StandardError.new("unsupported template: '#{byte.chr}' in '#{template}'")
end
}
raise DecodeError.new("limit exceeded") if @limit < @index + len
arr = @data.unpack("@#{@index}#{template}")
@index += len
return arr
end
|