Skip to content

Support 32 or 64 bit sizes in offset columns #1530

Closed

Description

@jeromekelleher

#1529 added some infrastructure abstract out reading and writing offset columns. Here's how I think we can build on this to allow us to support either 32 bit or 64 bit sizes for the offset column (see #1527) in the file format:

  • add a new field tsk_size_t * offset_array_mem to the read_table_ragged_col_t struct
  • Then, in read_table_ragged_cols if the type of the offset_col is KAS_UINT32, then we allocate the required memory for this column into the offset_array_mem, and update col->offset_array_dest to point to this memory. We then loop through the array of 32 bit values from the kastore, and cast them into the newly allocated array.
  • As part of the out block in (.e.g) tsk_individual_table_load we call a new function free_read_table_memory(cols, ragged_cols, properties);, which will loop through the ragged cols and tsk_safe_free the offset_array_mem. (I think we should include the cols and properties here while we're at it, because we may do something similar for them soon.)
  • We'll probably have to update the struct initialisers read_table_ragged_col_t to set offset_array_mem to NULL; either that or we change to using named initialsers (like .name="individuals/location", etc) which I think guarantee that anything that's not explicity assigned is set to zero.

What do you think @benjeffery?

Activity

  1. added
    C API
    on Jun 27, 2021
  2. benjeffery commented on Jun 28, 2021

    @benjeffery
    Member

    Sounds good - you're right that they unspecified are zero'd:
    http://c0x.coding-guidelines.com/6.7.8.html
    If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.

  3. added this to the C API 1.0.0 milestone on Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C API

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions