Skip to content

Fix macOS compile of scorecomp.cpp: cast size_t to uint64_t for TextStream#33988

Merged
RomanPudashkin merged 1 commit into
musescore:mainfrom
manolo:fix/scorecomp-textstream-macos
Jun 29, 2026
Merged

Fix macOS compile of scorecomp.cpp: cast size_t to uint64_t for TextStream#33988
RomanPudashkin merged 1 commit into
musescore:mainfrom
manolo:fix/scorecomp-textstream-macos

Conversation

@manolo

@manolo manolo commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Resolves: #33987

ScoreComp::compareFiles writes size_t diff-header values into a muse::TextStream, which has no size_t overload, so on macOS the call is ambiguous and the unit tests fail to compile. Cast the four values to uint64_t at the call sites. No behaviour change (on Linux it already resolved to the uint64_t overload).

  • I signed the CLA (regular contributor)
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable). Not applicable: compile-only fix; the existing engraving tests now build on macOS.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f45caf84-ad63-45d4-98db-58612d7ea55a

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca304d and e2e1470.

📒 Files selected for processing (1)
  • src/engraving/tests/utils/scorecomp.cpp

📝 Walkthrough

Walkthrough

In ScoreComp::compareFiles, the unified-diff hunk header output was updated to explicitly cast headerStart1, headerStart2, count1, and count2 to uint64_t via static_cast<uint64_t> when streaming them. The conditional logic for including the optional ,<count> suffixes is unchanged.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: fixing the macOS compile issue by casting scorecomp.cpp values to uint64_t.
Description check ✅ Passed The description matches the template well, includes the issue reference, summary, and completed checklist items.
Linked Issues check ✅ Passed The change addresses #33987 by resolving the macOS TextStream ambiguity in scorecomp.cpp with the expected minimal cast fix.
Out of Scope Changes check ✅ Passed The diff is limited to the reported compile fix in scorecomp.cpp and adds no unrelated changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped musescore/muse_framework.git.


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.

❤️ Share

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

@rpatters1

rpatters1 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

In my opinion, this PR in muse is a more comprehensive fix and will get rid of the need for ugly casting in << sequences.

@RomanPudashkin

Copy link
Copy Markdown
Contributor

Merging this PR as a temporary solution (until Casper's PR is merged)

@RomanPudashkin RomanPudashkin merged commit ac11168 into musescore:main Jun 29, 2026
15 checks passed
@manolo manolo deleted the fix/scorecomp-textstream-macos branch June 30, 2026 12:16
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.

Unit tests fail to compile on macOS: ambiguous TextStream::operator<< in scorecomp.cpp

4 participants