address review: warn once when a by-paragraph build is truncated

This commit is contained in:
Dylan M. Taylor
2026-11-03 22:04:08 +00:00
parent fba5e8ce5d
commit c531b64dfa
+8 -1
View File
@@ -604,9 +604,12 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm
shape_index(shapes, 0, &mut by_id);
let mut roles_of: std::collections::HashMap<ShapeId, Vec<BuildRole>> = Default::default();
let mut effect_count = 0usize;
let mut warned = false;
for a in anims.iter().take(10_000) {
if effect_count >= MAX_EFFECTS {
log::warn!("pptx: more than {MAX_EFFECTS} animation effects; the rest are left out");
if !warned {
log::warn!("pptx: more than {MAX_EFFECTS} animation effects; the rest are left out");
}
break;
}
let Some(spid) = idmap.get(a.shape) else {
@@ -660,6 +663,10 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm
};
let Ok(pi) = u32::try_from(i) else { break };
if effect_count + effs.len() >= MAX_EFFECTS {
if !warned {
log::warn!("pptx: more than {MAX_EFFECTS} animation effects; the rest are left out");
warned = true;
}
break;
}
effs.push(Eff { a, spid, start, paragraph: Some(pi), grp });