Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f494523a authored by Mark Harman's avatar Mark Harman
Browse files

Suppress warning "Possibly lossy implicit cast in compound assignment".

parent a5d86a0c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -364,8 +364,11 @@ public class GyroSensor implements SensorEventListener {

            double mag = Math.sqrt(accelVector[0]*accelVector[0] + accelVector[1]*accelVector[1] + accelVector[2]*accelVector[2]);
            if( mag > 1.0e-8 ) {
                //noinspection lossy-conversions
                accelVector[0] /= mag;
                //noinspection lossy-conversions
                accelVector[1] /= mag;
                //noinspection lossy-conversions
                accelVector[2] /= mag;
            }

@@ -404,8 +407,11 @@ public class GyroSensor implements SensorEventListener {
                // Normalize the rotation vector if it's big enough to get the axis
                // (that is, EPSILON should represent your maximum allowable margin of error)
                if( omegaMagnitude > 1.0e-5 ) {
                    //noinspection lossy-conversions
                    axisX /= omegaMagnitude;
                    //noinspection lossy-conversions
                    axisY /= omegaMagnitude;
                    //noinspection lossy-conversions
                    axisZ /= omegaMagnitude;
                }

@@ -549,8 +555,10 @@ public class GyroSensor implements SensorEventListener {
                        Log.d(TAG, "    p_u norm: " + p_ux/p_u_mag + " , " + p_uy/p_u_mag + " , " + p_uz/p_u_mag);
                    }*/
                    // normalise p_u
                    //noinspection lossy-conversions
                    p_ux /= p_u_mag;
                    //p_uy /= p_u_mag; // commented out as not needed
                    //noinspection lossy-conversions
                    p_uz /= p_u_mag;

                    // compute p_u X (0 1 0)
+6 −0
Original line number Diff line number Diff line
@@ -2578,7 +2578,13 @@ public class ImageSaver extends Thread {
            matrix.postScale(scale, scale);
            w0 *= scale;
            h0 *= scale;
            // warning "Possibly lossy implicit cast in compound assignment" suppressed:
            // it's intentional that we multiply int by float, and implicitly cast back to int
            // (the suggested solution is to first cast the float to int before multiplying, which
            // we don't want)
            //noinspection lossy-conversions
            w1 *= scale;
            //noinspection lossy-conversions
            h1 *= scale;
            if( MyDebug.LOG ) {
                Log.d(TAG, "after scaling: w0 = " + w0 + " , h0 = " + h0);
+2 −0
Original line number Diff line number Diff line
@@ -3273,7 +3273,9 @@ public class MyApplicationInterface extends BasicApplicationInterface {
				Log.d(TAG, "width: " + width);*/
            if( paint.getTextAlign() == Paint.Align.CENTER )
                width /= 2.0f;
            //noinspection lossy-conversions
            text_bounds.left -= width;
            //noinspection lossy-conversions
            text_bounds.right -= width;
        }
		/*if( MyDebug.LOG )
+29 −0
Original line number Diff line number Diff line
@@ -2243,6 +2243,11 @@ public class PanoramaProcessor {
                            //y0 *= y_scale;
                            int transformed_x0 = (int)(x0 * Math.cos(angle) - y0 * Math.sin(angle));
                            int transformed_y0 = (int)(x0 * Math.sin(angle) + y0 * Math.cos(angle));
                            // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                            // it's intentional that we multiply int by float, and implicitly cast back to int
                            // (the suggested solution is to first cast the float to int before multiplying, which
                            // we don't want)
                            //noinspection lossy-conversions
                            transformed_y0 *= y_scale;
                            transformed_x0 += c1_x;
                            transformed_y0 += c1_y;
@@ -2428,7 +2433,9 @@ public class PanoramaProcessor {
                Log.d(TAG, "offset_y before rotation: " + offset_y);
                Log.d(TAG, "rotated_centre: " + rotated_centre_x + " , " + rotated_centre_y);
            }
            //noinspection lossy-conversions
            offset_x += centres[0].x - rotated_centre_x;
            //noinspection lossy-conversions
            offset_y += centres[0].y - rotated_centre_y;

        }
@@ -2508,6 +2515,11 @@ public class PanoramaProcessor {
                //int t_cy = (int)(x0 * Math.sin(rotation) + y_scale * y0 * Math.cos(rotation));
                int t_cx = (int)(x0 * Math.cos(rotation) - y0 * Math.sin(rotation));
                int t_cy = (int)(x0 * Math.sin(rotation) + y0 * Math.cos(rotation));
                // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                // it's intentional that we multiply int by float, and implicitly cast back to int
                // (the suggested solution is to first cast the float to int before multiplying, which
                // we don't want)
                //noinspection lossy-conversions
                t_cy *= y_scale;
                t_cx += offset_x;
                t_cy += offset_y;
@@ -2530,7 +2542,13 @@ public class PanoramaProcessor {
                int dir_u_x = 0, dir_u_y = -50;
                if( i == 1 ) {
                    // transform
                    // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                    // it's intentional that we multiply int by float, and implicitly cast back to int
                    // (the suggested solution is to first cast the float to int before multiplying, which
                    // we don't want)
                    //noinspection lossy-conversions
                    dir_r_y *= y_scale;
                    //noinspection lossy-conversions
                    dir_u_y *= y_scale;
                    int n_dir_r_x = (int)(dir_r_x * Math.cos(rotation) - dir_r_y * Math.sin(rotation));
                    int n_dir_r_y = (int)(dir_r_x * Math.sin(rotation) + dir_r_y * Math.cos(rotation));
@@ -2564,6 +2582,11 @@ public class PanoramaProcessor {
                            //t_cy = (int)(cx * Math.sin(rotation) + y_scale * cy * Math.cos(rotation));
                            t_cx = (int)(cx * Math.cos(rotation) - cy * Math.sin(rotation));
                            t_cy = (int)(cx * Math.sin(rotation) + cy * Math.cos(rotation));
                            // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                            // it's intentional that we multiply int by float, and implicitly cast back to int
                            // (the suggested solution is to first cast the float to int before multiplying, which
                            // we don't want)
                            //noinspection lossy-conversions
                            t_cy *= y_scale;
                            t_cx += offset_x;
                            t_cy += offset_y;
@@ -3289,7 +3312,13 @@ public class PanoramaProcessor {
                }
                if( MyDebug.LOG )
                    Log.d(TAG, "### time after auto-alignment for " + i + "th bitmap: " + (System.currentTimeMillis() - time_s));
                // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                // it's intentional that we multiply int by float, and implicitly cast back to int
                // (the suggested solution is to first cast the float to int before multiplying, which
                // we don't want)
                //noinspection lossy-conversions
                this_align_x *= align_downsample;
                //noinspection lossy-conversions
                this_align_y *= align_downsample;
                for(Bitmap alignment_bitmap : alignment_bitmaps) {
                    alignment_bitmap.recycle();
+10 −0
Original line number Diff line number Diff line
@@ -7683,6 +7683,11 @@ public class CameraController2 extends CameraController {
                        double this_scale = scale;
                        for(int j=i;j<n_half_images-1;j++)
                            this_scale *= scale;
                        // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                        // it's intentional that we divide long by double, and implicitly cast back to long
                        // (the suggested solution is to first cast the double to long before dividing, which
                        // we don't want)
                        //noinspection lossy-conversions
                        exposure_time /= this_scale;
                        if( exposure_time < min_exposure_time )
                            exposure_time = min_exposure_time;
@@ -7711,6 +7716,11 @@ public class CameraController2 extends CameraController {
                        double this_scale = scale;
                        for(int j=0;j<i;j++)
                            this_scale *= scale;
                        // warning "Possibly lossy implicit cast in compound assignment" suppressed:
                        // it's intentional that we multiply long by double, and implicitly cast back to long
                        // (the suggested solution is to first cast the double to long before multiplying, which
                        // we don't want)
                        //noinspection lossy-conversions
                        exposure_time *= this_scale;
                        if( exposure_time > max_exposure_time )
                            exposure_time = max_exposure_time;