Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Palo <ville@mono-cvs.ximian.com>2003-05-28 11:51:40 +0400
committerVille Palo <ville@mono-cvs.ximian.com>2003-05-28 11:51:40 +0400
commit4f7e50b2a58f44870a88461ebaf2a8db2d3c9090 (patch)
treebeb8caa74f4b6fc86acb54993b037a3d57987d6c /mcs/class/System.Data/System.Data.SqlTypes
parentc7db5d28576d5daf10320c61561d63629e538ddc (diff)
2003-05-28 Ville Palo <vi64pa@kolumbus.fi>
* SqlDouble.cs: Some fixes. Mostly infinity checks * SqlSingle.cs: tiny fixes. * SqlInt64.cs: checked fix. svn path=/trunk/mcs/; revision=14961
Diffstat (limited to 'mcs/class/System.Data/System.Data.SqlTypes')
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/ChangeLog6
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs38
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs11
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs13
4 files changed, 47 insertions, 21 deletions
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog b/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog
index 934257e0a52..b8d8955a208 100644
--- a/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog
+++ b/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog
@@ -1,5 +1,11 @@
2003-05-28 Ville Palo <vi64pa@kolumbus.fi>
+ * SqlDouble.cs: Some fixes. Mostly infinity checks
+ * SqlSingle.cs: tiny fixes.
+ * SqlInt64.cs: checked fix.
+
+2003-05-28 Ville Palo <vi64pa@kolumbus.fi>
+
* ChangeLog: Added this.
* SqlByte.cs: Fixed checked parts
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs
index 1194898b6b7..79b5540c03d 100644
--- a/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs
@@ -196,16 +196,25 @@ namespace System.Data.SqlTypes
public static SqlDouble operator + (SqlDouble x, SqlDouble y)
{
- checked {
- return new SqlDouble (x.Value + y.Value);
- }
+ double d = 0;
+ d = x.Value + y.Value;
+
+ if (Double.IsInfinity (d))
+ throw new OverflowException ();
+
+ return new SqlDouble (d);
}
public static SqlDouble operator / (SqlDouble x, SqlDouble y)
{
- checked {
- return new SqlDouble (x.Value / y.Value);
+ double d = x.Value / y.Value;
+
+ if (Double.IsInfinity (d)) {
+ if (y.Value == 0)
+ throw new DivideByZeroException ();
}
+
+ return new SqlDouble (d);
}
public static SqlBoolean operator == (SqlDouble x, SqlDouble y)
@@ -258,16 +267,23 @@ namespace System.Data.SqlTypes
public static SqlDouble operator * (SqlDouble x, SqlDouble y)
{
- checked {
- return new SqlDouble (x.Value * y.Value);
- }
+ double d = x.Value * y.Value;
+
+ if (Double.IsInfinity (d))
+ throw new OverflowException ();
+
+ return new SqlDouble (d);
+
}
public static SqlDouble operator - (SqlDouble x, SqlDouble y)
{
- checked {
- return new SqlDouble (x.Value - y.Value);
- }
+ double d = x.Value - y.Value;
+
+ if (Double.IsInfinity (d))
+ throw new OverflowException ();
+
+ return new SqlDouble (d);
}
public static SqlDouble operator - (SqlDouble n)
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs
index bdd80858256..cd2eb7a2380 100644
--- a/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs
@@ -355,12 +355,13 @@ namespace System.Data.SqlTypes
public static explicit operator SqlInt64 (SqlDouble x)
{
- //checked {
- if (x.IsNull)
- return SqlInt64.Null;
- else
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else {
+ checked {
return new SqlInt64 ((long)x.Value);
- //}
+ }
+ }
}
public static explicit operator long (SqlInt64 x)
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs
index 862e0075c8a..0bf216fb053 100644
--- a/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs
@@ -280,12 +280,15 @@ namespace System.Data.SqlTypes
public static explicit operator SqlSingle (SqlDouble x)
{
- checked {
- if (x.IsNull)
- return Null;
+ if (x.IsNull)
+ return Null;
+
+ float f = (float)x.Value;
+
+ if (Single.IsInfinity (f))
+ throw new OverflowException ();
- return new SqlSingle((float)x.Value);
- }
+ return new SqlSingle(f);
}
public static explicit operator float (SqlSingle x)