diff options
author | Justin Clark-Casey (justincc) | 2012-07-11 22:54:22 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-11 22:54:22 +0100 |
commit | 916e3bf886ee622e2f18d6eb74f90fee8c630471 (patch) | |
tree | 69f9a6d2a7f7041966400f56f46c198f2cc06158 | |
parent | Fix build break for windows with missing package for IScriptEngine in prebuil... (diff) | |
download | opensim-SC_OLD-916e3bf886ee622e2f18d6eb74f90fee8c630471.zip opensim-SC_OLD-916e3bf886ee622e2f18d6eb74f90fee8c630471.tar.gz opensim-SC_OLD-916e3bf886ee622e2f18d6eb74f90fee8c630471.tar.bz2 opensim-SC_OLD-916e3bf886ee622e2f18d6eb74f90fee8c630471.tar.xz |
Where possible, use the system Encoding.ASCII and Encoding.UTF8 rather than constructing fresh copies.
The encodings are thread-safe and already used in such a manner in other places.
This isn't done where Byte Order Mark output is suppressed, since Encoding.UTF8 is constructed to output the BOM.
Diffstat (limited to '')
20 files changed, 51 insertions, 80 deletions
diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs index fefe969..aabb02c 100644 --- a/OpenSim/ConsoleClient/Requester.cs +++ b/OpenSim/ConsoleClient/Requester.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.ConsoleClient | |||
50 | 50 | ||
51 | request.ContentType = "application/x-www-form-urlencoded"; | 51 | request.ContentType = "application/x-www-form-urlencoded"; |
52 | 52 | ||
53 | byte[] buffer = new System.Text.ASCIIEncoding().GetBytes(data); | 53 | byte[] buffer = Encoding.ASCII.GetBytes(data); |
54 | int length = (int) buffer.Length; | 54 | int length = (int) buffer.Length; |
55 | request.ContentLength = length; | 55 | request.ContentLength = length; |
56 | 56 | ||
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index e8d82d3..a64f01c 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs | |||
@@ -44,8 +44,6 @@ namespace OpenSim.Framework.Serialization.External | |||
44 | { | 44 | { |
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); | ||
48 | |||
49 | private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors | 47 | private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors |
50 | = new Dictionary<string, Action<LandData, XmlTextReader>>(); | 48 | = new Dictionary<string, Action<LandData, XmlTextReader>>(); |
51 | 49 | ||
@@ -163,7 +161,7 @@ namespace OpenSim.Framework.Serialization.External | |||
163 | /// <exception cref="System.Xml.XmlException"></exception> | 161 | /// <exception cref="System.Xml.XmlException"></exception> |
164 | public static LandData Deserialize(byte[] serializedLandData) | 162 | public static LandData Deserialize(byte[] serializedLandData) |
165 | { | 163 | { |
166 | return Deserialize(m_utf8Encoding.GetString(serializedLandData, 0, serializedLandData.Length)); | 164 | return Deserialize(Encoding.UTF8.GetString(serializedLandData, 0, serializedLandData.Length)); |
167 | } | 165 | } |
168 | 166 | ||
169 | /// <summary> | 167 | /// <summary> |
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index f18435d..19468c3 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | |||
@@ -40,8 +40,6 @@ namespace OpenSim.Framework.Serialization.External | |||
40 | /// </summary> | 40 | /// </summary> |
41 | public class RegionSettingsSerializer | 41 | public class RegionSettingsSerializer |
42 | { | 42 | { |
43 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | ||
44 | |||
45 | /// <summary> | 43 | /// <summary> |
46 | /// Deserialize settings | 44 | /// Deserialize settings |
47 | /// </summary> | 45 | /// </summary> |
@@ -50,7 +48,7 @@ namespace OpenSim.Framework.Serialization.External | |||
50 | /// <exception cref="System.Xml.XmlException"></exception> | 48 | /// <exception cref="System.Xml.XmlException"></exception> |
51 | public static RegionSettings Deserialize(byte[] serializedSettings) | 49 | public static RegionSettings Deserialize(byte[] serializedSettings) |
52 | { | 50 | { |
53 | return Deserialize(m_asciiEncoding.GetString(serializedSettings, 0, serializedSettings.Length)); | 51 | return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length)); |
54 | } | 52 | } |
55 | 53 | ||
56 | /// <summary> | 54 | /// <summary> |
diff --git a/OpenSim/Framework/Serialization/TarArchiveReader.cs b/OpenSim/Framework/Serialization/TarArchiveReader.cs index 77c29f8..339a37a 100644 --- a/OpenSim/Framework/Serialization/TarArchiveReader.cs +++ b/OpenSim/Framework/Serialization/TarArchiveReader.cs | |||
@@ -53,8 +53,6 @@ namespace OpenSim.Framework.Serialization | |||
53 | TYPE_CONTIGUOUS_FILE = 8, | 53 | TYPE_CONTIGUOUS_FILE = 8, |
54 | } | 54 | } |
55 | 55 | ||
56 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | ||
57 | |||
58 | /// <summary> | 56 | /// <summary> |
59 | /// Binary reader for the underlying stream | 57 | /// Binary reader for the underlying stream |
60 | /// </summary> | 58 | /// </summary> |
@@ -120,13 +118,13 @@ namespace OpenSim.Framework.Serialization | |||
120 | if (header[156] == (byte)'L') | 118 | if (header[156] == (byte)'L') |
121 | { | 119 | { |
122 | int longNameLength = ConvertOctalBytesToDecimal(header, 124, 11); | 120 | int longNameLength = ConvertOctalBytesToDecimal(header, 124, 11); |
123 | tarHeader.FilePath = m_asciiEncoding.GetString(ReadData(longNameLength)); | 121 | tarHeader.FilePath = Encoding.ASCII.GetString(ReadData(longNameLength)); |
124 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got long file name {0}", tarHeader.FilePath); | 122 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got long file name {0}", tarHeader.FilePath); |
125 | header = m_br.ReadBytes(512); | 123 | header = m_br.ReadBytes(512); |
126 | } | 124 | } |
127 | else | 125 | else |
128 | { | 126 | { |
129 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); | 127 | tarHeader.FilePath = Encoding.ASCII.GetString(header, 0, 100); |
130 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); | 128 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); |
131 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath); | 129 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath); |
132 | } | 130 | } |
@@ -205,7 +203,7 @@ namespace OpenSim.Framework.Serialization | |||
205 | { | 203 | { |
206 | // Trim leading white space: ancient tars do that instead | 204 | // Trim leading white space: ancient tars do that instead |
207 | // of leading 0s :-( don't ask. really. | 205 | // of leading 0s :-( don't ask. really. |
208 | string oString = m_asciiEncoding.GetString(bytes, startIndex, count).TrimStart(m_spaceCharArray); | 206 | string oString = Encoding.ASCII.GetString(bytes, startIndex, count).TrimStart(m_spaceCharArray); |
209 | 207 | ||
210 | int d = 0; | 208 | int d = 0; |
211 | 209 | ||
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs index fca909f..122fa8e 100644 --- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs +++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Framework.Serialization | |||
41 | { | 41 | { |
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | ||
45 | protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); | 44 | protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); |
46 | 45 | ||
47 | /// <summary> | 46 | /// <summary> |
@@ -85,7 +84,7 @@ namespace OpenSim.Framework.Serialization | |||
85 | public void WriteFile(string filePath, byte[] data) | 84 | public void WriteFile(string filePath, byte[] data) |
86 | { | 85 | { |
87 | if (filePath.Length > 100) | 86 | if (filePath.Length > 100) |
88 | WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L'); | 87 | WriteEntry("././@LongLink", Encoding.ASCII.GetBytes(filePath), 'L'); |
89 | 88 | ||
90 | char fileType; | 89 | char fileType; |
91 | 90 | ||
@@ -137,7 +136,7 @@ namespace OpenSim.Framework.Serialization | |||
137 | oString = "0" + oString; | 136 | oString = "0" + oString; |
138 | } | 137 | } |
139 | 138 | ||
140 | byte[] oBytes = m_asciiEncoding.GetBytes(oString); | 139 | byte[] oBytes = Encoding.ASCII.GetBytes(oString); |
141 | 140 | ||
142 | return oBytes; | 141 | return oBytes; |
143 | } | 142 | } |
@@ -156,20 +155,20 @@ namespace OpenSim.Framework.Serialization | |||
156 | byte[] header = new byte[512]; | 155 | byte[] header = new byte[512]; |
157 | 156 | ||
158 | // file path field (100) | 157 | // file path field (100) |
159 | byte[] nameBytes = m_asciiEncoding.GetBytes(filePath); | 158 | byte[] nameBytes = Encoding.ASCII.GetBytes(filePath); |
160 | int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length; | 159 | int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length; |
161 | Array.Copy(nameBytes, header, nameSize); | 160 | Array.Copy(nameBytes, header, nameSize); |
162 | 161 | ||
163 | // file mode (8) | 162 | // file mode (8) |
164 | byte[] modeBytes = m_asciiEncoding.GetBytes("0000777"); | 163 | byte[] modeBytes = Encoding.ASCII.GetBytes("0000777"); |
165 | Array.Copy(modeBytes, 0, header, 100, 7); | 164 | Array.Copy(modeBytes, 0, header, 100, 7); |
166 | 165 | ||
167 | // owner user id (8) | 166 | // owner user id (8) |
168 | byte[] ownerIdBytes = m_asciiEncoding.GetBytes("0000764"); | 167 | byte[] ownerIdBytes = Encoding.ASCII.GetBytes("0000764"); |
169 | Array.Copy(ownerIdBytes, 0, header, 108, 7); | 168 | Array.Copy(ownerIdBytes, 0, header, 108, 7); |
170 | 169 | ||
171 | // group user id (8) | 170 | // group user id (8) |
172 | byte[] groupIdBytes = m_asciiEncoding.GetBytes("0000764"); | 171 | byte[] groupIdBytes = Encoding.ASCII.GetBytes("0000764"); |
173 | Array.Copy(groupIdBytes, 0, header, 116, 7); | 172 | Array.Copy(groupIdBytes, 0, header, 116, 7); |
174 | 173 | ||
175 | // file size in bytes (12) | 174 | // file size in bytes (12) |
@@ -181,17 +180,17 @@ namespace OpenSim.Framework.Serialization | |||
181 | Array.Copy(fileSizeBytes, 0, header, 124, 11); | 180 | Array.Copy(fileSizeBytes, 0, header, 124, 11); |
182 | 181 | ||
183 | // last modification time (12) | 182 | // last modification time (12) |
184 | byte[] lastModTimeBytes = m_asciiEncoding.GetBytes("11017037332"); | 183 | byte[] lastModTimeBytes = Encoding.ASCII.GetBytes("11017037332"); |
185 | Array.Copy(lastModTimeBytes, 0, header, 136, 11); | 184 | Array.Copy(lastModTimeBytes, 0, header, 136, 11); |
186 | 185 | ||
187 | // entry type indicator (1) | 186 | // entry type indicator (1) |
188 | header[156] = m_asciiEncoding.GetBytes(new char[] { fileType })[0]; | 187 | header[156] = Encoding.ASCII.GetBytes(new char[] { fileType })[0]; |
189 | 188 | ||
190 | Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7); | 189 | Array.Copy(Encoding.ASCII.GetBytes("0000000"), 0, header, 329, 7); |
191 | Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7); | 190 | Array.Copy(Encoding.ASCII.GetBytes("0000000"), 0, header, 337, 7); |
192 | 191 | ||
193 | // check sum for header block (8) [calculated last] | 192 | // check sum for header block (8) [calculated last] |
194 | Array.Copy(m_asciiEncoding.GetBytes(" "), 0, header, 148, 8); | 193 | Array.Copy(Encoding.ASCII.GetBytes(" "), 0, header, 148, 8); |
195 | 194 | ||
196 | int checksum = 0; | 195 | int checksum = 0; |
197 | foreach (byte b in header) | 196 | foreach (byte b in header) |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 9459f76..14d8b0c 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -591,8 +591,8 @@ namespace OpenSim.Framework.Servers | |||
591 | { | 591 | { |
592 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | 592 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); |
593 | FileStream fs = File.Create(path); | 593 | FileStream fs = File.Create(path); |
594 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 594 | |
595 | Byte[] buf = enc.GetBytes(pidstring); | 595 | Byte[] buf = Encoding.ASCII.GetBytes(pidstring); |
596 | fs.Write(buf, 0, buf.Length); | 596 | fs.Write(buf, 0, buf.Length); |
597 | fs.Close(); | 597 | fs.Close(); |
598 | m_pidFile = path; | 598 | m_pidFile = path; |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e03bb74..fd9586c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1236,8 +1236,7 @@ namespace OpenSim.Framework | |||
1236 | 1236 | ||
1237 | public static string Base64ToString(string str) | 1237 | public static string Base64ToString(string str) |
1238 | { | 1238 | { |
1239 | UTF8Encoding encoder = new UTF8Encoding(); | 1239 | Decoder utf8Decode = Encoding.UTF8.GetDecoder(); |
1240 | Decoder utf8Decode = encoder.GetDecoder(); | ||
1241 | 1240 | ||
1242 | byte[] todecode_byte = Convert.FromBase64String(str); | 1241 | byte[] todecode_byte = Convert.FromBase64String(str); |
1243 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | 1242 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs index 2c04008..8c0ef88 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs | |||
@@ -46,8 +46,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | ||
50 | |||
51 | /// <summary> | 49 | /// <summary> |
52 | /// Store for asset data we received before we get the metadata | 50 | /// Store for asset data we received before we get the metadata |
53 | /// </summary> | 51 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs index 7a0db26..b5c7d33 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs | |||
@@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
252 | if (horizontalScale < 0.01d) | 252 | if (horizontalScale < 0.01d) |
253 | horizontalScale = 0.01d; | 253 | horizontalScale = 0.01d; |
254 | 254 | ||
255 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 255 | Encoding enc = Encoding.ASCII; |
256 | 256 | ||
257 | bs.Write(enc.GetBytes("TERRAGENTERRAIN ")); | 257 | bs.Write(enc.GetBytes("TERRAGENTERRAIN ")); |
258 | 258 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index be8873d..7fafdc6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -823,11 +823,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
823 | m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}", | 823 | m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}", |
824 | landName, land.LocalID, landUUID); | 824 | landName, land.LocalID, landUUID); |
825 | } | 825 | } |
826 | System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); | ||
827 | 826 | ||
828 | // slvoice handles the sip address differently if it begins with confctl, hiding it from the user in the friends list. however it also disables | 827 | // slvoice handles the sip address differently if it begins with confctl, hiding it from the user in the friends list. however it also disables |
829 | // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. | 828 | // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. |
830 | channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); | 829 | channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(Encoding.ASCII.GetBytes(landUUID)), m_freeSwitchRealm); |
831 | 830 | ||
832 | lock (m_ParcelAddress) | 831 | lock (m_ParcelAddress) |
833 | { | 832 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 52fc27d..61aaf04 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -1120,7 +1120,6 @@ namespace Nwc.XmlRpc | |||
1120 | /// <summary>Class supporting the request side of an XML-RPC transaction.</summary> | 1120 | /// <summary>Class supporting the request side of an XML-RPC transaction.</summary> |
1121 | public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest | 1121 | public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest |
1122 | { | 1122 | { |
1123 | private Encoding _encoding = new ASCIIEncoding(); | ||
1124 | private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); | 1123 | private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); |
1125 | private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); | 1124 | private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); |
1126 | private bool _disableKeepAlive = true; | 1125 | private bool _disableKeepAlive = true; |
@@ -1153,7 +1152,7 @@ namespace Nwc.XmlRpc | |||
1153 | request.KeepAlive = !_disableKeepAlive; | 1152 | request.KeepAlive = !_disableKeepAlive; |
1154 | 1153 | ||
1155 | Stream stream = request.GetRequestStream(); | 1154 | Stream stream = request.GetRequestStream(); |
1156 | XmlTextWriter xml = new XmlTextWriter(stream, _encoding); | 1155 | XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); |
1157 | _serializer.Serialize(xml, this); | 1156 | _serializer.Serialize(xml, this); |
1158 | xml.Flush(); | 1157 | xml.Flush(); |
1159 | xml.Close(); | 1158 | xml.Close(); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index 4949097..eaba816 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -425,10 +425,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
425 | 425 | ||
426 | try | 426 | try |
427 | { | 427 | { |
428 | System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); | 428 | string jsondata = SLUtil.ParseNotecardToString(Encoding.UTF8.GetString(a.Data)); |
429 | string jsondata = SLUtil.ParseNotecardToString(enc.GetString(a.Data)); | 429 | int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; |
430 | int result = m_store.SetValue(storeID,path,jsondata,true) ? 1 : 0; | 430 | m_comms.DispatchReply(scriptID,result, "", reqID.ToString()); |
431 | m_comms.DispatchReply(scriptID,result,"",reqID.ToString()); | ||
432 | return; | 431 | return; |
433 | } | 432 | } |
434 | catch (Exception e) | 433 | catch (Exception e) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 74f5208..03481d2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -482,10 +482,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
482 | // Convert to base64 | 482 | // Convert to base64 |
483 | // | 483 | // |
484 | string filetext = Convert.ToBase64String(data); | 484 | string filetext = Convert.ToBase64String(data); |
485 | 485 | Byte[] buf = Encoding.ASCII.GetBytes(filetext); | |
486 | ASCIIEncoding enc = new ASCIIEncoding(); | ||
487 | |||
488 | Byte[] buf = enc.GetBytes(filetext); | ||
489 | 486 | ||
490 | m_log.Info("MRM 9"); | 487 | m_log.Info("MRM 9"); |
491 | 488 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0a25454..0ebcd8d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10536,9 +10536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10536 | return; | 10536 | return; |
10537 | } | 10537 | } |
10538 | 10538 | ||
10539 | System.Text.UTF8Encoding enc = | 10539 | string data = Encoding.UTF8.GetString(a.Data); |
10540 | new System.Text.UTF8Encoding(); | ||
10541 | string data = enc.GetString(a.Data); | ||
10542 | //m_log.Debug(data); | 10540 | //m_log.Debug(data); |
10543 | NotecardCache.Cache(id, data); | 10541 | NotecardCache.Cache(id, data); |
10544 | AsyncCommands. | 10542 | AsyncCommands. |
@@ -10591,9 +10589,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10591 | return; | 10589 | return; |
10592 | } | 10590 | } |
10593 | 10591 | ||
10594 | System.Text.UTF8Encoding enc = | 10592 | string data = Encoding.UTF8.GetString(a.Data); |
10595 | new System.Text.UTF8Encoding(); | ||
10596 | string data = enc.GetString(a.Data); | ||
10597 | //m_log.Debug(data); | 10593 | //m_log.Debug(data); |
10598 | NotecardCache.Cache(id, data); | 10594 | NotecardCache.Cache(id, data); |
10599 | AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), | 10595 | AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e90f577..cfa08c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1811,8 +1811,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1811 | if (a == null) | 1811 | if (a == null) |
1812 | return UUID.Zero; | 1812 | return UUID.Zero; |
1813 | 1813 | ||
1814 | System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); | 1814 | string data = Encoding.UTF8.GetString(a.Data); |
1815 | string data = enc.GetString(a.Data); | ||
1816 | NotecardCache.Cache(assetID, data); | 1815 | NotecardCache.Cache(assetID, data); |
1817 | }; | 1816 | }; |
1818 | 1817 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 8f2ec49..17a0d69 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Globalization; | 31 | using System.Globalization; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.IO; | 33 | using System.IO; |
34 | using System.Text; | ||
34 | using Microsoft.CSharp; | 35 | using Microsoft.CSharp; |
35 | //using Microsoft.JScript; | 36 | //using Microsoft.JScript; |
36 | using Microsoft.VisualBasic; | 37 | using Microsoft.VisualBasic; |
@@ -711,9 +712,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
711 | // | 712 | // |
712 | string filetext = System.Convert.ToBase64String(data); | 713 | string filetext = System.Convert.ToBase64String(data); |
713 | 714 | ||
714 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 715 | Byte[] buf = Encoding.ASCII.GetBytes(filetext); |
715 | |||
716 | Byte[] buf = enc.GetBytes(filetext); | ||
717 | 716 | ||
718 | FileStream sfs = File.Create(assembly + ".text"); | 717 | FileStream sfs = File.Create(assembly + ".text"); |
719 | sfs.Write(buf, 0, buf.Length); | 718 | sfs.Write(buf, 0, buf.Length); |
@@ -804,8 +803,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
804 | mapstring += String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value); | 803 | mapstring += String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value); |
805 | } | 804 | } |
806 | 805 | ||
807 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 806 | Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring); |
808 | Byte[] mapbytes = enc.GetBytes(mapstring); | ||
809 | FileStream mfs = File.Create(filename); | 807 | FileStream mfs = File.Create(filename); |
810 | mfs.Write(mapbytes, 0, mapbytes.Length); | 808 | mfs.Write(mapbytes, 0, mapbytes.Length); |
811 | mfs.Close(); | 809 | mfs.Close(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 306090e..1c0cac7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -26,15 +26,16 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Globalization; | ||
29 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | ||
30 | using System.Runtime.Remoting; | 34 | using System.Runtime.Remoting; |
31 | using System.Runtime.Remoting.Lifetime; | 35 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Threading; | ||
33 | using System.Collections; | ||
34 | using System.Collections.Generic; | ||
35 | using System.Security.Policy; | 36 | using System.Security.Policy; |
36 | using System.Reflection; | 37 | using System.Text; |
37 | using System.Globalization; | 38 | using System.Threading; |
38 | using System.Xml; | 39 | using System.Xml; |
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | using log4net; | 41 | using log4net; |
@@ -298,13 +299,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
298 | using (FileStream fs = File.Open(savedState, | 299 | using (FileStream fs = File.Open(savedState, |
299 | FileMode.Open, FileAccess.Read, FileShare.None)) | 300 | FileMode.Open, FileAccess.Read, FileShare.None)) |
300 | { | 301 | { |
301 | System.Text.UTF8Encoding enc = | ||
302 | new System.Text.UTF8Encoding(); | ||
303 | |||
304 | Byte[] data = new Byte[size]; | 302 | Byte[] data = new Byte[size]; |
305 | fs.Read(data, 0, size); | 303 | fs.Read(data, 0, size); |
306 | 304 | ||
307 | xml = enc.GetString(data); | 305 | xml = Encoding.UTF8.GetString(data); |
308 | 306 | ||
309 | ScriptSerializer.Deserialize(xml, this); | 307 | ScriptSerializer.Deserialize(xml, this); |
310 | 308 | ||
@@ -954,8 +952,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
954 | try | 952 | try |
955 | { | 953 | { |
956 | FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); | 954 | FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); |
957 | System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); | 955 | Byte[] buf = (new UTF8Encoding()).GetBytes(xml); |
958 | Byte[] buf = enc.GetBytes(xml); | ||
959 | fs.Write(buf, 0, buf.Length); | 956 | fs.Write(buf, 0, buf.Length); |
960 | fs.Close(); | 957 | fs.Close(); |
961 | } | 958 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index f768cf2..20fad05 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1763,7 +1763,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1763 | tfs.Read(tdata, 0, tdata.Length); | 1763 | tfs.Read(tdata, 0, tdata.Length); |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | assem = new System.Text.ASCIIEncoding().GetString(tdata); | 1766 | assem = Encoding.ASCII.GetString(tdata); |
1767 | } | 1767 | } |
1768 | catch (Exception e) | 1768 | catch (Exception e) |
1769 | { | 1769 | { |
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 36c48e6..b137c05 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -27,9 +27,10 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Xml; | ||
31 | using System.Threading; | ||
32 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | ||
32 | using System.Text; | ||
33 | using System.Xml; | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
35 | using log4net; | 36 | using log4net; |
@@ -335,8 +336,7 @@ namespace OpenSim.Server.Base | |||
335 | { | 336 | { |
336 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | 337 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); |
337 | FileStream fs = File.Create(path); | 338 | FileStream fs = File.Create(path); |
338 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 339 | Byte[] buf = Encoding.ASCII.GetBytes(pidstring); |
339 | Byte[] buf = enc.GetBytes(pidstring); | ||
340 | fs.Write(buf, 0, buf.Length); | 340 | fs.Write(buf, 0, buf.Length); |
341 | fs.Close(); | 341 | fs.Close(); |
342 | m_pidFile = path; | 342 | m_pidFile = path; |
diff --git a/OpenSim/Tools/Compiler/Program.cs b/OpenSim/Tools/Compiler/Program.cs index 249e18b..6c59c31 100644 --- a/OpenSim/Tools/Compiler/Program.cs +++ b/OpenSim/Tools/Compiler/Program.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Text; | ||
31 | using Microsoft.CSharp; | 32 | using Microsoft.CSharp; |
32 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
33 | using System.CodeDom.Compiler; | 34 | using System.CodeDom.Compiler; |
@@ -201,12 +202,8 @@ namespace OpenSim.Tools.LSL.Compiler | |||
201 | // Convert to base64 | 202 | // Convert to base64 |
202 | // | 203 | // |
203 | string filetext = System.Convert.ToBase64String(data); | 204 | string filetext = System.Convert.ToBase64String(data); |
204 | 205 | Byte[] buf = Encoding.ASCII.GetBytes(filetext); | |
205 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 206 | FileStream sfs = File.Create(OutFile + ".text"); |
206 | |||
207 | Byte[] buf = enc.GetBytes(filetext); | ||
208 | |||
209 | FileStream sfs = File.Create(OutFile+".text"); | ||
210 | sfs.Write(buf, 0, buf.Length); | 207 | sfs.Write(buf, 0, buf.Length); |
211 | sfs.Close(); | 208 | sfs.Close(); |
212 | 209 | ||
@@ -222,9 +219,9 @@ namespace OpenSim.Tools.LSL.Compiler | |||
222 | // } | 219 | // } |
223 | // } | 220 | // } |
224 | 221 | ||
225 | buf = enc.GetBytes(posmap); | 222 | buf = Encoding.ASCII.GetBytes(posmap); |
226 | 223 | ||
227 | FileStream mfs = File.Create(OutFile+".map"); | 224 | FileStream mfs = File.Create(OutFile + ".map"); |
228 | mfs.Write(buf, 0, buf.Length); | 225 | mfs.Write(buf, 0, buf.Length); |
229 | mfs.Close(); | 226 | mfs.Close(); |
230 | 227 | ||