kaitai-struct 0.7 → 0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kaitai/struct/struct.rb +10 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30c10c742a6b3c8908f17006910643fa1a97607c
|
4
|
+
data.tar.gz: 62d30b905f0c22b2eb076c2d4eb43714172a0b08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52979e774b3fa89691646a5cc5d3b75b3d2676a6516de12ff5fef1dfa22bb6f856d205b54b2c0c4a5e302349a36aafbd1bce75fcce5714e81757863b737f4555
|
7
|
+
data.tar.gz: 85a035c2959cfdf73da65268d0d4c72a21b42d0aff890f56bc7dc7969855676d7c6f04a96e60aff27bf6bb3585ea112f86aa71e5b70834be98d5360f95686cef
|
data/lib/kaitai/struct/struct.rb
CHANGED
@@ -3,7 +3,7 @@ require 'stringio'
|
|
3
3
|
module Kaitai
|
4
4
|
module Struct
|
5
5
|
|
6
|
-
VERSION = '0.
|
6
|
+
VERSION = '0.8'
|
7
7
|
|
8
8
|
##
|
9
9
|
# Common base class for all structured generated by Kaitai Struct.
|
@@ -87,6 +87,13 @@ class Stream
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
##
|
91
|
+
# Error that occurs when default endianness should be decided with
|
92
|
+
# a switch, but nothing matches (although using endianness expression
|
93
|
+
# implies that there should be some positive result).
|
94
|
+
class UndecidedEndiannessError < Exception
|
95
|
+
end
|
96
|
+
|
90
97
|
##
|
91
98
|
# Constructs new Kaitai Stream object.
|
92
99
|
# @param arg [String, IO] if String, it will be used as byte array to read data from;
|
@@ -377,9 +384,10 @@ class Stream
|
|
377
384
|
|
378
385
|
def self.bytes_strip_right(bytes, pad_byte)
|
379
386
|
new_len = bytes.length
|
380
|
-
while bytes.getbyte(new_len - 1) == pad_byte
|
387
|
+
while new_len > 0 and bytes.getbyte(new_len - 1) == pad_byte
|
381
388
|
new_len -= 1
|
382
389
|
end
|
390
|
+
|
383
391
|
bytes[0, new_len]
|
384
392
|
end
|
385
393
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaitai-struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Yakshin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Kaitai Struct is a declarative language used for describe various binary data structures, laid out in files or in memory: i.e. binary file formats, network stream packet formats, etc.
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project:
|
48
|
-
rubygems_version: 2.5.2
|
48
|
+
rubygems_version: 2.5.2.2
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
51
|
summary: 'Kaitai Struct: runtime library for Ruby'
|