* Creates Util.UTF8 and switches some references of Encoding.UTF8 to Util.UTF8 (not all references were switched since not all OpenSim libraries reference OpenSim.Framework)
* Shrinks the largest in-memory object, the LLRAW.HeightmapLookupValue struct (only used for exporting to LLRAW terrain files), to the minimum possible size. This seems to have the odd side effect of cutting the size of the two double[256,256] terrain objects in half. Possibly an alignment optimization?prioritization
parent
3ab6c89652
commit
387e9f7a7f
|
@ -163,7 +163,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
get { return Plugin.RequestId; }
|
||||
}
|
||||
|
||||
internal static Encoding Encoding = Encoding.UTF8;
|
||||
internal static Encoding Encoding = Util.UTF8;
|
||||
|
||||
/// <summary>
|
||||
/// Version control for REST implementation. This
|
||||
|
@ -435,7 +435,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
try
|
||||
{
|
||||
byte[] encData_byte = new byte[str.Length];
|
||||
encData_byte = Encoding.UTF8.GetBytes(str);
|
||||
encData_byte = Util.UTF8.GetBytes(str);
|
||||
return Convert.ToBase64String(encData_byte);
|
||||
}
|
||||
catch
|
||||
|
|
|
@ -45,7 +45,8 @@ namespace OpenSim.ApplicationPlugins.Rest
|
|||
{
|
||||
}
|
||||
|
||||
public RestXmlWriter(Stream stream) : this(stream, Encoding.UTF8)
|
||||
public RestXmlWriter(Stream stream)
|
||||
: this(stream, Encoding.UTF8)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -886,7 +886,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid;
|
||||
chatActionEvent.ActionFragment.ObservationRadius = 180.0f;
|
||||
chatActionEvent.ActionFragment.ExtensionDialect = "TEXT";
|
||||
chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message));
|
||||
chatActionEvent.SetPayloadData(Util.UTF8.GetBytes(message));
|
||||
|
||||
Session.Send(chatActionEvent);
|
||||
}
|
||||
|
|
|
@ -581,13 +581,17 @@ namespace OpenSim.Data.SQLite
|
|||
if (row.Read())
|
||||
{
|
||||
// TODO: put this into a function
|
||||
MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]);
|
||||
BinaryReader br = new BinaryReader(str);
|
||||
for (int x = 0; x < (int)Constants.RegionSize; x++)
|
||||
using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"]))
|
||||
{
|
||||
for (int y = 0; y < (int)Constants.RegionSize; y++)
|
||||
using (BinaryReader br = new BinaryReader(str))
|
||||
{
|
||||
terret[x, y] = br.ReadDouble();
|
||||
for (int x = 0; x < (int)Constants.RegionSize; x++)
|
||||
{
|
||||
for (int y = 0; y < (int)Constants.RegionSize; y++)
|
||||
{
|
||||
terret[x, y] = br.ReadDouble();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rev = (int) row["Revision"];
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace OpenSim.Framework
|
|||
|
||||
private void InternData()
|
||||
{
|
||||
string temp = Encoding.UTF8.GetString(Data).Trim();
|
||||
string temp = Util.UTF8.GetString(Data).Trim();
|
||||
string[] parts = temp.Split('\n');
|
||||
int.TryParse(parts[0].Substring(17, 1), out Version);
|
||||
UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
writer.Close();
|
||||
|
||||
return Encoding.UTF8.GetBytes(sw.ToString());
|
||||
return Util.UTF8.GetBytes(sw.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -329,7 +329,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
reader.Read();
|
||||
FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
|
||||
byte[] inp = Encoding.UTF8.GetBytes(reader.ReadString());
|
||||
byte[] inp = Util.UTF8.GetBytes(reader.ReadString());
|
||||
ret = b64.TransformFinalBlock(inp, 0, inp.Length);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
//Encoding encoding = Encoding.UTF8;
|
||||
//Encoding encoding = Util.UTF8;
|
||||
//StreamReader streamReader = new StreamReader(request, false);
|
||||
|
||||
//string requestBody = streamReader.ReadToEnd();
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Framework.Communications.XMPP
|
|||
{
|
||||
}
|
||||
|
||||
public XMPPWriter(IOStream stream) : this(stream, Encoding.UTF8)
|
||||
public XMPPWriter(IOStream stream) : this(stream, Util.UTF8)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Framework.Configuration.HTTP
|
|||
count = resStream.Read(buf, 0, buf.Length);
|
||||
if (count != 0)
|
||||
{
|
||||
tempString = Encoding.UTF8.GetString(buf, 0, count);
|
||||
tempString = Util.UTF8.GetString(buf, 0, count);
|
||||
sb.Append(tempString);
|
||||
}
|
||||
} while (count > 0);
|
||||
|
|
|
@ -965,7 +965,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
// response.ContentType = "application/llsd+json";
|
||||
// return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse));
|
||||
// return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse));
|
||||
response.ContentType = "application/llsd+xml";
|
||||
return OSDParser.SerializeLLSDXmlBytes(llsdResponse);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,9 @@ namespace OpenSim.Framework
|
|||
|
||||
public static readonly Regex UUIDPattern
|
||||
= new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
|
||||
|
||||
|
||||
public static Encoding UTF8 = Encoding.UTF8;
|
||||
|
||||
/// <value>
|
||||
/// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)
|
||||
/// </value>
|
||||
|
@ -432,7 +434,7 @@ namespace OpenSim.Framework
|
|||
output.Append(": ");
|
||||
}
|
||||
|
||||
output.Append(CleanString(Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)));
|
||||
output.Append(CleanString(Util.UTF8.GetString(bytes, 0, bytes.Length - 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -793,7 +795,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public static string Compress(string text)
|
||||
{
|
||||
byte[] buffer = Encoding.UTF8.GetBytes(text);
|
||||
byte[] buffer = Util.UTF8.GetBytes(text);
|
||||
MemoryStream memory = new MemoryStream();
|
||||
using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true))
|
||||
{
|
||||
|
@ -827,7 +829,7 @@ namespace OpenSim.Framework
|
|||
decompressor.Read(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
return Encoding.UTF8.GetString(buffer);
|
||||
return Util.UTF8.GetString(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1101,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
byte[] data = new byte[length];
|
||||
stream.Read(data, 0, length);
|
||||
string strdata = Encoding.UTF8.GetString(data);
|
||||
string strdata = Util.UTF8.GetString(data);
|
||||
OSDMap args = null;
|
||||
OSD buffer;
|
||||
buffer = OSDParser.DeserializeJson(strdata);
|
||||
|
|
|
@ -699,7 +699,7 @@ namespace OpenSim
|
|||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes("OK");
|
||||
return Util.UTF8.GetBytes("OK");
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
|
@ -736,7 +736,7 @@ namespace OpenSim
|
|||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
|
@ -777,7 +777,7 @@ namespace OpenSim
|
|||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
|
|
|
@ -4748,7 +4748,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
Hashtable mp = (Hashtable)simMapProfiles[iii];
|
||||
mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock();
|
||||
mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]);
|
||||
mbReply.Data[iii].Name = Util.UTF8.GetBytes((string)mp["name"]);
|
||||
mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]);
|
||||
mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]);
|
||||
mbReply.Data[iii].MapImageID = new UUID((string)mp["map-image-id"]);
|
||||
|
@ -7338,7 +7338,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
#endregion
|
||||
|
||||
string mapName = Encoding.UTF8.GetString(map.NameData.Name, 0,
|
||||
string mapName = Util.UTF8.GetString(map.NameData.Name, 0,
|
||||
map.NameData.Name.Length - 1);
|
||||
handlerMapNameRequest = OnMapNameRequest;
|
||||
if (handlerMapNameRequest != null)
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
|||
stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd);
|
||||
}
|
||||
|
||||
layerDecodeAsset.Data = Encoding.UTF8.GetBytes(stringResult.ToString());
|
||||
layerDecodeAsset.Data = Util.UTF8.GetBytes(stringResult.ToString());
|
||||
|
||||
#endregion Serialize Layer Data
|
||||
|
||||
|
@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
|||
{
|
||||
#region Deserialize Layer Data
|
||||
|
||||
string readResult = Encoding.UTF8.GetString(layerDecodeAsset.Data);
|
||||
string readResult = Util.UTF8.GetString(layerDecodeAsset.Data);
|
||||
string[] lines = readResult.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (lines.Length == 0)
|
||||
|
|
|
@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
// Encode outbound data
|
||||
if (OutboundBody.Length > 0)
|
||||
{
|
||||
byte[] data = Encoding.UTF8.GetBytes(OutboundBody);
|
||||
byte[] data = Util.UTF8.GetBytes(OutboundBody);
|
||||
|
||||
Request.ContentLength = data.Length;
|
||||
Stream bstream = Request.GetRequestStream();
|
||||
|
@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
if (count != 0)
|
||||
{
|
||||
// translate from bytes to ASCII text
|
||||
tempString = Encoding.UTF8.GetString(buf, 0, count);
|
||||
tempString = Util.UTF8.GetString(buf, 0, count);
|
||||
|
||||
// continue building the string
|
||||
sb.Append(tempString);
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
{
|
||||
public struct HeightmapLookupValue : IComparable<HeightmapLookupValue>
|
||||
{
|
||||
public int Index;
|
||||
public double Value;
|
||||
public ushort Index;
|
||||
public float Value;
|
||||
|
||||
public HeightmapLookupValue(int index, double value)
|
||||
public HeightmapLookupValue(ushort index, float value)
|
||||
{
|
||||
Index = index;
|
||||
Value = value;
|
||||
|
@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
{
|
||||
for (int j = 0; j < 256; j++)
|
||||
{
|
||||
LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue(i + (j * 256), ((double)i * ((double)j / 128.0d)));
|
||||
LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue((ushort)(i + (j * 256)), (float)((double)i * ((double)j / 128.0d)));
|
||||
}
|
||||
}
|
||||
Array.Sort<HeightmapLookupValue>(LookupHeightTable);
|
||||
|
@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
|
||||
// The lookup table is pre-sorted, so we either find an exact match or
|
||||
// the next closest (smaller) match with a binary search
|
||||
index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, t));
|
||||
index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
|
||||
if (index < 0)
|
||||
index = ~index - 1;
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
m_log.WarnFormat("[DATASNAPSHOT]: Unable to decode reply from data service. Ignoring. {0}", e.StackTrace);
|
||||
}
|
||||
// This is not quite working, so...
|
||||
// string responseStr = Encoding.UTF8.GetString(response);
|
||||
// string responseStr = Util.UTF8.GetString(response);
|
||||
m_log.Info("[DATASNAPSHOT]: data service notified: " + url);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(Report());
|
||||
return Util.UTF8.GetBytes(Report());
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public string SaveToXmlString()
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
settings.Encoding = Util.UTF8;
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(sw, settings))
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
{
|
||||
m_log.Info("[IRCd] Sending >>> " + command);
|
||||
|
||||
byte[] buf = Encoding.UTF8.GetBytes(command + "\r\n");
|
||||
byte[] buf = Util.UTF8.GetBytes(command + "\r\n");
|
||||
|
||||
m_client.GetStream().BeginWrite(buf, 0, buf.Length, SendComplete, null);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
byte[] buf = new byte[8]; // RFC1459 defines max message size as 512.
|
||||
|
||||
int count = m_client.GetStream().Read(buf, 0, buf.Length);
|
||||
string line = Encoding.UTF8.GetString(buf, 0, count);
|
||||
string line = Util.UTF8.GetString(buf, 0, count);
|
||||
|
||||
strbuf += line;
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
if (method == "POST")
|
||||
{
|
||||
byte[] contentreq = Encoding.UTF8.GetBytes(body);
|
||||
byte[] contentreq = Util.UTF8.GetBytes(body);
|
||||
forwardreq.ContentLength = contentreq.Length;
|
||||
Stream reqStream = forwardreq.GetRequestStream();
|
||||
reqStream.Write(contentreq, 0, contentreq.Length);
|
||||
|
@ -535,7 +535,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
}
|
||||
|
||||
HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse();
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
Encoding encoding = Util.UTF8;
|
||||
StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding);
|
||||
fwdresponsestr = fwdresponsestream.ReadToEnd();
|
||||
fwdresponsecontenttype = fwdrsp.ContentType;
|
||||
|
|
|
@ -539,7 +539,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
|
|||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof(Copse));
|
||||
|
||||
using (XmlTextWriter writer = new XmlTextWriter(fileName, System.Text.Encoding.UTF8))
|
||||
using (XmlTextWriter writer = new XmlTextWriter(fileName, Util.UTF8))
|
||||
{
|
||||
writer.Formatting = Formatting.Indented;
|
||||
xs.Serialize(writer, obj);
|
||||
|
|
|
@ -7064,7 +7064,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
try
|
||||
{
|
||||
byte[] encData_byte = new byte[str.Length];
|
||||
encData_byte = Encoding.UTF8.GetBytes(str);
|
||||
encData_byte = Util.UTF8.GetBytes(str);
|
||||
string encodedData = Convert.ToBase64String(encData_byte);
|
||||
return encodedData;
|
||||
}
|
||||
|
|
|
@ -1457,7 +1457,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
|
||||
+ textLength.ToString() + "\n" + notecardData + "}\n";
|
||||
|
||||
asset.Data = Encoding.UTF8.GetBytes(notecardData);
|
||||
asset.Data = Util.UTF8.GetBytes(notecardData);
|
||||
World.AssetService.Store(asset);
|
||||
|
||||
// Create Task Entry
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace OpenSim.Server.Base
|
|||
public static byte[] SerializeResult(XmlSerializer xs, object data)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xs.Serialize(xw, data);
|
||||
xw.Flush();
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace OpenSim.Server.Handlers.Neighbour
|
|||
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
|
||||
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(resp));
|
||||
return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
|
||||
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(resp));
|
||||
return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue