Fix string encoding and clean up

This commit is contained in:
Birk Tjelmeland committed 2019-02-26 11:09:54 +01:00
1 parent addfaa5692
commit 098b799a62
3 files changed
+36 -35

No files matched your search

+4 -2
View File
@@ -77,8 +77,10 @@ impl<W: Write> TiffWriter<W> {
}
pub fn pad_word_boundary(&mut self) -> Result<(), io::Error> {
while self.offset % 4 != 0 {
self.writer.write_u8(0)?;
if self.offset % 4 != 0 {
let padding = [0, 0, 0];
let padd_len = 4 - (self.offset % 4);
self.writer.write_all(&padding[..padd_len as usize])?;
}
Ok(())