Skip to content

Instantly share code, notes, and snippets.

@takahashim
Created October 5, 2010 17:30
Show Gist options
  • Save takahashim/611956 to your computer and use it in GitHub Desktop.
Save takahashim/611956 to your computer and use it in GitHub Desktop.
diff -ur rubyzip-0.9.4.old/lib/zip/stdrubyext.rb rubyzip-0.9.4/lib/zip/stdrubyext.rb
--- rubyzip-0.9.4.old/lib/zip/stdrubyext.rb 2010-09-19 02:24:37.000000000 +0900
+++ rubyzip-0.9.4/lib/zip/stdrubyext.rb 2010-10-06 02:25:00.000000000 +0900
@@ -48,6 +48,10 @@
def lchop
slice(1, length)
end
+
+ if "".respond_to?(:bytesize)
+ alias :bytesize :size
+ end
end
class Time #:nodoc:all
diff -ur rubyzip-0.9.4.old/lib/zip/zip.rb rubyzip-0.9.4/lib/zip/zip.rb
--- rubyzip-0.9.4.old/lib/zip/zip.rb 2010-09-19 02:24:37.000000000 +0900
+++ rubyzip-0.9.4/lib/zip/zip.rb 2010-10-06 01:20:57.000000000 +0900
@@ -1080,7 +1080,7 @@
def << (data)
val = data.to_s
@crc = Zlib::crc32(val, @crc)
- @size += val.size
+ @size += val.bytesize
@outputStream << val
end
@@ -1109,7 +1109,7 @@
def << (data)
val = data.to_s
@crc = Zlib::crc32(val, @crc)
- @size += val.size
+ @size += val.bytesize
@outputStream << @zlibDeflater.deflate(data)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment