mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-13 16:18:29 +00:00
fixes for crystal 1.1.0
This commit is contained in:
parent
095c894548
commit
ac0c8ca208
@ -761,7 +761,7 @@ class HTTP::Client
|
|||||||
end
|
end
|
||||||
|
|
||||||
class TCPSocket
|
class TCPSocket
|
||||||
def initialize(host, port, dns_timeout = nil, connect_timeout = nil, family = Socket::Family::UNSPEC)
|
def initialize(host : String, port : Int32, dns_timeout = nil, connect_timeout = nil, family = Socket::Family::UNSPEC)
|
||||||
Addrinfo.tcp(host, port, timeout: dns_timeout, family: family) do |addrinfo|
|
Addrinfo.tcp(host, port, timeout: dns_timeout, family: family) do |addrinfo|
|
||||||
super(addrinfo.family, addrinfo.type, addrinfo.protocol)
|
super(addrinfo.family, addrinfo.type, addrinfo.protocol)
|
||||||
connect(addrinfo, timeout: connect_timeout) do |error|
|
connect(addrinfo, timeout: connect_timeout) do |error|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module JSONFilter
|
module JSONFilter
|
||||||
alias BracketIndex = Hash(Int64, Int64)
|
alias BracketIndex = Hash(Int32, Int32)
|
||||||
|
|
||||||
alias GroupedFieldsValue = String | Array(GroupedFieldsValue)
|
alias GroupedFieldsValue = String | Array(GroupedFieldsValue)
|
||||||
alias GroupedFieldsList = Array(GroupedFieldsValue)
|
alias GroupedFieldsList = Array(GroupedFieldsValue)
|
||||||
@ -61,7 +61,7 @@ module JSONFilter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.parse_nest_groups(fields_text : String) : Nil
|
def self.parse_nest_groups(fields_text : String) : Nil
|
||||||
nest_stack = [] of NamedTuple(group_name: String, closing_bracket_index: Int64)
|
nest_stack = [] of NamedTuple(group_name: String, closing_bracket_index: Int32)
|
||||||
bracket_pairs = get_bracket_pairs(fields_text, true)
|
bracket_pairs = get_bracket_pairs(fields_text, true)
|
||||||
|
|
||||||
text_index = 0
|
text_index = 0
|
||||||
@ -141,19 +141,19 @@ module JSONFilter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_bracket_pairs(text : String, recursive = true) : BracketIndex
|
def self.get_bracket_pairs(text : String, recursive = true) : BracketIndex
|
||||||
istart = [] of Int64
|
istart = [] of Int32
|
||||||
bracket_index = BracketIndex.new
|
bracket_index = BracketIndex.new
|
||||||
|
|
||||||
text.each_char_with_index do |char, index|
|
text.each_char_with_index do |char, index|
|
||||||
if char == '('
|
if char == '('
|
||||||
istart.push(index.to_i64)
|
istart.push(index.to_i32)
|
||||||
end
|
end
|
||||||
|
|
||||||
if char == ')'
|
if char == ')'
|
||||||
begin
|
begin
|
||||||
opening = istart.pop
|
opening = istart.pop
|
||||||
if recursive || (!recursive && istart.size == 0)
|
if recursive || (!recursive && istart.size == 0)
|
||||||
bracket_index[opening] = index.to_i64
|
bracket_index[opening] = index.to_i32
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
raise FieldsParser::ParseError.new "No matching opening parenthesis at: #{index}"
|
raise FieldsParser::ParseError.new "No matching opening parenthesis at: #{index}"
|
||||||
|
Loading…
Reference in New Issue
Block a user