Fir MSVC compiler warnings#33772
Conversation
Jojo-Schmitz
commented
Jun 11, 2026
- reg.: 'initializing': conversion from 'size_t' to 'int', possible loss of data (C4267)
- reg.: potentially uninitialized local variable 'actualOrientation' used (C4701)
reg.: 'initializing': conversion from 'size_t' to 'int', possible loss of data (C4267)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR changes totInstrumentCount in formattedSharedStaffLabel from int to size_t to match vector::size(), and adds a default case to the SharedLabelOrientation switch that asserts/logs and assigns actualOrientation = SharedLabelOrientation::VOICE to ensure it is always initialized. 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsLinked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/engraving/rendering/score/systemheaderlayout.cpp (1)
1175-1177: ⚡ Quick winConsider explicitly setting a valid fallback value in the default case.
The default case correctly prevents the uninitialized variable warning. However, setting
actualOrientation = orientationwhenorientationcontains an invalid enum value (possible via thePropertyValue::fromQVariantconversion shown in context snippet 3) propagates that invalid value downstream. While the current code at line 1180 safely handles this by treating invalid values as the VOICE case, explicitly setting a known-valid fallback would be more robust and self-documenting:default: // should not happen, but don't leave actualOrientation uninitialized actualOrientation = SharedLabelOrientation::VOICE; break;This makes the fallback behavior explicit and prevents potential issues if future code assumes
actualOrientationalways contains a valid enumerator.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/engraving/rendering/score/systemheaderlayout.cpp` around lines 1175 - 1177, The default branch in systemheaderlayout.cpp currently assigns actualOrientation = orientation which can propagate an invalid enum value; change the default case to assign a known-valid enumerator (e.g. SharedLabelOrientation::VOICE) so actualOrientation always holds a valid SharedLabelOrientation; update the switch/default that sets actualOrientation (referencing actualOrientation, orientation, and the SharedLabelOrientation enum) to use this explicit fallback and retain the break.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/engraving/rendering/score/systemheaderlayout.cpp`:
- Around line 1175-1177: The default branch in systemheaderlayout.cpp currently
assigns actualOrientation = orientation which can propagate an invalid enum
value; change the default case to assign a known-valid enumerator (e.g.
SharedLabelOrientation::VOICE) so actualOrientation always holds a valid
SharedLabelOrientation; update the switch/default that sets actualOrientation
(referencing actualOrientation, orientation, and the SharedLabelOrientation
enum) to use this explicit fallback and retain the break.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 90cba1bb-ce11-42e7-97a6-bff5eecaf30e
📒 Files selected for processing (1)
src/engraving/rendering/score/systemheaderlayout.cpp
reg.: potentially uninitialized local variable 'actualOrientation' used (C4701)
a58d94f to
a107271
Compare