From a533db7e279d533a6858a194fef5d913553c1bf9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 23 Aug 2012 22:30:14 +0100 Subject: [PATCH 01/11] Add an [HGAssetService] section to SQLiteStandalone.ini with the same connection string as [AssetService]. This is necessary because commit 8131a24 (Tue Mar 27 10:08:13 2012) started passing the config section name rather than hardcoding "AssetService" This meant that the HG external-facing asset service tried to read ConnectionString from [HGAssetService] rather than [AssetService]. On SQLite, not finding this meant that it fell back to [DatabaseService], which is set for OpenSim.db rather than Asset.db. Therefore, all external asset requests returned null. Solution taken here is to create an [HGAssetService] section with the same ConnectionString as [AssetService]. This bug does not affect normal MySQL/MSSQL config since they use the [DatabaseService] connection string anyway. Addresses http://opensimulator.org/mantis/view.php?id=6200, many thanks to DanBanner for identifying the exact problem commit which was very helpful. This was a regression from OpenSimulator 0.7.3.1 which did not contain this bug. --- bin/config-include/storage/SQLiteStandalone.ini | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/config-include/storage/SQLiteStandalone.ini b/bin/config-include/storage/SQLiteStandalone.ini index c1de71aa21..67d98fff69 100644 --- a/bin/config-include/storage/SQLiteStandalone.ini +++ b/bin/config-include/storage/SQLiteStandalone.ini @@ -7,6 +7,16 @@ [AssetService] ConnectionString = "URI=file:Asset.db,version=3" +; The HGAssetService section controls the connection given to the AssetService in a Hypergrid configuration. +; This has to be separate from [AssetService] because the Hypergrid facing connector uses [HGAssetService] for its config data instead. +; However, the internal asset service will still use the [AssetService] section. +; Therefore, you will almost certainly want the ConnectionString in [HGAssetService] to be the same as in [AssetService] +; so that they both access the same database. +; This issue does not apply to normal MySQL/MSSQL configurations, since by default they use the settings in [DatabaseService] and +; do not have separate connection strings for different services. +[HGAssetService] + ConnectionString = "URI=file:Asset.db,version=3" + [InventoryService] ;ConnectionString = "URI=file:inventory.db,version=3" ; if you have a legacy inventory store use the connection string below From aede42b87559aa1f8f3197b53b9bf5c2b547701a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 23 Aug 2012 23:13:53 +0100 Subject: [PATCH 02/11] If a script state save fails for some reason on shutdown/region removal, get xengine to spit out some useful information and continue to save other script states --- .../Region/ScriptEngine/XEngine/XEngine.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 53f899abcd..5a3f002c53 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -589,7 +589,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (m_Assemblies.ContainsKey(instance.AssetID)) { string assembly = m_Assemblies[instance.AssetID]; - instance.SaveState(assembly); + + try + { + instance.SaveState(assembly); + } + catch (Exception e) + { + m_log.Error( + string.Format( + "[XEngine]: Failed final state save for script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ", + instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name) + , e); + } } // Clear the event queue and abort the instance thread @@ -707,7 +719,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine assembly = m_Assemblies[i.AssetID]; } - i.SaveState(assembly); + try + { + i.SaveState(assembly); + } + catch (Exception e) + { + m_log.Error( + string.Format( + "[XEngine]: Failed to save state of script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ", + i.PrimName, i.ScriptName, i.ItemID, i.ObjectID, World.Name) + , e); + } } instances.Clear(); From 4f3fabae5bec8a71f9953ef9f4c247e086e4757f Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Thu, 9 Aug 2012 18:03:26 +0100 Subject: [PATCH 03/11] Adds osGetHealth. Returns the amount of health (in an integer) that an avatar has left in the scene. If an avatar is not found or safe is enabled on a region, -1 is returned. Example usage: default { touch_end(integer _t) { key agentID = llDetectedKey(0); osCauseDamage(agentID, 50); llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left."); } } --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 7 ++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1e8b51be80..3d233d7443 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2895,6 +2895,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } }); } + + public LSL_Float osGetHealth(string avatar) + { + CheckThreatLevel(ThreatLevel.None, "osGetHealth"); + m_host.AddScriptLPS(1); + + UUID avatarId = new UUID(avatar); + Vector3 pos = m_host.GetWorldPosition(); + + LSL_Float health = new LSL_Float(-1); + ScenePresence presence = World.GetScenePresence(avatarId); + if (presence != null) + { + LandData land = World.GetLandData((float)pos.X, (float)pos.Y); + if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) + { + health = presence.Health; + } + } + return health; + } public void osCauseDamage(string avatar, double damage) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f000a3e77..9ad1c22bd1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -258,6 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces int osGetSimulatorMemory(); void osKickAvatar(string FirstName,string SurName,string alert); void osSetSpeed(string UUID, LSL_Float SpeedModifier); + LSL_Float osGetHealth(string avatar); void osCauseHealing(string avatar, double healing); void osCauseDamage(string avatar, double damage); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 94405d2b5d..e9131e4655 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -865,7 +865,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); } - + + public LSL_Float osGetHealth(string avatar) + { + return m_OSSL_Functions.osGetHealth(avatar); + } + public void osCauseDamage(string avatar, double damage) { m_OSSL_Functions.osCauseDamage(avatar, damage); From a3cbda0d74a14c05acf04adaaa5b9ff30c6d9fa5 Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Fri, 10 Aug 2012 01:29:41 +0100 Subject: [PATCH 04/11] Removed land checking as suggested by SignpostMarv. Now whatever remaining health the avatar has is displayed (float). This will be 100% (100.000000) if no damage has occurred (as what the viewer should really be seeing anyway). Returns -1.000000 if the avatar is not found. --- .../Shared/Api/Implementation/OSSL_Api.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3d233d7443..5e7c2d98ab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2901,19 +2901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetHealth"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); - Vector3 pos = m_host.GetWorldPosition(); - LSL_Float health = new LSL_Float(-1); - ScenePresence presence = World.GetScenePresence(avatarId); - if (presence != null) - { - LandData land = World.GetLandData((float)pos.X, (float)pos.Y); - if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) - { - health = presence.Health; - } - } + ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + if (presence != null) health = presence.Health; return health; } From c55768466626336849c650349b335365c41359e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Aug 2012 00:15:30 +0100 Subject: [PATCH 05/11] Fix bad child prim permissions that can make objects change perms after rezzing Port from Avination --- .../Framework/Scenes/Scene.Inventory.cs | 3 +++ .../Framework/Scenes/SceneObjectGroup.cs | 18 +++++++++++++--- .../Framework/Scenes/SceneObjectPart.cs | 21 +++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7e31d60650..675c64dabe 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1943,6 +1943,9 @@ namespace OpenSim.Region.Framework.Scenes deleteIDs.Add(localID); deleteGroups.Add(grp); + // If child prims have invalid perms, fix them + grp.AdjustChildPrimPermissions(); + if (remoteClient == null) { // Autoreturn has a null client. Nothing else does. So diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f6c725ba50..b4a155e940 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2131,6 +2131,9 @@ namespace OpenSim.Region.Framework.Scenes // Can't do this yet since backup still makes use of the root part without any synchronization // objectGroup.m_rootPart = null; + // If linking prims with different permissions, fix them + AdjustChildPrimPermissions(); + AttachToBackup(); // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the @@ -2622,12 +2625,21 @@ namespace OpenSim.Region.Framework.Scenes } } + public void AdjustChildPrimPermissions() + { + ForEachPart(part => + { + if (part != RootPart) + part.ClonePermissions(RootPart); + }); + } + public void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF) { - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].UpdatePermissions(AgentID, field, localID, mask, addRemTF); + RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); + + AdjustChildPrimPermissions(); HasGroupChanged = true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2a9ee3a5d4..411dcc774e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3890,6 +3890,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void ClonePermissions(SceneObjectPart source) + { + bool update = false; + + if (BaseMask != source.BaseMask || + OwnerMask != source.OwnerMask || + GroupMask != source.GroupMask || + EveryoneMask != source.EveryoneMask || + NextOwnerMask != source.NextOwnerMask) + update = true; + + BaseMask = source.BaseMask; + OwnerMask = source.OwnerMask; + GroupMask = source.GroupMask; + EveryoneMask = source.EveryoneMask; + NextOwnerMask = source.NextOwnerMask; + + if (update) + SendFullUpdateToAllClients(); + } + public bool IsHingeJoint() { // For now, we use the NINJA naming scheme for identifying joints. From 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 10 Aug 2012 15:58:29 +0100 Subject: [PATCH 06/11] implementing function to allow scripts to self-replicate as if the owner duplicated them, using the same script delay as llRezObject() --- .../Shared/Api/Implementation/OSSL_Api.cs | 50 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 7 +++ .../Shared/Api/Runtime/OSSL_Stub.cs | 5 ++ 3 files changed, 62 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5e7c2d98ab..119c2ac7e8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3344,5 +3344,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } + + public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); + m_host.AddScriptLPS(1); + + Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + Quaternion r = new Quaternion( + (float)rot.x, + (float)rot.y, + (float)rot.z, + (float)rot.s + ); + + Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; + + if (!World.Permissions.CanRezObject( + m_host.ParentGroup.PrimCount, + m_host.OwnerID, + destination + )) + { + OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); + + ScriptSleep(100); + } + else + { + SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( + m_host.ParentGroup.LocalId, + v, + m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), + m_host.OwnerID, + m_host.GroupID, + r + ); + + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( + "object_rez", new Object[] { + new LSL_String( + duplicate.RootPart.UUID.ToString()) }, + new DetectParams[0])); + + ScriptSleep(100); + m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( + "on_rez", new Object[]{ + new LSL_Integer(0)}, + new DetectParams[0])); + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 9ad1c22bd1..8c90df438b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -306,5 +306,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown. LSL_Key osGetRezzingObject(); + + /// + /// Duplicates an object as if the owner duplicated it. + /// + /// + /// + void osRezDuplicate(vector offset, rotation rot); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e9131e4655..9a2f859e23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -955,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetRezzingObject(); } + + public void osRezDuplicate(vector offset, rotation rot) + { + m_OSSL_Functions.osRezDuplicate(offset, rot); + } } } From a08687aef35079f6c2884d3ae6fd8307ca8a6b0d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 01:18:35 +0100 Subject: [PATCH 07/11] Revert "implementing function to allow scripts to self-replicate as if the owner duplicated them, using the same script delay as llRezObject()" This reverts commit 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8. Reverted pending consideration of associated issues. --- .../Shared/Api/Implementation/OSSL_Api.cs | 50 ------------------- .../Shared/Api/Interface/IOSSL_Api.cs | 7 --- .../Shared/Api/Runtime/OSSL_Stub.cs | 5 -- 3 files changed, 62 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 119c2ac7e8..5e7c2d98ab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3344,55 +3344,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } - - public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) - { - CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); - m_host.AddScriptLPS(1); - - Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); - Quaternion r = new Quaternion( - (float)rot.x, - (float)rot.y, - (float)rot.z, - (float)rot.s - ); - - Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; - - if (!World.Permissions.CanRezObject( - m_host.ParentGroup.PrimCount, - m_host.OwnerID, - destination - )) - { - OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); - - ScriptSleep(100); - } - else - { - SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( - m_host.ParentGroup.LocalId, - v, - m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), - m_host.OwnerID, - m_host.GroupID, - r - ); - - m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( - "object_rez", new Object[] { - new LSL_String( - duplicate.RootPart.UUID.ToString()) }, - new DetectParams[0])); - - ScriptSleep(100); - m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( - "on_rez", new Object[]{ - new LSL_Integer(0)}, - new DetectParams[0])); - } - } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 8c90df438b..9ad1c22bd1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -306,12 +306,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown. LSL_Key osGetRezzingObject(); - - /// - /// Duplicates an object as if the owner duplicated it. - /// - /// - /// - void osRezDuplicate(vector offset, rotation rot); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 9a2f859e23..e9131e4655 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -955,10 +955,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetRezzingObject(); } - - public void osRezDuplicate(vector offset, rotation rot) - { - m_OSSL_Functions.osRezDuplicate(offset, rot); - } } } From 632908db9e4810a7f181e23b7188e81ec2f88bc3 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 09:46:41 +0100 Subject: [PATCH 08/11] adding sqlite journal files to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 36a1757338..bf3ac37e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ bin/Debug/*.dll bin/*.dll.mdb bin/*.db +bin/*.db-journal bin/addin-db-* bin/*.dll bin/OpenSim.vshost.exe.config From d188272462f2c8d3e67aead26bb5b15ab243cdab Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:52:30 +0100 Subject: [PATCH 09/11] refactoring using List.ConvertAll --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0d275f7424..a98fb04f2a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5170,17 +5170,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { string ret = String.Empty; - int x = 0; m_host.AddScriptLPS(1); if (src.Data.Length > 0) { - ret = src.Data[x++].ToString(); - for (; x < src.Data.Length; x++) - { - ret += ", "+src.Data[x].ToString(); - } + ret = string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } return ret; From 582a256646d1093b2c8889d89dbaa88f1c5fc81d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:53:53 +0100 Subject: [PATCH 10/11] immediately returning the string.Join operation instead of checking if the list has members --- .../Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a98fb04f2a..bbbc6ccea9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5169,20 +5169,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llList2CSV(LSL_List src) { - string ret = String.Empty; m_host.AddScriptLPS(1); - if (src.Data.Length > 0) - { - ret = string.Join(", ", - (new List(src.Data)).ConvertAll(o => - { - return o.ToString(); - }).ToArray()); - } - - return ret; + return string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } /// From 67477290ad34f7350495c2787022eed5d1d535d8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:56:42 +0100 Subject: [PATCH 11/11] stripping superfluous whitespace Signed-off-by: Melanie --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bbbc6ccea9..2bfb9b3e40 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5165,11 +5165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// separated list. There is a space after /// each comma. /// - public LSL_String llList2CSV(LSL_List src) { - - m_host.AddScriptLPS(1); return string.Join(", ",