From adacbbde2fdab77a09bc66d132979fd7ce1aafc4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 9 May 2022 19:22:44 +0100 Subject: [PATCH] shapelib: Promote call to group.d.outline.check() Signed-off-by: Ian Jackson --- src/shapelib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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()?; -- 2.30.2