Skip to content
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

Resolved pedantic warnings; fixed Retina images #79

Merged
merged 2 commits into from
Mar 26, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions SMCalloutView.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ - (UIView *)subtitleViewOrDefault {

- (SMCalloutBackgroundView *)backgroundView {
// create our default background on first access only if it's nil, since you might have set your own background anyway.
return _backgroundView ?: (_backgroundView = [self defaultBackgroundView]);
return _backgroundView ? _backgroundView : (_backgroundView = [self defaultBackgroundView]);
Copy link
Owner

Choose a reason for hiding this comment

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

Interesting; the ?: operator causes a warning?

Copy link
Owner

Choose a reason for hiding this comment

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

Yep just reproduced it. That sucks, I love that operator! Oh well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do too… :-\

}

- (SMCalloutBackgroundView *)defaultBackgroundView {
Expand Down Expand Up @@ -159,6 +159,9 @@ - (CGFloat)leftAccessoryVerticalMargin {
return 0;
}

#pragma clang diagnostic push
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of this, could you change MIN to fminf? I didn't realize MIN and MAX were uncool now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the compiler is pedantic, it’s really pedantic. The problem is that MIN() and MAX() are implemented using the ({…}) GNU extension.

#pragma clang diagnostic ignored "-Wgnu-statement-expression"

- (CGFloat)leftAccessoryHorizontalMargin {
return MIN(self.leftAccessoryVerticalMargin, TITLE_HMARGIN);
}
Expand All @@ -174,6 +177,8 @@ - (CGFloat)rightAccessoryHorizontalMargin {
return MIN(self.rightAccessoryVerticalMargin, TITLE_HMARGIN);
}

#pragma clang diagnostic pop

- (CGFloat)innerContentMarginLeft {
if (self.leftAccessoryView)
return self.leftAccessoryHorizontalMargin + self.leftAccessoryView.frameWidth + TITLE_HMARGIN;
Expand Down Expand Up @@ -250,7 +255,7 @@ - (CGSize)offsetToContainRect:(CGRect)innerRect inRect:(CGRect)outerRect {
CGFloat nudgeLeft = fminf(0, CGRectGetMaxX(outerRect) - CGRectGetMaxX(innerRect));
CGFloat nudgeTop = fmaxf(0, CGRectGetMinY(outerRect) - CGRectGetMinY(innerRect));
CGFloat nudgeBottom = fminf(0, CGRectGetMaxY(outerRect) - CGRectGetMaxY(innerRect));
return CGSizeMake(nudgeLeft ?: nudgeRight, nudgeTop ?: nudgeBottom);
return CGSizeMake(nudgeLeft ? nudgeLeft : nudgeRight, nudgeTop ? nudgeTop : nudgeBottom);
}

- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated {
Expand Down
Loading