diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index dcf078c86d..222c873f79 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -162,19 +162,19 @@ namespace OpenSim.Framework /// /// The description of the inventory item (must be less than 64 characters) /// + public osUTF8 UTF8Description; public string Description { get { - return m_description; + return UTF8Description.ToString(); } set { - m_description = value; + UTF8Description = new osUTF8(value); } } - protected string m_description = String.Empty; /// /// diff --git a/OpenSim/Framework/InventoryNodeBase.cs b/OpenSim/Framework/InventoryNodeBase.cs index 9ef36b7bde..a95979762c 100644 --- a/OpenSim/Framework/InventoryNodeBase.cs +++ b/OpenSim/Framework/InventoryNodeBase.cs @@ -37,12 +37,13 @@ namespace OpenSim.Framework /// /// The name of the node (64 characters or less) /// + public virtual string Name { - get { return m_name; } - set { m_name = value; } + get { return UTF8Name.ToString(); } + set { UTF8Name = new osUTF8(value); } } - private string m_name = string.Empty; + public osUTF8 UTF8Name; /// /// A UUID containing the ID for the inventory node itself diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3e0741b152..78cd741012 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6314,16 +6314,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddUUID(sop.LastOwnerID); //name - zc.AddShortString(sop.Name, 64); + zc.AddShortLimitedUTF8(sop.osUTF8Name); //Description - zc.AddShortString(sop.Description, 128); + zc.AddShortLimitedUTF8(sop.osUTF8description); // touch name - zc.AddShortString(root.TouchName, 9, 37); + zc.AddShortLimitedUTF8(sop.osUTF8TouchName); // sit name - zc.AddShortString(root.SitName, 9, 37); + zc.AddShortLimitedUTF8(sop.osUTF8SitName); //texture ids block // still not sending, not clear the impact on viewers, if any. @@ -7345,10 +7345,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } //media url - if (part.MediaUrl == null || part.MediaUrl.Length == 0) - zc.AddZeros(1); - else - zc.AddShortString(part.MediaUrl, 255); + zc.AddShortLimitedUTF8(part.osUTFMediaUrl); bool hasps = false; //particle system @@ -7814,11 +7811,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP hasangvel = true; } - byte[] mediaURLBytes = null; - if (part.MediaUrl != null && part.MediaUrl.Length > 1) + if (part.osUTFMediaUrl.Length > 0) { - mediaURLBytes = Util.StringToBytes256(part.MediaUrl); // must be null term - BlockLengh += mediaURLBytes.Length; + BlockLengh += part.osUTFMediaUrl.Length + 1; cflags |= CompressedFlags.MediaURL; hasmediaurl = true; } @@ -7903,7 +7898,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } if (hasmediaurl) { - zc.AddBytes(mediaURLBytes, mediaURLBytes.Length); + zc.AddBytes(part.osUTFMediaUrl.GetArray(), part.osUTFMediaUrl.Length); + zc.AddZeros(1); } if (hasps) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8f981d7e75..d5f7a6052b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -308,12 +308,9 @@ namespace OpenSim.Region.Framework.Scenes private int m_scriptAccessPin; private readonly Dictionary m_scriptEvents = new Dictionary(); - private string m_sitName = String.Empty; private Quaternion m_sitTargetOrientation = Quaternion.Identity; private Vector3 m_sitTargetPosition; private string m_sitAnimation = "SIT"; - private string m_text = String.Empty; - private string m_touchName = String.Empty; private UndoRedoState m_UndoRedo = null; private readonly object m_UndoLock = new object(); @@ -404,12 +401,13 @@ namespace OpenSim.Region.Framework.Scenes m_TextureAnimation = Utils.EmptyBytes; m_particleSystem = Utils.EmptyBytes; Rezzed = DateTime.UtcNow; - Description = String.Empty; + //Description = String.Empty; PseudoCRC = (int)DateTime.UtcNow.Ticks; // random could be as good; fallbak if not on region db m_inventory = new SceneObjectPartInventory(this); LastColSoundSentTime = Util.EnvironmentTickCount(); } + public static osUTF8 defaultName = new osUTF8("Object", true); /// /// Create a completely new SceneObjectPart (prim). This will need to be added separately to a SceneObjectGroup /// @@ -418,11 +416,13 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// + public SceneObjectPart( UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, Quaternion rotationOffset, Vector3 offsetPosition) : this() { - m_name = "Object"; + osUTF8Name = defaultName; + osUTF8LargeName = defaultName; CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed); RezzerID = LastOwnerID = CreatorID = OwnerID = ownerID; @@ -621,12 +621,18 @@ namespace OpenSim.Region.Framework.Scenes } } + // several code still depends on large uncontroled names + private osUTF8 osUTF8LargeName; public override string Name { - get { return m_name; } + get + { + return osUTF8LargeName.ToString(); + } set { - m_name = value; + osUTF8LargeName = new osUTF8(value); + osUTF8Name = new osUTF8(value, 63); if(ParentGroup != null) ParentGroup.InvalidatePartsLinkMaps(); @@ -669,7 +675,6 @@ namespace OpenSim.Region.Framework.Scenes m_isSelected = value; if (ParentGroup != null) ParentGroup.PartSelectChanged(value); - } } @@ -1037,7 +1042,12 @@ namespace OpenSim.Region.Framework.Scenes } } - public string Description { get; set; } + public osUTF8 osUTF8description; + public string Description + { + get {return osUTF8description.ToString(); } + set { osUTF8description = new osUTF8(value, 127);} + } /// /// Text color. @@ -1048,28 +1058,25 @@ namespace OpenSim.Region.Framework.Scenes set { m_color = value; } } + public osUTF8 osUTF8Text; public string Text { - get - { - if (m_text.Length > 254) - return m_text.Substring(0, 254); - return m_text; - } - set { m_text = value; } + get { return osUTF8Text.ToString(); } + set { osUTF8Text = new osUTF8(value, 254); } } - + public osUTF8 osUTF8SitName; public string SitName { - get { return m_sitName; } - set { m_sitName = value; } + get { return osUTF8SitName.ToString(); } + set { osUTF8SitName = new osUTF8(value, 36); } } + public osUTF8 osUTF8TouchName; public string TouchName { - get { return m_touchName; } - set { m_touchName = value; } + get { return osUTF8TouchName.ToString(); } + set { osUTF8TouchName = new osUTF8(value, 36); } } public int LinkNum @@ -1184,19 +1191,22 @@ namespace OpenSim.Region.Framework.Scenes /// Used for media on a prim. /// /// Do not change this value directly - always do it through an IMoapModule. + public osUTF8 osUTFMediaUrl; public string MediaUrl { get { - return m_mediaUrl; + if(osUTFMediaUrl.Length == 0) + return null; + return osUTFMediaUrl.ToString(); } set { - string old = m_mediaUrl; - m_mediaUrl = value; + osUTF8 old = osUTFMediaUrl; + osUTFMediaUrl = new osUTF8(value, 254); - if (ParentGroup != null && old != m_mediaUrl) + if (ParentGroup != null && !osUTFMediaUrl.Equals(old)) ParentGroup.HasGroupChanged = true; } } @@ -4052,10 +4062,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetText(string text) { - string oldtext = m_text; - m_text = text; + osUTF8 old = osUTF8Text; + osUTF8Text = new osUTF8(text, 254); - if (ParentGroup != null && oldtext != text) + if (ParentGroup != null && !osUTF8Text.Equals(old)) { ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); @@ -4071,13 +4081,14 @@ namespace OpenSim.Region.Framework.Scenes public void SetText(string text, Vector3 color, double alpha) { Color oldcolor = Color; - string oldtext = m_text; + Color = Color.FromArgb((int) (alpha*0xff), (int) (color.X*0xff), (int) (color.Y*0xff), (int) (color.Z*0xff)); - m_text = text; - if(ParentGroup != null && (oldcolor != Color || oldtext != m_text)) + osUTF8 old = osUTF8Text; + osUTF8Text = new osUTF8(text, 254); + if (ParentGroup != null && (oldcolor != Color || !osUTF8Text.Equals(old))) { ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 4545661ee5..adfbd6fb8c 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -811,7 +811,7 @@ namespace OpenSim.Region.Framework.Scenes return; try { - osUTF8 ostmp = new osUTF8(asset.Data); + osUTF8Slice ostmp = new osUTF8Slice(asset.Data); if (!ostmp.SkipLine()) // version return; if (!ostmp.SkipLine()) // name @@ -821,10 +821,10 @@ namespace OpenSim.Region.Framework.Scenes if (!ostmp.SkipLine()) return; - while (ostmp.ReadLine(out osUTF8 line)) + while (ostmp.ReadLine(out osUTF8Slice line)) { line.SelfTrim(wearableSeps); - osUTF8[] parts = line.Split(wearableSeps); + osUTF8Slice[] parts = line.Split(wearableSeps); if(parts[0].Length == 0) continue; parts[0].SelfTrim(wearableSeps); @@ -833,7 +833,7 @@ namespace OpenSim.Region.Framework.Scenes if (parts[1].Length == 0) return; parts[1].SelfTrim(wearableSeps); - if (!osUTF8.TryParseInt(parts[1], out int count) || count == 0) + if (!osUTF8Slice.TryParseInt(parts[1], out int count) || count == 0) return; for (int i = 0; i < count; ++i) { @@ -846,14 +846,14 @@ namespace OpenSim.Region.Framework.Scenes if(parts[1].Length == 0) return; parts[1].SelfTrim(wearableSeps); - if (!osUTF8.TryParseInt(parts[1], out int count) || count == 0) + if (!osUTF8Slice.TryParseInt(parts[1], out int count) || count == 0) return; for(int i = 0; i < count; ++i) { - if(!ostmp.ReadLine(out osUTF8 texline)) + if(!ostmp.ReadLine(out osUTF8Slice texline)) return; texline.SelfTrim(wearableSeps); - osUTF8[] texparts = texline.Split(wearableSeps); + osUTF8Slice[] texparts = texline.Split(wearableSeps); if(texparts.Length <2 || texparts[1].Length < 36) continue; texparts[1].SelfTrim(wearableSeps); @@ -868,14 +868,14 @@ namespace OpenSim.Region.Framework.Scenes } } - private int getxmlNode(ref osUTF8 data, out osUTF8 h) + private int getxmlNode(ref osUTF8Slice data, out osUTF8Slice h) { h = data; int st = -1; while ((st = data.IndexOf('<')) >= 0) { if (st > 0 && data[st - 1] == (byte)'\\') - data.osUTF8SubStringSelf(st + 1); + data.SubUTF8Self(st + 1); break; } if (st < 0) @@ -885,23 +885,23 @@ namespace OpenSim.Region.Framework.Scenes while ((ed = data.IndexOf('>')) >= 0) { if (data[st - 1] == (byte)'\\') - data.osUTF8SubStringSelf(st + 1); + data.SubUTF8Self(st + 1); break; } if (ed < 0) return -1; - h = data.osUTF8SubString(st, ed - st); + h = data.SubUTF8(st, ed - st); h.SelfTrim(); ++ed; - data.osUTF8SubStringSelf(ed); + data.SubUTF8Self(ed); return ed; } - private bool TryGetxmlUUIDValue(ref osUTF8 data, out UUID id) + private bool TryGetxmlUUIDValue(ref osUTF8Slice data, out UUID id) { id = UUID.Zero; - if(getxmlNode(ref data, out osUTF8 h) < 0) + if(getxmlNode(ref data, out osUTF8Slice h) < 0) return false; if (h.StartsWith(UUIDB)) @@ -912,10 +912,10 @@ namespace OpenSim.Region.Framework.Scenes if (indx < 0) return false; - osUTF8 tmp = data.osUTF8SubString(0, indx); - data.osUTF8SubStringSelf(indx + 1); + osUTF8Slice tmp = data.SubUTF8(0, indx); + data.SubUTF8Self(indx + 1); - return osUTF8.TryParseUUID(tmp, out id); + return osUTF8Slice.TryParseUUID(tmp, out id); } if (h.StartsWith(uuidB)) @@ -926,24 +926,24 @@ namespace OpenSim.Region.Framework.Scenes if (indx < 0) return false; - osUTF8 tmp = data.osUTF8SubString(0, indx); - data.osUTF8SubStringSelf(indx + 1); + osUTF8Slice tmp = data.SubUTF8(0, indx); + data.SubUTF8Self(indx + 1); - return osUTF8.TryParseUUID(tmp, out id); + return osUTF8Slice.TryParseUUID(tmp, out id); } return false; } - private bool TryGetXMLBinary(ref osUTF8 data, out byte[] te) + private bool TryGetXMLBinary(ref osUTF8Slice data, out byte[] te) { te = null; int indx = data.IndexOf((byte)'<'); if(indx <= 0) return false; - osUTF8 tmp = data.osUTF8SubString(0, indx); - data.osUTF8SubStringSelf(indx + 1); + osUTF8Slice tmp = data.SubUTF8(0, indx); + data.SubUTF8Self(indx + 1); tmp.SelfTrim(); if(tmp.Length == 0) @@ -959,7 +959,7 @@ namespace OpenSim.Region.Framework.Scenes } - // bad ugly and ulgy + // bad ugly private static osUTF8 UUIDB = new osUTF8("UUID"); private static osUTF8 uuidB = new osUTF8("uuid"); private static osUTF8 SOPAnimsB = new osUTF8("SOPAnims"); @@ -981,10 +981,10 @@ namespace OpenSim.Region.Framework.Scenes /// private void RecordSceneObjectAssetUuids(AssetBase sceneObjectAsset) { - osUTF8 data = new osUTF8(sceneObjectAsset.Data); + osUTF8Slice data = new osUTF8Slice(sceneObjectAsset.Data); int next; - osUTF8 nodeName; + osUTF8Slice nodeName; while ((next = getxmlNode(ref data, out nodeName)) > 0) { if (nodeName.StartsWith((byte)'/')) @@ -1153,7 +1153,7 @@ namespace OpenSim.Region.Framework.Scenes /// private void RecordGestureAssetUuids(AssetBase gestureAsset) { - osUTF8 osdata = new osUTF8(gestureAsset.Data); + osUTF8Slice osdata = new osUTF8Slice(gestureAsset.Data); if (!osdata.SkipLine()) // version return; @@ -1166,21 +1166,21 @@ namespace OpenSim.Region.Framework.Scenes if (!osdata.SkipLine()) // replace return; - if (!osdata.ReadLine(out osUTF8 line)) + if (!osdata.ReadLine(out osUTF8Slice line)) return; - if(!osUTF8.TryParseInt(line, out int scount) || scount == 0) + if(!osUTF8Slice.TryParseInt(line, out int scount) || scount == 0) return; for(int i = 0; i < scount; ++i) { - if (!osdata.ReadLine(out osUTF8 typeline)) // type + if (!osdata.ReadLine(out osUTF8Slice typeline)) // type return; typeline.SelfTrim(); - if (!osUTF8.TryParseInt(typeline, out int type)) + if (!osUTF8Slice.TryParseInt(typeline, out int type)) return; - osUTF8 id; + osUTF8Slice id; UUID uid; switch(type) { @@ -1190,7 +1190,7 @@ namespace OpenSim.Region.Framework.Scenes return; if (!osdata.ReadLine(out id)) // uuid return; - if (osUTF8.TryParseUUID(id, out uid) && uid != UUID.Zero) + if (osUTF8Slice.TryParseUUID(id, out uid) && uid != UUID.Zero) GatheredUuids[uid] = type == 0 ? (sbyte)AssetType.Animation : (sbyte)AssetType.Sound; if (!osdata.SkipLine()) // flags return; @@ -1213,9 +1213,9 @@ namespace OpenSim.Region.Framework.Scenes /// private void RecordMaterialAssetUuids(AssetBase materialAsset) { - osUTF8 data = new osUTF8(materialAsset.Data); + osUTF8Slice data = new osUTF8Slice(materialAsset.Data); int next; - while ((next = getxmlNode(ref data, out osUTF8 header)) > 0) + while ((next = getxmlNode(ref data, out osUTF8Slice header)) > 0) { if (header.StartsWith((byte)'/')) continue; @@ -1226,10 +1226,10 @@ namespace OpenSim.Region.Framework.Scenes int indx = data.IndexOf((byte)'<'); if(indx < 0) continue; - osUTF8 tmp = data.osUTF8SubString(0, indx); - if(osUTF8.TryParseUUID(tmp, out UUID id) && id != UUID.Zero) + osUTF8Slice tmp = data.SubUTF8(0, indx); + if(osUTF8Slice.TryParseUUID(tmp, out UUID id) && id != UUID.Zero) GatheredUuids[id] = (sbyte)AssetType.Texture; - data.osUTF8SubStringSelf(indx + 1); + data.SubUTF8Self(indx + 1); } } } diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 6e1f8bb654..9c7a938a0b 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -619,13 +619,14 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator if(grp.RootPart.Shape.PCode != (byte)PCode.NewTree && grp.RootPart.Shape.PCode != (byte)PCode.Tree) continue; - if (grp.Name.Length > 5 && (grp.Name.Substring(0, 5) == "ATPM:" || grp.Name.Substring(0, 5) == "FTPM:")) + string grpname = grp.Name; + if (grpname.Length > 5 && (grpname.Substring(0, 5) == "ATPM:" || grpname.Substring(0, 5) == "FTPM:")) { // Create a new copse definition or add uuid to an existing definition try { Boolean copsefound = false; - Copse grpcopse = new Copse(grp.Name); + Copse grpcopse = new Copse(grpname); lock(mylock) { diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index 6a1ce0b5d3..7289f2d94e 100755 Binary files a/bin/OpenMetaverse.Rendering.Meshmerizer.dll and b/bin/OpenMetaverse.Rendering.Meshmerizer.dll differ diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 6c28011a54..5ebb79760c 100755 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index f227e2217c..a3ac8498bb 100755 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index ee7e613fab..cab0f5ffcf 100755 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ