aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization/TarArchiveWriter.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs23
1 files changed, 11 insertions, 12 deletions
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)