Open joachimmetz opened 6 years ago
Structure that defines a string array
name: char
type: integer
attributes:
format: signed
size: 1
units: bytes
---
name: uint32
type: integer
attributes:
format: signed
size: 4
units: bytes
---
name: cstring
type: string
encoding: ascii
element_data_type: char
elements_terminator: "\x00"
---
name: string_array
type: structure
attributes:
byte_order: little-endian
members:
- name: number_of_strings
data_type: uint32
- name: strings
type: sequence
element_data_type: cstring
number_of_elements: string_array.number_of_strings
Which currently raises:
Traceback (most recent call last):
File "./dtfabric/tests/reader.py", line 1123, in testReadFileObjectStructureWithStringArray
definitions_reader.ReadFileObject(definitions_registry, file_object)
File "./dtfabric/reader.py", line 947, in ReadFileObject
raise errors.FormatError(error_message)
FormatError: in: string_array in: strings unsupported variable size element data type: cstring
Check the element data type and allow string?
Alternatively have specific type for a sequence of strings?
name: char
type: integer
attributes:
format: signed
size: 1
units: bytes
---
name: uint32
type: integer
attributes:
format: signed
size: 4
units: bytes
---
name: string_array
type: structure
attributes:
byte_order: little-endian
members:
- name: number_of_strings
data_type: uint32
- name: strings
type: sequence_of_strings
number_of_elements: string_array.number_of_strings
string_encoding: ascii
string_data_type: char
string_terminator: "\x00"
Consider addding support for sequence with variable element size? or add a higher (abstract) level data type for this?
For now, dtFabric will error on sequence with variable size element data type