long strin gmissing values
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 24 Dec 2024 19:29:05 +0000 (11:29 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 24 Dec 2024 19:29:05 +0000 (11:29 -0800)
rust/pspp/src/cooked.rs

index 959515a02f6b86757bf9c6770cb53beaa496c3b9..cb8dbe6d75311b5c832671517501bbd7c506ba8a 100644 (file)
@@ -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);
         }
     }