Compare commits

...

4 Commits

Author SHA1 Message Date
UbitUmarov 00e9e3c77a change limits on parcel name and description on llupd packets 2024-02-05 19:13:57 +00:00
UbitUmarov f127fd56a2 pesty warning 2024-02-05 18:44:51 +00:00
UbitUmarov f1cba63aad retire StringToBytes variants with string format. Do the format before calling.. 2024-02-05 18:34:44 +00:00
UbitUmarov db04234685 update libomv 2024-02-05 18:07:57 +00:00
10 changed files with 29 additions and 38 deletions

View File

@ -2643,12 +2643,13 @@ namespace OpenSim.Framework
/// Arguments to substitute into the string via the {} mechanism.
/// </param>
/// <returns></returns>
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes256(string str, params object[] args)
{
return Utils.StringToBytes(string.Format(str, args), 255);
}
*/
/// <summary>
/// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary.
/// </summary>
@ -2658,7 +2659,7 @@ namespace OpenSim.Framework
/// </param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes256(string str)
public static byte[] StringToBytes256(ReadOnlySpan<char> str)
{
return Utils.StringToBytes(str, 255);
}
@ -2674,11 +2675,13 @@ namespace OpenSim.Framework
/// Arguments to substitute into the string via the {} mechanism.
/// </param>
/// <returns></returns>
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes1024(string str, params object[] args)
{
return Utils.StringToBytes(string.Format(str, args), 1024);
return Utils.StringToBytes(string.Format(str, args).AsSpan(), 1024);
}
*/
/// <summary>
/// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary.
@ -2689,7 +2692,7 @@ namespace OpenSim.Framework
/// </param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes1024(string str)
public static byte[] StringToBytes1024(ReadOnlySpan<char> str)
{
return Utils.StringToBytes(str, 1024);
}
@ -2705,11 +2708,13 @@ namespace OpenSim.Framework
/// Arguments to substitute into the string via the {} mechanism.
/// </param>
/// <returns></returns>
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes(string str, int MaxLength, params object[] args)
{
return StringToBytes1024(string.Format(str, args), MaxLength);
return Utils.StringToBytes(string.Format(str, args).AsSpan(), MaxLength);
}
*/
/// <summary>
/// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to MaxLength bytes if necessary.
@ -2720,26 +2725,26 @@ namespace OpenSim.Framework
/// </param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytes(string str, int MaxLength)
public static byte[] StringToBytes(ReadOnlySpan<char> str, int MaxLength)
{
return Utils.StringToBytes(str, MaxLength);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] StringToBytesNoTerm(string str, int MaxLength)
public static byte[] StringToBytesNoTerm(ReadOnlySpan<char> str, int MaxLength)
{
return Utils.StringToBytesNoTerm(str, MaxLength);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int osUTF8Getbytes(string srcstr, byte[] dstarray, int maxdstlen, bool NullTerm = true)
public static int osUTF8Getbytes(ReadOnlySpan<char> srcstr, byte[] dstarray, int maxdstlen, bool NullTerm = true)
{
return osUTF8Getbytes(srcstr, dstarray, 0, maxdstlen, NullTerm);
}
public static unsafe int osUTF8Getbytes(string srcstr, byte* dstarray, int maxdstlen, bool NullTerm = true)
public static unsafe int osUTF8Getbytes(ReadOnlySpan<char> srcstr, byte* dstarray, int maxdstlen, bool NullTerm = true)
{
if (string.IsNullOrEmpty(srcstr))
if (srcstr.Length == 0)
return 0;
fixed (char* srcbase = srcstr)
@ -2748,9 +2753,9 @@ namespace OpenSim.Framework
}
}
public static unsafe int osUTF8Getbytes(string srcstr, byte[] dstarray, int pos, int maxdstlen, bool NullTerm = true)
public static unsafe int osUTF8Getbytes(ReadOnlySpan<char> srcstr, byte[] dstarray, int pos, int maxdstlen, bool NullTerm = true)
{
if (string.IsNullOrEmpty(srcstr))
if (srcstr.Length == 0)
return 0;
if (pos + maxdstlen > dstarray.Length)

View File

@ -424,9 +424,8 @@ namespace OpenSim.Region.ClientStack.Linden
LLSDxmlEncode2.AddEndMapAndArray(sb);
LLSDxmlEncode2.AddRawElem("<key>FolderData</key><array><map><key>FolderID</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>Name</key><string></string><key>ParentID</key><uuid>00000000-0000-0000-0000-000000000000</uuid ><key>Type</key ><integer>-1</integer></map ></array>",sb);
osUTF8 osName = new osUTF8(Utils.StringToBytesNoTerm(item.Name, 255));
osUTF8 osDesc = new osUTF8(Utils.StringToBytesNoTerm(item.Description, 255));
osUTF8 osName = new osUTF8(item.Name, 255);
osUTF8 osDesc = new osUTF8(item.Description, 255);
LLSDxmlEncode2.AddArray("ItemData", sb);
LLSDxmlEncode2.AddMap(sb);

View File

@ -3624,16 +3624,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
reply.AgentData.AgentID = m_agentId;
reply.Data.ParcelID = parcelID;
reply.Data.OwnerID = land.OwnerID;
reply.Data.Name = Utils.StringToBytes(land.Name);
if (!string.IsNullOrEmpty(land.Description))
{
if (land.Description.Length > 254)
reply.Data.Desc = Utils.StringToBytes(land.Description[..254]);
else
reply.Data.Desc = Utils.StringToBytes(land.Description);
}
else
reply.Data.Desc = Array.Empty<byte>();
reply.Data.Name = Utils.StringToBytes(land.Name, 63);
reply.Data.Desc = Utils.StringToBytes(land.Description, 255);
reply.Data.ActualArea = land.Area;
reply.Data.BillableArea = land.Area; // TODO: what is this?

View File

@ -26,22 +26,12 @@
*/
using System;
using System.Xml;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Timers;
using Timer = System.Timers.Timer;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using log4net;
//using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Client;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes.Types;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.Framework.Scenes
{

View File

@ -3708,7 +3708,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Position = pos,
RegionID = World.RegionInfo.RegionID.Guid,
message = (message.Length > 1024) ? message[..1024] : message,
binaryBucket = Util.StringToBytes256("{0}/{1}/{2}/{3}", m_regionName, (int)pos.X, (int)pos.Y, (int)pos.Z)
binaryBucket = Util.StringToBytes256($"{m_regionName}/{(int)pos.X}/{(int)pos.Y}/{(int)pos.Z}")
};
m_TransferModule?.SendInstantMessage(msg, delegate(bool success) {});

View File

@ -459,6 +459,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_REFLECTION_PROBE = 44;
public const int PRIM_GLTF_NORMAL = 45;
public const int PRIM_GLTF_EMISSIVE = 46;
public const int PRIM_GLTF_METALLIC_ROUGHNESS = 47;
public const int PRIM_GLTF_BASE_COLOR = 48;
public const int PRIM_RENDER_MATERIAL = 49;
// parameters

Binary file not shown.

Binary file not shown.

Binary file not shown.