-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix some static analysis warnings #1958
Closed
ZevEisenberg
wants to merge
1
commit into
TextureGroup:master
from
ZevEisenberg:chore/zeveisenberg/fix-some-static-analysis-warnings
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2385,7 +2385,7 @@ static void ASTextDrawRun(ASTextLine *line, CTRunRef run, CGContextRef context, | |
if (mode) { // CJK glyph, need rotated | ||
CGFloat ofs = (ascent - descent) * 0.5; | ||
CGFloat w = glyphAdvances[g].width * 0.5; | ||
CGFloat x = x = line.position.x + verticalOffset + glyphPositions[g].y + (ofs - w); | ||
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. This seems good. small diffs are terrific. Would you mind splitting this up? Thanks. |
||
CGFloat x = line.position.x + verticalOffset + glyphPositions[g].y + (ofs - w); | ||
CGFloat y = -line.position.y + size.height - glyphPositions[g].x - (ofs + w); | ||
if (mode == ASTextRunGlyphDrawModeVerticalRotateMove) { | ||
x += w; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
while Xcode may flag this, I think the comment above indicates its intentional.
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 don't believe it is intentional. The stuff about directly clearing the interface bit would be satisfied by
interfaceState & (~ASInterfaceStateVisible)
. The&=
is also leavinginterfaceState
different after the expression is run, but it doesn't matter becauseinterfaceState
is never used again. This code is only working because&=
also returns the value of the newly mutated variable. You couldn't write this code in Swift, because I believe&=
doesn't return anything by default.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.
regardless, since I have no idea, but that seems more in-depth thinking is required than the other one. I think splitting this PR up is best.
For this change, I think I'd want unit tests that ensure the existing behavior persists. I've no idea how much work that would be w/o an expert weighing in on this 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.
Opened a new PR for this. If you still want a unit test after reading my description, I'm happy to add one :)