X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=rust%2Fsrc%2Flib.rs;h=5253402699c6340b470a8bef8772c644f11f5850;hb=559e5e5035fd98393beac3ddfd70d08dc2134c23;hp=6dc13b586a96e7949d0e21e5d06d9884ca26c0ad;hpb=2f5387c960ae55adfd09d698566430947c28615e;p=pspp diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 6dc13b586a..5253402699 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -3,7 +3,9 @@ use thiserror::Error as ThisError; pub mod endian; pub mod raw; +pub mod cooked; pub mod sack; +pub mod encoding; #[derive(ThisError, Debug)] pub enum Error { @@ -28,7 +30,7 @@ pub enum Error { #[error("Document record at offset {offset:#x} has document line count ({n}) greater than the maximum number {max}.")] BadDocumentLength { offset: u64, n: u32, max: u32 }, - #[error("At offset {offset:#x}, Unrecognized record type {rec_type}.")] + #[error("At offset {offset:#x}, unrecognized record type {rec_type}.")] BadRecordType { offset: u64, rec_type: u32 }, #[error("At offset {offset:#x}, variable label code ({code}) is not 0 or 1.")] @@ -84,4 +86,22 @@ pub enum Error { expected_n_blocks: u64, ztrailer_len: u64, }, + + #[error("At offset {offset:#x}, {record} has bad size {size} bytes instead of the expected {expected_size}.")] + BadRecordSize { offset: u64, record: String, size: u32, expected_size: u32 }, + + #[error("At offset {offset:#x}, {record} has bad count {count} instead of the expected {expected_count}.")] + BadRecordCount { offset: u64, record: String, count: u32, expected_count: u32 }, + + #[error("The encoding record at offset {offset:#x} contains an encoding name that is not valid UTF-8.")] + BadEncodingName { offset: u64 }, + + #[error("In long string missing values record starting at offset {record_offset:#x}, value length at offset {offset:#x} is {value_len} instead of the expected 8.")] + BadLongMissingValueLength { record_offset: u64, offset: u64, value_len: u32 }, + + #[error("This file has corrupted metadata written by a buggy version of PSPP. To fix it, save a new copy of the file.")] + BadLongMissingValueFormat, + + #[error("Details TBD")] + TBD, }