diff --git a/src/map.rs b/src/map.rs index af47725..416aba3 100644 --- a/src/map.rs +++ b/src/map.rs @@ -321,9 +321,12 @@ pub struct StreamableMap{ impl StreamableMap{ pub(crate) fn new(mut file:crate::file::File)->Result{ //assume the file seek is in the right place to start reading a map header + let mut f=file.as_mut(); //let mut f=file.block_reader(BlockId::new(0)).map_err(Error::File)?; - //println!("position={}",f.stream_position().unwrap()); - let header:MapHeader=file.as_mut().read_le().map_err(Error::InvalidHeader)?; + println!("file header end position={}",f.stream_position().unwrap()); + //let header:MapHeader=f.read_le().map_err(Error::InvalidHeader)?; + let header=read_map_header(&mut f).map_err(Error::InvalidHeader)?; + println!("map header end position={}",f.stream_position().unwrap()); let modes=header.modes.into_iter().map(Into::into).collect(); let attributes=header.attributes.into_iter().map(Into::into).collect(); let render_configs=header.render_configs.into_iter().map(Into::into).collect();