Merge branch 'diva-textures-osgrid'

prioritization
Melanie 2009-10-04 05:49:16 +01:00
commit 6878b26b0d
28 changed files with 73 additions and 51 deletions

View File

@ -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

View File

@ -45,7 +45,8 @@ namespace OpenSim.ApplicationPlugins.Rest
{
}
public RestXmlWriter(Stream stream) : this(stream, Encoding.UTF8)
public RestXmlWriter(Stream stream)
: this(stream, Encoding.UTF8)
{
}

View File

@ -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);
}

View File

@ -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"];

View File

@ -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);

View File

@ -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;
}

View File

@ -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();

View File

@ -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)
{
}

View File

@ -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);

View File

@ -979,7 +979,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);
}

View File

@ -58,6 +58,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
{
Type type = typeof (TRequest);
TResponse deserial = default(TResponse);
WebRequest request = WebRequest.Create(requestUrl);
request.Method = verb;
@ -81,19 +82,33 @@ namespace OpenSim.Framework.Servers.HttpServer
int length = (int) buffer.Length;
request.ContentLength = length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length);
Stream requestStream = null;
try
{
requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length);
}
catch (Exception)
{
return deserial;
}
finally
{
if (requestStream != null)
requestStream.Close();
}
}
TResponse deserial = default(TResponse);
try
{
using (WebResponse resp = request.GetResponse())
{
if (resp.ContentLength > 0)
{
Stream respStream = resp.GetResponseStream();
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
deserial = (TResponse)deserializer.Deserialize(respStream);
respStream.Close();
}
}
}

View File

@ -103,6 +103,8 @@ namespace OpenSim.Framework
}
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>
@ -465,7 +467,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
{
@ -826,7 +828,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))
{
@ -860,7 +862,7 @@ namespace OpenSim.Framework
decompressor.Read(buffer, 0, buffer.Length);
}
return Encoding.UTF8.GetString(buffer);
return Util.UTF8.GetString(buffer);
}
}
@ -1132,7 +1134,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);

View File

@ -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

View File

@ -4751,7 +4751,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"]);
@ -7341,7 +7341,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)

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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

View File

@ -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))

View File

@ -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;

View File

@ -559,7 +559,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);
@ -567,7 +567,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;

View File

@ -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);

View File

@ -7077,7 +7077,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;
}

View File

@ -1491,7 +1491,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

View File

@ -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();

View File

@ -160,7 +160,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));
}
}

View File

@ -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));
}
}