fix(ffi): map SingularTransform diagnostic to C ABI v1 - #3
deepin-bot[bot] merged 3 commits into
Conversation
Map RenderDiagnosticKind::SingularTransform to the new constant ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM (7). Documents containing objects with a singular transform (degenerate CTM, e.g. empty text objects written by some converters) made from_render_report fail with ROFD_STATUS_INTERNAL, so the whole page failed to render. The diagnostic is now reported through the render report and rendering continues. 将 RenderDiagnosticKind::SingularTransform 映射到新增常量 ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM (7)。此前含奇异变换对象(退化 CTM,部分转换器生成的空白文本对象)的文档会因诊断类型未映射而以 ROFD_STATUS_INTERNAL 整页渲染失败;现在诊断通过渲染报告正常上报, 页面继续渲染。 Log: 修复奇异变换诊断导致整页渲染失败 Influence: 含奇异变换对象的OFD文档可正常打开渲染,诊断经渲染报告上报,C ABI向后兼容。
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe FFI layer now reports skipped objects with singular transforms as diagnostic kind 7 through both Rust and C ABI definitions, preventing valid renderer diagnostics from escalating to internal errors and preserving C ABI v1 compatibility. Sequence diagram for singular-transform diagnostic reportingsequenceDiagram
participant Renderer
participant FFI
participant CConsumer
Renderer->>FFI: RenderDiagnosticKind::SingularTransform
FFI->>FFI: diagnostic_kind(kind)
FFI-->>CConsumer: ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM (7)
CConsumer-->>CConsumer: Record diagnostic and continue rendering
alt Unmapped diagnostic kind
FFI-->>CConsumer: ROFD_STATUS_INTERNAL
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The license-check workflow runs reuse lint on every PR, but the repository had no copyright or licensing declarations at all (331 files non-compliant), so every PR failed the check regardless of its content. Add a REUSE.toml covering the whole tree with LGPL-2.1-or-later (matching Cargo.toml and debian/copyright), Apache-2.0 for the ofdrw compatibility fixtures, a LicenseRef annotation for the archived GB/T 33190-2016 standard document, and the corresponding license texts under LICENSES/. 此前仓库完全没有REUSE许可声明(331个文件不合规),license-check 流水线对任何PR都会失败。新增全仓REUSE.toml(LGPL-2.1-or-later, 与Cargo.toml及debian/copyright一致)、ofdrw兼容测试资源的 Apache-2.0声明、GB/T标准文档的LicenseRef注记及LICENSES/许可文本。 Log: 补充REUSE许可声明修复流水线license-check失败 Influence: 仓库通过REUSE 3.3合规检查,许可信息与既有声明保持一致。
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰,无需修改 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,注释完整,无需修改 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理,无需优化 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞,代码仅涉及内部诊断常量映射,无用户输入处理、无外部数据交互、无密码学操作、无缓冲区操作、无路径操作、无命令执行,不存在攻击面 💡 改进建议代码示例// 本次提交代码实现正确,无需修复示例
// crates/rofd-ffi/src/abi.rs
/// Diagnostic indicating an object was skipped because its transform is singular.
pub const ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM: u32 = 7;
// crates/rofd-ffi/src/report.rs - diagnostic_kind()
RenderDiagnosticKind::SingularTransform => Ok(ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM),
// crates/rofd-ffi/include/rofd.h
#define ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM 7u本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, BLumia, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
license-check 工作流同时检查中文自述文件 README.zh_CN.md 是否存在, 补充与 README.md 内容对应的中文版本。 Log: 补充README.zh_CN.md修复流水线license-check失败 Influence: 满足 license-check 对中英双语自述文件的要求。
069a050 to
f3384a5
Compare
|
/merge |
|
This pr cannot be merged! (status: unstable) |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
问题
打开含奇异变换对象(退化 CTM,如
CTM="0 0 0 0.3528 0 0"的空白文本对象,常见于部分转换器生成的 OFD)的文档时,rofd-render 正确跳过这些对象并发出RenderDiagnosticKind::SingularTransform诊断,但 FFI 层diagnostic_kind()未映射该枚举值,走到兜底分支返回ROFD_STATUS_INTERNAL(错误消息 "renderer returned a diagnostic kind unknown to C ABI v1"),导致整页渲染失败、文档无法打开。复现样例:发票监制章-数科.ofd(内含 33 个此类对象)。
修复
crates/rofd-ffi/src/abi.rs:新增ROFD_DIAGNOSTIC_SINGULAR_TRANSFORM: u32 = 7crates/rofd-ffi/include/rofd.h:新增对应 C 宏定义crates/rofd-ffi/src/report.rs:映射SingularTransform,并在单元测试中补齐该映射新增值为追加常量,不破坏 C ABI v1 兼容性;消费方(deepin-reader)仅记录诊断内容,无需适配。
验证
cargo test -p rofd-core -p rofd-render -p rofd-ffi、C ABI 集成测试脚本、cargo fmt --check全部通过Summary by Sourcery
Map singular-transform renderer diagnostics to a stable C ABI value so affected documents render successfully instead of failing.
New Features:
Bug Fixes:
Documentation:
Tests:
Chores: