From 7da598c6bfb344b0e3604efd9e45590808353e42 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 24 Dec 2024 11:29:05 -0800 Subject: [PATCH] long strin gmissing values --- rust/pspp/src/cooked.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rust/pspp/src/cooked.rs b/rust/pspp/src/cooked.rs index 959515a02f..cb8dbe6d75 100644 --- a/rust/pspp/src/cooked.rs +++ b/rust/pspp/src/cooked.rs @@ -681,9 +681,17 @@ pub fn decode( warn(Error::TBD); continue; }; - for (value, label) in record.labels.into_iter() { - let value = Value:: - variable.value_labels.insert(value) + let Some(width) = variable.width.as_string_width() else { + warn(Error::TBD); + continue; + }; + for (mut value, label) in record.labels.into_iter() { + // XXX warn about too-long value? + value.0.resize(width, b' '); + // XXX warn abouat duplicat value labels? + variable + .value_labels + .insert(Value::String(value.0.into_boxed_slice()), label); } } -- 2.30.2