ICU-8854 Result of integer multiplication cast to long after
multiplication. Casting should be done before multiplication to avoid overflow. X-SVN-Rev: 30837
This commit is contained in:
parent
7a58e117d9
commit
0c1d2e9452
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -692,7 +692,7 @@ public class CalendarAstronomer {
|
||||
// Make a rough guess: 6am or 6pm local time on the current day
|
||||
long noon = ((time + fGmtOffset)/DAY_MS)*DAY_MS - fGmtOffset + 12*HOUR_MS;
|
||||
|
||||
setTime(noon + (long)((rise ? -6 : 6) * HOUR_MS));
|
||||
setTime(noon + (rise ? -6L : 6L) * HOUR_MS);
|
||||
|
||||
long t = riseOrSet(new CoordFunc() {
|
||||
public Equatorial eval() { return getSunPosition(); }
|
||||
|
@ -649,7 +649,7 @@ public class TimeZoneNamesImpl extends TimeZoneNames {
|
||||
}
|
||||
|
||||
long date = Grego.fieldsToDay(year, month - 1, day) * Grego.MILLIS_PER_DAY
|
||||
+ hour * Grego.MILLIS_PER_HOUR + min * Grego.MILLIS_PER_MINUTE;
|
||||
+ (long)hour * Grego.MILLIS_PER_HOUR + (long)min * Grego.MILLIS_PER_MINUTE;
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
@ -2706,7 +2706,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
if (newHour < 0) {
|
||||
newHour += max + 1;
|
||||
}
|
||||
setTimeInMillis(start + ONE_HOUR * (newHour - oldHour));
|
||||
setTimeInMillis(start + ONE_HOUR * ((long)newHour - oldHour));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5497,7 +5497,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
return (int)(numerator / denominator);
|
||||
}
|
||||
int quotient = (int)(((numerator + 1) / denominator) - 1);
|
||||
remainder[0] = (int)(numerator - (quotient * denominator));
|
||||
remainder[0] = (int)(numerator - ((long)quotient * denominator));
|
||||
return quotient;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user