-
Notifications
You must be signed in to change notification settings - Fork 19
Fix C++20 compiler warnings #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -318,7 +318,8 @@ static JsonObject toObj(const DrawText& text) | |||||||||||||||||||
| } else { | ||||||||||||||||||||
| o["rect"] = toArr(text.rect); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| o["flags"] = text.flags; | ||||||||||||||||||||
| o["alignment"] = static_cast<int>(text.alignment); | ||||||||||||||||||||
| o["textFlags"] = static_cast<int>(text.textFlags); | ||||||||||||||||||||
| o["text"] = text.text; | ||||||||||||||||||||
| return o; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
@@ -334,7 +335,8 @@ static void fromObj(const JsonObject& obj, DrawText& text) | |||||||||||||||||||
| fromArr(obj["rect"].toArray(), text.rect); | ||||||||||||||||||||
| text.mode = DrawText::Rect; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| text.flags = obj["flags"].toInt(); | ||||||||||||||||||||
| text.alignment = static_cast<Alignment>(obj["alignment"].toInt()); | ||||||||||||||||||||
| text.textFlags = static_cast<TextFlags>(obj["textFlags"].toInt()); | ||||||||||||||||||||
|
Comment on lines
+338
to
+339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add legacy Line 338-339 only reads 💡 Proposed compatibility fix- text.alignment = static_cast<Alignment>(obj["alignment"].toInt());
- text.textFlags = static_cast<TextFlags>(obj["textFlags"].toInt());
+ const int legacyFlags = obj.value("flags").toInt();
+ text.alignment = obj.contains("alignment")
+ ? static_cast<Alignment>(obj.value("alignment").toInt())
+ : static_cast<Alignment>(legacyFlags);
+ text.textFlags = obj.contains("textFlags")
+ ? static_cast<TextFlags>(obj.value("textFlags").toInt())
+ : static_cast<TextFlags>(legacyFlags);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| text.text = obj["text"].toString(); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to add a new method here...
and then delete the old one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... but I got the corresponding MSS PR already ready: musescore/MuseScore#33504
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can try to merge them quickly!
But it's better to go with compatibility, especially in simple cases like these. Add something new, mark something old as deprecated, and remove it after syncing.