making TarArchiveReader more resilient when faced with OARs created by

ancient tars.
0.6.6-post-fixes
Dr Scofield 2009-05-27 17:34:06 +00:00
parent e0ef697402
commit 9e37e291b0
1 changed files with 8 additions and 2 deletions

View File

@ -63,7 +63,11 @@ namespace OpenSim.Framework.Serialization
/// <summary>
/// Used to trim off null chars
/// </summary>
protected char[] m_nullCharArray = new char[] { '\0' };
protected static char[] m_nullCharArray = new char[] { '\0' };
/// <summary>
/// Used to trim off space chars
/// </summary>
protected static char[] m_spaceCharArray = new char[] { ' ' };
/// <summary>
/// Generate a tar reader which reads from the given stream.
@ -195,7 +199,9 @@ namespace OpenSim.Framework.Serialization
/// <returns></returns>
public static int ConvertOctalBytesToDecimal(byte[] bytes, int startIndex, int count)
{
string oString = m_asciiEncoding.GetString(bytes, startIndex, count);
// Trim leading white space: ancient tars do that instead
// of leading 0s :-( don't ask. really.
string oString = m_asciiEncoding.GetString(bytes, startIndex, count).TrimStart(m_spaceCharArray);
int d = 0;