mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-27 02:56:01 +01:00
CP-36392: Cast operands of divisions to not lose precision
Cast to `decimal` or `float` to keep floating-point precision Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
dcbaf5d1a4
commit
db2c00d54d
@ -1500,7 +1500,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
if (this.Size.Height >= (displayBorder ? this.DesktopSize.Height + BORDER_PADDING + BORDER_PADDING : DesktopSize.Height))
|
||||
{
|
||||
this.dy = (this.Size.Height - this.DesktopSize.Height) / 2;
|
||||
this.dy = ((float) this.Size.Height - this.DesktopSize.Height) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1518,7 +1518,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
if (this.Size.Width >= (displayBorder ? this.DesktopSize.Width + BORDER_PADDING + BORDER_PADDING : DesktopSize.Width))
|
||||
{
|
||||
this.dx = (this.Size.Width - this.DesktopSize.Width) / 2;
|
||||
this.dx = ((float) this.Size.Width - this.DesktopSize.Width) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ namespace XenAdmin.Controls
|
||||
}
|
||||
case VerticalAlignment.Middle:
|
||||
{
|
||||
Y = (this.Height - this.Padding.Vertical) / 2;
|
||||
Y = ((float) this.Height - this.Padding.Vertical) / 2;
|
||||
break;
|
||||
}
|
||||
case VerticalAlignment.Bottom:
|
||||
|
@ -2498,7 +2498,7 @@ namespace XenAdmin.Controls.XenSearch
|
||||
if (intQuery == null)
|
||||
return;
|
||||
|
||||
queryElement.numericUpDown.Value = intQuery.query / multiplier;
|
||||
queryElement.numericUpDown.Value = (decimal) intQuery.query / multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,13 +213,12 @@ namespace XenAdmin.Dialogs
|
||||
into g
|
||||
select new { ExpiryDate = g.Key, Hosts = g };
|
||||
|
||||
expiryGroups = expiryGroups.OrderBy(g => g.ExpiryDate).ToList();
|
||||
|
||||
if (expiryGroups.Count() <= 1)
|
||||
return false;
|
||||
|
||||
if ((expiryGroups.ElementAt(1).ExpiryDate - expiryGroups.ElementAt(0).ExpiryDate).TotalDays > 30)
|
||||
return true;
|
||||
if(expiryGroups.Count() > 1)
|
||||
{
|
||||
expiryGroups.OrderBy(g => g.ExpiryDate);
|
||||
if ((expiryGroups.ElementAt(1).ExpiryDate - expiryGroups.ElementAt(0).ExpiryDate).TotalDays > 30)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace XenAdmin.Dialogs.OptionsPages
|
||||
log.Warn("Could not unprotect internet proxy password.", e);
|
||||
}
|
||||
|
||||
ConnectionTimeoutNud.Value = Properties.Settings.Default.ConnectionTimeout / 1000;
|
||||
ConnectionTimeoutNud.Value = (decimal) Properties.Settings.Default.ConnectionTimeout / 1000;
|
||||
|
||||
eventsDisabled = false;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ namespace XenAdmin.SettingsPanels
|
||||
Host host = (Host)_XenObject;
|
||||
Host_metrics metrics = host.Connection.Resolve(host.metrics);
|
||||
if (metrics != null)
|
||||
nudMemoryUsage.Maximum = metrics.memory_total / (1024 * 1024);
|
||||
nudMemoryUsage.Maximum = (decimal) metrics.memory_total / (1024 * 1024);
|
||||
}
|
||||
|
||||
Repopulate();
|
||||
|
@ -67,7 +67,7 @@ namespace XenAdmin.Actions
|
||||
{
|
||||
if (startupOptions != null)
|
||||
{
|
||||
double increment = 10 / Math.Max(startupOptions.Count, 1);
|
||||
double increment = 10.0 / Math.Max(startupOptions.Count, 1);
|
||||
int i = 0;
|
||||
// First set any VM restart priorities supplied
|
||||
foreach (VM vm in startupOptions.Keys)
|
||||
|
Loading…
Reference in New Issue
Block a user