bindata 2.4.8 → 2.4.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 930073ad9a50e67aa2d584a17c0138f3cb4008e4bd96851ceef305e16c7cadd2
4
- data.tar.gz: ec59bb6fcff33192da1ee33952c69e1069c214c0f41f9b21786694ed7fa4c87c
3
+ metadata.gz: a511668b89503e38575dbc2eb0f02e542556c63bf008294a2a99a4f116639d74
4
+ data.tar.gz: 259742f4fe4f2632b0edca7bf155277198291663546ff3c148d1d515ac8e76d5
5
5
  SHA512:
6
- metadata.gz: c2ebc4a2e56294d7b503d73cfee08fa165c37b96a4216e6ac17206b2566d3b5ea77adb188b819a8e63bf1a059ab79d068d1def5059d7b2b6811609f099a3656f
7
- data.tar.gz: 96c38802d6197001dfbfb76a4a338bcc7dbf2e8f7ec685b5007cdc6a8917b502ad8bc1ca106323a52f3555cada27f1b90ba204a5c72253447983026af020c27f
6
+ metadata.gz: 1e2f3a1a41443ec3ddfc44734bd7c1e03d6c957ea86d86fa68f0ec913df63ac5c2a32e26ef73fe2d8abe889fdfe916d2e9fc97686ede3fd6e1e51598480acbb5
7
+ data.tar.gz: e3f21a9882a1a259044cfd284308ba6d13d1bef9674b03c7a501fae53a30fac5b868a9d5a11bc10302889bd03d5e73e6e9203c1b5b395b9ba12a33ed9b4c7f72
data/ChangeLog.rdoc CHANGED
@@ -1,5 +1,10 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.9 (2021-04-22)
4
+
5
+ * Change example from Fixnum to Integer. Thanks to Tim Chambers.
6
+ * Now works with frozen string literals. Requested by Jeremy Evans.
7
+
3
8
  == Version 2.4.8 (2020-07-21)
4
9
 
5
10
  * Bug fix array self assignment. Thanks to Spencer McIntyre.
data/bindata.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.summary = 'A declarative way to read and write binary file formats'
9
9
  s.author = 'Dion Mendel'
10
10
  s.email = 'bindata@dm9.info'
11
- s.homepage = 'http://github.com/dmendel/bindata'
11
+ s.homepage = 'https://github.com/dmendel/bindata'
12
12
  s.require_path = 'lib'
13
13
  s.extra_rdoc_files = ['NEWS.rdoc']
14
14
  s.rdoc_options << '--main' << 'NEWS.rdoc'
data/examples/list.rb CHANGED
@@ -105,7 +105,7 @@ class Term < BinData::Record
105
105
  end
106
106
 
107
107
  def self.encode(val)
108
- if Fixnum === val
108
+ if Integer === val
109
109
  Term.new(tag: 'a', term: Atom.encode(val))
110
110
  else
111
111
  Term.new(tag: 'l', term: List.encode(val))
@@ -47,7 +47,7 @@ module BinData
47
47
  end
48
48
  def readbytes(n)
49
49
  n.times.inject("") do |bytes, _|
50
- bytes << @io.readbits(8, :big).chr
50
+ bytes += @io.readbits(8, :big).chr
51
51
  end
52
52
  end
53
53
  end
data/lib/bindata/int.rb CHANGED
@@ -107,7 +107,7 @@ module BinData
107
107
  parts = (0...nwords).collect do |i|
108
108
  "(ints.at(#{idx[i]}) << #{bits_per_word(nbits) * i})"
109
109
  end
110
- parts[0].sub!(/ << 0\b/, "") # Remove " << 0" for optimisation
110
+ parts[0] = parts[0].sub(/ << 0\b/, "") # Remove " << 0" for optimisation
111
111
 
112
112
  parts.join(" + ")
113
113
  end
@@ -132,7 +132,7 @@ module BinData
132
132
  mask = (1 << bits_per_word(nbits)) - 1
133
133
 
134
134
  vals = (0...nwords).collect { |i| "val >> #{bits_per_word(nbits) * i}" }
135
- vals[0].sub!(/ >> 0\b/, "") # Remove " >> 0" for optimisation
135
+ vals[0] = vals[0].sub(/ >> 0\b/, "") # Remove " >> 0" for optimisation
136
136
  vals.reverse! if (endian == :big)
137
137
 
138
138
  vals = vals.collect { |val| "#{val} & #{mask}" } # TODO: "& mask" is needed to work around jruby bug. Remove this line when fixed.
@@ -160,7 +160,7 @@ module BinData
160
160
  directives = { 8 => "C", 16 => "S", 32 => "L", 64 => "Q" }
161
161
 
162
162
  d = directives[bits_per_word(nbits)]
163
- d << ((endian == :big) ? ">" : "<") unless d == "C"
163
+ d += ((endian == :big) ? ">" : "<") unless d == "C"
164
164
 
165
165
  if signed == :signed && directives.key?(nbits)
166
166
  (d * nwords).downcase
data/lib/bindata/io.rb CHANGED
@@ -169,7 +169,7 @@ module BinData
169
169
 
170
170
  unless @read_data.empty? || @in_readahead
171
171
  bytes_to_consume = [n, @read_data.length].min
172
- data << @read_data.slice!(0, bytes_to_consume)
172
+ data += @read_data.slice!(0, bytes_to_consume)
173
173
  n -= bytes_to_consume
174
174
 
175
175
  if @read_data.empty?
@@ -180,10 +180,10 @@ module BinData
180
180
  end
181
181
 
182
182
  raw_data = @raw_io.read(n)
183
- data << raw_data if raw_data
183
+ data += raw_data if raw_data
184
184
 
185
185
  if @in_readahead
186
- @read_data << data
186
+ @read_data += data
187
187
  end
188
188
 
189
189
  @offset += data.size
@@ -54,7 +54,7 @@ module BinData
54
54
  # read until zero byte or we have read in the max number of bytes
55
55
  while ch != "\0" && i != max_length
56
56
  ch = io.readbytes(1)
57
- str << ch
57
+ str += ch
58
58
  i += 1
59
59
  end
60
60
 
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.8"
2
+ VERSION = "2.4.9"
3
3
  end
data/test/bits_test.rb CHANGED
@@ -101,14 +101,14 @@ def generate_bit_classes_to_test(endian, signed)
101
101
 
102
102
  (start .. 64).each do |nbits|
103
103
  name = "#{base}#{nbits}"
104
- name << "le" if endian == :little
104
+ name += "le" if endian == :little
105
105
  obj = BinData.const_get(name).new
106
106
  bits << [obj, nbits]
107
107
  end
108
108
 
109
109
  (start .. 64).each do |nbits|
110
110
  name = "#{base}"
111
- name << "Le" if endian == :little
111
+ name += "Le" if endian == :little
112
112
  obj = BinData.const_get(name).new(nbits: nbits)
113
113
  bits << [obj, nbits]
114
114
  end
@@ -99,7 +99,7 @@ describe BinData::DelayedIO, "subclassed with a single type" do
99
99
  end
100
100
 
101
101
  it "writes explicitly" do
102
- io = StringIO.new "\001\002\003\004\005\006\007\010\011"
102
+ io = StringIO.new "\001\002\003\004\005\006\007\010\011".dup
103
103
  obj = IntDelayedIO.new(3)
104
104
  obj.write(io)
105
105
  obj.write_now!
@@ -107,7 +107,7 @@ describe BinData::DelayedIO, "subclassed with a single type" do
107
107
  end
108
108
 
109
109
  it "writes explicitly after setting abs_offset" do
110
- io = StringIO.new "\001\002\003\004\005\006\007\010\011"
110
+ io = StringIO.new "\001\002\003\004\005\006\007\010\011".dup
111
111
  obj = IntDelayedIO.new(7)
112
112
  obj.write(io)
113
113
 
@@ -139,7 +139,7 @@ describe BinData::DelayedIO, "subclassed with multiple types" do
139
139
  end
140
140
 
141
141
  it "writes explicitly" do
142
- io = StringIO.new "\001\002\003\004\005\006\007\010\011\012\013\014\015"
142
+ io = StringIO.new "\001\002\003\004\005\006\007\010\011\012\013\014\015".dup
143
143
  obj = StringDelayedIO.new(str: "hello")
144
144
  obj.write(io)
145
145
  obj.write_now!
data/test/int_test.rb CHANGED
@@ -128,7 +128,7 @@ module AllIntegers
128
128
  end
129
129
 
130
130
  def int_to_binary_str(val)
131
- str = "".force_encoding(Encoding::BINARY)
131
+ str = "".dup.force_encoding(Encoding::BINARY)
132
132
  v = val & ((1 << (@nbytes * 8)) - 1)
133
133
  @nbytes.times do
134
134
  str.concat(v & 0xff)
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.8
4
+ version: 2.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dion Mendel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2021-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -149,7 +149,7 @@ files:
149
149
  - test/uint8_array_test.rb
150
150
  - test/virtual_test.rb
151
151
  - test/warnings_test.rb
152
- homepage: http://github.com/dmendel/bindata
152
+ homepage: https://github.com/dmendel/bindata
153
153
  licenses:
154
154
  - Ruby
155
155
  metadata: {}
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.1.2
173
+ rubygems_version: 3.1.4
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: A declarative way to read and write binary file formats