pr-zlib 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +7 -0
- data/MANIFEST +1 -1
- data/Rakefile +1 -1
- data/bin/{minizip.rb → minirbgzip} +75 -65
- data/lib/pr/zlib.rb +1 -1
- data/pr-zlib.gemspec +3 -2
- data/test/test_zlib.rb +1 -1
- metadata +6 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 884faa312813258452c180d7b246e02d3d373b79d5990c7aed19d66c4280db5d
|
4
|
+
data.tar.gz: dfffc0fd870fc104809938535c89c6a65be8612c607c930c261386b972f741bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c947923f7ca9f1f73a677774d4820ecbce39e6c059ecd1987c15ee47a5c7fad58e797ec0628e984a27157cc771c5cc6780af0f1ce4c25a988a8666c216f2c4d
|
7
|
+
data.tar.gz: 66bde3b05ad77c5ad8dc45ea4c38b414ce315735c3453cf08dcdd35409e2d8f3965cc576db31a2233668182ade1118e5bffcb22e11b0a71e7db3e34b5c4a269b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
= 1.0.6 - 19-Mar-2018
|
2
|
+
* Added the minirbgzip executable, a Ruby implementation of minigzip.
|
3
|
+
Formerly minigzip.rb, this had been part of the repo but had never been
|
4
|
+
released with the gem.
|
5
|
+
* Some minor updates and fixes to the minirbgzip executable.
|
6
|
+
* Metadata fix for changelog_uri.
|
7
|
+
|
1
8
|
= 1.0.5 - 18-Mar-2018
|
2
9
|
* Set the frozen_string_literal pragma, which gives us a small performance
|
3
10
|
boost for reads.
|
data/MANIFEST
CHANGED
data/Rakefile
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
# minigzip
|
1
|
+
# minigzip -- simulate gzip using the zlib compression library
|
2
2
|
# Copyright (C) 1995-2005 Jean-loup Gailly.
|
3
3
|
# For conditions of distribution and use, see copyright notice in rbzlib.rb
|
4
4
|
#
|
5
|
-
#
|
6
|
-
#
|
7
5
|
# minigzip is a minimal implementation of the gzip utility. This is
|
8
6
|
# only an example of using zlib and isn't meant to replace the
|
9
7
|
# full-featured gzip. No attempt is made to deal with file systems
|
@@ -11,10 +9,10 @@
|
|
11
9
|
# very limited. So use minigzip only for testing; use gzip for the
|
12
10
|
# real thing. On MSDOS, use only on file names without extension
|
13
11
|
# or in pipe mode.
|
14
|
-
#
|
15
|
-
# Ruby
|
12
|
+
#
|
13
|
+
# minigzip to minirbgzip Ruby translation By Park Heesob.
|
16
14
|
|
17
|
-
require '
|
15
|
+
require 'pr-zlib'
|
18
16
|
include Rbzlib
|
19
17
|
|
20
18
|
GZ_SUFFIX = ".gz"
|
@@ -23,69 +21,70 @@ SUFFIX_LEN = GZ_SUFFIX.length
|
|
23
21
|
BUFLEN = 16384
|
24
22
|
MAX_NAME_LEN = 1024
|
25
23
|
|
26
|
-
|
27
24
|
def error(msg)
|
28
|
-
|
29
|
-
|
25
|
+
puts("#{__FILE__}: #{msg}")
|
26
|
+
exit(1)
|
30
27
|
end
|
31
28
|
|
32
29
|
def gz_compress(_in, out)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
break if buf.nil?
|
40
|
-
err = 0
|
41
|
-
len = buf.length
|
42
|
-
if (gzwrite(out, buf, len) != len)
|
43
|
-
error(gzerror(out, err))
|
44
|
-
end
|
30
|
+
while true
|
31
|
+
begin
|
32
|
+
buf = _in.read(BUFLEN)
|
33
|
+
rescue
|
34
|
+
raise RuntimeError,"read"
|
45
35
|
end
|
46
|
-
_in.close
|
47
|
-
error("failed gzclose") if (gzclose(out) != Z_OK)
|
48
|
-
end
|
49
36
|
|
37
|
+
break if buf.nil?
|
38
|
+
|
39
|
+
err = 0
|
40
|
+
len = buf.length
|
41
|
+
|
42
|
+
if (gzwrite(out, buf, len) != len)
|
43
|
+
error(gzerror(out, err))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
_in.close
|
47
|
+
error("failed gzclose") if (gzclose(out) != Z_OK)
|
48
|
+
end
|
50
49
|
|
51
50
|
def gz_uncompress(_in, out)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
buf = 0.chr * BUFLEN
|
52
|
+
while true
|
53
|
+
len = gzread(_in, buf, buf.length)
|
54
|
+
err = 0
|
55
|
+
error(gzerror(_in, err)) if (len < 0)
|
56
|
+
break if len.zero?
|
58
57
|
if(out.write(buf[0,len]) != len)
|
59
|
-
|
60
|
-
end
|
58
|
+
error("failed write")
|
61
59
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
end
|
61
|
+
begin
|
62
|
+
out.close
|
63
|
+
rescue
|
64
|
+
error("failed fclose")
|
65
|
+
end
|
66
|
+
|
67
|
+
error("failed gzclose") if (gzclose(_in) != Z_OK)
|
69
68
|
end
|
70
69
|
|
71
|
-
|
72
70
|
def file_compress(file, mode)
|
73
|
-
|
71
|
+
outfile = file + GZ_SUFFIX
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
if out.nil?
|
81
|
-
puts("#{__FILE__}: can't gzopen #{outfile}")
|
82
|
-
exit(1)
|
83
|
-
end
|
84
|
-
gz_compress(_in, out)
|
73
|
+
_in = File.open(file, "rb")
|
74
|
+
if _in.nil?
|
75
|
+
raise RuntimeError,file
|
76
|
+
end
|
77
|
+
out = gzopen(outfile, mode)
|
85
78
|
|
86
|
-
|
87
|
-
|
79
|
+
if out.nil?
|
80
|
+
puts("#{__FILE__}: can't gzopen #{outfile}")
|
81
|
+
exit(1)
|
82
|
+
end
|
88
83
|
|
84
|
+
gz_compress(_in, out)
|
85
|
+
|
86
|
+
File.unlink(file)
|
87
|
+
end
|
89
88
|
|
90
89
|
def file_uncompress(file)
|
91
90
|
len = file.length
|
@@ -94,17 +93,17 @@ def file_uncompress(file)
|
|
94
93
|
if (file[-SUFFIX_LEN..-1] == GZ_SUFFIX)
|
95
94
|
infile = file.dup
|
96
95
|
outfile = buf[0..(-SUFFIX_LEN-1)]
|
97
|
-
else
|
96
|
+
else
|
98
97
|
outfile = file.dup
|
99
98
|
infile = buf + GZ_SUFFIX
|
100
99
|
end
|
101
100
|
_in = gzopen(infile, "rb")
|
102
|
-
if _in.nil?
|
101
|
+
if _in.nil?
|
103
102
|
puts("#{__FILE__}: can't gzopen #{infile}")
|
104
103
|
exit(1)
|
105
104
|
end
|
106
105
|
out = File.open(outfile, "wb")
|
107
|
-
if out.nil?
|
106
|
+
if out.nil?
|
108
107
|
raise RuntimeError,file
|
109
108
|
exit(1)
|
110
109
|
end
|
@@ -141,6 +140,17 @@ end
|
|
141
140
|
outmode[3] = 'R'
|
142
141
|
when "-1".."-9"
|
143
142
|
outmode[2] = argv[1]
|
143
|
+
when "--help"
|
144
|
+
help = <<-HERE
|
145
|
+
Usage: minigzip [-d] [-f] [-h] [-r] [-1 to -9] [files...]
|
146
|
+
-d : decompress
|
147
|
+
-f : compress with Z_FILTERED
|
148
|
+
-h : compress with Z_HUFFMAN_ONLY
|
149
|
+
-r : compress with Z_RLE
|
150
|
+
-1 to -9 : compression level
|
151
|
+
HERE
|
152
|
+
puts help
|
153
|
+
exit!
|
144
154
|
else
|
145
155
|
ARGV.unshift(argv)
|
146
156
|
break
|
@@ -149,23 +159,23 @@ end
|
|
149
159
|
if (outmode[3].chr == ' ')
|
150
160
|
outmode = outmode[0,3]
|
151
161
|
end
|
152
|
-
if (ARGV.empty?)
|
162
|
+
if (ARGV.empty?)
|
153
163
|
$stdin.binmode
|
154
164
|
$stdout.binmode
|
155
|
-
if (uncompr)
|
165
|
+
if (uncompr)
|
156
166
|
file = gzdopen($stdin.fileno, "rb")
|
157
|
-
error("can't gzdopen stdin") if file.nil?
|
167
|
+
error("can't gzdopen stdin") if file.nil?
|
158
168
|
gz_uncompress(file, $stdout)
|
159
|
-
else
|
169
|
+
else
|
160
170
|
file = gzdopen($stdout.fileno, outmode)
|
161
|
-
error("can't gzdopen stdout") if file.nil?
|
171
|
+
error("can't gzdopen stdout") if file.nil?
|
162
172
|
gz_compress($stdin, file)
|
163
173
|
end
|
164
|
-
else
|
165
|
-
while !ARGV.empty?
|
166
|
-
if (uncompr)
|
174
|
+
else
|
175
|
+
while !ARGV.empty?
|
176
|
+
if (uncompr)
|
167
177
|
file_uncompress(ARGV.shift)
|
168
|
-
else
|
178
|
+
else
|
169
179
|
file_compress(ARGV.shift, outmode)
|
170
180
|
end
|
171
181
|
end
|
data/lib/pr/zlib.rb
CHANGED
data/pr-zlib.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'pr-zlib'
|
5
|
-
spec.version = '1.0.
|
5
|
+
spec.version = '1.0.6'
|
6
6
|
spec.authors = ['Park Heesob', 'Daniel Berger']
|
7
7
|
spec.email = ['phasis@gmail.com', 'djberg96@gmail.com'],
|
8
8
|
spec.homepage = 'https://github.com/djberg96/pr-zlib'
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.files = Dir["**/*"].reject{ |f| f.include?('git') }
|
13
13
|
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
14
14
|
spec.cert_chain = Dir['certs/*']
|
15
|
+
spec.executables = 'minirbgzip'
|
15
16
|
|
16
17
|
spec.add_development_dependency('test-unit', '>= 2.4.0')
|
17
18
|
spec.add_development_dependency('ruby-prof')
|
@@ -21,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
21
22
|
spec.metadata = {
|
22
23
|
'homepage_uri' => 'https://github.com/djberg96/pr-zlib',
|
23
24
|
'bug_tracker_uri' => 'https://github.com/djberg96/pr-zlib/issues',
|
24
|
-
'changelog_uri' => 'https://github.com/djberg96/pr-zlib/CHANGES',
|
25
|
+
'changelog_uri' => 'https://github.com/djberg96/pr-zlib/blob/master/CHANGES',
|
25
26
|
'documentation_uri' => 'https://github.com/djberg96/pr-zlib/wiki',
|
26
27
|
'source_code_uri' => 'https://github.com/djberg96/pr-zlib',
|
27
28
|
'wiki_uri' => 'https://github.com/djberg96/pr-zlib/wiki'
|
data/test/test_zlib.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pr-zlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Park Heesob
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
37
37
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2018-03-
|
39
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: test-unit
|
@@ -74,7 +74,8 @@ email:
|
|
74
74
|
- - phasis@gmail.com
|
75
75
|
- djberg96@gmail.com
|
76
76
|
- https://github.com/djberg96/pr-zlib
|
77
|
-
executables:
|
77
|
+
executables:
|
78
|
+
- minirbgzip
|
78
79
|
extensions: []
|
79
80
|
extra_rdoc_files:
|
80
81
|
- README
|
@@ -82,7 +83,7 @@ extra_rdoc_files:
|
|
82
83
|
- MANIFEST
|
83
84
|
files:
|
84
85
|
- bin
|
85
|
-
- bin/
|
86
|
+
- bin/minirbgzip
|
86
87
|
- certs
|
87
88
|
- certs/djberg96_pub.pem
|
88
89
|
- CHANGES
|
@@ -119,7 +120,7 @@ licenses:
|
|
119
120
|
metadata:
|
120
121
|
homepage_uri: https://github.com/djberg96/pr-zlib
|
121
122
|
bug_tracker_uri: https://github.com/djberg96/pr-zlib/issues
|
122
|
-
changelog_uri: https://github.com/djberg96/pr-zlib/CHANGES
|
123
|
+
changelog_uri: https://github.com/djberg96/pr-zlib/blob/master/CHANGES
|
123
124
|
documentation_uri: https://github.com/djberg96/pr-zlib/wiki
|
124
125
|
source_code_uri: https://github.com/djberg96/pr-zlib
|
125
126
|
wiki_uri: https://github.com/djberg96/pr-zlib/wiki
|
metadata.gz.sig
CHANGED
Binary file
|