Ticket #16472: 16472.coverity_fixes.patch

File 16472.coverity_fixes.patch, 1.5 KB (added by taylor.smock, 4 years ago)

Fix coverity FB.FE_FLOATING_POINT_EQUALITY and FB.UG_SYNC_SET_UNSYNC_GET

  • src/org/openstreetmap/josm/gui/util/imagery/CameraPlane.java

    diff --git a/src/org/openstreetmap/josm/gui/util/imagery/CameraPlane.java b/src/org/openstreetmap/josm/gui/util/imagery/CameraPlane.java
    index 620f9eb940..249d0ad2b9 100644
    a b public class CameraPlane {  
    182182        setRotation(vec.getPolarAngle(), vec.getAzimuthalAngle());
    183183    }
    184184
    185     public Vector3D getRotation() {
     185    public synchronized Vector3D getRotation() {
    186186        return this.rotation;
    187187    }
    188188
  • src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java

    diff --git a/src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java b/src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java
    index d643ed5152..92d1e05c47 100644
    a b  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.util.imagery;
    33
     4import org.openstreetmap.josm.tools.Utils;
     5
    46/**
    57 * A basic 3D vector class (immutable)
    68 * @author Taylor Smock (documentation, spherical conversions)
    public final class Vector3D {  
    236238    public boolean equals(Object o) {
    237239        if (o instanceof Vector3D) {
    238240            Vector3D other = (Vector3D) o;
    239             return this.x == other.x && this.y == other.y && this.z == other.z;
     241            return Utils.equalsEpsilon(this.x, other.x) && Utils.equalsEpsilon(this.y, other.y) && Utils.equalsEpsilon(this.z, other.z);
    240242        }
    241243        return false;
    242244    }