mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
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.
This commit is contained in:
@@ -31,6 +31,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.CSharp;
|
||||
//using Microsoft.JScript;
|
||||
using Microsoft.VisualBasic;
|
||||
@@ -711,9 +712,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
//
|
||||
string filetext = System.Convert.ToBase64String(data);
|
||||
|
||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
|
||||
Byte[] buf = enc.GetBytes(filetext);
|
||||
Byte[] buf = Encoding.ASCII.GetBytes(filetext);
|
||||
|
||||
FileStream sfs = File.Create(assembly + ".text");
|
||||
sfs.Write(buf, 0, buf.Length);
|
||||
@@ -804,8 +803,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
mapstring += String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value);
|
||||
}
|
||||
|
||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
Byte[] mapbytes = enc.GetBytes(mapstring);
|
||||
Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring);
|
||||
FileStream mfs = File.Create(filename);
|
||||
mfs.Write(mapbytes, 0, mapbytes.Length);
|
||||
mfs.Close();
|
||||
|
||||
Reference in New Issue
Block a user