master
UbitUmarov 2020-05-15 15:11:06 +01:00
parent 214cf5d60b
commit 79bb22eaf6
3 changed files with 19 additions and 13 deletions

View File

@ -153,17 +153,17 @@ namespace OpenSim.Framework
} }
} }
public static void AddElem(byte[] e, int start, int lenght, StringBuilder sb) public static void AddElem(byte[] e, int start, int length, StringBuilder sb)
{ {
if (start + lenght >= e.Length) if (start + length >= e.Length)
lenght = e.Length - start; length = e.Length - start;
if (e == null || e.Length == 0 || lenght <= 0) if (e == null || e.Length == 0 || length <= 0)
sb.Append("binary />"); sb.Append("binary />");
else else
{ {
sb.Append("<binary>"); // encode64 is default sb.Append("<binary>"); // encode64 is default
base64Encode(e, start, lenght, sb); base64Encode(e, start, length, sb);
sb.Append("</binary>"); sb.Append("</binary>");
} }
} }
@ -476,21 +476,21 @@ namespace OpenSim.Framework
} }
} }
public static void AddElem(string name, byte[] e, int start, int lenght, StringBuilder sb) public static void AddElem(string name, byte[] e, int start, int length, StringBuilder sb)
{ {
sb.Append("<key>"); sb.Append("<key>");
sb.Append(name); sb.Append(name);
sb.Append("</key>"); sb.Append("</key>");
if (start + lenght >= e.Length) if (start + length >= e.Length)
lenght = e.Length - start; length = e.Length - start;
if (e == null || e.Length == 0 || lenght <= 0) if (e == null || e.Length == 0 || length <= 0)
sb.Append("binary />"); sb.Append("binary />");
else else
{ {
sb.Append("<binary>"); // encode64 is default sb.Append("<binary>"); // encode64 is default
base64Encode(e, start, lenght, sb); base64Encode(e, start, length, sb);
sb.Append("</binary>"); sb.Append("</binary>");
} }
} }
@ -870,10 +870,10 @@ namespace OpenSim.Framework
} }
} }
public static unsafe void base64Encode(byte[] data, int start, int lenght, StringBuilder sb) public static unsafe void base64Encode(byte[] data, int start, int length, StringBuilder sb)
{ {
int lenMod3 = lenght % 3; int lenMod3 = length % 3;
int len = start + (lenght - lenMod3); int len = start + (length - lenMod3);
fixed (byte* d = data) fixed (byte* d = data)
{ {

View File

@ -106,6 +106,7 @@ namespace OpenSim.Region.Framework.Interfaces
void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID); void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID);
void WindlightRefreshEvent(int interpolate, UUID avatarID); void WindlightRefreshEvent(int interpolate, UUID avatarID);
StringBuilder StartEvent(string eventName); StringBuilder StartEvent(string eventName);
StringBuilder StartEvent(string eventName, int cap);
string EndEvent(StringBuilder sb); string EndEvent(StringBuilder sb);
byte[] EndEventToBytes(StringBuilder sb); byte[] EndEventToBytes(StringBuilder sb);
} }

View File

@ -212,6 +212,11 @@ namespace OpenSim.Tests.Common
return null; return null;
} }
public StringBuilder StartEvent(string eventName, int cap)
{
return null;
}
public string EndEvent(StringBuilder sb) public string EndEvent(StringBuilder sb)
{ {
return ""; return "";