Changeset 10316 in josm for trunk/src


Ignore:
Timestamp:
2016-06-02T02:46:59+02:00 (8 years ago)
Author:
Don-vip
Message:

fix coverity 1313942 + 1353522 - Integer handling issues

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r10300 r10316  
    236236                        dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, hn));
    237237                    } else {
    238                         int d;
    239                         try {
    240                             d = (h0-he) * dm / dp;
    241                         } catch (ArithmeticException e) { /* D_p may be zero - nothing wrong with that. */
    242                             d = 0;
    243                         }
     238                        int d = dp == 0 ? 0 : ((h0-he) * dm / dp);
    244239                        dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, h0 - d));
    245240                    }
  • trunk/src/org/openstreetmap/josm/tools/GeoPropertyIndex.java

    r9070 r10316  
    7373
    7474    public static int index(LatLon ll, int level) {
    75         long noParts = 1 << level;
     75        long noParts = 1L << level;
    7676        long x = ((long) ((ll.lon() + 180.0) * noParts / 360.0)) & 1;
    7777        long y = ((long) ((ll.lat() + 90.0) * noParts / 180.0)) & 1;
Note: See TracChangeset for help on using the changeset viewer.