File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -54,18 +54,29 @@ pub fn convert_mst(opts: ConvertOpts) -> anyhow::Result<()> {
54
54
55
55
let mut content_offsets = Vec :: new ( ) ;
56
56
for content_buf in content_bufs {
57
- let mut pos = out_file. seek ( SeekFrom :: Current ( 0 ) ) ?;
57
+ let mut pos = out_file. stream_position ( ) ?;
58
58
if pos % 2048 > 0 {
59
59
let padding = 2048 - pos % 2048 ;
60
60
let padding = vec ! [ 0u8 ; padding as usize ] ;
61
61
out_file. write_all ( & padding) ?;
62
- pos = out_file. seek ( SeekFrom :: Current ( 0 ) ) ?;
62
+ pos = out_file. stream_position ( ) ?;
63
63
}
64
64
65
65
content_offsets. push ( pos) ;
66
66
out_file. write_all ( & content_buf) ?;
67
67
}
68
68
69
+ if let Some ( min_data_offset) = content_offsets. iter ( ) . min ( ) {
70
+ out_file. seek ( SeekFrom :: Start ( 28 ) ) ?;
71
+
72
+ let offset = * min_data_offset as u32 ;
73
+ if mst. identifier . is_little ( ) {
74
+ out_file. write_all ( & offset. to_le_bytes ( ) ) ?;
75
+ } else {
76
+ out_file. write_all ( & offset. to_be_bytes ( ) ) ?;
77
+ }
78
+ }
79
+
69
80
for ( pos, offset) in content_offset_offsets. borrow ( ) . iter ( ) . zip ( content_offsets) {
70
81
out_file. seek ( SeekFrom :: Start ( * pos) ) ?;
71
82
You can’t perform that action at this time.
0 commit comments