Fix llParseString2List bug when separator is longer than 1 character.

0.6.0-stable
Jeff Ames 2008-03-23 00:39:35 +00:00
parent 9a2b289e32
commit 0d43aaa337
1 changed files with 8 additions and 10 deletions

View File

@ -2685,25 +2685,25 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LSL_Types.list ret = new LSL_Types.list(); LSL_Types.list ret = new LSL_Types.list();
object[] delimeters = new object[separators.Length + spacers.Length]; object[] delimiters = new object[separators.Length + spacers.Length];
separators.Data.CopyTo(delimeters, 0); separators.Data.CopyTo(delimiters, 0);
spacers.Data.CopyTo(delimeters, separators.Length); spacers.Data.CopyTo(delimiters, separators.Length);
bool dfound = false; bool dfound = false;
do do
{ {
dfound = false; dfound = false;
int cindex = -1; int cindex = -1;
string cdeli = ""; string cdeli = "";
for (int i = 0; i < delimeters.Length; i++) for (int i = 0; i < delimiters.Length; i++)
{ {
int index = str.IndexOf(delimeters[i].ToString()); int index = str.IndexOf(delimiters[i].ToString());
bool found = index != -1; bool found = index != -1;
if (found) if (found)
{ {
if ((cindex > index) || (cindex == -1)) if ((cindex > index) || (cindex == -1))
{ {
cindex = index; cindex = index;
cdeli = (string)delimeters[i]; cdeli = (string)delimiters[i];
} }
dfound = dfound || found; dfound = dfound || found;
} }
@ -2722,16 +2722,14 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
ret.Add(cdeli); ret.Add(cdeli);
} }
str = str.Substring(cindex + 1); str = str.Substring(cindex + cdeli.Length);
} }
} } while (dfound);
while (dfound);
if (str != "") if (str != "")
{ {
ret.Add(str); ret.Add(str);
} }
return ret; return ret;
} }
public int llOverMyLand(string id) public int llOverMyLand(string id)