aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-11 22:54:22 +0100
committerJustin Clark-Casey (justincc)2012-07-11 22:54:22 +0100
commit916e3bf886ee622e2f18d6eb74f90fee8c630471 (patch)
tree69f9a6d2a7f7041966400f56f46c198f2cc06158 /OpenSim/Region/ScriptEngine/Shared/CodeTools
parentFix build break for windows with missing package for IScriptEngine in prebuil... (diff)
downloadopensim-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 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs8
1 files changed, 3 insertions, 5 deletions
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;
31using System.Globalization; 31using System.Globalization;
32using System.Reflection; 32using System.Reflection;
33using System.IO; 33using System.IO;
34using System.Text;
34using Microsoft.CSharp; 35using Microsoft.CSharp;
35//using Microsoft.JScript; 36//using Microsoft.JScript;
36using Microsoft.VisualBasic; 37using 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();