Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/care.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def byteslice(io, at, n_bytes)
else # We only have one page
# Optimize a little. If we only have one page that we need to read from
# - which is likely going to be the case *often* we can avoid allocating
# a new string for the joined pages and juse use the only page
# a new string for the joined pages and just use the only page
# directly as the slab. Since it might contain a `nil` and we do
# not join (which casts nils to strings) we take care of that too
relevant_pages.first || ''
Expand Down
2 changes: 1 addition & 1 deletion lib/parsers/exif_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def method_missing(*a)
# The EXIF tags get appended to the file, so the ones coming _later_
# are more specific and potentially overwrite the earlier ones. Walk
# through the frames in reverse (starting with one that comes last)
# and if it contans the requisite EXIF property, return the value
# and if it contains the requisite EXIF property, return the value
# from that tag.
@multiple_exif_results.reverse_each do |exif_tag_frame|
value_of = exif_tag_frame.public_send(*a)
Expand Down
2 changes: 1 addition & 1 deletion lib/parsers/jpeg_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def scan
# ambiguously capture things like JPEGs embedded in ID3
# tags of MP3s - these _are_ JPEGs but we care much
# more about the top-level "wrapper" file, not about
# it's bits and bobs
# its bits and bobs
return unless safe_read(@buf, 2) == JPEG_SOI_MARKER_HEAD

markers_start_at = @buf.pos
Expand Down
4 changes: 2 additions & 2 deletions lib/parsers/json_parser/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class JSONParserError < StandardError
end

MAX_SAMPLE_SIZE = 1024
MAX_LITERAL_SIZE = 30 # much larger then necessary.
MAX_LITERAL_SIZE = 30 # much larger than necessary.
ESCAPE_CHAR = "\\"
WHITESPACE_CHARS = [" ", "\t", "\n", "\r"]
ENDING_VALUE_CHARS = [",", "]", "}"]
Expand Down Expand Up @@ -271,7 +271,7 @@ def start_literal(c)
end

def close_literal(c)
raise JSONParserError, "Literal to large at #{@pos}" if @current_literal_size > MAX_LITERAL_SIZE
raise JSONParserError, "Literal too large at #{@pos}" if @current_literal_size > MAX_LITERAL_SIZE

if whitespace?(c) || ENDING_VALUE_CHARS.include?(c)
end_node
Expand Down
2 changes: 1 addition & 1 deletion lib/parsers/mpeg_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.likely_match?(filename)
def self.call(io)
return unless matches_mpeg_header?(io)

# We are looping though the stream because there can be several sequence headers and some of them are not useful.
# We are looping through the stream because there can be several sequence headers and some of them are not useful.
# If we detect that the header is not useful, then we look for the next one for SEEK_FOR_SEQUENCE_HEADER_TIMES_LIMIT
# If we reach the EOF, then the mpg is likely to be corrupted and we return nil
MAX_BLOCK_READS.times do
Expand Down
4 changes: 2 additions & 2 deletions lib/parsers/webp_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def call(io)
# 0...3 | "RIFF" (Since WebP is based on the RIFF file container format).
# 4...7 | The size of the file in bytes - 8 bytes.
# 8...11 | "WEBP" (To signify that this is a WebP file).
# 12...15 | The VB8 variant in use ("VB8 ", "VP8L" or "VB8X")
# 16...19 | The length of the VB8 data in bytes (i.e. The size of the file - 20 bytes).
# 12...15 | The VP8 variant in use ("VP8 ", "VP8L" or "VP8X")
# 16...19 | The length of the VP8 data in bytes (i.e. The size of the file - 20 bytes).
riff, webp, variant = safe_read(@buf, 20).unpack('A4x4A4A4')
return unless riff == 'RIFF' && webp == 'WEBP'
read_data(variant)
Expand Down
2 changes: 1 addition & 1 deletion lib/remote_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def request_range(range, uri = @uri, headers = @headers.clone, redirects = REDIR
# We return `nil` if we tried to read past the end of the IO,
# which satisfies the Ruby IO convention. The caller should deal with `nil` being the result of a read()
# S3 will also handily _not_ supply us with the Content-Range of the actual resource, so we
# cannot hint size with this response - at lease not when working with S3
# cannot hint size with this response - at least not when working with S3
nil
when Net::HTTPServerError
Measurometer.increment_counter('format_parser.remote_io.upstream50x_errors', 1)
Expand Down