From 3293f512476bd07e955a1774e5d165a861f3b4b8 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 15 Mar 2026 23:24:50 +0100 Subject: [PATCH 1/2] Remove deprecated constructor for `HdrDecoder` --- src/codecs/hdr/decoder.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/codecs/hdr/decoder.rs b/src/codecs/hdr/decoder.rs index 6b2965c1fe..63c50bcaef 100644 --- a/src/codecs/hdr/decoder.rs +++ b/src/codecs/hdr/decoder.rs @@ -191,12 +191,6 @@ impl HdrDecoder { HdrDecoder::with_strictness(reader, true) } - /// Allows reading old Radiance HDR images - #[deprecated(note = "Use `new_with_spec_compliance(reader, SpecCompliance::Lenient)` instead")] - pub fn new_nonstrict(reader: R) -> ImageResult { - Self::with_strictness(reader, false) - } - /// Create a new decoder with the given spec compliance mode. pub(crate) fn new_with_spec_compliance(reader: R, spec: SpecCompliance) -> ImageResult { Self::with_strictness(reader, spec == SpecCompliance::Strict) From e9307e4f7956f5b3697b1ab066301cf0dce70fff Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 15 Mar 2026 23:55:37 +0100 Subject: [PATCH 2/2] Update HDR docs --- src/codecs/hdr/decoder.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/codecs/hdr/decoder.rs b/src/codecs/hdr/decoder.rs index 63c50bcaef..a994f7319a 100644 --- a/src/codecs/hdr/decoder.rs +++ b/src/codecs/hdr/decoder.rs @@ -184,9 +184,11 @@ impl Rgbe8Pixel { } impl HdrDecoder { - /// Reads Radiance HDR image header from stream ```r``` - /// if the header is valid, creates `HdrDecoder` - /// strict mode is enabled + /// Reads Radiance HDR image header from `reader` with strict mode enabled. + /// + /// In strict mode, the header is required to be well-formed. This prevents + /// certain older slightly-malformed files from being read. See + /// [`HdrDecoder::with_strictness`] for details. pub fn new(reader: R) -> ImageResult { HdrDecoder::with_strictness(reader, true) } @@ -196,13 +198,19 @@ impl HdrDecoder { Self::with_strictness(reader, spec == SpecCompliance::Strict) } - /// Reads Radiance HDR image header from stream `reader`, - /// if the header is valid, creates `HdrDecoder`. + /// Reads Radiance HDR image header from `reader`. + /// + /// In strict mode, the header is required to be well-formed. I.e. it must + /// contain a valid signature among other requirements. In non-strict mode, + /// certain malformed headers are accepted, allowing more files to be read + /// but potentially incorrectly. + /// + /// Certain older files require non-strict mode to be read. /// - /// strict enables strict mode + /// # Warning /// - /// Warning! Reading wrong file in non-strict mode could consume up to a few - /// megabytes of memory before this errors, if the file is large enough. + /// In non-strict mode, certain invalid files may consume multiple megabytes of memory + /// before an error is returned. pub fn with_strictness(mut reader: R, strict: bool) -> ImageResult> { let mut attributes = HdrMetadata::new();