zlib 0.1.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c89a988315358942a700fcaad47423267840ffe6
4
- data.tar.gz: '0967f4982f0a1c36f43815420f05e6ef674c1252'
2
+ SHA256:
3
+ metadata.gz: d8f0f4c2a4ba8053045fbe977bc5cf5ab6a8d1142d2d6ad7bc80cdbaa8e86da5
4
+ data.tar.gz: 67b0d3fb3d2bcd309e6e55298aff6df2a136135a56822b6c057d8236aaa2766c
5
5
  SHA512:
6
- metadata.gz: 6e1a0fee0c0f38e9fccf904f70b3f3d71753ce537bf7bee59aa390d57e548588ecc2d5253b13904e7c61c4983475e8603759e51f6bd0bed1795c7f852f9dc2aa
7
- data.tar.gz: 92b5a9d994aa80fa3b7fc15064b3753e604ba024f37ed6258772c7e38ea84aeadb49fd2ea9054707cff0c564d873aa3cf836f46c174ce2e4adaee1e7539fd395
6
+ metadata.gz: 50bf8adea4a39c751f12c6a13c967d3792cf27f5636eb4b1228501a427d9b1b377fd4757c54a4806979631501ee4833dacc9f31a0a41d1aa448138d244911b6d
7
+ data.tar.gz: e8e442a205ba16f584a6ac43cf8fa0f5abddfa59e8f6eca007fc5691ec7b82801198461391e3e79866a8d4d38a57f1031ec918a61ccb81aabb94aa35bf544675
data/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # Zlib
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zlib`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This module provides access to the [zlib library](http://zlib.net). Zlib is designed to be a portable, free, general-purpose, legally unencumbered -- that is, not covered by any patents -- lossless data-compression library for use on virtually any computer hardware and operating system.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ The zlib compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data.
6
+
7
+ The zlib compressed data format is described in RFC 1950, which is a wrapper around a deflate stream which is described in RFC 1951.
8
+
9
+ The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of IO. The gzip format is described in RFC 1952 which is also a wrapper around a deflate stream.
10
+
11
+ The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single-file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib.
12
+
13
+ See your system's zlib.h for further information about zlib
6
14
 
7
15
  ## Installation
8
16
 
@@ -22,7 +30,26 @@ Or install it yourself as:
22
30
 
23
31
  ## Usage
24
32
 
25
- TODO: Write usage instructions here
33
+ Using the wrapper to compress strings with default parameters is quite simple:
34
+
35
+ ```ruby
36
+ require "zlib"
37
+
38
+ data_to_compress = File.read("don_quixote.txt")
39
+
40
+ puts "Input size: #{data_to_compress.size}"
41
+ #=> Input size: 2347740
42
+
43
+ data_compressed = Zlib::Deflate.deflate(data_to_compress)
44
+
45
+ puts "Compressed size: #{data_compressed.size}"
46
+ #=> Compressed size: 887238
47
+
48
+ uncompressed_data = Zlib::Inflate.inflate(data_compressed)
49
+
50
+ puts "Uncompressed data is: #{uncompressed_data}"
51
+ #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
52
+ ```
26
53
 
27
54
  ## Development
28
55
 
data/ext/zlib/extconf.rb CHANGED
@@ -10,11 +10,12 @@ require 'rbconfig'
10
10
 
11
11
  dir_config 'zlib'
12
12
 
13
-
13
+ libs = $libs
14
14
  if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and
15
15
  have_header('zlib.h') then
16
16
  have_zlib = true
17
17
  else
18
+ $libs = libs
18
19
  unless File.directory?(zsrc = "#{$srcdir}/zlib")
19
20
  dirs = Dir.open($srcdir) {|z| z.grep(/\Azlib-\d+[.\d]*\z/) {|x|"#{$srcdir}/#{x}"}}
20
21
  dirs.delete_if {|x| !File.directory?(x)}
@@ -31,9 +32,12 @@ else
31
32
  $extso << dll
32
33
  $cleanfiles << "$(topdir)/#{dll}" << "$(ZIMPLIB)"
33
34
  zmk = "\t$(MAKE) -f $(ZMKFILE) TOP=$(ZSRC)"
35
+ zopts = []
34
36
  if $nmake
35
37
  zmkfile = "$(ZSRC)/win32/Makefile.msc"
36
38
  m = "#{zsrc}/win32/Makefile.msc"
39
+ # zopts << "USE_ASM=1"
40
+ zopts << "ARCH=#{RbConfig::CONFIG['target_cpu']}"
37
41
  else
38
42
  zmkfile = "$(ZSRC)/win32/Makefile.gcc"
39
43
  m = "#{zsrc}/win32/Makefile.gcc"
@@ -43,7 +47,7 @@ else
43
47
  end
44
48
  m = File.read(m)
45
49
  zimplib = m[/^IMPLIB[ \t]*=[ \t]*(\S+)/, 1]
46
- $LOCAL_LIBS << " " << zimplib
50
+ ($LOCAL_LIBS << " ./" << zimplib).strip!
47
51
  unless $nmake or /^TOP[ \t]/ =~ m
48
52
  m.gsub!(/win32\/zlib\.def/, '$(TOP)/\&')
49
53
  m.gsub!(/^(\t.*[ \t])(\S+\.rc)/, '\1-I$(<D) $<')
@@ -55,10 +59,11 @@ else
55
59
  addconf.push(
56
60
  "ZMKFILE = #{zmkfile}\n",
57
61
  "ZIMPLIB = #{zimplib}\n",
62
+ "ZOPTS = #{zopts.join(' ')}\n",
58
63
  "$(TARGET_SO): $(ZIMPLIB)\n",
59
64
  "$(ZIMPLIB):\n",
60
- "#{zmk} $@\n",
61
- "install-so: $(topdir)/#{dll}",
65
+ "#{zmk} $(ZOPTS) $@\n",
66
+ "install-so static: $(topdir)/#{dll}",
62
67
  "$(topdir)/#{dll}: $(ZIMPLIB)\n",
63
68
  "\t$(Q) $(COPY) #{dll} $(@D)\n",
64
69
  "clean: clean-zsrc\n",