wahwah 1.6.0 → 1.6.1

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
2
  SHA256:
3
- metadata.gz: 7ed4753543c1ad49e2c3c274198e3bc9a4a2416ff4e8937d6d418587f777756f
4
- data.tar.gz: 16079b5131d51a3ba203a859acd7c17627a34d705105234a4a15a00bd68c9eb3
3
+ metadata.gz: d366d9e5b09b02f94de258c09e03b9d107dda83fe31052bf9b93696e669aac08
4
+ data.tar.gz: 5a6cc11a98174b658d2b35d3440940023e7aec4a2cb964636c58930d9690338a
5
5
  SHA512:
6
- metadata.gz: bf8adc7cef79b90caa947f5997a489b7b678defac1efc64fc51e2e95c9a50453a762dcf03a8295e4036cd5c9b6bd55fbd565381ba7d1fa9fcc74008bc4013eb0
7
- data.tar.gz: a09f45c83ce58685d6da2df6ebffc20883acb2ce70cf95168c6896659b98fd682d696f3c52a066b092ac92694a9c3cb92e790c08edf3d0485e4a125116fac9ed
6
+ metadata.gz: 47ad25531fe9835c08f0db10ca919cb73f5688237d19586e7b4f0b7cfacd85c176d2e6555243a1ed566c092dcfea83f39fd9f5c9869240f9a0f3b4b2c056bd64
7
+ data.tar.gz: 8284a87d145252d60146f5bf2a2fa42c0201422b72ecc4755388a65ff6d2e890b2d029059d9c5d7199b9dd7f873309e38b0890faeae8a3910b960e38556f4c53
data/lib/wahwah/helper.rb CHANGED
@@ -22,7 +22,15 @@ module WahWah
22
22
  end
23
23
 
24
24
  def self.split_with_terminator(string, terminator_size)
25
- string.split(Regexp.new(('\x00' * terminator_size).b), 2)
25
+ terminator = ("\x00" * terminator_size).b
26
+
27
+ (0...string.size).step(terminator_size).each do |index|
28
+ if string[index...(index + terminator_size)] == terminator
29
+ return [string[0...index], string[index + terminator_size..]]
30
+ end
31
+ end
32
+
33
+ []
26
34
  end
27
35
 
28
36
  def self.file_format(io)
@@ -49,9 +49,9 @@ module WahWah
49
49
  # Picture data <binary data>
50
50
  def parse
51
51
  frame_format = @version > 2 ? "CZ*Ca*" : "Ca3Ca*"
52
- encoding_id, @mime_type, type_index, reset_content = @content.unpack(frame_format)
52
+ encoding_id, @mime_type, type_index, rest_content = @content.unpack(frame_format)
53
53
  encoding = ENCODING_MAPPING[encoding_id]
54
- _description, data = Helper.split_with_terminator(reset_content, ENCODING_TERMINATOR_SIZE[encoding])
54
+ _description, data = Helper.split_with_terminator(rest_content, ENCODING_TERMINATOR_SIZE[encoding])
55
55
 
56
56
  @value = {data: data, mime_type: mime_type, type: TYPES[type_index]}
57
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WahWah
4
- VERSION = "1.6.0"
4
+ VERSION = "1.6.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wahwah
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aidewoode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-06 00:00:00.000000000 Z
11
+ date: 2024-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler