I'm reading BootImage from a file, changing a couple properties, and writing BootImage back to the same file. I was surprised to find out that the ramdisk_fragments part of my file was all zeros. I wanted to skip reading/writing the ramdisk_fragments since it's not relevant to my use case.
Reading the documentation for align_before, align_after, and pad_size_to, it says "Aligns the reader/writer to the Nth byte before a field." and "Ensures the reader/writer is always advanced at least N bytes.". It doesn't mention that it zero fills the space. Reading the pad_after function shows the zeroing code.
I doubt we can change the behavior at this point, but maybe we can update the documentation?
I can work around my issue by using seek_before, it just makes the struct less readable.
Take the following:
I'm reading
BootImage
from a file, changing a couple properties, and writingBootImage
back to the same file. I was surprised to find out that theramdisk_fragments
part of my file was all zeros. I wanted to skip reading/writing theramdisk_fragments
since it's not relevant to my use case.Reading the documentation for
align_before
,align_after
, andpad_size_to
, it says "Aligns the reader/writer to the Nth byte before a field." and "Ensures the reader/writer is always advanced at least N bytes.". It doesn't mention that it zero fills the space. Reading the pad_after function shows the zeroing code.I doubt we can change the behavior at this point, but maybe we can update the documentation?
I can work around my issue by using
seek_before
, it just makes the struct less readable.Thanks!