Skip to content

Commit

Permalink
Align writer to 4-byte boundary after every blob instead of after fin…
Browse files Browse the repository at this point in the history
…alizing an image that could contain multiple blobs
  • Loading branch information
cry-inc committed Feb 22, 2024
1 parent ac4399f commit f690eb4
Show file tree
Hide file tree
Showing 3 changed files with 702 additions and 703 deletions.
4 changes: 4 additions & 0 deletions src/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ impl Blob {
section_header.to_writer(writer)?;
writer.physical_seek(end_offset)?;

writer
.align()
.write_err("Failed to align writer on next 4-byte offset after writing blob section")?;

Ok(Self {
offset: start_offset,
length,
Expand Down
5 changes: 0 additions & 5 deletions src/image_writer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::error::Converter;
use crate::paged_writer::PagedWriter;
use crate::Blob;
use crate::CylindricalImage;
Expand Down Expand Up @@ -243,10 +242,6 @@ impl<'a, T: Read + Write + Seek> ImageWriter<'a, T> {
// Add metadata for XML generation later, when the file is completed.
self.images.push(self.image.clone());

self.writer
.align()
.write_err("Failed to align writer on next 4-byte offset after writing data packet")?;

Ok(())
}
}
Loading

0 comments on commit f690eb4

Please sign in to comment.