From: Ian Jackson Date: Mon, 9 May 2022 18:22:44 +0000 (+0100) Subject: shapelib: Promote call to group.d.outline.check() X-Git-Tag: otter-1.1.0~259 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=adacbbde2fdab77a09bc66d132979fd7ce1aafc4;p=otter.git shapelib: Promote call to group.d.outline.check() Signed-off-by: Ian Jackson --- diff --git a/src/shapelib.rs b/src/shapelib.rs index 6ee0e488..b346327d 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -801,13 +801,19 @@ pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource) groupname: groupname.clone(), d, mformat, }); - group.d.outline.check(&group)?; + + // We do this here rather than in the files loop because + // 1. we want to check it even if there are no files specified + // 2. this is OK because the group doesn't change from here on + let outline_calculable = group.d.outline.check(&group)?.into(); + if [ group.d.flip, group.d.back.is_some(), ].iter().filter(|x|**x).count() > 1 { throw!(LLE::MultipleMultipleFaceDefinitions) } + for fe in gdefn.files.0 { #[throws(SubstError)] fn subst(before: &str, needle: &'static str, replacement: &str) @@ -833,8 +839,6 @@ pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource) + rhs } - let outline_calculable = group.d.outline.check(&group)?.into(); - let item_name = format!("{}{}{}", gdefn.item_prefix, fe.item_spec, gdefn.item_suffix); let item_name: GoodItemName = item_name.try_into()?;