Skip to content

fix: correct bitwise operation in dconfig status tracking#472

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
18202781743:master
May 8, 2025
Merged

fix: correct bitwise operation in dconfig status tracking#472
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Contributor

  1. Fixed incorrect bitwise AND operation in property status tracking
  2. Changed fetchAndAndOrdered(1 << index) to fetchAndAndOrdered(~(1 << index))
  3. This ensures proper bit clearing when unsetting property flags
  4. The change was made in both the generated header and the generator
    tool
  5. Without this fix, status tracking would incorrectly set bits instead
    of clearing them

fix: 修正 dconfig 状态跟踪中的位操作

  1. 修复了属性状态跟踪中错误的位与操作
  2. fetchAndAndOrdered(1 << index) 改为 fetchAndAndOrdered(~(1 << index))
  3. 确保在取消设置属性标志时能正确清除位
  4. 修改同时应用于生成的头部文件和生成器工具
  5. 若不修复此问题,状态跟踪会错误地设置位而非清除它们

1. Fixed incorrect bitwise AND operation in property status tracking
2. Changed `fetchAndAndOrdered(1 << index)` to `fetchAndAndOrdered(~(1
<< index))`
3. This ensures proper bit clearing when unsetting property flags
4. The change was made in both the generated header and the generator
tool
5. Without this fix, status tracking would incorrectly set bits instead
of clearing them

fix: 修正 dconfig 状态跟踪中的位操作

1. 修复了属性状态跟踪中错误的位与操作
2. 将 `fetchAndAndOrdered(1 << index)` 改为 `fetchAndAndOrdered(~(1
<< index))`
3. 确保在取消设置属性标志时能正确清除位
4. 修改同时应用于生成的头部文件和生成器工具
5. 若不修复此问题,状态跟踪会错误地设置位而非清除它们
@18202781743 18202781743 requested review from BLumia, mhduiy and zccrs May 8, 2025 08:59
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request May 8, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#472
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. 代码注释

    • dconfig_org_deepin_dtk_preference.hpp文件中,生成时间的注释应该更新为最新的生成时间,以反映最新的修改。
  2. 逻辑错误

    • dconfig_org_deepin_dtk_preference.hpp文件中,fetchAndAndOrdered函数的参数从1 << (index - 0)更改为~(1 << (index - 0))。这可能是为了实现相反的逻辑,即当onfalse时,清除对应位置的位。但是,需要确认这一更改是否符合预期的业务逻辑。
  3. 代码风格

    • tools/dconfig2cpp/main.cpp文件中,生成的代码风格应该保持一致,例如,if (on)else语句的缩进应该保持一致。
  4. 代码可读性

    • tools/dconfig2cpp/main.cpp文件中,生成的代码应该有适当的注释,解释每个步骤的目的,以提高代码的可读性。
  5. 性能考虑

    • 如果fetchAndAndOrdered函数的调用频率很高,考虑是否有必要优化这些操作,例如,是否可以通过批量操作来减少对原子操作的依赖。
  6. 安全性

    • 确保所有对m_propertySetStatus0等成员变量的操作都是线程安全的,特别是在多线程环境下。
  7. 错误处理

    • 如果index的值不在预期的范围内(例如,小于0或大于某个最大值),应该添加相应的错误处理逻辑,以避免潜在的运行时错误。

综上所述,代码的更改看起来是为了实现特定的逻辑,但是需要确保这一更改是经过充分测试的,并且符合项目的整体设计和需求。同时,代码的注释、风格和可读性也需要保持一致,以提高代码的可维护性。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, zccrs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented May 8, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 579d86a into linuxdeepin:master May 8, 2025
45 of 49 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6core that referenced this pull request May 8, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants