Skip to content

Commit

Permalink
Updated for Crystal 0.35.1
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis committed Jun 22, 2020
1 parent 1c374c0 commit 08751cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: brotli
version: 0.1.2
version: 0.1.3

authors:
- Ali Naqvi <[email protected]>
description: |
Crystal bindings to the Brotli compression library.
crystal: 0.35.0
crystal: 0.35.1

license: MIT
2 changes: 1 addition & 1 deletion src/brotli.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `Brotli` Crystal Wrapper
module Compress::Brotli
VERSION = "0.1.2"
VERSION = "0.1.3"

class BrotliError < Exception
end
Expand Down
6 changes: 2 additions & 4 deletions src/brotli/writer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Compress::Brotli::Writer < IO
end

# See `IO#write`.
def write(slice : Bytes) : Int64
def write(slice : Bytes) : Nil
check_open

return 0i64 if slice.empty?
Expand Down Expand Up @@ -108,7 +108,6 @@ class Compress::Brotli::Writer < IO

private def write_chunk(chunk : Slice, op : LibBrotli::EncoderOperation)
raise BrotliError.new("Writer closed") if @closed || @state.nil?
written = 0i64
loop do
size = chunk.size
avail_in = size.to_u64
Expand All @@ -123,11 +122,10 @@ class Compress::Brotli::Writer < IO

chunk = chunk[bytes_consumed..]
if output_data_size != 0
written += @output.write output.to_slice(output_data_size)
@output.write output.to_slice(output_data_size)
end
break if chunk.size == 0 && !has_more
end
written
end
end

Expand Down

0 comments on commit 08751cd

Please sign in to comment.