diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 298d664..461b473 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -1536,6 +1536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1536 | public struct LSLInteger | 1536 | public struct LSLInteger |
1537 | { | 1537 | { |
1538 | public int value; | 1538 | public int value; |
1539 | private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)"); | ||
1539 | 1540 | ||
1540 | #region Constructors | 1541 | #region Constructors |
1541 | public LSLInteger(int i) | 1542 | public LSLInteger(int i) |
@@ -1555,9 +1556,10 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1555 | 1556 | ||
1556 | public LSLInteger(string s) | 1557 | public LSLInteger(string s) |
1557 | { | 1558 | { |
1558 | Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)"); | 1559 | Match m = castRegex.Match(s); |
1559 | Match m = r.Match(s); | ||
1560 | string v = m.Groups[0].Value; | 1560 | string v = m.Groups[0].Value; |
1561 | // Leading plus sign is allowed, but ignored | ||
1562 | v = v.Replace("+", ""); | ||
1561 | 1563 | ||
1562 | if (v == String.Empty) | 1564 | if (v == String.Empty) |
1563 | { | 1565 | { |