Given the perverse way that strided works, if
there is only one element in the range, it must also coincide with the specified stride. The existing code assumes that the stride starts at start ( which is the expected and most useful behavior). Signed-off-by: dr scofield (aka dirk husemann) <drscofield@xyzzyxyzzy.net>0.6.8-post-fixes
parent
77f5e41631
commit
a43706862c
|
@ -4999,6 +4999,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (end > src.Length)
|
if (end > src.Length)
|
||||||
end = src.Length;
|
end = src.Length;
|
||||||
|
|
||||||
|
if (stride == 0)
|
||||||
|
stride = 1;
|
||||||
|
|
||||||
// There may be one or two ranges to be considered
|
// There may be one or two ranges to be considered
|
||||||
|
|
||||||
if (start != end)
|
if (start != end)
|
||||||
|
@ -5025,9 +5028,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// A negative stride reverses the direction of the
|
// A negative stride reverses the direction of the
|
||||||
// scan producing an inverted list as a result.
|
// scan producing an inverted list as a result.
|
||||||
|
|
||||||
if (stride == 0)
|
|
||||||
stride = 1;
|
|
||||||
|
|
||||||
if (stride > 0)
|
if (stride > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < src.Length; i += stride)
|
for (int i = 0; i < src.Length; i += stride)
|
||||||
|
@ -5050,9 +5050,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (start%stride == 0)
|
||||||
{
|
{
|
||||||
result.Add(src.Data[start]);
|
result.Add(src.Data[start]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue