Skip to content

unnamed fields should simply skip the stream #1261

@fzakaria

Description

@fzakaria

If i put an unnamed field in my definition I see that it stores the value in a variable (i.e. m__unnamed2 below)

void nix_nar_t::type_regular_t::file_content_t::_read() {
  m_len_contents = m__io->read_u8le();

  n__unnamed1 = true;

  if (nar_offset() < 0) {
    n__unnamed1 = false;

    m__unnamed1 = m__io->read_bytes(0);
  }

  m__unnamed2 = m__io->read_bytes(len_contents());

  m_padding = m__io->read_bytes(
      kaitai::kstream::mod(8 - kaitai::kstream::mod(len_contents(), 8), 8));
}

it would be great to instead seek the m__io forward the specified size.

The purpose of this is I am writing a spec for an archive format and I want to avoid serializing the contents of each file.
I have an instance that is a pointer to the start of the contents that I can use on a separate stream to read to if I want to emit the file.

This avoids keeping the whole structure of the archive format in memory.

I originally filed it in the runtime but I think that was incorrect and it's a compiler bug.
kaitai-io/kaitai_struct_cpp_stl_runtime#81

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions