Repository navigation
fix(objects): document RawObject's framing and add byte_len and mc_width (#83) - #281
Merged
Merged
Conversation
…dth (#83) raw.len() and size_bytes disagree on R2010+, because a record's MS does not count its own leading MC handle-stream-size field (#77). The type now documents the framing (MS | MC | streams | CRC) and gains byte_len() for the record's length and mc_width() for the difference, so a caller need not know the trap. size_bytes is unchanged. Over the 52-file public corpus mc_width is 0 on every R14 to R2007 record and 1 or 2 on every R2010+ record.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Close the
RawObjectlength trap before the API stabilises.raw.len()andsize_bytesdisagree on R2010+, because theMSdoes not count the record's own leadingMC(#77). The type now documents its framing and gainsbyte_len()andmc_width(), so a caller never has to know that.Closes #83.
Spec reference
§2.6 (modular chars) and the record framing measured in #77, documented in ARCHITECTURE.md ("A record's
MSexcludes its ownMC"):rawspans everything between theMSand the CRC.size_bytesstays theMSverbatim: it is unchanged and not renamed, so no caller breaks.byte_len()returnsraw.len();mc_width()returnsbyte_len() - size_bytes.Measured
A throwaway check, not committed, tallied
mc_width()over every record of the 52-file public corpus (#225). It is0on every R14, R2000, R2004 and R2007 record, and1or2on every R2010, R2013 and R2018 record.sample_AC1032.dwg, for example, has 772 one-byte and 70 two-byteMCs, which are the counts #77 reported:No decode count moves, and
tools/corpus/baseline.tsvis unchanged.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningsRUSTFLAGS="-D warnings" cargo test --release --all-featuresRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featuresSource-provenance declaration
By submitting this PR I certify that my contribution does not incorporate executable code from any source whose license is incompatible with Apache-2.0. Specifically:
CLEANROOM.md).My contribution is based on §2.6 of the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1) and on the corpus bytes. No third-party code or comments were read.
Developer Certificate of Origin
By submitting this PR, I certify that the contribution complies with the Developer Certificate of Origin 1.1.