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 /OpenSim/Tools | |
parent | Fix build break for windows with missing package for IScriptEngine in prebuil... (diff) | |
download | opensim-SC-916e3bf886ee622e2f18d6eb74f90fee8c630471.zip opensim-SC-916e3bf886ee622e2f18d6eb74f90fee8c630471.tar.gz opensim-SC-916e3bf886ee622e2f18d6eb74f90fee8c630471.tar.bz2 opensim-SC-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 'OpenSim/Tools')
-rw-r--r-- | OpenSim/Tools/Compiler/Program.cs | 13 |
1 files changed, 5 insertions, 8 deletions
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 | ||