aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization/TarArchiveWriter.cs
diff options
context:
space:
mode:
authorubit2012-07-17 02:07:21 +0200
committerubit2012-07-17 02:07:21 +0200
commite925b0654d12c534ff9f837355ad43483dbd22cb (patch)
treee8a05e918e55ec8034dd724c38f143aac31493b2 /OpenSim/Framework/Serialization/TarArchiveWriter.cs
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentMerge branch 'avination' into ubitwork (diff)
downloadopensim-SC_OLD-e925b0654d12c534ff9f837355ad43483dbd22cb.zip
opensim-SC_OLD-e925b0654d12c534ff9f837355ad43483dbd22cb.tar.gz
opensim-SC_OLD-e925b0654d12c534ff9f837355ad43483dbd22cb.tar.bz2
opensim-SC_OLD-e925b0654d12c534ff9f837355ad43483dbd22cb.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Framework/Serialization/TarArchiveWriter.cs')
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs27
1 files changed, 12 insertions, 15 deletions
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
index fca909f..2a3bc48 100644
--- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
@@ -41,9 +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();
46
47 /// <summary> 44 /// <summary>
48 /// Binary writer for the underlying stream 45 /// Binary writer for the underlying stream
49 /// </summary> 46 /// </summary>
@@ -74,7 +71,7 @@ namespace OpenSim.Framework.Serialization
74 /// <param name="data"></param> 71 /// <param name="data"></param>
75 public void WriteFile(string filePath, string data) 72 public void WriteFile(string filePath, string data)
76 { 73 {
77 WriteFile(filePath, m_utf8Encoding.GetBytes(data)); 74 WriteFile(filePath, Util.UTF8NoBomEncoding.GetBytes(data));
78 } 75 }
79 76
80 /// <summary> 77 /// <summary>
@@ -85,7 +82,7 @@ namespace OpenSim.Framework.Serialization
85 public void WriteFile(string filePath, byte[] data) 82 public void WriteFile(string filePath, byte[] data)
86 { 83 {
87 if (filePath.Length > 100) 84 if (filePath.Length > 100)
88 WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L'); 85 WriteEntry("././@LongLink", Encoding.ASCII.GetBytes(filePath), 'L');
89 86
90 char fileType; 87 char fileType;
91 88
@@ -137,7 +134,7 @@ namespace OpenSim.Framework.Serialization
137 oString = "0" + oString; 134 oString = "0" + oString;
138 } 135 }
139 136
140 byte[] oBytes = m_asciiEncoding.GetBytes(oString); 137 byte[] oBytes = Encoding.ASCII.GetBytes(oString);
141 138
142 return oBytes; 139 return oBytes;
143 } 140 }
@@ -156,20 +153,20 @@ namespace OpenSim.Framework.Serialization
156 byte[] header = new byte[512]; 153 byte[] header = new byte[512];
157 154
158 // file path field (100) 155 // file path field (100)
159 byte[] nameBytes = m_asciiEncoding.GetBytes(filePath); 156 byte[] nameBytes = Encoding.ASCII.GetBytes(filePath);
160 int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length; 157 int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length;
161 Array.Copy(nameBytes, header, nameSize); 158 Array.Copy(nameBytes, header, nameSize);
162 159
163 // file mode (8) 160 // file mode (8)
164 byte[] modeBytes = m_asciiEncoding.GetBytes("0000777"); 161 byte[] modeBytes = Encoding.ASCII.GetBytes("0000777");
165 Array.Copy(modeBytes, 0, header, 100, 7); 162 Array.Copy(modeBytes, 0, header, 100, 7);
166 163
167 // owner user id (8) 164 // owner user id (8)
168 byte[] ownerIdBytes = m_asciiEncoding.GetBytes("0000764"); 165 byte[] ownerIdBytes = Encoding.ASCII.GetBytes("0000764");
169 Array.Copy(ownerIdBytes, 0, header, 108, 7); 166 Array.Copy(ownerIdBytes, 0, header, 108, 7);
170 167
171 // group user id (8) 168 // group user id (8)
172 byte[] groupIdBytes = m_asciiEncoding.GetBytes("0000764"); 169 byte[] groupIdBytes = Encoding.ASCII.GetBytes("0000764");
173 Array.Copy(groupIdBytes, 0, header, 116, 7); 170 Array.Copy(groupIdBytes, 0, header, 116, 7);
174 171
175 // file size in bytes (12) 172 // file size in bytes (12)
@@ -181,17 +178,17 @@ namespace OpenSim.Framework.Serialization
181 Array.Copy(fileSizeBytes, 0, header, 124, 11); 178 Array.Copy(fileSizeBytes, 0, header, 124, 11);
182 179
183 // last modification time (12) 180 // last modification time (12)
184 byte[] lastModTimeBytes = m_asciiEncoding.GetBytes("11017037332"); 181 byte[] lastModTimeBytes = Encoding.ASCII.GetBytes("11017037332");
185 Array.Copy(lastModTimeBytes, 0, header, 136, 11); 182 Array.Copy(lastModTimeBytes, 0, header, 136, 11);
186 183
187 // entry type indicator (1) 184 // entry type indicator (1)
188 header[156] = m_asciiEncoding.GetBytes(new char[] { fileType })[0]; 185 header[156] = Encoding.ASCII.GetBytes(new char[] { fileType })[0];
189 186
190 Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7); 187 Array.Copy(Encoding.ASCII.GetBytes("0000000"), 0, header, 329, 7);
191 Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7); 188 Array.Copy(Encoding.ASCII.GetBytes("0000000"), 0, header, 337, 7);
192 189
193 // check sum for header block (8) [calculated last] 190 // check sum for header block (8) [calculated last]
194 Array.Copy(m_asciiEncoding.GetBytes(" "), 0, header, 148, 8); 191 Array.Copy(Encoding.ASCII.GetBytes(" "), 0, header, 148, 8);
195 192
196 int checksum = 0; 193 int checksum = 0;
197 foreach (byte b in header) 194 foreach (byte b in header)