Skip to content

[4.7] Fix MSVC compiler warnings#32922

Open
Jojo-Schmitz wants to merge 1 commit intomusescore:4.7from
Jojo-Schmitz:4.7-compiler-warnings
Open

[4.7] Fix MSVC compiler warnings#32922
Jojo-Schmitz wants to merge 1 commit intomusescore:4.7from
Jojo-Schmitz:4.7-compiler-warnings

Conversation

@Jojo-Schmitz
Copy link
Copy Markdown
Contributor

@Jojo-Schmitz Jojo-Schmitz commented Apr 7, 2026

'return': conversion from 'uint32_t' to 'uint8_t'/'uint16_t', possible loss of data (C4244)
and
reg.: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data (C4244)

Summary by CodeRabbit

  • Bug Fixes
    • Corrected MIDI value conversions to preserve velocity precision when translating between formats.
    • Improved scaling and masking for data values, including pitch-bend, ensuring values stay within valid MIDI ranges.
    • Prevented unintended narrowing/truncation of controller values during conversion, maintaining controller data integrity across MIDI formats.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 09456c6e-3850-4329-9795-740ad19b0f12

📥 Commits

Reviewing files that changed from the base of the PR and between ce531f0 and f0c6c4f.

📒 Files selected for processing (1)
  • src/framework/midi/midievent.h

📝 Walkthrough

Walkthrough

Adjusted MIDI event value handling: explicit casts for velocity returns, in-place scaling in data7() with added MIDI1.0 PitchBend (14→7) handling and final 7-bit mask, and widened control-change intermediate type to uint32_t in toMIDI10().

Changes

Cohort / File(s) Summary
MIDI event value handling
src/framework/midi/midievent.h
velocity7() now casts scaled result to uint8_t; velocity16() casts scaled result to uint16_t. data7() applies in-place val = scaleDown(...), adds handling to scale MIDI1.0 PitchBend (14→7), and returns val & 0x7F. toMIDI10() changes controlChanges pair second type from uint8_t to uint32_t to avoid 8-bit narrowing when calling setData(...).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Fix MSVC Compiler warnings #32771 — applies the same midievent.h changes (casts, PitchBend scaling/masking, widening controlChanges pair to uint32_t) to address MSVC narrowing warnings.

Suggested reviewers

  • mike-spa
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description contains the specific compiler warnings being addressed but lacks the structured format required by the template, missing sections like CLA confirmation and commit message details. Restructure the description to follow the template format, including resolved issue reference, checkboxes completion, and clearer problem motivation statement.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective: fixing MSVC compiler warnings, which aligns with the specific C4244 warnings addressed in the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jojo-Schmitz Jojo-Schmitz force-pushed the 4.7-compiler-warnings branch from b2856b6 to 76b238a Compare April 7, 2026 07:35
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 95a4c5e6-604d-4d37-9848-8737a19766ab

📥 Commits

Reviewing files that changed from the base of the PR and between a601bfc and 76b238a.

📒 Files selected for processing (1)
  • src/framework/midi/midievent.h

@Jojo-Schmitz Jojo-Schmitz force-pushed the 4.7-compiler-warnings branch from 76b238a to ce531f0 Compare April 7, 2026 08:33
@Jojo-Schmitz Jojo-Schmitz changed the title Fix MSVC compiler warnings [4.7] Fix MSVC compiler warnings Apr 7, 2026
@Jojo-Schmitz
Copy link
Copy Markdown
Contributor Author

Jojo-Schmitz commented Apr 7, 2026

Counterpart (#32771, commit 4) has just been merged to master

'return': conversion from 'uint32_t' to 'uint8_t'/'uint16_t', possible loss of data (C4244)
and
reg.: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data (C4244)
@Jojo-Schmitz Jojo-Schmitz force-pushed the 4.7-compiler-warnings branch from ce531f0 to f0c6c4f Compare April 10, 2026 12:17
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.

1 participant