aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-12 12:50:14 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-12 12:50:14 -0400
commit5376109eb902c8c0eac8fde89358bce1b792e4b4 (patch)
treed4ee4b4d317d97f0790bd2009c735406f3964d1e
parent45638b4ba40f2f0d47b5cfdabec6664b262a52bd (diff)
downloadzip-crystal-5376109eb902c8c0eac8fde89358bce1b792e4b4.tar.bz2
zip-crystal-5376109eb902c8c0eac8fde89358bce1b792e4b4.zip
minor cleanups
-rw-r--r--src/zip.cr6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/zip.cr b/src/zip.cr
index db5088f..ea0142f 100644
--- a/src/zip.cr
+++ b/src/zip.cr
@@ -1637,11 +1637,11 @@ module Zip
# Return number of bytes needed for this Extra.
#
def bytes_needed : UInt16
- 4.to_u16 + @data.size.to_u16
+ (4 + @data.size).to_u16
end
def to_s(io) : UInt16
- @code.to_u64.to_io(io, LE)
+ @code.to_u16.to_io(io, LE)
@data.size.to_u16.to_io(io, LE)
@data.to_s(io)
@@ -1770,7 +1770,7 @@ module Zip
def self.pack(extras : Array(Extra::Base)?) : Bytes
if extras && extras.size > 0
# create backing buffer for extras
- buf = Bytes.new(extras.reduce(0_u32) { |r, e| r + e.bytes_needed })
+ buf = Bytes.new(extras.reduce(0) { |r, e| r + e.bytes_needed })
# create io and write each extra data to io
io = MemoryIO.new(buf)