From 571becefb652869fa844188cadf8aca1fea774ab Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Nov 2010 23:31:29 +0100 Subject: Fix some crashes caused by the addition of the CreatorData column --- .../InventoryAccess/InventoryAccessModule.cs | 6 ++++++ .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2e3db48..22da665 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -436,9 +436,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item = new InventoryItemBase(); // Can't know creator is the same, so null it in inventory if (objlist.Count > 1) + { item.CreatorId = UUID.Zero.ToString(); + item.CreatorData = String.Empty; + } else + { item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); + item.CreatorData = objlist[0].RootPart.CreatorData; + } item.ID = UUID.Random(); item.InvType = (int)InventoryType.Object; item.Folder = folder.ID; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1ba28dc..7e9224d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10177,6 +10177,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (str2 == String.Empty) return str1; + int len = str2.Length; + if ((len % 4) != 0) // LL is EVIL!!!! + { + while (str2.EndsWith("=")) + str2 = str2.Substring(0, str2.Length - 1); + + len = str2.Length; + int mod = len % 4; + + if (mod == 1) + str2 = str2.Substring(0, str2.Length - 1); + else if (mod == 2) + str2 += "=="; + else if (mod == 3) + str2 += "="; + } + byte[] data1; byte[] data2; try @@ -10200,7 +10217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { while (pos < data1.Length) { - int len = data1.Length - pos; + len = data1.Length - pos; if (len > data2.Length) len = data2.Length; -- cgit v1.1