ScriptEngine/Shared: Fix bug 5473 (v2).
parent
bdd7849094
commit
a2c19847b4
|
@ -1536,6 +1536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
public struct LSLInteger
|
public struct LSLInteger
|
||||||
{
|
{
|
||||||
public int value;
|
public int value;
|
||||||
|
private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)");
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public LSLInteger(int i)
|
public LSLInteger(int i)
|
||||||
|
@ -1555,9 +1556,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public LSLInteger(string s)
|
public LSLInteger(string s)
|
||||||
{
|
{
|
||||||
Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)");
|
Match m = castRegex.Match(s);
|
||||||
Match m = r.Match(s);
|
|
||||||
string v = m.Groups[0].Value;
|
string v = m.Groups[0].Value;
|
||||||
|
// Leading plus sign is allowed, but ignored
|
||||||
|
v = v.Replace("+", "");
|
||||||
|
|
||||||
if (v == String.Empty)
|
if (v == String.Empty)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue