From 76d8eaa4069d6445c47784168e274ba4253f7b9c Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 1 May 2008 18:50:44 +0000 Subject: [PATCH] * Thanks to Mic Bowman for inspiring me to look at that we are still using ASCIIEncoder in places we shouldn't. --- OpenSim/Data/MSSQL/MSSQLGridData.cs | 2 +- OpenSim/Data/MySQL/MySQLGridData.cs | 2 +- OpenSim/Data/SQLite/SQLiteGridData.cs | 2 +- OpenSim/Data/SQLite/SQLiteRegionData.cs | 16 ---------- OpenSim/Framework/Servers/BaseHttpServer.cs | 2 +- .../DataSnapshot/DataSnapshotManager.cs | 2 +- .../Common/LSL_BuiltIn_Commands.cs | 2 +- .../Region/ScriptEngine/Common/TRPC_Remote.cs | 4 +-- .../ScriptEngine/LSOEngine/LSO/LSO_Parser.cs | 3 -- .../OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | 15 --------- OpenSim/TestSuite/BotManager.cs | 2 +- OpenSim/Tools/pCampBot/BotManager.cs | 2 +- ThirdParty/3Di/LoadBalancer/TcpClient.cs | 32 ------------------- 13 files changed, 10 insertions(+), 76 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index 3330732707..cf81bee8b4 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs @@ -417,7 +417,7 @@ namespace OpenSim.Data.MSSQL public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) { SHA512Managed HashProvider = new SHA512Managed(); - ASCIIEncoding TextProvider = new ASCIIEncoding(); + Encoding TextProvider = new UTF8Encoding(); byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); byte[] hash = HashProvider.ComputeHash(stream); diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index df52ae0e61..e830133f74 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs @@ -366,7 +366,7 @@ namespace OpenSim.Data.MySQL public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) { SHA512Managed HashProvider = new SHA512Managed(); - ASCIIEncoding TextProvider = new ASCIIEncoding(); + Encoding TextProvider = new UTF8Encoding(); byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); byte[] hash = HashProvider.ComputeHash(stream); diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs index f07b98fb38..989ec77cd8 100644 --- a/OpenSim/Data/SQLite/SQLiteGridData.cs +++ b/OpenSim/Data/SQLite/SQLiteGridData.cs @@ -224,7 +224,7 @@ namespace OpenSim.Data.SQLite public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) { SHA512Managed HashProvider = new SHA512Managed(); - ASCIIEncoding TextProvider = new ASCIIEncoding(); + Encoding TextProvider = new UTF8Encoding(); byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge); byte[] hash = HashProvider.ComputeHash(stream); diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 9908735ae1..b648ee8f6a 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -1223,22 +1223,6 @@ namespace OpenSim.Data.SQLite s.TextureEntry = textureEntry; s.ExtraParams = (byte[]) row["ExtraParams"]; - // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); - // string texture = encoding.GetString((Byte[])row["Texture"]); - // if (!texture.StartsWith("<")) - // { - // //here so that we can still work with old format database files (ie from before I added xml serialization) - // LLObject.TextureEntry textureEntry = null; - // textureEntry = new LLObject.TextureEntry(new LLUUID(texture)); - // s.TextureEntry = textureEntry.ToBytes(); - // } - // else - // { - // TextureBlock textureEntry = TextureBlock.FromXmlString(texture); - // s.TextureEntry = textureEntry.TextureData; - // s.ExtraParams = textureEntry.ExtraParams; - // } - return s; } diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 088d9441b3..e198c2cd54 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -201,7 +201,7 @@ namespace OpenSim.Framework.Servers } } } - catch (SocketException e) + catch (SocketException) { // At least on linux, it appears that if the client makes a request without requiring the response, // an unconnected socket exception is thrown when we close the response output stream. There's no diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index ba23216a9f..2dbdce6f34 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -515,7 +515,7 @@ namespace OpenSim.Region.DataSnapshot m_log.Warn("[DATASNAPSHOT] Unable to decode reply from data service. Ignoring. " + e.StackTrace); } // This is not quite working, so... - string responseStr = ASCIIEncoding.UTF8.GetString(response); + string responseStr = Encoding.UTF8.GetString(response); m_log.Info("[DATASNAPSHOT] data service notified: " + url); } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 419ca8f3ba..67c6ad25ab 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -583,7 +583,7 @@ namespace OpenSim.Region.ScriptEngine.Common return objectname; } - EntityBase SensedObject = null; + EntityBase SensedObject; lock (World.Entities) { World.Entities.TryGetValue(objecUUID, out SensedObject); diff --git a/OpenSim/Region/ScriptEngine/Common/TRPC_Remote.cs b/OpenSim/Region/ScriptEngine/Common/TRPC_Remote.cs index 013ae0fa86..c293ecb3ab 100644 --- a/OpenSim/Region/ScriptEngine/Common/TRPC_Remote.cs +++ b/OpenSim/Region/ScriptEngine/Common/TRPC_Remote.cs @@ -119,7 +119,7 @@ namespace OpenSim.Region.ScriptEngine.Common if (myIQS.QueueSize == 0) return; - string receivedData = Encoding.ASCII.GetString(myIQS.Queue, 0, myIQS.QueueSize); + string receivedData = Encoding.UTF8.GetString(myIQS.Queue, 0, myIQS.QueueSize); Debug.WriteLine("RAW: " + receivedData); byte newLine = 10; @@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Common tmpStr += "," + p[i].GetType().ToString() + "|" + HttpUtility.UrlEncode(p[i].ToString()); // .Replace(",", "%44") } tmpStr += "\n"; - byte[] byteData = Encoding.ASCII.GetBytes(tmpStr); + byte[] byteData = Encoding.UTF8.GetBytes(tmpStr); TCPS.Send(ID, byteData, 0, byteData.Length); } } diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs index e4a57e8a0e..06ae1e9dac 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs @@ -289,10 +289,8 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO //} // READ EVENT CODE CHUNKS - LSO_Struct.CodeChunk[] myEventCodeChunk; if (myStateFrameBlock.StateCount > 0) { - myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; for (int i = 0; i < myStateFrameBlock.StateCount; i++) { // TODO: Somehow organize events and functions so they can be found again, @@ -465,7 +463,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO // TODO: How to determine number of codechunks -- does this method work? myCodeChunk.CodeChunkArguments = new List(); byte reader = br_read(1)[0]; - reader = br_read(1)[0]; // NOTE ON CODE CHUNK ARGUMENTS // This determins type definition diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs index 39babd6eff..c917e1e528 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs @@ -656,21 +656,6 @@ namespace OpenSim.DataStore.MSSQL s.ExtraParams = (byte[]) row["ExtraParams"]; - // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); - // string texture = encoding.GetString((Byte[])row["Texture"]); - // if (!texture.StartsWith("<")) - // { - // //here so that we can still work with old format database files (ie from before I added xml serialization) - // LLObject.TextureEntry textureEntry = null; - // textureEntry = new LLObject.TextureEntry(new LLUUID(texture)); - // s.TextureEntry = textureEntry.ToBytes(); - // } - // else - // { - // TextureBlock textureEntry = TextureBlock.FromXmlString(texture); - // s.TextureEntry = textureEntry.TextureData; - // s.ExtraParams = textureEntry.ExtraParams; - // } return s; } diff --git a/OpenSim/TestSuite/BotManager.cs b/OpenSim/TestSuite/BotManager.cs index 61cc9084da..77e9044293 100644 --- a/OpenSim/TestSuite/BotManager.cs +++ b/OpenSim/TestSuite/BotManager.cs @@ -197,7 +197,7 @@ namespace OpenSim.TestSuite Environment.Exit(0); break; case "addbots": - int newbots = 0; + int newbots; Helpers.TryParse(cmdparams[0], out newbots); if (newbots > 0) diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 8877f7d3cc..302dc08db0 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -196,7 +196,7 @@ namespace pCampBot Environment.Exit(0); break; case "addbots": - int newbots = 0; + int newbots; Helpers.TryParse(cmdparams[0], out newbots); if (newbots > 0) diff --git a/ThirdParty/3Di/LoadBalancer/TcpClient.cs b/ThirdParty/3Di/LoadBalancer/TcpClient.cs index af678a0213..ddd40cc41c 100644 --- a/ThirdParty/3Di/LoadBalancer/TcpClient.cs +++ b/ThirdParty/3Di/LoadBalancer/TcpClient.cs @@ -80,38 +80,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer } } -/* - public static void Receive(Socket client) { - try { - StateObject state = new StateObject(); - state.workSocket = client; - client.BeginReceive( state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReceiveCallback), state); - } catch (Exception e) { - Console.WriteLine(e.ToString()); - } - } - - private static void ReceiveCallback( IAsyncResult ar ) { - try { - StateObject state = (StateObject) ar.AsyncState; - Socket client = state.workSocket; - - int bytesRead = client.EndReceive(ar); - if (bytesRead > 0) { - state.sb.Append(Encoding.ASCII.GetString(state.buffer,0,bytesRead)); - client.BeginReceive(state.buffer,0,StateObject.BufferSize,0, new AsyncCallback(ReceiveCallback), state); - } else { - if (state.sb.Length > 1) { - response = state.sb.ToString(); - } - receiveDone.Set(); - } - } catch (Exception e) { - Console.WriteLine(e.ToString()); - } - } -*/ - public static void Send(Socket client, byte[] byteData) { client.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), client);