aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDr Scofield2008-05-30 07:38:45 +0000
committerDr Scofield2008-05-30 07:38:45 +0000
commit5b0d47dddb4d48abf0c9b6dfbed4f70718fcdf7c (patch)
treedd597df16110e0ebacff9e54163b15a0392246a4 /OpenSim
parent* Added helper method to the Sun module to Get the Linden hour based on the m... (diff)
downloadopensim-SC_OLD-5b0d47dddb4d48abf0c9b6dfbed4f70718fcdf7c.zip
opensim-SC_OLD-5b0d47dddb4d48abf0c9b6dfbed4f70718fcdf7c.tar.gz
opensim-SC_OLD-5b0d47dddb4d48abf0c9b6dfbed4f70718fcdf7c.tar.bz2
opensim-SC_OLD-5b0d47dddb4d48abf0c9b6dfbed4f70718fcdf7c.tar.xz
thanks krtaylor for a
Patch to cleanup some incorrect parsing, boundry conditions and error checking in the llGetNotecardLine and llGetNumberOfNotecardLines functions.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs35
1 files changed, 18 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 9a2d240..33aa905 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -3827,7 +3827,11 @@ namespace OpenSim.Region.ScriptEngine.Common
3827 // once it is implemented - krtaylor 3827 // once it is implemented - krtaylor
3828 3828
3829 String[] notecardLines = GetNotecardLines(name); 3829 String[] notecardLines = GetNotecardLines(name);
3830 if (!String.IsNullOrEmpty(notecardLines[0])) 3830
3831 line--; // array starts at 0
3832 if ((!String.IsNullOrEmpty(notecardLines[0])) &&
3833 (line >= 0) &&
3834 (line < notecardLines.Length))
3831 { 3835 {
3832 return notecardLines[line]; 3836 return notecardLines[line];
3833 } 3837 }
@@ -3858,7 +3862,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3858 { 3862 {
3859 // good, we have the notecard data as a string 3863 // good, we have the notecard data as a string
3860 // now parse the text lines using the Linden Text delimiters 3864 // now parse the text lines using the Linden Text delimiters
3861 notecardIndex = dataString.IndexOf("}\n"); 3865 notecardIndex = dataString.IndexOf("}\nText length ");
3862 if (notecardIndex > 0) 3866 if (notecardIndex > 0)
3863 { 3867 {
3864 notecardIndex = notecardIndex + 2; //get past delimiter 3868 notecardIndex = notecardIndex + 2; //get past delimiter
@@ -3867,23 +3871,20 @@ namespace OpenSim.Region.ScriptEngine.Common
3867 { 3871 {
3868 // Finally got to the first line of the notecard 3872 // Finally got to the first line of the notecard
3869 // now find the end of the notecard text delimited by }<LF> 3873 // now find the end of the notecard text delimited by }<LF>
3870 // parse the lines, delimited by <LF> 3874 // parse the lines, delimited by <LF>
3871 char[] delimChar = { '\n' }; 3875 notecardIndex = dataString.IndexOf("\n", notecardIndex);
3872 int notecardEof = dataString.IndexOf("}\n", notecardIndex); 3876 notecardIndex++; // get past delimiter
3873 if (notecardEof > 0)
3874 {
3875 int notecardLength = notecardEof - notecardIndex - 1;
3876 notecardIndex = dataString.IndexOf("\n", notecardIndex);
3877 notecardIndex++; // get past delimiter
3878 3877
3879 // create new string to parse that only consists of the actual lines in the asset 3878 int notecardLength = dataString.Length - notecardIndex - 3;
3880 Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength);
3881 String notecardString = new String(notecardCharArray);
3882 3879
3883 // split the lines of the notecard into separate strings 3880 // create new string to parse that only consists of the actual lines in the asset
3884 notecardLines = notecardString.Split(delimChar); 3881 Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength);
3885 return notecardLines; 3882 String notecardString = new String(notecardCharArray);
3886 } 3883
3884 // split the lines of the notecard into separate strings
3885 char[] delimChar = { '\n' };
3886 notecardLines = notecardString.Split(delimChar);
3887 return notecardLines;
3887 } 3888 }
3888 } 3889 }
3889 } 3890 }