From 08751cd871c3d670f48ddcb0d1d10c905c7c12c7 Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Mon, 22 Jun 2020 13:15:00 +0800 Subject: [PATCH] Updated for Crystal 0.35.1 --- shard.yml | 4 ++-- src/brotli.cr | 2 +- src/brotli/writer.cr | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/shard.yml b/shard.yml index c92933f..8748499 100644 --- a/shard.yml +++ b/shard.yml @@ -1,11 +1,11 @@ name: brotli -version: 0.1.2 +version: 0.1.3 authors: - Ali Naqvi description: | Crystal bindings to the Brotli compression library. -crystal: 0.35.0 +crystal: 0.35.1 license: MIT diff --git a/src/brotli.cr b/src/brotli.cr index 1751965..c44ab49 100644 --- a/src/brotli.cr +++ b/src/brotli.cr @@ -1,6 +1,6 @@ # `Brotli` Crystal Wrapper module Compress::Brotli - VERSION = "0.1.2" + VERSION = "0.1.3" class BrotliError < Exception end diff --git a/src/brotli/writer.cr b/src/brotli/writer.cr index afe9bd5..dc1fff0 100644 --- a/src/brotli/writer.cr +++ b/src/brotli/writer.cr @@ -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? @@ -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 @@ -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