From ac0c8ca208434b0b8ca62da30d5160b31e5beab4 Mon Sep 17 00:00:00 2001 From: tleydxdy <10610765+tleydxdy@users.noreply.github.com> Date: Mon, 19 Jul 2021 23:37:21 +0000 Subject: [PATCH] fixes for crystal 1.1.0 --- src/invidious/helpers/helpers.cr | 2 +- src/invidious/helpers/json_filter.cr | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index d332ad37..0326f9ba 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -761,7 +761,7 @@ class HTTP::Client end 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| super(addrinfo.family, addrinfo.type, addrinfo.protocol) connect(addrinfo, timeout: connect_timeout) do |error| diff --git a/src/invidious/helpers/json_filter.cr b/src/invidious/helpers/json_filter.cr index e4b57cea..0bce8a1a 100644 --- a/src/invidious/helpers/json_filter.cr +++ b/src/invidious/helpers/json_filter.cr @@ -1,5 +1,5 @@ module JSONFilter - alias BracketIndex = Hash(Int64, Int64) + alias BracketIndex = Hash(Int32, Int32) alias GroupedFieldsValue = String | Array(GroupedFieldsValue) alias GroupedFieldsList = Array(GroupedFieldsValue) @@ -61,7 +61,7 @@ module JSONFilter end 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) text_index = 0 @@ -141,19 +141,19 @@ module JSONFilter end def self.get_bracket_pairs(text : String, recursive = true) : BracketIndex - istart = [] of Int64 + istart = [] of Int32 bracket_index = BracketIndex.new text.each_char_with_index do |char, index| if char == '(' - istart.push(index.to_i64) + istart.push(index.to_i32) end if char == ')' begin opening = istart.pop if recursive || (!recursive && istart.size == 0) - bracket_index[opening] = index.to_i64 + bracket_index[opening] = index.to_i32 end rescue raise FieldsParser::ParseError.new "No matching opening parenthesis at: #{index}"