From b0a0163253e14514289578d31e83ce0afe9b91a3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 28 Jun 2017 01:29:49 +0100 Subject: BUG FIX: change lludp hovertext utf-8 cut point. Thx djphil --- OpenSim/Framework/Util.cs | 6 +++--- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 ++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index af14939..ed24452 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2221,9 +2221,9 @@ namespace OpenSim.Framework // might have gotten an oversized array even after the string trim byte[] data = UTF8.GetBytes(str); - if (data.Length > 256) + if (data.Length > 255) //play safe { - int cut = 255; + int cut = 254; if((data[cut] & 0x80 ) != 0 ) { while(cut > 0 && (data[cut] & 0xc0) != 0xc0) @@ -2325,7 +2325,7 @@ namespace OpenSim.Framework if (data.Length > MaxLength) { - int cut = MaxLength -1 ; + int cut = MaxLength - 1 ; if((data[cut] & 0x80 ) != 0 ) { while(cut > 0 && (data[cut] & 0xc0) != 0xc0) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 01c1fb9..b3e68ec 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5753,7 +5753,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //update.JointPivot = Vector3.Zero; //update.JointType = 0; update.Material = part.Material; - update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim /* if (data.ParentGroup.IsAttachment) { @@ -5832,8 +5831,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes; update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes; update.Scale = part.Shape.Scale; - update.Text = Util.StringToBytes256(part.Text); - update.MediaURL = Util.StringToBytes256(part.MediaUrl); + update.Text = Util.StringToBytes(part.Text, 255); + update.MediaURL = Util.StringToBytes(part.MediaUrl, 255); #region PrimFlags diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c2eac24..f9699b1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1103,8 +1103,8 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (m_text.Length > 255) - return m_text.Substring(0, 254); + if (m_text.Length > 256) // yes > 254 + return m_text.Substring(0, 256); return m_text; } set { m_text = value; } @@ -1379,7 +1379,8 @@ namespace OpenSim.Region.Framework.Scenes public UUID LastOwnerID { get { return _lastOwnerID; } - set { _lastOwnerID = value; } + set { + _lastOwnerID = value; } } public UUID RezzerID -- cgit v1.1