fix
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 14 Oct 2025 23:36:11 +0000 (16:36 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 14 Oct 2025 23:36:11 +0000 (16:36 -0700)
rust/doc/src/spv/light-detail.md
rust/pspp/src/output/spv/light.rs

index f89eb5d65960fe466597c0828112becfb00681dc..b42b6ebbe683a686255475027d73936a0051b3c3 100644 (file)
@@ -661,7 +661,7 @@ X3 =>
     double[small] 01
     (string[dataset] string[datafile] i0 int32[date] i0)?
     Y2
-    (int32[x22] i0 01?)?
+    (int32[x22] i0 bool[x25]?)?
 ```
 
 `small` is a small real number.  In the corpus, it overwhelmingly
@@ -686,8 +686,10 @@ a null byte (a valid string never will).
 
 `x22` is usually 0 or 2000000.
 
-A writer may safely use 4 for `x21` and omit `x22` and the other
-optional bytes at the end.
+`x25` is usually `01`.
+
+A writer may safely use 4 for `x21` and omit `x22`, `x25`, and the
+other optional bytes at the end.
 
 ### Encoding
 
index 22a01e8386b8a86f137dab0ac09e8871bc7c6667..fdc2864aa507d7bf5a59ab507901d3243da5f5aa 100644 (file)
@@ -712,13 +712,13 @@ where
         endian: binrw::Endian,
         args: Self::Args<'_>,
     ) -> BinResult<Self> {
-        let start = reader.stream_position()?;
         let count = u32::read_options(reader, endian, ())? as u64;
+        let start = reader.stream_position()?;
         let end = start + count;
         let mut inner = reader.take_seek(count);
         let result = <T>::read_options(&mut inner, Endian::Little, args)?;
         let pos = inner.stream_position()?;
-        if pos < end {
+        if pos != end {
             let consumed = pos - start;
             return Err(binrw::Error::Custom {
                 pos,
@@ -1001,8 +1001,8 @@ struct X3Tail {
     _x22: i32,
     #[br(temp, assert(_zero == 0))]
     _zero: i32,
-    #[br(temp)]
-    _one: Optional<One>,
+    #[br(temp, assert(_x25.is_none_or(|x25| x25 == 0 || x25 == 1)))]
+    _x25: Optional<u8>,
 }
 
 #[binread]