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

Fixed Coverity error UNINTENDED_INTEGER_DIVISION #8

Merged
merged 1 commit into from
May 13, 2016

Conversation

Letme
Copy link
Contributor

@Letme Letme commented May 13, 2016

Coverity Scan found an error:

CID 105392 (#1 of 1): Result is not floating-point
(UNINTENDED_INTEGER_DIVISION)integer_division: Dividing integer
expressions width and 2 * squareSize, and then converting the integer
quotient to type double. Any remainder, or fractional part of the
quotient, is ignored.

The solution is simply to cast one of the arguments to double. This
commit does that.


This change is Reviewable

Coverity Scan found an error:
```
CID 105392 (athkalia#1 of 1): Result is not floating-point
(UNINTENDED_INTEGER_DIVISION)integer_division: Dividing integer
expressions width and 2 * squareSize, and then converting the integer
quotient to type double. Any remainder, or fractional part of the
quotient, is ignored.
```

The solution is simply to cast one of the arguments to double. This
commit does that.
@@ -38,7 +38,7 @@ private void cacheDimensions(int width, int height) {
protected Path buildClippingPath() {

Path squaresPath = new Path();
int numSquares = (int) Math.ceil(width / (2 * squareSize));
int numSquares = (int) Math.ceil((double) width / (2 * squareSize));
Copy link
Owner

Choose a reason for hiding this comment

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

Did you test the SquareClippingTransform sample demo page after doing this change ? Is it working properly ?

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 went through the application and there was no difference.

@JorgeCastilloPrz JorgeCastilloPrz merged commit dcae693 into JorgeCastilloPrz:master May 13, 2016
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.

None yet

2 participants