bindata 2.4.4 → 2.4.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bindata might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/ChangeLog.rdoc +6 -0
- data/bindata.gemspec +1 -3
- data/examples/tcp_ip.rb +2 -2
- data/lib/bindata/base.rb +1 -2
- data/lib/bindata/version.rb +1 -1
- data/test/buffer_test.rb +19 -0
- data/test/offset_test.rb +9 -3
- data/test/registry_test.rb +9 -3
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a4db841bf592779a772cd1965118786c6004bb5460a51d5f4154207970f2016
|
4
|
+
data.tar.gz: dfebc39f1f2a3089d491050da6a58997401ac194f1cc3ef5602ff82a6a6554bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c0ef8d9c2bbbc39eee0c63c591097431b8cd428f5f3cfa03fedc15158f22fc05b6efab56bbad5990f967f45400af07a9c205da1c5953873dff9dcdc6ac24237
|
7
|
+
data.tar.gz: 03bcde0becfa611a100cb43c5d7982bfd3d156a264e817b9c01b1f4522fff7379a4279f25fa9f92d64535d411c597894adb7ba4004cc923c721721899cc9b99a
|
data/.travis.yml
CHANGED
data/ChangeLog.rdoc
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
= BinData Changelog
|
2
2
|
|
3
|
+
== Version 2.4.5 (2020-02-21)
|
4
|
+
|
5
|
+
* Small typo fixes to examples.
|
6
|
+
* Fix encoding issue for ruby 2.7. Thanks to Aaron Patterson.
|
7
|
+
* Quieter test output.
|
8
|
+
|
3
9
|
== Version 2.4.4 (2018-10-03)
|
4
10
|
|
5
11
|
* Display a hint when endian is omitted. Requested by Tails.
|
data/bindata.gemspec
CHANGED
@@ -9,16 +9,14 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.author = 'Dion Mendel'
|
10
10
|
s.email = 'bindata@dm9.info'
|
11
11
|
s.homepage = 'http://github.com/dmendel/bindata'
|
12
|
-
s.rubyforge_project = 'bindata'
|
13
12
|
s.require_path = 'lib'
|
14
|
-
s.has_rdoc = true
|
15
13
|
s.extra_rdoc_files = ['NEWS.rdoc']
|
16
14
|
s.rdoc_options << '--main' << 'NEWS.rdoc'
|
17
15
|
s.files = `git ls-files`.split("\n")
|
18
16
|
s.license = 'Ruby'
|
19
17
|
|
20
18
|
s.add_development_dependency('rake')
|
21
|
-
s.add_development_dependency('minitest', "> 5.0.0")
|
19
|
+
s.add_development_dependency('minitest', "> 5.0.0", "< 5.12.0")
|
22
20
|
s.add_development_dependency('coveralls')
|
23
21
|
s.description = <<-END.gsub(/^ +/, "")
|
24
22
|
BinData is a declarative way to read and write binary file formats.
|
data/examples/tcp_ip.rb
CHANGED
@@ -14,7 +14,7 @@ class MacAddr < BinData::Primitive
|
|
14
14
|
array :octets, type: :uint8, initial_length: 6
|
15
15
|
|
16
16
|
def set(val)
|
17
|
-
self.octets = val.split(
|
17
|
+
self.octets = val.split(/:/).collect(&:to_i)
|
18
18
|
end
|
19
19
|
|
20
20
|
def get
|
@@ -23,7 +23,7 @@ class MacAddr < BinData::Primitive
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# Present IP addresses in a human readable way
|
26
|
-
class
|
26
|
+
class IP_Addr < BinData::Primitive
|
27
27
|
array :octets, type: :uint8, initial_length: 4
|
28
28
|
|
29
29
|
def set(val)
|
data/lib/bindata/base.rb
CHANGED
data/lib/bindata/version.rb
CHANGED
data/test/buffer_test.rb
CHANGED
@@ -52,6 +52,25 @@ describe BinData::Buffer, "subclassed with a single type" do
|
|
52
52
|
obj.to_binary_s.must_equal_binary "\000\003\000\000\000"
|
53
53
|
end
|
54
54
|
|
55
|
+
it "returns binary encoded data" do
|
56
|
+
obj = IntBuffer.new(3)
|
57
|
+
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
58
|
+
end
|
59
|
+
|
60
|
+
it "returns binary encoded data despite Encoding.default_internal" do
|
61
|
+
w, $-w = $-w, false
|
62
|
+
before_enc = Encoding.default_internal
|
63
|
+
|
64
|
+
begin
|
65
|
+
Encoding.default_internal = Encoding::UTF_8
|
66
|
+
obj = IntBuffer.new(3)
|
67
|
+
obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
|
68
|
+
ensure
|
69
|
+
Encoding.default_internal = before_enc
|
70
|
+
$-w = w
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
55
74
|
it "has total num_bytes" do
|
56
75
|
obj = IntBuffer.new
|
57
76
|
assert obj.clear?
|
data/test/offset_test.rb
CHANGED
@@ -74,9 +74,15 @@ describe BinData::Base, "offsets" do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "adjust offset when incorrect" do
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
w, $-w = $-w, false
|
78
|
+
|
79
|
+
begin
|
80
|
+
io.seek(2)
|
81
|
+
obj = TenByteOffsetBase.create(adjust_offset: 13)
|
82
|
+
obj.read(io).snapshot.must_equal data[2 + 13, 3]
|
83
|
+
ensure
|
84
|
+
$-w = w
|
85
|
+
end
|
80
86
|
end
|
81
87
|
|
82
88
|
it "succeeds when offset is correct" do
|
data/test/registry_test.rb
CHANGED
@@ -36,10 +36,16 @@ describe BinData::Registry do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "allows overriding of registered classes" do
|
39
|
-
|
40
|
-
r.register('A', B)
|
39
|
+
w, $-w = $-w, false
|
41
40
|
|
42
|
-
|
41
|
+
begin
|
42
|
+
r.register('A', A)
|
43
|
+
r.register('A', B)
|
44
|
+
|
45
|
+
r.lookup('a').must_equal B
|
46
|
+
ensure
|
47
|
+
$-w = w
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
51
|
it "converts CamelCase to underscores" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dion Mendel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -31,6 +31,9 @@ dependencies:
|
|
31
31
|
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 5.0.0
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 5.12.0
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,6 +41,9 @@ dependencies:
|
|
38
41
|
- - ">"
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 5.0.0
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 5.12.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: coveralls
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,8 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
170
|
- !ruby/object:Gem::Version
|
165
171
|
version: '0'
|
166
172
|
requirements: []
|
167
|
-
|
168
|
-
rubygems_version: 2.7.6
|
173
|
+
rubygems_version: 3.1.2
|
169
174
|
signing_key:
|
170
175
|
specification_version: 4
|
171
176
|
summary: A declarative way to read and write binary file formats
|